query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Unused import
aldebaran/qibuild/python/qibuild/actions/test.py
[ { "content": "## Copyright (c) 2012-2016 Aldebaran Robotics. All rights reserved.\n## Use of this source code is governed by a BSD-style license that can be\n## found in the COPYING file.\n\n\"\"\" Launch automatic tests -- deprecated, use `qitest run` instead\n\"\"\"\n\nimport argparse\nimport os\nimport sys\n\nfrom qisys import ui\nimport qisys.script\nimport qisys.parsers\nimport qibuild.parsers\nimport qitest.parsers\nimport qitest.actions.run\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def configure_parser(parser):\n \"\"\"Configure parser for this action\"\"\"\n qitest.parsers.test_parser(parser)\n qibuild.parsers.project_parser(parser)\n qisys.parsers.build_parser(parser, include_worktree_parser=False)\n parser.add_argument(\"-l\", \"--list\", dest=\"list\", action=\"store_true\",\n help=\"List what tests would be run\")", "metadata": "root.configure_parser", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def do(args):\n \"\"\"Main entry point\"\"\"\n if args.list:\n ui.warning(\"`qibuild test --list` is deprecated, use `qitest list` instead\")\n qisys.script.run_action(\"qitest.actions.list\", forward_args=args)\n else:\n projects = args.projects\n ui.warning(\"`qibuild test` is deprecated, use `qitest run` instead\")\n qisys.script.run_action(\"qitest.actions.run\", args=projects,\n forward_args=args)", "metadata": "root.do", "header": "['module', '___EOS___']", "index": 27 } ]
[ { "span": "import argparse", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 15 }, { "span": "import os", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 }, { "span": "import sys", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2016", " ", "Al", "deb", "aran", " ", "Robot", "ics", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "found", " ", "in", " ", "the", " ", "COPY", "ING", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Launch", " ", "automati", "c", " ", "tests", " ", "--", " ", "depre", "cated", ",", " ", "use", " ", "`", "qi", "test", " ", "run", "`", " ", "inst", "ead", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "qi", "sys_", "import_", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "parsers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "parsers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "test_", "._", "parsers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "test_", "._", "actions_", "._", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configur", "e\\u", "parser_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "parser", " ", "for", " ", "this", " ", "action", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "test_", "._", "parsers_", "._", "test\\u", "parser_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build_", "._", "parsers_", "._", "project", "\\u", "parser_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "parsers_", "._", "build", "\\u", "parser_", "(_", "parser_", ",_", "include", "\\u", "work", "tree", "\\u", "parser_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "l", "\"_", ",_", "\"--", "list", "\"_", ",_", "dest_", "=_", "\"", "list", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "List", " ", "what", " ", "tests", " ", "wou", "ld", " ", "be", " ", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Main", " ", "entry", " ", "point", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "warning_", "(_", "\"`", "qi", "build", " ", "test", " ", "--", "list", "`", " ", "is", " ", "depre", "cated", ",", " ", "use", " ", "`", "qi", "test", " ", "list", "`", " ", "inst", "ead", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "script_", "._", "run", "\\u", "action_", "(_", "\"", "qi", "test", ".", "action", "s", ".", "list", "\"_", ",_", "forward", "\\u", "args_", "=_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projects_", "=_", "args_", "._", "projects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "warning_", "(_", "\"`", "qi", "build", " ", "test", "`", " ", "is", " ", "depre", "cated", ",", " ", "use", " ", "`", "qi", "test", " ", "run", "`", " ", "inst", "ead", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "script_", "._", "run", "\\u", "action_", "(_", "\"", "qi", "test", ".", "action", "s", ".", "run", "\"_", ",_", "args_", "=_", "projects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "forward", "\\u", "args_", "=_", "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, 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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django-webtest/django-webtest/django_webtest_tests/urls.py
[ { "content": "\n# prevent DeprecationWarning for more recent django versions\ntry:\n from django.conf.urls import patterns, url\nexcept ImportError:\n from django.conf.urls.defaults import patterns, url, handler404, handler500\n\nfrom django.http import HttpResponse\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\n\n\n\nurlpatterns = patterns('',\n url(r'^$', simple_method_test, name='simple-method-test'),\n url(r'^template/(.*)$', simple_template_render, name='simple-template-test'),\n url(r'^check-password/$', 'testapp_tests.views.check_password', name='check_password'),\n url(r'^search/$', 'testapp_tests.views.search', name='search'),\n url(r'^login/$', 'django.contrib.auth.views.login', name='auth_login'),\n url(r'^set-session/$', 'testapp_tests.views.set_session', name='set_session'),\n url(r'^protected/$', 'testapp_tests.views.protected', name='protected'),\n url(r'^redirect-to-protected/$', 'testapp_tests.views.redirect_to_protected', name='redirect-to-protected'),\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def simple_method_test(request):\n return HttpResponse(str(request.method))", "metadata": "root.simple_method_test", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def simple_template_render(request, template_name):\n return render_to_response(template_name, {\n 'foo': ('a', 'b', 'c'),\n 'bar': True,\n 'spam': None,\n }, context_instance=RequestContext(request))", "metadata": "root.simple_template_render", "header": "['module', '___EOS___']", "index": 18 } ]
[ { "span": "from django.conf.urls.defaults import patterns, url, handler404, handler500", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 79 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prevent", " ", "Dep", "reca", "tion", "Warn", "ing", " ", "for", " ", "more", " ", "recent", " ", "django", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "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_", ",_", "url_", ",_", "handler", "404_", ",_", "handler", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "the", " ", "next", " ", "two", " ", "lines", " ", "to", " ", "enable", " ", "the", " ", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "django", ".", "contrib", " ", "import", " ", "admin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "autodiscover", "()", "_", "\\u\\u\\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_", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "$'_", ",_", "simple", "\\u", "method", "\\u", "test_", ",_", "name_", "=_", "'", "simple", "-", "method", "-", "test", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "template", "/(.", "*)", "$'_", ",_", "simple", "\\u", "template", "\\u", "render_", ",_", "name_", "=_", "'", "simple", "-", "template", "-", "test", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "check", "-", "password", "/$'_", ",_", "'", "testa", "pp", "\\u", "tests", ".", "views", ".", "check", "\\u", "password", "'_", ",_", "name_", "=_", "'", "check", "\\u", "password", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "search", "/$'_", ",_", "'", "testa", "pp", "\\u", "tests", ".", "views", ".", "search", "'_", ",_", "name_", "=_", "'", "search", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "login", "/$'_", ",_", "'", "django", ".", "contrib", ".", "auth", ".", "views", ".", "login", "'_", ",_", "name_", "=_", "'", "auth", "\\u", "login", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "set", "-", "session", "/$'_", ",_", "'", "testa", "pp", "\\u", "tests", ".", "views", ".", "set\\u", "session", "'_", ",_", "name_", "=_", "'", "set\\u", "session", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "protect", "ed", "/$'_", ",_", "'", "testa", "pp", "\\u", "tests", ".", "views", ".", "protect", "ed", "'_", ",_", "name_", "=_", "'", "protect", "ed", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "redirec", "t", "-", "to", "-", "protect", "ed", "/$'_", ",_", "'", "testa", "pp", "\\u", "tests", ".", "views", ".", "redirec", "t", "\\u", "to", "\\u", "protect", "ed", "'_", ",_", "name_", "=_", "'", "redirec", "t", "-", "to", "-", "protect", "ed", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "simple", "\\u", "method", "\\u", "test_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "str_", "(_", "request_", "._", "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_", "def_", "simple", "\\u", "template", "\\u", "render_", "(_", "request_", ",_", "template", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "template", "\\u", "name_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "'_", ":_", "(_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spam", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\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, 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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 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 ]
Unused local variable
sassoftware/conary/conary_test/libtest/artest.py
[ { "content": " def testNotAnArArchive(self):\n a = ar.Archive(self.getArchiveFile('unstripped_archive.o'))\n def parseArchive():\n b = [x.name for x in a]\n self.assertRaises(ar.ArchiveError, parseArchive)", "metadata": "root.ArTest.testNotAnArArchive", "header": "['class', 'ArTest', '(', 'rephelp', '.', 'RepositoryHelper', ')', ':', '___EOS___']", "index": 66 }, { "content": " def testTruncatedArchive(self):\n a = ar.Archive(self.getArchiveFile('testshortheader.a'))\n def parseArchive():\n b = [x.name for x in a]\n self.assertRaises(ar.ArchiveError, parseArchive)", "metadata": "root.ArTest.testTruncatedArchive", "header": "['class', 'ArTest', '(', 'rephelp', '.', 'RepositoryHelper', ')', ':', '___EOS___']", "index": 72 } ]
[ { "span": "b ", "start_line": 69, "start_column": 12, "end_line": 69, "end_column": 13 }, { "span": "b ", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ar", "Test_", "(_", "rep", "help_", "._", "Repos", "itor", "y", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Not", "An", "Ar", "Archive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "ar_", "._", "Archive_", "(_", "self_", "._", "get", "Archive", "File_", "(_", "'", "unst", "rip", "ped", "\\u", "archive", ".", "o", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parse", "Archive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "[_", "x_", "._", "name_", "for_", "x_", "in_", "a_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "ar_", "._", "Archive", "Error_", ",_", "parse", "Archive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ar", "Test_", "(_", "rep", "help_", "._", "Repos", "itor", "y", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Truncate", "d", "Archive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "ar_", "._", "Archive_", "(_", "self_", "._", "get", "Archive", "File_", "(_", "'", "tests", "hort", "header", ".", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parse", "Archive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "[_", "x_", "._", "name_", "for_", "x_", "in_", "a_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "ar_", "._", "Archive", "Error_", ",_", "parse", "Archive_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
networkdynamics/zenlib/src/zen/tests/clustering.py
[ { "content": "\tdef test_simple2(self):\n\t\tG = DiGraph()\n\t\tn1 = G.add_node()\n\t\tn2 = G.add_node()\n\t\tG.add_edge_(n1,n2)\n\n\t\tfor i in range(2,100):\n\t\t\tn = G.add_node()\n\t\t\tG.add_edge_(n1,n)\n\t\t\tG.add_edge_(n,n-1)\n\n\t\tG.add_edge_(n2,99)\t\n\t\tx = clustering.lcc(G)", "metadata": "root.LocalClusteringCoefficientTestCase.test_simple2", "header": "['class', 'LocalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": "\tdef test_simple2(self):\n\t\tG = DiGraph()\n\t\tn1 = G.add_node()\n\t\tn2 = G.add_node()\n\t\tG.add_edge_(n1,n2)\n\n\t\tfor i in range(2,100):\n\t\t\tn = G.add_node()\n\t\t\tG.add_edge_(n1,n)\n\t\t\tG.add_edge_(n,n-1)\n\n\t\tG.add_edge_(n2,99)\t\n\t\tx = clustering.gcc(G)", "metadata": "root.GlobalClusteringCoefficientTestCase.test_simple2", "header": "['class', 'GlobalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 141 } ]
[ { "span": "x ", "start_line": 101, "start_column": 2, "end_line": 101, "end_column": 3 }, { "span": "x ", "start_line": 153, "start_column": 2, "end_line": 153, "end_column": 3 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Local", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "n_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n_", ",_", "n_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n2_", ",_", "99_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "lc", "c_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "n_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n_", ",_", "n_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
wdm0006/git-pandas/gitpandas/project.py
[ { "content": " def coverage(self):\n \"\"\"\n Will return a DataFrame with coverage information (if available) for each repo in the project).\n\n If there is a .coverage file available, this will attempt to form a DataFrame with that information in it, which\n will contain the columns:\n\n * repository\n * filename\n * lines_covered\n * total_lines\n * coverage\n\n If it can't be found or parsed, an empty DataFrame of that form will be returned.\n\n :return: DataFrame\n \"\"\"\n\n df = pd.DataFrame(columns=['filename', 'lines_covered', 'total_lines', 'coverage', 'repository'])\n\n for repo in self.repos:\n try:\n cov = repo.coverage()\n cov['repository'] = repo._repo_name()\n df = df.append(cov)\n except GitCommandError as err:\n print('Warning! Repo: %s seems to not have coverage' % (repo, ))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.coverage", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def file_change_rates(self, branch='master', limit=None, extensions=None, ignore_dir=None, coverage=False, days=None):\n \"\"\"\n This function will return a DataFrame containing some basic aggregations of the file change history data, and\n optionally test coverage data from a coverage_data.py .coverage file. The aim here is to identify files in the\n project which have abnormal edit rates, or the rate of changes without growing the files size. If a file has\n a high change rate and poor test coverage, then it is a great candidate for writing more tests.\n\n :param branch: (optional, default=master) the branch to return commits for\n :param limit: (optional, default=None) a maximum number of commits to return, None for no limit\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param coverage: (optional, default=False) a bool for whether or not to attempt to join in coverage data.\n :param days: (optional, default=None) number of days to return if limit is None\n :return: DataFrame\n \"\"\"\n\n columns = ['unique_committers', 'abs_rate_of_change', 'net_rate_of_change', 'net_change', 'abs_change', 'edit_rate', 'repository']\n if coverage:\n columns += ['lines_covered', 'total_lines', 'coverage']\n df = pd.DataFrame(columns=columns)\n\n for repo in self.repos:\n try:\n fcr = repo.file_change_rates(\n branch=branch,\n limit=limit,\n extensions=extensions,\n ignore_dir=ignore_dir,\n coverage=coverage,\n days=days\n )\n fcr['repository'] = repo._repo_name()\n df = df.append(fcr)\n except GitCommandError as err:\n print('Warning! Repo: %s seems to not have the branch: %s' % (repo, branch))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.file_change_rates", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def hours_estimate(self, branch='master', grouping_window=0.5, single_commit_hours=0.5, limit=None, extensions=None, ignore_dir=None, days=None, committer=True, by=None):\n \"\"\"\n inspired by: https://github.com/kimmobrunfeldt/git-hours/blob/8aaeee237cb9d9028e7a2592a25ad8468b1f45e4/index.js#L114-L143\n\n Iterates through the commit history of repo to estimate the time commitement of each author or committer over\n the course of time indicated by limit/extensions/days/etc.\n\n :param branch: the branch to return commits for\n :param limit: (optional, default=None) a maximum number of commits to return, None for no limit\n :param grouping_window: (optional, default=0.5 hours) the threhold for how close two commits need to be to consider them part of one coding session\n :param single_commit_hours: (optional, default 0.5 hours) the time range to associate with one single commit\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param days: (optional, default=None) number of days to return, if limit is None\n :param committer: (optional, default=True) whether to use committer vs. author\n :return: DataFrame\n \"\"\"\n\n if limit is not None:\n limit = int(limit / len(self.repo_dirs))\n\n if committer:\n com = 'committer'\n else:\n com = 'author'\n\n df = pd.DataFrame(columns=[com, 'hours', 'repository'])\n\n for repo in self.repos:\n try:\n ch = repo.hours_estimate(\n branch,\n grouping_window=grouping_window,\n single_commit_hours=single_commit_hours,\n limit=limit,\n extensions=extensions,\n ignore_dir=ignore_dir,\n days=days,\n committer=committer\n )\n ch['repository'] = repo._repo_name()\n df = df.append(ch)\n except GitCommandError as err:\n print('Warning! Repo: %s seems to not have the branch: %s' % (repo, branch))\n pass\n\n df.reset_index()\n\n if by == 'committer' or by == 'author':\n df = df.groupby(com).agg({'hours': sum})\n df = df.reset_index()\n elif by == 'project':\n df = df.groupby('repository').agg({'hours': sum})\n df = df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.hours_estimate", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": " def commit_history(self, branch, limit=None, extensions=None, ignore_dir=None, days=None):\n \"\"\"\n Returns a pandas DataFrame containing all of the commits for a given branch. The results from all repositories\n are appended to each other, resulting in one large data frame of size <limit>. If a limit is provided, it is\n divided by the number of repositories in the project directory to find out how many commits to pull from each\n project. Future implementations will use date ordering across all projects to get the true most recent N commits\n across the project.\n\n Included in that DataFrame will be the columns:\n\n * repository\n * date (index)\n * author\n * committer\n * message\n * lines\n * insertions\n * deletions\n * net\n\n :param branch: the branch to return commits for\n :param limit: (optional, default=None) a maximum number of commits to return, None for no limit\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param days: (optional, default=None) number of days to return if limit is None\n :return: DataFrame\n \"\"\"\n\n if limit is not None:\n limit = int(limit / len(self.repo_dirs))\n\n df = pd.DataFrame(columns=['author', 'committer', 'message', 'lines', 'insertions', 'deletions', 'net'])\n\n for repo in self.repos:\n try:\n ch = repo.commit_history(branch, limit=limit, extensions=extensions, ignore_dir=ignore_dir, days=days)\n ch['repository'] = repo._repo_name()\n df = df.append(ch)\n except GitCommandError as err:\n print('Warning! Repo: %s seems to not have the branch: %s' % (repo, branch))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.commit_history", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 210 }, { "content": " def file_change_history(self, branch='master', limit=None, extensions=None, ignore_dir=None, days=None):\n \"\"\"\n Returns a DataFrame of all file changes (via the commit history) for the specified branch. This is similar to\n the commit history DataFrame, but is one row per file edit rather than one row per commit (which may encapsulate\n many file changes). Included in the DataFrame will be the columns:\n\n * repository\n * date (index)\n * author\n * committer\n * message\n * filename\n * insertions\n * deletions\n\n :param branch: the branch to return commits for\n :param limit: (optional, default=None) a maximum number of commits to return, None for no limit\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param days: (optional, default=None) number of days to return if limit is None\n :return: DataFrame\n \"\"\"\n\n if limit is not None:\n limit = int(limit / len(self.repo_dirs))\n\n df = pd.DataFrame(columns=['repository', 'date', 'author', 'committer', 'message', 'rev', 'filename', 'insertions', 'deletions'])\n\n for repo in self.repos:\n try:\n ch = repo.file_change_history(\n branch,\n limit=limit,\n extensions=extensions,\n ignore_dir=ignore_dir,\n days=days\n )\n ch['repository'] = repo._repo_name()\n df = df.append(ch)\n except GitCommandError as err:\n print('Warning! Repo: %s seems to not have the branch: %s' % (repo, branch))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.file_change_history", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 256 }, { "content": " def blame(self, extensions=None, ignore_dir=None, committer=True, by='repository'):\n \"\"\"\n Returns the blame from the current HEAD of the repositories as a DataFrame. The DataFrame is grouped by committer\n name, so it will be the sum of all contributions to all repositories by each committer. As with the commit history\n method, extensions and ignore_dirs parameters can be passed to exclude certain directories, or focus on certain\n file extensions. The DataFrame will have the columns:\n\n * committer\n * loc\n\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param committer: (optional, default=True) true if committer should be reported, false if author\n :param by: (optional, default=repository) whether to group by repository or by file\n :return: DataFrame\n \"\"\"\n\n df = None\n\n for repo in self.repos:\n try:\n if df is None:\n df = repo.blame(extensions=extensions, ignore_dir=ignore_dir, committer=committer, by=by)\n else:\n df = df.append(repo.blame(extensions=extensions, ignore_dir=ignore_dir, committer=committer, by=by))\n except GitCommandError as err:\n print('Warning! Repo: %s couldnt be blamed' % (repo, ))\n pass\n\n df = df.reset_index(level=1)\n df = df.reset_index(level=1)\n if committer:\n if by == 'repository':\n df = df.groupby('committer').agg({'loc': np.sum})\n elif by == 'file':\n df = df.groupby(['committer', 'file']).agg({'loc': np.sum})\n else:\n if by == 'repository':\n df = df.groupby('author').agg({'loc': np.sum})\n elif by == 'file':\n df = df.groupby(['author', 'file']).agg({'loc': np.sum})\n\n df = df.sort_values(by=['loc'], ascending=False)\n\n return df", "metadata": "root.ProjectDirectory.blame", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 303 }, { "content": " def file_detail(self, extensions=None, ignore_dir=None, rev='HEAD', committer=True):\n \"\"\"\n Returns a table of all current files in the repos, with some high level information about each file (total LOC,\n file owner, extension, most recent edit date, etc.).\n\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param committer: (optional, default=True) true if committer should be reported, false if author\n :return:\n \"\"\"\n\n df = None\n\n for repo in self.repos:\n try:\n if df is None:\n df = repo.file_detail(extensions=extensions, ignore_dir=ignore_dir, committer=committer, rev=rev)\n df['repository'] = repo._repo_name()\n else:\n chunk = repo.file_detail(extensions=extensions, ignore_dir=ignore_dir, committer=committer, rev=rev)\n chunk['repository'] = repo._repo_name()\n df = df.append(chunk)\n except GitCommandError as err:\n print('Warning! Repo: %s couldnt be inspected' % (repo, ))\n pass\n\n df = df.reset_index(level=1)\n df = df.set_index(['file', 'repository'])\n return df", "metadata": "root.ProjectDirectory.file_detail", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 349 }, { "content": " def branches(self):\n \"\"\"\n Returns a data frame of all branches in origin. The DataFrame will have the columns:\n\n * repository\n * local\n * branch\n\n :returns: DataFrame\n \"\"\"\n\n df = pd.DataFrame(columns=['repository', 'local', 'branch'])\n\n for repo in self.repos:\n try:\n df = df.append(repo.branches())\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.branches", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 379 }, { "content": " def revs(self, branch='master', limit=None, skip=None, num_datapoints=None):\n \"\"\"\n Returns a dataframe of all revision tags and their timestamps for each project. It will have the columns:\n\n * date\n * repository\n * rev\n\n :param branch: (optional, default 'master') the branch to work in\n :param limit: (optional, default None), the maximum number of revisions to return, None for no limit\n :param skip: (optional, default None), the number of revisions to skip. Ex: skip=2 returns every other revision, None for no skipping.\n :param num_datapoints: (optional, default=None) if limit and skip are none, and this isn't, then num_datapoints evenly spaced revs will be used\n\n :return: DataFrame\n \"\"\"\n\n if limit is not None:\n limit = math.floor(float(limit) / len(self.repos))\n\n if num_datapoints is not None:\n num_datapoints = math.floor(float(num_datapoints) / len(self.repos))\n\n df = pd.DataFrame(columns=['repository', 'rev'])\n\n for repo in self.repos:\n try:\n revs = repo.revs(branch=branch, limit=limit, skip=skip, num_datapoints=num_datapoints)\n revs['repository'] = repo._repo_name()\n df = df.append(revs)\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.revs", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 403 }, { "content": " def cumulative_blame(self, branch='master', extensions=None, ignore_dir=None, by='committer', limit=None, skip=None, num_datapoints=None, committer=True):\n \"\"\"\n Returns a time series of cumulative blame for a collection of projects. The goal is to return a dataframe for a\n collection of projects with the LOC attached to an entity at each point in time. The returned dataframe can be\n returned in 3 forms (switched with the by parameter, default 'committer'):\n\n * committer: one column per committer\n * project: one column per project\n * raw: one column per committed per project\n\n :param branch: (optional, default 'master') the branch to work in\n :param limit: (optional, default None), the maximum number of revisions to return, None for no limit\n :param skip: (optional, default None), the number of revisions to skip. Ex: skip=2 returns every other revision, None for no skipping.\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param num_datapoints: (optional, default=None) if limit and skip are none, and this isn't, then num_datapoints evenly spaced revs will be used\n :param committer: (optional, default=True) true if committer should be reported, false if author\n :param by: (optional, default='committer') whether to arrange the output by committer or project\n :return: DataFrame\n\n \"\"\"\n\n blames = []\n for repo in self.repos:\n try:\n blame = repo.cumulative_blame(\n branch=branch,\n extensions=extensions,\n ignore_dir=ignore_dir,\n limit=limit,\n skip=skip,\n num_datapoints=num_datapoints,\n committer=committer\n )\n blames.append((repo._repo_name(), blame))\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n\n global_blame = blames[0][1]\n global_blame.columns = [x + '__' + str(blames[0][0]) for x in global_blame.columns.values]\n blames = blames[1:]\n for reponame, blame in blames:\n blame.columns = [x + '__' + reponame for x in blame.columns.values]\n global_blame = pd.merge(global_blame, blame, left_index=True, right_index=True, how='outer')\n\n global_blame.fillna(method='pad', inplace=True)\n global_blame.fillna(0.0, inplace=True)\n\n if by == 'committer':\n committers = [(str(x).split('__')[0].lower().strip(), x) for x in global_blame.columns.values]\n\n if sys.version_info.major == 2:\n committer_mapping = dict([(c, [x[1] for x in committers if x[0] == c]) for c in set([x[0] for x in committers])])\n else:\n committer_mapping = {c: [x[1] for x in committers if x[0] == c] for c in {x[0] for x in committers}}\n\n for committer in committer_mapping.keys():\n global_blame[committer] = 0\n for col in committer_mapping.get(committer, []):\n global_blame[committer] += global_blame[col]\n\n global_blame = global_blame.reindex(columns=list(committer_mapping.keys()))\n elif by == 'project':\n projects = [(str(x).split('__')[1].lower().strip(), x) for x in global_blame.columns.values]\n\n if sys.version_info.major == 2:\n project_mapping = dict([(c, [x[1] for x in projects if x[0] == c]) for c in set([x[0] for x in projects])])\n else:\n project_mapping = {c: [x[1] for x in projects if x[0] == c] for c in {x[0] for x in projects}}\n\n for project in project_mapping.keys():\n global_blame[project] = 0\n for col in project_mapping.get(project, []):\n global_blame[project] += global_blame[col]\n\n global_blame = global_blame.reindex(columns=list(project_mapping.keys()))\n\n global_blame = global_blame[~global_blame.index.duplicated()]\n\n return global_blame", "metadata": "root.ProjectDirectory.cumulative_blame", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 440 }, { "content": " def tags(self):\n \"\"\"\n Returns a data frame of all tags in origin. The DataFrame will have the columns:\n\n * repository\n * tag\n\n :returns: DataFrame\n \"\"\"\n\n df = pd.DataFrame(columns=['repository', 'tag'])\n\n for repo in self.repos:\n try:\n df = df.append(repo.tags())\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n\n df.reset_index()\n\n return df", "metadata": "root.ProjectDirectory.tags", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 522 }, { "content": " def bus_factor(self, extensions=None, ignore_dir=None, by='projectd'):\n \"\"\"\n An experimental heuristic for truck factor of a repository calculated by the current distribution of blame in\n the repository's primary branch. The factor is the fewest number of contributors whose contributions make up at\n least 50% of the codebase's LOC\n\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n\n :return:\n \"\"\"\n\n if by == 'file':\n raise NotImplementedError('File-wise bus factor')\n elif by == 'projectd':\n blame = self.blame(extensions=extensions, ignore_dir=ignore_dir, by='repository')\n blame = blame.sort_values(by=['loc'], ascending=False)\n\n total = blame['loc'].sum()\n cumulative = 0\n tc = 0\n for idx in range(blame.shape[0]):\n cumulative += blame.ix[idx, 'loc']\n tc += 1\n if cumulative >= total / 2:\n break\n\n return pd.DataFrame([['projectd', tc]], columns=['projectd', 'bus factor'])\n elif by == 'repository':\n df = pd.DataFrame(columns=['repository', 'bus factor'])\n for repo in self.repos:\n try:\n df = df.append(repo.bus_factor(extensions=extensions, ignore_dir=ignore_dir, by=by))\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n df.reset_index()\n return df", "metadata": "root.ProjectDirectory.bus_factor", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 590 }, { "content": " def punchcard(self, branch='master', limit=None, extensions=None, ignore_dir=None, days=None, by=None, normalize=None):\n \"\"\"\n Returns a pandas DataFrame containing all of the data for a punchcard.\n\n * day_of_week\n * hour_of_day\n * author / committer\n * lines\n * insertions\n * deletions\n * net\n\n :param branch: the branch to return commits for\n :param limit: (optional, default=None) a maximum number of commits to return, None for no limit\n :param extensions: (optional, default=None) a list of file extensions to return commits for\n :param ignore_dir: (optional, default=None) a list of directory names to ignore\n :param days: (optional, default=None) number of days to return, if limit is None\n :param by: (optional, default=None) agg by options, None for no aggregation (just a high level punchcard), or 'committer', 'author', 'repository'\n :param normalize: (optional, default=None) if an integer, returns the data normalized to max value of that (for plotting)\n :return: DataFrame\n \"\"\"\n\n df = pd.DataFrame()\n\n if by == 'repository':\n repo_by = None\n else:\n repo_by = by\n\n for repo in self.repos:\n try:\n chunk = repo.punchcard(\n branch=branch,\n limit=limit,\n extensions=extensions,\n ignore_dir=ignore_dir,\n days=days,\n by=repo_by,\n normalize=None\n )\n chunk['repository'] = repo._repo_name()\n df = df.append(chunk)\n except GitCommandError as err:\n print('Warning! Repo: %s couldn\\'t be inspected' % (repo, ))\n pass\n\n df.reset_index()\n\n aggs = ['hour_of_day', 'day_of_week']\n if by is not None:\n aggs.append(by)\n\n punch_card = df.groupby(aggs).agg({\n 'lines': np.sum,\n 'insertions': np.sum,\n 'deletions': np.sum,\n 'net': np.sum\n })\n punch_card.reset_index(inplace=True)\n\n # normalize all cols\n if normalize is not None:\n for col in ['lines', 'insertions', 'deletions', 'net']:\n punch_card[col] = (punch_card[col] / punch_card[col].sum()) * normalize\n\n return punch_card", "metadata": "root.ProjectDirectory.punchcard", "header": "['class', 'ProjectDirectory', '(', 'object', ')', ':', '___EOS___']", "index": 629 } ]
[ { "span": "pass", "start_line": 106, "start_column": 16, "end_line": 106, "end_column": 20 }, { "span": "pass", "start_line": 147, "start_column": 16, "end_line": 147, "end_column": 20 }, { "span": "pass", "start_line": 197, "start_column": 16, "end_line": 197, "end_column": 20 }, { "span": "pass", "start_line": 250, "start_column": 16, "end_line": 250, "end_column": 20 }, { "span": "pass", "start_line": 297, "start_column": 16, "end_line": 297, "end_column": 20 }, { "span": "pass", "start_line": 330, "start_column": 16, "end_line": 330, "end_column": 20 }, { "span": "pass", "start_line": 373, "start_column": 16, "end_line": 373, "end_column": 20 }, { "span": "pass", "start_line": 397, "start_column": 16, "end_line": 397, "end_column": 20 }, { "span": "pass", "start_line": 434, "start_column": 16, "end_line": 434, "end_column": 20 }, { "span": "pass", "start_line": 477, "start_column": 16, "end_line": 477, "end_column": 20 }, { "span": "pass", "start_line": 539, "start_column": 16, "end_line": 539, "end_column": 20 }, { "span": "pass", "start_line": 625, "start_column": 20, "end_line": 625, "end_column": 24 }, { "span": "pass", "start_line": 673, "start_column": 16, "end_line": 673, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coverage_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "return", " ", "a", " ", "Data", "Frame", " ", "with", " ", "covera", "ge", " ", "informati", "on", " ", "(", "if", " ", "avail", "able", ")", " ", "for", " ", "each", " ", "repo", " ", "in", " ", "the", " ", "project", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "there", " ", "is", " ", "a", " ", ".", "covera", "ge", " ", "file", " ", "avail", "able", ",", " ", "this", " ", "will", " ", "atte", "mpt", " ", "to", " ", "form", " ", "a", " ", "Data", "Frame", " ", "with", " ", "tha", "t", " ", "informati", "on", " ", "in", " ", "it", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "contain", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "filename", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "lines", "\\u", "covered", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "total", "\\u", "lines", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "covera", "ge", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "it", " ", "can", "'", "t", " ", "be", " ", "found", " ", "or", " ", "parsed", ",", " ", "an", " ", "empty", " ", "Data", "Frame", " ", "of", " ", "tha", "t", " ", "form", " ", "will", " ", "be", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "filename", "'_", ",_", "'", "lines", "\\u", "covered", "'_", ",_", "'", "total", "\\u", "lines", "'_", ",_", "'", "covera", "ge", "'_", ",_", "'", "repos", "itor", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "cov_", "=_", "repo_", "._", "coverage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cov_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "cov_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "not", " ", "have", " ", "covera", "ge", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "change", "\\u", "rates_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "limit_", "=_", "None_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "coverage_", "=_", "False_", ",_", "days_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "will", " ", "return", " ", "a", " ", "Data", "Frame", " ", "contain", "ing", " ", "some", " ", "basic", " ", "aggregation", "s", " ", "of", " ", "the", " ", "file", " ", "change", " ", "histo", "ry", " ", "data", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "option", "ally", " ", "test", " ", "covera", "ge", " ", "data", " ", "from", " ", "a", " ", "covera", "ge", "\\u", "data", ".", "py", " ", ".", "covera", "ge", " ", "file", ".", " ", " ", "The", " ", "aim", " ", "here", " ", "is", " ", "to", " ", "identify", " ", "files", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "project", " ", "whi", "ch", " ", "have", " ", "ab", "normal", " ", "edit", " ", "rate", "s", ",", " ", "or", " ", "the", " ", "rate", " ", "of", " ", "change", "s", " ", "with", "out", " ", "grow", "ing", " ", "the", " ", "files", " ", "size", ".", " ", " ", "If", " ", "a", " ", "file", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "high", " ", "change", " ", "rate", " ", "and", " ", "poo", "r", " ", "test", " ", "covera", "ge", ",", " ", "then", " ", "it", " ", "is", " ", "a", " ", "great", " ", "candidate", " ", "for", " ", "writ", "ing", " ", "more", " ", "tests", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "(", "option", "al", ",", " ", "default", "=", "master", ")", " ", "the", " ", "branch", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", " ", "commit", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "covera", "ge", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Fal", "se", ")", " ", "a", " ", "bool", " ", "for", " ", "whe", "ther", " ", "or", " ", "not", " ", "to", " ", "atte", "mpt", " ", "to", " ", "join", " ", "in", " ", "covera", "ge", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "day", "s", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "number", " ", "of", " ", "day", "s", " ", "to", " ", "return", " ", "if", " ", "limit", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "'", "unique", "\\u", "committer", "s", "'_", ",_", "'", "abs", "\\u", "rate", "\\u", "of", "\\u", "change", "'_", ",_", "'", "net", "\\u", "rate", "\\u", "of", "\\u", "change", "'_", ",_", "'", "net", "\\u", "change", "'_", ",_", "'", "abs", "\\u", "change", "'_", ",_", "'", "edit", "\\u", "rate", "'_", ",_", "'", "repos", "itor", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "+=_", "[_", "'", "lines", "\\u", "covered", "'_", ",_", "'", "total", "\\u", "lines", "'_", ",_", "'", "covera", "ge", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "fc", "r_", "=_", "repo_", "._", "file", "\\u", "change", "\\u", "rates_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "=_", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coverage_", "=_", "coverage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "days_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fc", "r_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "fc", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "not", " ", "have", " ", "the", " ", "branch", ":", " ", "%", "s", "'_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hour", "s", "\\u", "estimate_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "grouping", "\\u", "window_", "=_", "0.5_", ",_", "single", "\\u", "commit", "\\u", "hours_", "=_", "0.5_", ",_", "limit_", "=_", "None_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "days_", "=_", "None_", ",_", "committer", "_", "=_", "True_", ",_", "by_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "inspire", "d", " ", "by", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "kim", "mob", "runf", "eld", "t", "/", "git", "-", "hour", "s", "/", "blob", "/", "8a", "ae", "ee", "237", "cb", "9", "d", "902", "8e", "7a", "259", "2a", "25", "ad", "846", "8b", "1f", "4", "5e", "4", "/", "index", ".", "js", "#", "L1", "14", "-", "L1", "4", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Iterat", "es", " ", "through", " ", "the", " ", "commit", " ", "histo", "ry", " ", "of", " ", "repo", " ", "to", " ", "estimate", " ", "the", " ", "time", " ", "commit", "ement", " ", "of", " ", "each", " ", "author", " ", "or", " ", "committer", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "course", " ", "of", " ", "time", " ", "indicat", "ed", " ", "by", " ", "limit", "/", "extensi", "ons", "/", "day", "s", "/", "etc", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "the", " ", "branch", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", " ", "commit", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "grouping", "\\u", "window", ":", " ", "(", "option", "al", ",", " ", "default", "=", "0.", "5", " ", "hour", "s", ")", " ", "the", " ", "thr", "eh", "old", " ", "for", " ", "how", " ", "close", " ", "two", " ", "commit", "s", " ", "need", " ", "to", " ", "be", " ", "to", " ", "consider", " ", "them", " ", "part", " ", "of", " ", "one", " ", "codi", "ng", " ", "session", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "single", "\\u", "commit", "\\u", "hour", "s", ":", " ", "(", "option", "al", ",", " ", "default", " ", "0.", "5", " ", "hour", "s", ")", " ", "the", " ", "time", " ", "range", " ", "to", " ", "associate", " ", "with", " ", "one", " ", "single", " ", "commit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "day", "s", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "number", " ", "of", " ", "day", "s", " ", "to", " ", "return", ",", " ", "if", " ", "limit", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "committer", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Tru", "e", ")", " ", "whe", "ther", " ", "to", " ", "use", " ", "committer", " ", "vs", ".", " ", "author", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "int_", "(_", "limit_", "/_", "len_", "(_", "self_", "._", "repo", "\\u", "dirs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "committer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "com_", "=_", "'", "committer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "com_", "=_", "'", "author", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "com_", ",_", "'", "hour", "s", "'_", ",_", "'", "repos", "itor", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "ch_", "=_", "repo_", "._", "hour", "s", "\\u", "estimate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "grouping", "\\u", "window_", "=_", "grouping", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "single", "\\u", "commit", "\\u", "hours_", "=_", "single", "\\u", "commit", "\\u", "hours_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "committer", "_", "=_", "committer", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "not", " ", "have", " ", "the", " ", "branch", ":", " ", "%", "s", "'_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "by_", "==_", "'", "committer", "'_", "or_", "by_", "==_", "'", "author", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "com_", ")_", "._", "agg_", "(_", "{_", "'", "hour", "s", "'_", ":_", "sum_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "project", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "'", "repos", "itor", "y", "'_", ")_", "._", "agg_", "(_", "{_", "'", "hour", "s", "'_", ":_", "sum_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit", "\\u", "history_", "(_", "self_", ",_", "branch_", ",_", "limit_", "=_", "None_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "days_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "panda", "s", " ", "Data", "Frame", " ", "contain", "ing", " ", "all", " ", "of", " ", "the", " ", "commit", "s", " ", "for", " ", "a", " ", "give", "n", " ", "branch", ".", " ", "The", " ", "results", " ", "from", " ", "all", " ", "repos", "itori", "es", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "append", "ed", " ", "to", " ", "each", " ", "other", ",", " ", "result", "ing", " ", "in", " ", "one", " ", "large", " ", "data", " ", "frame", " ", "of", " ", "size", " ", "<", "limit", ">.", " ", " ", "If", " ", "a", " ", "limit", " ", "is", " ", "provided", ",", " ", "it", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "divide", "d", " ", "by", " ", "the", " ", "number", " ", "of", " ", "repos", "itori", "es", " ", "in", " ", "the", " ", "project", " ", "director", "y", " ", "to", " ", "find", " ", "out", " ", "how", " ", "many", " ", "commit", "s", " ", "to", " ", "pull", " ", "from", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "project", ".", " ", "Fu", "ture", " ", "implementation", "s", " ", "will", " ", "use", " ", "date", " ", "orderi", "ng", " ", "acro", "ss", " ", "all", " ", "project", "s", " ", "to", " ", "get", " ", "the", " ", "true", " ", "most", " ", "recent", " ", "N", " ", "commit", "s", "\\", "10", ";", " ", " ", " ", " ", "acro", "ss", " ", "the", " ", "project", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Include", "d", " ", "in", " ", "tha", "t", " ", "Data", "Frame", " ", "will", " ", "be", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "date", " ", "(", "index", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "author", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "message", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "lines", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "insertion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "deletion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "net", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "the", " ", "branch", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", " ", "commit", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "day", "s", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "number", " ", "of", " ", "day", "s", " ", "to", " ", "return", " ", "if", " ", "limit", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "int_", "(_", "limit_", "/_", "len_", "(_", "self_", "._", "repo", "\\u", "dirs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "author", "'_", ",_", "'", "committer", "'_", ",_", "'", "message", "'_", ",_", "'", "lines", "'_", ",_", "'", "insertion", "s", "'_", ",_", "'", "deletion", "s", "'_", ",_", "'", "net", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "ch_", "=_", "repo_", "._", "commit", "\\u", "history_", "(_", "branch_", ",_", "limit_", "=_", "limit_", ",_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "days_", "=_", "days_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "not", " ", "have", " ", "the", " ", "branch", ":", " ", "%", "s", "'_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "change", "\\u", "history_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "limit_", "=_", "None_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "days_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Data", "Frame", " ", "of", " ", "all", " ", "file", " ", "change", "s", " ", "(", "via", " ", "the", " ", "commit", " ", "histo", "ry", ")", " ", "for", " ", "the", " ", "specified", " ", "branch", ".", " ", " ", "Thi", "s", " ", "is", " ", "similar", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "commit", " ", "histo", "ry", " ", "Data", "Frame", ",", " ", "but", " ", "is", " ", "one", " ", "row", " ", "per", " ", "file", " ", "edit", " ", "rat", "her", " ", "than", " ", "one", " ", "row", " ", "per", " ", "commit", " ", "(", "whi", "ch", " ", "may", " ", "encapsulat", "e", "\\", "10", ";", " ", " ", " ", " ", "many", " ", "file", " ", "change", "s", ").", " ", "Include", "d", " ", "in", " ", "the", " ", "Data", "Frame", " ", "will", " ", "be", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "date", " ", "(", "index", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "author", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "message", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "filename", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "insertion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "deletion", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "the", " ", "branch", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", " ", "commit", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "day", "s", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "number", " ", "of", " ", "day", "s", " ", "to", " ", "return", " ", "if", " ", "limit", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "int_", "(_", "limit_", "/_", "len_", "(_", "self_", "._", "repo", "\\u", "dirs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "repos", "itor", "y", "'_", ",_", "'", "date", "'_", ",_", "'", "author", "'_", ",_", "'", "committer", "'_", ",_", "'", "message", "'_", ",_", "'", "rev", "'_", ",_", "'", "filename", "'_", ",_", "'", "insertion", "s", "'_", ",_", "'", "deletion", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "ch_", "=_", "repo_", "._", "file", "\\u", "change", "\\u", "history_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "days_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "see", "ms", " ", "to", " ", "not", " ", "have", " ", "the", " ", "branch", ":", " ", "%", "s", "'_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bla", "me_", "(_", "self_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "committer", "_", "=_", "True_", ",_", "by_", "=_", "'", "repos", "itor", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "bla", "me", " ", "from", " ", "the", " ", "current", " ", "HEAD", " ", "of", " ", "the", " ", "repos", "itori", "es", " ", "as", " ", "a", " ", "Data", "Frame", ".", " ", " ", "The", " ", "Data", "Frame", " ", "is", " ", "groupe", "d", " ", "by", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", "name", ",", " ", "so", " ", "it", " ", "will", " ", "be", " ", "the", " ", "sum", " ", "of", " ", "all", " ", "contributions", " ", "to", " ", "all", " ", "repos", "itori", "es", " ", "by", " ", "each", " ", "committer", ".", " ", "As", " ", "with", " ", "the", " ", "commit", " ", "histo", "ry", "\\", "10", ";", " ", " ", " ", " ", "method", ",", " ", "extensi", "ons", " ", "and", " ", "ignore", "\\u", "dirs", " ", "parameter", "s", " ", "can", " ", "be", " ", "pass", "ed", " ", "to", " ", "exclu", "de", " ", "cert", "ain", " ", "director", "ies", ",", " ", "or", " ", "foc", "us", " ", "on", " ", "cert", "ain", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "extensi", "ons", ".", " ", "The", " ", "Data", "Frame", " ", "will", " ", "have", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "loc", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "committer", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Tru", "e", ")", " ", "true", " ", "if", " ", "committer", " ", "shou", "ld", " ", "be", " ", "reporte", "d", ",", " ", "fal", "se", " ", "if", " ", "author", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "by", ":", " ", "(", "option", "al", ",", " ", "default", "=", "repos", "itor", "y", ")", " ", "whe", "ther", " ", "to", " ", "group", " ", "by", " ", "repos", "itor", "y", " ", "or", " ", "by", " ", "file", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "df_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "df_", "=_", "repo_", "._", "bla", "me_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "committer", "_", "=_", "committer", "_", ",_", "by_", "=_", "by_", ")_", "\\u\\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_", "=_", "df_", "._", "append_", "(_", "repo_", "._", "bla", "me_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "committer", "_", "=_", "committer", "_", ",_", "by_", "=_", "by_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "t", " ", "be", " ", "bla", "med", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "df_", "._", "reset", "\\u", "index_", "(_", "level_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "reset", "\\u", "index_", "(_", "level_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "committer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "by_", "==_", "'", "repos", "itor", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "'", "committer", "'_", ")_", "._", "agg_", "(_", "{_", "'", "loc", "'_", ":_", "np_", "._", "sum_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "[_", "'", "committer", "'_", ",_", "'", "file", "'_", "]_", ")_", "._", "agg_", "(_", "{_", "'", "loc", "'_", ":_", "np_", "._", "sum_", "}_", ")_", "\\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_", "by_", "==_", "'", "repos", "itor", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "'", "author", "'_", ")_", "._", "agg_", "(_", "{_", "'", "loc", "'_", ":_", "np_", "._", "sum_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "groupby_", "(_", "[_", "'", "author", "'_", ",_", "'", "file", "'_", "]_", ")_", "._", "agg_", "(_", "{_", "'", "loc", "'_", ":_", "np_", "._", "sum_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "df_", "._", "sort", "\\u", "values_", "(_", "by_", "=_", "[_", "'", "loc", "'_", "]_", ",_", "ascending_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "detail_", "(_", "self_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "rev_", "=_", "'", "HEAD", "'_", ",_", "committer", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "table", " ", "of", " ", "all", " ", "current", " ", "files", " ", "in", " ", "the", " ", "repos", ",", " ", "with", " ", "some", " ", "high", " ", "level", " ", "informati", "on", " ", "abo", "ut", " ", "each", " ", "file", " ", "(", "total", " ", "LOC", ",", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "owner", ",", " ", "extensi", "on", ",", " ", "most", " ", "recent", " ", "edit", " ", "date", ",", " ", "etc", ".)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "committer", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Tru", "e", ")", " ", "true", " ", "if", " ", "committer", " ", "shou", "ld", " ", "be", " ", "reporte", "d", ",", " ", "fal", "se", " ", "if", " ", "author", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "df_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "df_", "=_", "repo_", "._", "file", "\\u", "detail_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "committer", "_", "=_", "committer", "_", ",_", "rev_", "=_", "rev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "chunk_", "=_", "repo_", "._", "file", "\\u", "detail_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "committer", "_", "=_", "committer", "_", ",_", "rev_", "=_", "rev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "df_", "._", "reset", "\\u", "index_", "(_", "level_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "set\\u", "index_", "(_", "[_", "'", "file", "'_", ",_", "'", "repos", "itor", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "branches_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "data", " ", "frame", " ", "of", " ", "all", " ", "branch", "es", " ", "in", " ", "orig", "in", ".", " ", " ", "The", " ", "Data", "Frame", " ", "will", " ", "have", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "local", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "branch", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "repos", "itor", "y", "'_", ",_", "'", "local", "'_", ",_", "'", "branch", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "append_", "(_", "repo_", "._", "branches_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revs_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "limit_", "=_", "None_", ",_", "skip_", "=_", "None_", ",_", "num", "\\u", "datapoints", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dataframe", " ", "of", " ", "all", " ", "revis", "ion", " ", "tags", " ", "and", " ", "thei", "r", " ", "timestamp", "s", " ", "for", " ", "each", " ", "project", ".", " ", "It", " ", "will", " ", "have", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "date", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "rev", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "(", "option", "al", ",", " ", "default", " ", "'", "master", "')", " ", "the", " ", "branch", " ", "to", " ", "work", " ", "in", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", " ", "Non", "e", "),", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "revis", "ion", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "skip", ":", " ", "(", "option", "al", ",", " ", "default", " ", "Non", "e", "),", " ", "the", " ", "number", " ", "of", " ", "revis", "ion", "s", " ", "to", " ", "skip", ".", " ", "Ex", ":", " ", "skip", "=", "2", " ", "return", "s", " ", "every", " ", "other", " ", "revis", "ion", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "skip", "ping", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "num", "\\u", "datapoints", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "if", " ", "limit", " ", "and", " ", "skip", " ", "are", " ", "none", ",", " ", "and", " ", "this", " ", "isn", "'", "t", ",", " ", "then", " ", "num", "\\u", "datapoints", " ", "even", "ly", " ", "space", "d", " ", "revs", " ", "will", " ", "be", " ", "used", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "math_", "._", "floor_", "(_", "float_", "(_", "limit_", ")_", "/_", "len_", "(_", "self_", "._", "repos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num", "\\u", "datapoints", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "datapoints", "_", "=_", "math_", "._", "floor_", "(_", "float_", "(_", "num", "\\u", "datapoints", "_", ")_", "/_", "len_", "(_", "self_", "._", "repos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "repos", "itor", "y", "'_", ",_", "'", "rev", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "revs_", "=_", "repo_", "._", "revs_", "(_", "branch_", "=_", "branch_", ",_", "limit_", "=_", "limit_", ",_", "skip_", "=_", "skip_", ",_", "num", "\\u", "datapoints", "_", "=_", "num", "\\u", "datapoints", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revs_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "revs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cumul", "ative", "\\u", "bla", "me_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "by_", "=_", "'", "committer", "'_", ",_", "limit_", "=_", "None_", ",_", "skip_", "=_", "None_", ",_", "num", "\\u", "datapoints", "_", "=_", "None_", ",_", "committer", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "time", " ", "series", " ", "of", " ", "cumul", "ative", " ", "bla", "me", " ", "for", " ", "a", " ", "collection", " ", "of", " ", "project", "s", ".", " ", " ", "The", " ", "goal", " ", "is", " ", "to", " ", "return", " ", "a", " ", "dataframe", " ", "for", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "collection", " ", "of", " ", "project", "s", " ", "with", " ", "the", " ", "LOC", " ", "attache", "d", " ", "to", " ", "an", " ", "entity", " ", "at", " ", "each", " ", "point", " ", "in", " ", "time", ".", " ", "The", " ", "return", "ed", " ", "dataframe", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", " ", "in", " ", "3", " ", "forms", " ", "(", "switche", "d", " ", "with", " ", "the", " ", "by", " ", "parameter", ",", " ", "default", " ", "'", "committer", "')", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "committer", ":", " ", "one", " ", "column", " ", "per", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "project", ":", " ", "one", " ", "column", " ", "per", " ", "project", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "raw", ":", " ", "one", " ", "column", " ", "per", " ", "committ", "ed", " ", "per", " ", "project", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "(", "option", "al", ",", " ", "default", " ", "'", "master", "')", " ", "the", " ", "branch", " ", "to", " ", "work", " ", "in", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", " ", "Non", "e", "),", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "revis", "ion", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "skip", ":", " ", "(", "option", "al", ",", " ", "default", " ", "Non", "e", "),", " ", "the", " ", "number", " ", "of", " ", "revis", "ion", "s", " ", "to", " ", "skip", ".", " ", "Ex", ":", " ", "skip", "=", "2", " ", "return", "s", " ", "every", " ", "other", " ", "revis", "ion", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "skip", "ping", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "num", "\\u", "datapoints", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "if", " ", "limit", " ", "and", " ", "skip", " ", "are", " ", "none", ",", " ", "and", " ", "this", " ", "isn", "'", "t", ",", " ", "then", " ", "num", "\\u", "datapoints", " ", "even", "ly", " ", "space", "d", " ", "revs", " ", "will", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "committer", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Tru", "e", ")", " ", "true", " ", "if", " ", "committer", " ", "shou", "ld", " ", "be", " ", "reporte", "d", ",", " ", "fal", "se", " ", "if", " ", "author", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "by", ":", " ", "(", "option", "al", ",", " ", "default", "='", "committer", "')", " ", "whe", "ther", " ", "to", " ", "arrange", " ", "the", " ", "output", " ", "by", " ", "committer", " ", "or", " ", "project", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bla", "mes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "bla", "me_", "=_", "repo_", "._", "cumul", "ative", "\\u", "bla", "me_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "=_", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip_", "=_", "skip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "datapoints", "_", "=_", "num", "\\u", "datapoints", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "committer", "_", "=_", "committer", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "mes_", "._", "append_", "(_", "(_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", ",_", "bla", "me_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "bla", "me_", "=_", "bla", "mes_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "bla", "me_", "._", "columns_", "=_", "[_", "x_", "+_", "'\\u\\u'_", "+_", "str_", "(_", "bla", "mes_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "for_", "x_", "in_", "global", "\\u", "bla", "me_", "._", "columns_", "._", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "mes_", "=_", "bla", "mes_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "repon", "ame_", ",_", "bla", "me_", "in_", "bla", "mes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bla", "me_", "._", "columns_", "=_", "[_", "x_", "+_", "'\\u\\u'_", "+_", "repon", "ame_", "for_", "x_", "in_", "bla", "me_", "._", "columns_", "._", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "bla", "me_", "=_", "pd_", "._", "merge_", "(_", "global", "\\u", "bla", "me_", ",_", "bla", "me_", ",_", "left", "\\u", "index_", "=_", "True_", ",_", "right", "\\u", "index_", "=_", "True_", ",_", "how_", "=_", "'", "outer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "bla", "me_", "._", "fillna_", "(_", "method_", "=_", "'", "pad", "'_", ",_", "inplace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "bla", "me_", "._", "fillna_", "(_", "0.0_", ",_", "inplace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "by_", "==_", "'", "committer", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "committer", "s_", "=_", "[_", "(_", "str_", "(_", "x_", ")_", "._", "split_", "(_", "'\\u\\u'_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", ",_", "x_", ")_", "for_", "x_", "in_", "global", "\\u", "bla", "me_", "._", "columns_", "._", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "._", "major_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "committer", "\\u", "mapping_", "=_", "dict_", "(_", "[_", "(_", "c_", ",_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "committer", "s_", "if_", "x_", "[_", "0_", "]_", "==_", "c_", "]_", ")_", "for_", "c_", "in_", "set_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "committer", "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 ", " _", "committer", "\\u", "mapping_", "=_", "{_", "c_", ":_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "committer", "s_", "if_", "x_", "[_", "0_", "]_", "==_", "c_", "]_", "for_", "c_", "in_", "{_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "committer", "s_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "committer", "_", "in_", "committer", "\\u", "mapping_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "bla", "me_", "[_", "committer", "_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "committer", "\\u", "mapping_", "._", "get_", "(_", "committer", "_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "global", "\\u", "bla", "me_", "[_", "committer", "_", "]_", "+=_", "global", "\\u", "bla", "me_", "[_", "col_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "bla", "me_", "=_", "global", "\\u", "bla", "me_", "._", "reindex", "_", "(_", "columns_", "=_", "list_", "(_", "committer", "\\u", "mapping_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "project", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projects_", "=_", "[_", "(_", "str_", "(_", "x_", ")_", "._", "split_", "(_", "'\\u\\u'_", ")_", "[_", "1_", "]_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", ",_", "x_", ")_", "for_", "x_", "in_", "global", "\\u", "bla", "me_", "._", "columns_", "._", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "._", "major_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "mapping_", "=_", "dict_", "(_", "[_", "(_", "c_", ",_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "projects_", "if_", "x_", "[_", "0_", "]_", "==_", "c_", "]_", ")_", "for_", "c_", "in_", "set_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "projects_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "mapping_", "=_", "{_", "c_", ":_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "projects_", "if_", "x_", "[_", "0_", "]_", "==_", "c_", "]_", "for_", "c_", "in_", "{_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "projects_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "project_", "in_", "project", "\\u", "mapping_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "bla", "me_", "[_", "project_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "project", "\\u", "mapping_", "._", "get_", "(_", "project_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "global", "\\u", "bla", "me_", "[_", "project_", "]_", "+=_", "global", "\\u", "bla", "me_", "[_", "col_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "bla", "me_", "=_", "global", "\\u", "bla", "me_", "._", "reindex", "_", "(_", "columns_", "=_", "list_", "(_", "project", "\\u", "mapping_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "bla", "me_", "=_", "global", "\\u", "bla", "me_", "[_", "~_", "global", "\\u", "bla", "me_", "._", "index_", "._", "duplicated", "_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "global", "\\u", "bla", "me_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tags_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "data", " ", "frame", " ", "of", " ", "all", " ", "tags", " ", "in", " ", "orig", "in", ".", " ", " ", "The", " ", "Data", "Frame", " ", "will", " ", "have", " ", "the", " ", "column", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "tag", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "repos", "itor", "y", "'_", ",_", "'", "tag", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "df_", "._", "append_", "(_", "repo_", "._", "tags_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bus", "\\u", "factor_", "(_", "self_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "by_", "=_", "'", "project", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "experimental", " ", "heuristic", " ", "for", " ", "tru", "ck", " ", "factor", " ", "of", " ", "a", " ", "repos", "itor", "y", " ", "calculated", " ", "by", " ", "the", " ", "current", " ", "distribu", "tion", " ", "of", " ", "bla", "me", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "repos", "itor", "y", "'", "s", " ", "primary", " ", "branch", ".", " ", " ", "The", " ", "factor", " ", "is", " ", "the", " ", "few", "est", " ", "number", " ", "of", " ", "contributor", "s", " ", "who", "se", " ", "contributions", " ", "make", " ", "up", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "leas", "t", " ", "50", "%", " ", "of", " ", "the", " ", "codeb", "ase", "'", "s", " ", "LOC", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "by_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "File", "-", "wis", "e", " ", "bus", " ", "factor", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "project", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bla", "me_", "=_", "self_", "._", "bla", "me_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "by_", "=_", "'", "repos", "itor", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "me_", "=_", "bla", "me_", "._", "sort", "\\u", "values_", "(_", "by_", "=_", "[_", "'", "loc", "'_", "]_", ",_", "ascending_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "bla", "me_", "[_", "'", "loc", "'_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cumul", "ative_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tc_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", "in_", "range_", "(_", "bla", "me_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cumul", "ative_", "+=_", "bla", "me_", "._", "ix_", "[_", "idx_", ",_", "'", "loc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tc_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cumul", "ative_", ">=_", "total_", "/_", "2_", ":_", "\\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_", "pd_", "._", "Data", "Frame_", "(_", "[_", "[_", "'", "project", "d", "'_", ",_", "tc_", "]_", "]_", ",_", "columns_", "=_", "[_", "'", "project", "d", "'_", ",_", "'", "bus", " ", "factor", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "by_", "==_", "'", "repos", "itor", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "columns_", "=_", "[_", "'", "repos", "itor", "y", "'_", ",_", "'", "bus", " ", "factor", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "df_", "=_", "df_", "._", "append_", "(_", "repo_", "._", "bus", "\\u", "factor_", "(_", "extensions_", "=_", "extensions_", ",_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "by_", "=_", "by_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Directory_", "(_", "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_", "punc", "hc", "ard_", "(_", "self_", ",_", "branch_", "=_", "'", "master", "'_", ",_", "limit_", "=_", "None_", ",_", "extensions_", "=_", "None_", ",_", "ignore", "\\u", "dir_", "=_", "None_", ",_", "days_", "=_", "None_", ",_", "by_", "=_", "None_", ",_", "normalize_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "panda", "s", " ", "Data", "Frame", " ", "contain", "ing", " ", "all", " ", "of", " ", "the", " ", "data", " ", "for", " ", "a", " ", "punc", "hc", "ard", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "day", "\\u", "of", "\\u", "week", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "hour", "\\u", "of", "\\u", "day", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "author", " ", "/", " ", "committer", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "lines", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "insertion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "deletion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "net", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "the", " ", "branch", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "limit", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", " ", "commit", "s", " ", "to", " ", "return", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "extensi", "ons", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "file", " ", "extensi", "ons", " ", "to", " ", "return", " ", "commit", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "dir", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "a", " ", "list", " ", "of", " ", "director", "y", " ", "names", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "day", "s", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "number", " ", "of", " ", "day", "s", " ", "to", " ", "return", ",", " ", "if", " ", "limit", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "by", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "agg", " ", "by", " ", "options", ",", " ", "Non", "e", " ", "for", " ", "no", " ", "aggregation", " ", "(", "just", " ", "a", " ", "high", " ", "level", " ", "punc", "hc", "ard", "),", " ", "or", " ", "'", "committer", "',", " ", "'", "author", "',", " ", "'", "repos", "itor", "y", "'", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "normali", "ze", ":", " ", "(", "option", "al", ",", " ", "default", "=", "Non", "e", ")", " ", "if", " ", "an", " ", "integ", "er", ",", " ", "return", "s", " ", "the", " ", "data", " ", "normali", "zed", " ", "to", " ", "max", " ", "value", " ", "of", " ", "tha", "t", " ", "(", "for", " ", "plott", "ing", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "by_", "==_", "'", "repos", "itor", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "by_", "=_", "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 ", " _", "repo", "\\u", "by_", "=_", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "repo_", "in_", "self_", "._", "repos_", ":_", "\\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 ", " _", "chunk_", "=_", "repo_", "._", "punc", "hc", "ard_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "=_", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dir_", "=_", "ignore", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "by_", "=_", "repo", "\\u", "by_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "[_", "'", "repos", "itor", "y", "'_", "]_", "=_", "repo_", "._", "\\u", "repo", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Command", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", "!", " ", "Rep", "o", ":", " ", "%", "s", " ", "coul", "dn", "\\\\'", "t", " ", "be", " ", "inspect", "ed", "'_", "%_", "(_", "repo_", ",_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aggs", "_", "=_", "[_", "'", "hour", "\\u", "of", "\\u", "day", "'_", ",_", "'", "day", "\\u", "of", "\\u", "week", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "by_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggs", "_", "._", "append_", "(_", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "punc", "h", "\\u", "card_", "=_", "df_", "._", "groupby_", "(_", "aggs", "_", ")_", "._", "agg_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lines", "'_", ":_", "np_", "._", "sum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insertion", "s", "'_", ":_", "np_", "._", "sum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deletion", "s", "'_", ":_", "np_", "._", "sum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "'_", ":_", "np_", "._", "sum_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "punc", "h", "\\u", "card_", "._", "reset", "\\u", "index_", "(_", "inplace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normali", "ze", " ", "all", " ", "cols_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "normalize_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "col_", "in_", "[_", "'", "lines", "'_", ",_", "'", "insertion", "s", "'_", ",_", "'", "deletion", "s", "'_", ",_", "'", "net", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "punc", "h", "\\u", "card_", "[_", "col_", "]_", "=_", "(_", "punc", "h", "\\u", "card_", "[_", "col_", "]_", "/_", "punc", "h", "\\u", "card_", "[_", "col_", "]_", "._", "sum_", "(_", ")_", ")_", "*_", "normalize_", "\\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_", "punc", "h", "\\u", "card_", "\\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, 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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 ]
Unused import
mozilla/django-badger/badger/printing.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Quick and dirty render-to-PDF for badge award claim codes\"\"\"\n\nimport logging\nimport math\nimport urllib\nimport urllib2\ntry:\n from cStringIO import cStringIO as StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom reportlab.pdfgen import canvas\nfrom reportlab.lib import pagesizes\nfrom reportlab.lib.units import inch\nfrom reportlab.platypus import (\n SimpleDocTemplate, BaseDocTemplate, Paragraph, Preformatted, Spacer,\n PageBreak, Frame, FrameBreak, PageTemplate, Image, Table)\nfrom reportlab.platypus.doctemplate import LayoutError\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom reportlab.rl_config import defaultPageSize \nfrom reportlab.lib.units import inch \nfrom reportlab.lib.enums import TA_LEFT, TA_CENTER\nfrom reportlab.lib import colors\nfrom reportlab.lib import textsplit\n\nfrom reportlab.lib.utils import ImageReader\n\nfrom django.conf import settings\n\nfrom django.http import (HttpResponseRedirect, HttpResponse,\n HttpResponseForbidden, HttpResponseNotFound)\n\nfrom django.utils.html import conditional_escape\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def render_claims_to_pdf(request, slug, claim_group, deferred_awards):\n \"\"\"Currently hard-coded to print to Avery 22805 labels\"\"\"\n\n metrics = dict(\n page_width=(8.5 * inch),\n page_height=(11.0 * inch),\n\n top_margin=(0.5 * inch),\n left_margin=((25.0 / 32.0) * inch),\n\n qr_overlap=((1.0 / 32.0) * inch),\n padding=((1.0 / 16.0) * inch),\n\n horizontal_spacing=((5.0 / 16.0) * inch),\n vertical_spacing=((13.0 / 64.0) * inch),\n\n width=(1.5 * inch),\n height=(1.5 * inch),\n )\n\n debug = (request.GET.get('debug', False) is not False)\n\n pagesize = (metrics['page_width'], metrics['page_height'])\n cols = int((metrics['page_width'] - metrics['left_margin']) /\n (metrics['width'] + metrics['horizontal_spacing']))\n rows = int((metrics['page_height'] - metrics['top_margin']) /\n (metrics['height'] + metrics['vertical_spacing']))\n per_page = (cols * rows)\n label_ct = len(deferred_awards)\n page_ct = math.ceil(label_ct / per_page)\n\n pages = [deferred_awards[x:x + (per_page)]\n for x in range(0, label_ct, per_page)]\n\n response = HttpResponse(content_type='application/pdf; charset=utf-8')\n if not debug:\n # If debugging, don't force download.\n response['Content-Disposition'] = ('attachment; filename=\"%s-%s.pdf\"' %\n (slug.encode('utf-8', 'replace'), claim_group))\n\n badge_img = None\n\n fout = StringIO()\n c = canvas.Canvas(fout, pagesize=pagesize)\n\n for page in pages:\n c.translate(metrics['left_margin'],\n metrics['page_height'] - metrics['top_margin'])\n\n for row in range(0, rows, 1):\n c.translate(0.0, 0 - metrics['height'])\n c.saveState()\n\n for col in range(0, cols, 1):\n\n try:\n da = page.pop(0)\n except IndexError:\n continue\n\n if not badge_img:\n image_fin = da.badge.image.file\n image_fin.open()\n badge_img = ImageReader(StringIO(image_fin.read()))\n\n c.saveState()\n render_label(request, c, metrics, da, badge_img, debug)\n c.restoreState()\n\n dx = (metrics['width'] + metrics['horizontal_spacing'])\n c.translate(dx, 0.0)\n\n c.restoreState()\n c.translate(0.0, 0 - metrics['vertical_spacing'])\n\n c.showPage()\n\n c.save()\n response.write(fout.getvalue())\n return response", "metadata": "root.render_claims_to_pdf", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def render_label(request, c, metrics, da, badge_img, debug):\n \"\"\"Render a single label\"\"\"\n badge = da.badge\n\n badge_image_width = (1.0 + (1.0 / 64.0)) * inch\n badge_image_height = (1.0 + (1.0 / 64.0)) * inch\n\n qr_left = badge_image_width - metrics['qr_overlap']\n qr_bottom = badge_image_height - metrics['qr_overlap']\n qr_width = metrics['width'] - qr_left\n qr_height = metrics['height'] - qr_bottom\n\n if False and debug:\n # Draw some layout lines on debug.\n c.setLineWidth(0.3)\n c.rect(0, 0, metrics['width'], metrics['height'])\n c.rect(qr_left, qr_bottom, qr_width, qr_height)\n c.rect(0, 0, badge_image_width, badge_image_height)\n\n fit_text(c, da.badge.title,\n 0.0, badge_image_height,\n badge_image_width, qr_height)\n\n c.saveState()\n c.rotate(-90)\n\n code_height = qr_height * (0.45)\n claim_height = qr_height - code_height\n\n c.setFont(\"Courier\", code_height)\n c.drawCentredString(0 - (badge_image_width / 2.0),\n metrics['height'] - code_height,\n da.claim_code)\n\n text = \"\"\"\n <font name=\"Helvetica\">Claim at</font> <font name=\"Courier\">%s</font>\n \"\"\" % (settings.SITE_TITLE)\n fit_text(c, text,\n 0 - badge_image_height, badge_image_width,\n badge_image_width, claim_height)\n\n c.restoreState()\n\n # Attempt to build a QR code image for the claim URL\n claim_url = request.build_absolute_uri(da.get_claim_url())\n qr_img = None\n try:\n # Try using PyQRNative: http://code.google.com/p/pyqrnative/\n # badg.us should have this in vendor-local\n from PyQRNative import QRCode, QRErrorCorrectLevel\n # TODO: Good-enough settings?\n if len(claim_url) < 20:\n qr = QRCode(3, QRErrorCorrectLevel.L)\n elif len(claim_url) < 50:\n qr = QRCode(4, QRErrorCorrectLevel.L)\n else:\n qr = QRCode(10, QRErrorCorrectLevel.L)\n qr.addData(claim_url)\n qr.make()\n qr_img = ImageReader(qr.makeImage())\n\n except ImportError:\n try:\n # Hmm, if we don't have PyQRNative, then try abusing this web\n # service. Should be fine for low volumes.\n qr_url = (\"http://api.qrserver.com/v1/create-qr-code/?%s\" %\n urllib.urlencode({'size': '%sx%s' % (500, 500),\n 'data': claim_url}))\n\n qr_img = ImageReader(StringIO(urllib2.urlopen(qr_url).read()))\n\n except Exception:\n # Ignore issues in drawing the QR code - maybe show an error?\n pass\n\n if qr_img:\n c.drawImage(qr_img, qr_left, qr_bottom, qr_width, qr_height)\n\n c.drawImage(badge_img,\n 0.0 * inch, 0.0 * inch,\n badge_image_width, badge_image_height)", "metadata": "root.render_label", "header": "['module', '___EOS___']", "index": 118 }, { "content": "def fit_text(c, text, x, y, max_w, max_h, font_name='Helvetica',\n padding_w=4.5, padding_h=4.5, font_decrement=0.0625):\n \"\"\"Draw text, reducing font size until it fits with a given max width and\n height.\"\"\"\n\n max_w -= (padding_w * 2.0)\n max_h -= (padding_h * 2.0)\n\n x += padding_w\n y += padding_h\n\n font_size = max_h\n\n while font_size > 1.0:\n ps = ParagraphStyle(name='text', alignment=TA_CENTER,\n fontName=font_name, fontSize=font_size,\n leading=font_size)\n p = Paragraph(text, ps)\n actual_w, actual_h = p.wrapOn(c, max_w, max_h)\n if actual_h > max_h or actual_w > max_w:\n font_size -= font_decrement\n else:\n y_pad = (max_h - actual_h) / 2\n p.drawOn(c, x, y + y_pad)\n return", "metadata": "root.fit_text", "header": "['module', '___EOS___']", "index": 201 } ]
[ { "span": "import logging", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 }, { "span": "from reportlab.lib import pagesizes", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 35 }, { "span": "from reportlab.platypus import (\n SimpleDocTemplate, BaseDocTemplate, Paragraph, Preformatted, Spacer,\n PageBreak, Frame, FrameBreak, PageTemplate, Image, Table)", "start_line": 15, "start_column": 0, "end_line": 17, "end_column": 61 }, { "span": "from reportlab.platypus.doctemplate import LayoutError", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 54 }, { "span": "from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 68 }, { "span": "from reportlab.rl_config import defaultPageSize ", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 47 }, { "span": "from reportlab.lib.enums import TA_LEFT, TA_CENTER", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 50 }, { "span": "from reportlab.lib import colors", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 32 }, { "span": "from reportlab.lib import textsplit", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 35 }, { "span": "from django.http import (HttpResponseRedirect, HttpResponse,\n HttpResponseForbidden, HttpResponseNotFound)", "start_line": 30, "start_column": 0, "end_line": 31, "end_column": 52 }, { "span": "from django.utils.html import conditional_escape", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Qui", "ck", " ", "and", " ", "dir", "ty", " ", "render", "-", "to", "-", "PD", "F", " ", "for", " ", "badge", " ", "award", " ", "claim", " ", "codes", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "c", "String", "IO_", "import_", "c", "String", "IO_", "as_", "String", "IO_", "\\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_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "reportlab_", "._", "pdf", "gen_", "import_", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "import_", "pagesize", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "._", "units_", "import_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "plat", "yp", "us_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Doc", "Template_", ",_", "Base", "Doc", "Template_", ",_", "Paragraph_", ",_", "Pref", "ormat", "ted_", ",_", "Spacer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Page", "Break", "_", ",_", "Frame_", ",_", "Frame", "Break", "_", ",_", "Page", "Template_", ",_", "Image_", ",_", "Table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "plat", "yp", "us_", "._", "docte", "mpla", "te_", "import_", "Lay", "out", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "._", "styles_", "import_", "get", "Sampl", "e", "Style", "Sheet_", ",_", "Para", "graph", "Style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "rl", "\\u", "config_", "import_", "default", "Page", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "._", "units_", "import_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "._", "enums_", "import_", "TA", "\\u", "LEFT_", ",_", "TA", "\\u", "CENTER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "import_", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "import_", "texts", "plit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "reportlab_", "._", "lib_", "._", "utils_", "import_", "Image", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "(_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Http", "Respons", "e", "Forbidden_", ",_", "Http", "Respons", "e", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "conditional", "\\u", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render", "\\u", "claim", "s", "\\u", "to", "\\u", "pdf_", "(_", "request_", ",_", "slug_", ",_", "claim", "\\u", "group_", ",_", "defer", "red", "\\u", "awards", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Curr", "ent", "ly", " ", "hard", "-", "code", "d", " ", "to", " ", "print", " ", "to", " ", "Ave", "ry", " ", "228", "05", " ", "labels", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metrics_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "page", "\\u", "width_", "=_", "(_", "8.5", "_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page", "\\u", "height_", "=_", "(_", "11.0_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top", "\\u", "margin_", "=_", "(_", "0.5_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "left", "\\u", "margin_", "=_", "(_", "(_", "25.0", "_", "/_", "32.", "0_", ")_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "overlap_", "=_", "(_", "(_", "1.0_", "/_", "32.", "0_", ")_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "padding_", "=_", "(_", "(_", "1.0_", "/_", "16.0_", ")_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "horizon", "tal", "\\u", "spacing_", "=_", "(_", "(_", "5.0_", "/_", "16.0_", ")_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vertical", "\\u", "spacing_", "=_", "(_", "(_", "13.", "0_", "/_", "64.", "0_", ")_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "(_", "1.5_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "height_", "=_", "(_", "1.5_", "*_", "inch_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "debug", "'_", ",_", "False_", ")_", "is_", "not_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pagesize", "_", "=_", "(_", "metrics_", "[_", "'", "page", "\\u", "widt", "h", "'_", "]_", ",_", "metrics_", "[_", "'", "page", "\\u", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "int_", "(_", "(_", "metrics_", "[_", "'", "page", "\\u", "widt", "h", "'_", "]_", "-_", "metrics_", "[_", "'", "left", "\\u", "marg", "in", "'_", "]_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", "+_", "metrics_", "[_", "'", "horizon", "tal", "\\u", "spaci", "ng", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "int_", "(_", "(_", "metrics_", "[_", "'", "page", "\\u", "height", "'_", "]_", "-_", "metrics_", "[_", "'", "top", "\\u", "marg", "in", "'_", "]_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "metrics_", "[_", "'", "height", "'_", "]_", "+_", "metrics_", "[_", "'", "vertical", "\\u", "spaci", "ng", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "per", "\\u", "page_", "=_", "(_", "cols_", "*_", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "ct_", "=_", "len_", "(_", "defer", "red", "\\u", "awards", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "ct_", "=_", "math_", "._", "ceil_", "(_", "label", "\\u", "ct_", "/_", "per", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pages_", "=_", "[_", "defer", "red", "\\u", "awards", "_", "[_", "x_", ":_", "x_", "+_", "(_", "per", "\\u", "page_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "label", "\\u", "ct_", ",_", "per", "\\u", "page_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "pdf", ";", " ", "charset", "=", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "debugg", "ing", ",", " ", "don", "'", "t", " ", "force", " ", "download", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "(_", "'", "attach", "ment", ";", " ", "filename", "=\"", "%", "s", "-%", "s", ".", "pdf", "\"'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "slug_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ",_", "'", "replace", "'_", ")_", ",_", "claim", "\\u", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "badge", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fout_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "canvas_", "._", "Canvas_", "(_", "fout_", ",_", "pagesize", "_", "=_", "pagesize", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "page_", "in_", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "translate_", "(_", "metrics_", "[_", "'", "left", "\\u", "marg", "in", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metrics_", "[_", "'", "page", "\\u", "height", "'_", "]_", "-_", "metrics_", "[_", "'", "top", "\\u", "marg", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "range_", "(_", "0_", ",_", "rows_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "translate_", "(_", "0.0_", ",_", "0_", "-_", "metrics_", "[_", "'", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "save", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "0_", ",_", "cols_", ",_", "1_", ")_", ":_", "\\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 ", " ", "_", "da_", "=_", "page_", "._", "pop_", "(_", "0_", ")_", "\\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 ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "badge", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "image", "\\u", "fin_", "=_", "da_", "._", "badge", "_", "._", "image_", "._", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "fin_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "badge", "\\u", "img_", "=_", "Image", "Reader_", "(_", "String", "IO_", "(_", "image", "\\u", "fin_", "._", "read_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "save", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "\\u", "label_", "(_", "request_", ",_", "c_", ",_", "metrics_", ",_", "da_", ",_", "badge", "\\u", "img_", ",_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "restore", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dx_", "=_", "(_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", "+_", "metrics_", "[_", "'", "horizon", "tal", "\\u", "spaci", "ng", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "translate_", "(_", "dx_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "restore", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "translate_", "(_", "0.0_", ",_", "0_", "-_", "metrics_", "[_", "'", "vertical", "\\u", "spaci", "ng", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "show", "Page_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "write_", "(_", "fout_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "label_", "(_", "request_", ",_", "c_", ",_", "metrics_", ",_", "da_", ",_", "badge", "\\u", "img_", ",_", "debug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "a", " ", "single", " ", "label", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "badge", "_", "=_", "da_", "._", "badge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", "=_", "(_", "1.0_", "+_", "(_", "1.0_", "/_", "64.", "0_", ")_", ")_", "*_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "badge", "\\u", "image", "\\u", "height_", "=_", "(_", "1.0_", "+_", "(_", "1.0_", "/_", "64.", "0_", ")_", ")_", "*_", "inch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "left_", "=_", "badge", "\\u", "image", "\\u", "width_", "-_", "metrics_", "[_", "'", "qr", "\\u", "overl", "ap", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "bottom_", "=_", "badge", "\\u", "image", "\\u", "height_", "-_", "metrics_", "[_", "'", "qr", "\\u", "overl", "ap", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "width_", "=_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", "-_", "qr", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "height_", "=_", "metrics_", "[_", "'", "height", "'_", "]_", "-_", "qr", "\\u", "bottom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "False_", "and_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Draw", " ", "some", " ", "layout", " ", "lines", " ", "on", " ", "debug", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "set", "Line", "Width_", "(_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "0_", ",_", "0_", ",_", "metrics_", "[_", "'", "widt", "h", "'_", "]_", ",_", "metrics_", "[_", "'", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "qr", "\\u", "left_", ",_", "qr", "\\u", "bottom_", ",_", "qr", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rect_", "(_", "0_", ",_", "0_", ",_", "badge", "\\u", "image", "\\u", "width_", ",_", "badge", "\\u", "image", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fit", "\\u", "text_", "(_", "c_", ",_", "da_", "._", "badge", "_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", ",_", "badge", "\\u", "image", "\\u", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "save", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "rotate_", "(_", "-_", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "height_", "=_", "qr", "\\u", "height_", "*_", "(_", "0.45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "claim", "\\u", "height_", "=_", "qr", "\\u", "height_", "-_", "code", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Font_", "(_", "\"", "Cour", "ier", "\"_", ",_", "code", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "draw", "Centre", "d", "String_", "(_", "0_", "-_", "(_", "badge", "\\u", "image", "\\u", "width_", "/_", "2.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metrics_", "[_", "'", "height", "'_", "]_", "-_", "code", "\\u", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "da_", "._", "claim", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "font", " ", "name", "=\"", "Hel", "vet", "ica", "\">", "Cla", "im", " ", "at", "</", "font", ">", " ", "<", "font", " ", "name", "=\"", "Cour", "ier", "\">", "%", "s", "</", "font", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "settings_", "._", "SITE", "\\u", "TITLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "\\u", "text_", "(_", "c_", ",_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "-_", "badge", "\\u", "image", "\\u", "height_", ",_", "badge", "\\u", "image", "\\u", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "claim", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "restore", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "build", " ", "a", " ", "QR", " ", "code", " ", "image", " ", "for", " ", "the", " ", "claim", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "claim", "\\u", "url_", "=_", "request_", "._", "build", "\\u", "abs", "olute", "\\u", "uri_", "(_", "da_", "._", "get", "\\u", "claim", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "usi", "ng", " ", "Py", "QR", "Nat", "ive", ":", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "pyq", "rna", "tiv", "e", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bad", "g", ".", "us", " ", "shou", "ld", " ", "have", " ", "this", " ", "in", " ", "vendor", "-", "local_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "QR", "Nat", "ive_", "import_", "QR", "Code_", ",_", "QR", "Error", "Correct", "Level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Good", "-", "eno", "ugh", " ", "settings", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "claim", "\\u", "url_", ")_", "<_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "3_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "claim", "\\u", "url_", ")_", "<_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "4_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "QR", "Code_", "(_", "10_", ",_", "QR", "Error", "Correct", "Level_", "._", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qr_", "._", "add", "Data_", "(_", "claim", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "make_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "=_", "Image", "Reader_", "(_", "qr_", "._", "make", "Image_", "(_", ")_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hm", "m", ",", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "Py", "QR", "Nat", "ive", ",", " ", "then", " ", "try", " ", "abu", "sing", " ", "this", " ", "web_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "service", ".", " ", "Sho", "ul", "d", " ", "be", " ", "fine", " ", "for", " ", "low", " ", "volume", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr", "\\u", "url_", "=_", "(_", "\"", "http", "://", "api", ".", "qr", "server", ".", "com", "/", "v1", "/", "create", "-", "qr", "-", "code", "/?", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "urlencode_", "(_", "{_", "'", "size", "'_", ":_", "'%", "sx", "%", "s", "'_", "%_", "(_", "500_", ",_", "500_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "claim", "\\u", "url_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "img_", "=_", "Image", "Reader_", "(_", "String", "IO_", "(_", "urllib2_", "._", "urlopen_", "(_", "qr", "\\u", "url_", ")_", "._", "read_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "issue", "s", " ", "in", " ", "drawing", " ", "the", " ", "QR", " ", "code", " ", "-", " ", "may", "be", " ", "show", " ", "an", " ", "error", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "qr", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "draw", "Image_", "(_", "qr", "\\u", "img_", ",_", "qr", "\\u", "left_", ",_", "qr", "\\u", "bottom_", ",_", "qr", "\\u", "width_", ",_", "qr", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "draw", "Image_", "(_", "badge", "\\u", "img_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "*_", "inch_", ",_", "0.0_", "*_", "inch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "badge", "\\u", "image", "\\u", "width_", ",_", "badge", "\\u", "image", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "\\u", "text_", "(_", "c_", ",_", "text_", ",_", "x_", ",_", "y_", ",_", "max", "\\u", "w_", ",_", "max", "\\u", "h_", ",_", "font", "\\u", "name_", "=_", "'", "Hel", "vet", "ica", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "padd", "ing", "\\u", "w_", "=_", "4.5_", ",_", "padd", "ing", "\\u", "h_", "=_", "4.5_", ",_", "font", "\\u", "decrement", "_", "=_", "0.06", "25_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Draw", " ", "text", ",", " ", "reduc", "ing", " ", "font", " ", "size", " ", "unti", "l", " ", "it", " ", "fits", " ", "with", " ", "a", " ", "give", "n", " ", "max", " ", "widt", "h", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "height", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "w_", "-=_", "(_", "padd", "ing", "\\u", "w_", "*_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "h_", "-=_", "(_", "padd", "ing", "\\u", "h_", "*_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "+=_", "padd", "ing", "\\u", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "+=_", "padd", "ing", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "font", "\\u", "size_", "=_", "max", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "font", "\\u", "size_", ">_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ps_", "=_", "Para", "graph", "Style_", "(_", "name_", "=_", "'", "text", "'_", ",_", "alignment_", "=_", "TA", "\\u", "CENTER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "font", "Name_", "=_", "font", "\\u", "name_", ",_", "font", "Size_", "=_", "font", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lead", "ing_", "=_", "font", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Paragraph_", "(_", "text_", ",_", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "w_", ",_", "actual", "\\u", "h_", "=_", "p_", "._", "wrap", "On_", "(_", "c_", ",_", "max", "\\u", "w_", ",_", "max", "\\u", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "actual", "\\u", "h_", ">_", "max", "\\u", "h_", "or_", "actual", "\\u", "w_", ">_", "max", "\\u", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "\\u", "size_", "-=_", "font", "\\u", "decrement", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_",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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 ]
First parameter of a method is not named 'self'
codeforamerica/comport/comport/data/csv_utils.py
[ { "content": " def coalesce_date(date):\n return \"\" if date is None else datetime.strftime(date, '%Y-%m-%d %H:%M:%S')", "metadata": "root.csv_utils.coalesce_date", "header": "['class', 'csv_utils', ':', '___EOS___']", "index": 3 }, { "content": " def coalesce_bool(field):\n return \"\" if field is None else \"true\" if field is True else \"false\"", "metadata": "root.csv_utils.coalesce_bool", "header": "['class', 'csv_utils', ':', '___EOS___']", "index": 6 }, { "content": " def coalesce_int(num):\n return \"\" if num is None else str(num)", "metadata": "root.csv_utils.coalesce_int", "header": "['class', 'csv_utils', ':', '___EOS___']", "index": 9 } ]
[ { "span": "def coalesce_date(date):", "start_line": 3, "start_column": 4, "end_line": 3, "end_column": 28 }, { "span": "def coalesce_bool(field):", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 29 }, { "span": "def coalesce_int(num):", "start_line": 9, "start_column": 4, "end_line": 9, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "csv", "\\u", "utils_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "coalesce", "\\u", "date_", "(_", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "if_", "date_", "is_", "None_", "else_", "datetime_", "._", "strftime_", "(_", "date_", ",_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "csv", "\\u", "utils_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coalesce", "\\u", "bool_", "(_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "if_", "field_", "is_", "None_", "else_", "\"", "true", "\"_", "if_", "field_", "is_", "True_", "else_", "\"", "fal", "se", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "csv", "\\u", "utils_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coalesce", "\\u", "int_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "if_", "num_", "is_", "None_", "else_", "str_", "(_", "num_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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, 4, 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, 4, 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 ]
Unused import
JoelBender/bacpypes/samples/ReadPropertyMultiple.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"\nThis application presents a 'console' prompt to the user asking for read commands\nwhich create ReadPropertyRequest PDUs, then lines up the coorresponding ReadPropertyACK\nand prints the value.\n\"\"\"\n\nimport sys\n\nfrom bacpypes.debugging import bacpypes_debugging, ModuleLogger\nfrom bacpypes.consolelogging import ConfigArgumentParser\nfrom bacpypes.consolecmd import ConsoleCmd\n\nfrom bacpypes.core import run\n\nfrom bacpypes.pdu import Address\nfrom bacpypes.app import LocalDeviceObject, BIPSimpleApplication\nfrom bacpypes.object import get_object_class, get_datatype\n\nfrom bacpypes.apdu import ReadPropertyMultipleRequest, PropertyReference, ReadAccessSpecification, Error, AbortPDU, ReadPropertyMultipleACK\nfrom bacpypes.primitivedata import Unsigned\nfrom bacpypes.constructeddata import Array\nfrom bacpypes.basetypes import PropertyIdentifier, ServicesSupported\n\n# some debugging\n_debug = 0\n_log = ModuleLogger(globals())\n\n# globals\nthis_device = None\nthis_application = None\nthis_console = None\n\n#\n# ReadPropertyMultipleApplication\n#\n\n\n#\n# ReadPropertyMultipleConsoleCmd\n#\n\n\n#\n# __main__\n#\n\ntry:\n # parse the command line arguments\n args = ConfigArgumentParser(description=__doc__).parse_args()\n\n if _debug: _log.debug(\"initialization\")\n if _debug: _log.debug(\" - args: %r\", args)\n\n # make a device object\n this_device = LocalDeviceObject(\n objectName=args.ini.objectname,\n objectIdentifier=int(args.ini.objectidentifier),\n maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),\n segmentationSupported=args.ini.segmentationsupported,\n vendorIdentifier=int(args.ini.vendoridentifier),\n )\n\n # make a simple application\n this_application = ReadPropertyMultipleApplication(this_device, args.ini.address)\n\n # get the services supported\n services_supported = this_application.get_services_supported()\n if _debug: _log.debug(\" - services_supported: %r\", services_supported)\n\n # let the device object know\n this_device.protocolServicesSupported = services_supported.value\n\n # make a console\n this_console = ReadPropertyMultipleConsoleCmd()\n\n _log.debug(\"running\")\n\n run()\n\nexcept Exception, e:\n _log.exception(\"an error has occurred: %s\", e)\nfinally:\n _log.debug(\"finally\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@bacpypes_debugging\nclass ReadPropertyMultipleApplication(BIPSimpleApplication):\n\n\n", "metadata": "root.ReadPropertyMultipleApplication", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def __init__(self, *args):\n if _debug: ReadPropertyMultipleApplication._debug(\"__init__ %r\", args)\n BIPSimpleApplication.__init__(self, *args)\n\n # keep track of requests to line up responses\n self._request = None", "metadata": "root.ReadPropertyMultipleApplication.__init__", "header": "['class', 'ReadPropertyMultipleApplication', '(', 'BIPSimpleApplication', ')', ':', '___EOS___']", "index": 41 }, { "content": " def request(self, apdu):\n if _debug: ReadPropertyMultipleApplication._debug(\"request %r\", apdu)\n\n # save a copy of the request\n self._request = apdu\n\n # forward it along\n BIPSimpleApplication.request(self, apdu)", "metadata": "root.ReadPropertyMultipleApplication.request", "header": "['class', 'ReadPropertyMultipleApplication', '(', 'BIPSimpleApplication', ')', ':', '___EOS___']", "index": 48 }, { "content": " def confirmation(self, apdu):\n if _debug: ReadPropertyMultipleApplication._debug(\"confirmation %r\", apdu)\n\n if isinstance(apdu, Error):\n sys.stdout.write(\"error: %s\\n\" % (apdu.errorCode,))\n sys.stdout.flush()\n\n elif isinstance(apdu, AbortPDU):\n apdu.debug_contents()\n\n elif (isinstance(self._request, ReadPropertyMultipleRequest)) and (isinstance(apdu, ReadPropertyMultipleACK)):\n # loop through the results\n for result in apdu.listOfReadAccessResults:\n # here is the object identifier\n objectIdentifier = result.objectIdentifier\n if _debug: ReadPropertyMultipleApplication._debug(\" - objectIdentifier: %r\", objectIdentifier)\n\n # now come the property values per object\n for element in result.listOfResults:\n # get the property and array index\n propertyIdentifier = element.propertyIdentifier\n if _debug: ReadPropertyMultipleApplication._debug(\" - propertyIdentifier: %r\", propertyIdentifier)\n propertyArrayIndex = element.propertyArrayIndex\n if _debug: ReadPropertyMultipleApplication._debug(\" - propertyArrayIndex: %r\", propertyArrayIndex)\n\n # here is the read result\n readResult = element.readResult\n\n sys.stdout.write(propertyIdentifier)\n if propertyArrayIndex is not None:\n sys.stdout.write(\"[\" + str(propertyArrayIndex) + \"]\")\n\n # check for an error\n if readResult.propertyAccessError is not None:\n sys.stdout.write(\" ! \" + str(readResult.propertyAccessError) + '\\n')\n\n else:\n # here is the value\n propertyValue = readResult.propertyValue\n\n # find the datatype\n datatype = get_datatype(objectIdentifier[0], propertyIdentifier)\n if _debug: ReadPropertyMultipleApplication._debug(\" - datatype: %r\", datatype)\n if not datatype:\n raise TypeError, \"unknown datatype\"\n\n # special case for array parts, others are managed by cast_out\n if issubclass(datatype, Array) and (propertyArrayIndex is not None):\n if propertyArrayIndex == 0:\n value = propertyValue.cast_out(Unsigned)\n else:\n value = propertyValue.cast_out(datatype.subtype)\n else:\n value = propertyValue.cast_out(datatype)\n if _debug: ReadPropertyMultipleApplication._debug(\" - value: %r\", value)\n\n sys.stdout.write(\" = \" + str(value) + '\\n')\n sys.stdout.flush()", "metadata": "root.ReadPropertyMultipleApplication.confirmation", "header": "['class', 'ReadPropertyMultipleApplication', '(', 'BIPSimpleApplication', ')', ':', '___EOS___']", "index": 57 }, { "content": "@bacpypes_debugging\nclass ReadPropertyMultipleConsoleCmd(ConsoleCmd):\n", "metadata": "root.ReadPropertyMultipleConsoleCmd", "header": "['module', '___EOS___']", "index": 120 }, { "content": " def do_read(self, args):\n \"\"\"read <addr> ( <type> <inst> ( <prop> [ <indx> ] )... )...\"\"\"\n args = args.split()\n if _debug: ReadPropertyMultipleConsoleCmd._debug(\"do_read %r\", args)\n\n try:\n i = 0\n addr = args[i]\n i += 1\n\n read_access_spec_list = []\n while i < len(args):\n obj_type = args[i]\n i += 1\n\n if obj_type.isdigit():\n obj_type = int(obj_type)\n elif not get_object_class(obj_type):\n raise ValueError, \"unknown object type\"\n \n obj_inst = int(args[i])\n i += 1\n\n prop_reference_list = []\n while i < len(args):\n prop_id = args[i]\n if prop_id not in PropertyIdentifier.enumerations:\n break\n\n i += 1\n if prop_id in ('all', 'required', 'optional'):\n pass\n else:\n datatype = get_datatype(obj_type, prop_id)\n if not datatype:\n raise ValueError, \"invalid property for object type\"\n\n # build a property reference\n prop_reference = PropertyReference(\n propertyIdentifier=prop_id,\n )\n\n # check for an array index\n if (i < len(args)) and args[i].isdigit():\n prop_reference.propertyArrayIndex = int(args[i])\n i += 1\n\n # add it to the list\n prop_reference_list.append(prop_reference)\n\n # check for at least one property\n if not prop_reference_list:\n raise ValueError, \"provide at least one property\"\n\n # build a read access specification\n read_access_spec = ReadAccessSpecification(\n objectIdentifier=(obj_type, obj_inst),\n listOfPropertyReferences=prop_reference_list,\n )\n\n # add it to the list\n read_access_spec_list.append(read_access_spec)\n\n # check for at least one\n if not read_access_spec_list:\n raise RuntimeError, \"at least one read access specification required\"\n\n # build the request\n request = ReadPropertyMultipleRequest(\n listOfReadAccessSpecs=read_access_spec_list,\n )\n request.pduDestination = Address(addr)\n if _debug: ReadPropertyMultipleConsoleCmd._debug(\" - request: %r\", request)\n\n # give it to the application\n this_application.request(request)\n\n except Exception, e:\n ReadPropertyMultipleConsoleCmd._exception(\"exception: %r\", e)", "metadata": "root.ReadPropertyMultipleConsoleCmd.do_read", "header": "['class', 'ReadPropertyMultipleConsoleCmd', '(', 'ConsoleCmd', ')', ':', '___EOS___']", "index": 123 } ]
[ { "span": "from bacpypes.basetypes import PropertyIdentifier, ServicesSupported", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 68 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "applica", "tion", " ", "presen", "ts", " ", "a", " ", "'", "console", "'", " ", "prompt", " ", "to", " ", "the", " ", "user", " ", "ask", "ing", " ", "for", " ", "read", " ", "command", "s", "\\", "10", ";", "whi", "ch", " ", "create", " ", "Read", "Proper", "ty", "Request", " ", "PD", "Us", ",", " ", "then", " ", "lines", " ", "up", " ", "the", " ", "coor", "respond", "ing", " ", "Read", "Proper", "ty", "AC", "K", "\\", "10", ";", "and", " ", "print", "s", " ", "the", " ", "value", ".", "\\", "10", ";\"\"\"_", "\\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_", "from_", "bac", "pype", "s_", "._", "debugg", "ing_", "import_", "bac", "pype", "s", "\\u", "debugg", "ing_", ",_", "Modul", "e", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "logging_", "import_", "Config", "Arg", "ument", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "cmd_", "import_", "Cons", "ole", "Cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "core_", "import_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "pdu_", "import_", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "app_", "import_", "Local", "Dev", "ice", "Object_", ",_", "BI", "PS", "impl", "e", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "object_", "import_", "get", "\\u", "object\\u", "class_", ",_", "get", "\\u", "datatype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "apd", "u_", "import_", "Read", "Proper", "ty", "Multipl", "e", "Request_", ",_", "Proper", "ty", "Reference_", ",_", "Read", "Access", "Specification", "_", ",_", "Error_", ",_", "Abo", "rt", "PD", "U_", ",_", "Read", "Proper", "ty", "Multipl", "e", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "primi", "tiv", "edat", "a_", "import_", "Unsigned", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "construct", "edd", "ata_", "import_", "Array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "basetype", "s_", "import_", "Proper", "ty", "Identifier_", ",_", "Service", "s", "Supported_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "debug_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "=_", "Modul", "e", "Logger_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "globals_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "application_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "console_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Read", "Proper", "ty", "Multipl", "e", "Application_", "\\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_", "#", " ", " ", " ", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "\\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", "main\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "command", " ", "line", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "Config", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\\u\\u", "doc\\u\\u_", ")_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", "initialization", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "args", ":", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "device", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "=_", "Local", "Dev", "ice", "Object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Name_", "=_", "args_", "._", "ini_", "._", "object", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "objectid", "enti", "fier", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Ap", "du", "Length", "Accept", "ed_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "maxa", "pdu", "length", "accepted_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "segmentation", "Supported_", "=_", "args_", "._", "ini_", "._", "segmentation", "supported_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vendor", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "vendor", "identifier_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "simple", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "=_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "(_", "this", "\\u", "device_", ",_", "args_", "._", "ini_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "service", "s", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "service", "s", "\\u", "supported_", "=_", "this", "\\u", "application_", "._", "get", "\\u", "service", "s", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "service", "s", "\\u", "support", "ed", ":", " ", "%", "r", "\"_", ",_", "service", "s", "\\u", "supported_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", " ", "the", " ", "device", " ", "object", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "._", "protoc", "ol", "Service", "s", "Supported_", "=_", "service", "s", "\\u", "supported_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "console_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "console_", "=_", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "log_", "._", "debug_", "(_", "\"", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log_", "._", "exception_", "(_", "\"", "an", " ", "error", " ", "has", " ", "occur", "red", ":", " ", "%", "s", "\"_", ",_", "e_", ")_", "\\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 ", " _", "\\u", "log_", "._", "debug_", "(_", "\"", "final", "ly", "\"_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "bac", "pype", "s", "\\u", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"\\u\\u", "init", "\\u\\u", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BI", "PS", "impl", "e", "Application_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "track", " ", "of", " ", "request", "s", " ", "to", " ", "line", " ", "up", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "request_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request_", "(_", "self_", ",_", "apd", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", "request", " ", "%", "r", "\"_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "request_", "=_", "apd", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "forward", " ", "it", " ", "along", "_", "\\u\\u\\uNL\\u\\u\\u_", "BI", "PS", "impl", "e", "Application_", "._", "request_", "(_", "self_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "(_", "BI", "PS", "impl", "e", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "confirmation_", "(_", "self_", ",_", "apd", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", "confirmation", " ", "%", "r", "\"_", ",_", "apd", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "apd", "u_", ",_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", "error", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "apd", "u_", "._", "error", "Code_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "apd", "u_", ",_", "Abo", "rt", "PD", "U_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apd", "u_", "._", "debug", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "self_", "._", "\\u", "request_", ",_", "Read", "Proper", "ty", "Multipl", "e", "Request_", ")_", ")_", "and_", "(_", "isinstance_", "(_", "apd", "u_", ",_", "Read", "Proper", "ty", "Multipl", "e", "ACK_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "the", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "result_", "in_", "apd", "u_", "._", "list", "Of", "Read", "Access", "Results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "here", " ", "is", " ", "the", " ", "object", " ", "identifier_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object", "Identifier_", "=_", "result_", "._", "object", "Identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "object", "Identifie", "r", ":", " ", "%", "r", "\"_", ",_", "object", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "come", " ", "the", " ", "property", " ", "values", " ", "per", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "element_", "in_", "result_", "._", "list", "Of", "Results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "property", " ", "and", " ", "array", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "property", "Identifier_", "=_", "element_", "._", "property", "Identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "property", "Identifie", "r", ":", " ", "%", "r", "\"_", ",_", "property", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property", "Array", "Index_", "=_", "element_", "._", "property", "Array", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "property", "Array", "Index", ":", " ", "%", "r", "\"_", ",_", "property", "Array", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "here", " ", "is", " ", "the", " ", "read", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "read", "Result_", "=_", "element_", "._", "read", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "property", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "Array", "Index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\"[\"_", "+_", "str_", "(_", "property", "Array", "Index_", ")_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "read", "Result_", "._", "property", "Access", "Error_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", " ", "!", " ", "\"_", "+_", "str_", "(_", "read", "Result_", "._", "property", "Access", "Error_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "here", " ", "is", " ", "the", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "property", "Value_", "=_", "read", "Result_", "._", "property", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "datatype_", "\\u\\u\\uNL\\u\\u\\u_", "datatype_", "=_", "get", "\\u", "datatype_", "(_", "object", "Identifier_", "[_", "0_", "]_", ",_", "property", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "datatype", ":", " ", "%", "r", "\"_", ",_", "datatype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "datatype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Type", "Error_", ",_", "\"", "unknown", " ", "datatype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "case", " ", "for", " ", "array", " ", "part", "s", ",", " ", "other", "s", " ", "are", " ", "manage", "d", " ", "by", " ", "cast", "\\u", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "issubclass_", "(_", "datatype_", ",_", "Array_", ")_", "and_", "(_", "property", "Array", "Index_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "property", "Array", "Index_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "property", "Value_", "._", "cast", "\\u", "out_", "(_", "Unsigned", "_", ")_", "\\u\\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_", "=_", "property", "Value_", "._", "cast", "\\u", "out_", "(_", "datatype_", "._", "subtype_", ")_", "\\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 ", " ", " _", "value_", "=_", "property", "Value_", "._", "cast", "\\u", "out_", "(_", "datatype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Application_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "value", ":", " ", "%", "r", "\"_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", " ", "=", " ", "\"_", "+_", "str_", "(_", "value_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "@_", "bac", "pype", "s", "\\u", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "(_", "Cons", "ole", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "read_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "read", " ", "<", "addr", ">", " ", "(", " ", "<", "type", ">", " ", "<", "inst", ">", " ", "(", " ", "<", "prop", ">", " ", "[", " ", "<", "indx", ">", " ", "]", " ", ").", "..", " ", ").", "..", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", "do", "\\u", "read", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\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 ", " _", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "args_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "access", "\\u", "spec", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "len_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "type_", "=_", "args_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj", "\\u", "type_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj", "\\u", "type_", "=_", "int_", "(_", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "get", "\\u", "object\\u", "class_", "(_", "obj", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", ",_", "\"", "unknown", " ", "object", " ", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj", "\\u", "inst_", "=_", "int_", "(_", "args_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prop", "\\u", "reference", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "len_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prop", "\\u", "id_", "=_", "args_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prop", "\\u", "id_", "not_", "in_", "Proper", "ty", "Identifier_", "._", "enumerati", "ons_", ":_", "\\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_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prop", "\\u", "id_", "in_", "(_", "'", "all", "'_", ",_", "'", "require", "d", "'_", ",_", "'", "option", "al", "'_", ")_", ":_", "\\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 ", " ", " _", "datatype_", "=_", "get", "\\u", "datatype_", "(_", "obj", "\\u", "type_", ",_", "prop", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "datatype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", ",_", "\"", "invalid", " ", "property", " ", "for", " ", "object", " ", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "property", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prop", "\\u", "reference_", "=_", "Proper", "ty", "Reference_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "property", "Identifier_", "=_", "prop", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "an", " ", "array", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "i_", "<_", "len_", "(_", "args_", ")_", ")_", "and_", "args_", "[_", "i_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "prop", "\\u", "reference_", "._", "property", "Array", "Index_", "=_", "int_", "(_", "args_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "it", " ", "to", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prop", "\\u", "reference", "\\u", "list_", "._", "append_", "(_", "prop", "\\u", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "at", " ", "leas", "t", " ", "one", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "prop", "\\u", "reference", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", ",_", "\"", "provide", " ", "at", " ", "leas", "t", " ", "one", " ", "property", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "read", " ", "access", " ", "specification_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "read", "\\u", "access", "\\u", "spec_", "=_", "Read", "Access", "Specification", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Identifier_", "=_", "(_", "obj", "\\u", "type_", ",_", "obj", "\\u", "inst_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list", "Of", "Proper", "ty", "Reference", "s_", "=_", "prop", "\\u", "reference", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "it", " ", "to", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "access", "\\u", "spec", "\\u", "list_", "._", "append_", "(_", "read", "\\u", "access", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "at", " ", "leas", "t", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "read", "\\u", "access", "\\u", "spec", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", ",_", "\"", "at", " ", "leas", "t", " ", "one", " ", "read", " ", "access", " ", "specifica", "tion", " ", "require", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "Read", "Proper", "ty", "Multipl", "e", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list", "Of", "Read", "Access", "Specs_", "=_", "read", "\\u", "access", "\\u", "spec", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "pdu", "Destination_", "=_", "Address_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "._", "\\u", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "request", ":", " ", "%", "r", "\"_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "it", " ", "to", " ", "the", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "._", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Read", "Proper", "ty", "Multipl", "e", "Cons", "ole", "Cmd_", "._", "\\u", "exception_", "(_", "\"", "exception", ":", " ", "%", "r", "\"_", ",_", "e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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 ]
Implicit string concatenation in a list
blackberry/ALF/alf/debug/_cdb.py
[ { "content": "def _cdb_common(target_pid=None, target_cmd=None, symbols=None, env=None, callback=None,\n callback_args=None, timeout=_common.DEFAULT_TIMEOUT, memory_limit=None,\n idle_limit=None):\n assert target_pid is not None or target_cmd is not None\n assert target_pid is None or target_cmd is None\n classification = None\n if env is None:\n env = dict(os.environ)\n env[\"LIBC_FATAL_STDERR_\"] = \"1\"\n if symbols is not None:\n env[\"_NT_ALT_SYMBOL_PATH\"] = symbols\n elif target_cmd:\n env[\"_NT_ALT_SYMBOL_PATH\"] = os.path.abspath(os.path.dirname(target_cmd[0]))\n cdb_cmd = [TOOL_CDB, \"-x\", \"-lines\", \"-y\",\n \"SRV*c:\\\\websymbols*http://msdl.microsoft.com/download/symbols\",\n \"-c\", \"!gflag;g;.lastevent;r;kb;!msec.exploitable -m;\" \\\n \"!heap -s 0;!heap -h;.echo;q\"] # keep -c last\n start_time = _common.prof_timer()\n with tempfile.TemporaryFile(mode=\"w+t\") as f:\n if target_pid is not None:\n cdb_cmd[-1] += \"d\" # change final 'q' to 'qd'\n cdb_cmd += [\"-p\", \"%d\" % target_pid]\n p = subprocess.Popen(cdb_cmd, stderr=f, stdout=f, env=env,\n stdin=subprocess.PIPE, creationflags=_common.POPEN_FLAGS)\n else:\n p = subprocess.Popen(cdb_cmd + target_cmd, stderr=f, stdout=f, env=env,\n stdin=subprocess.PIPE, creationflags=_common.POPEN_FLAGS)\n ps = psutil.Process(p.pid)\n bn = os.path.basename(target_cmd[0])\n try:\n while (_common.prof_timer() - start_time) < timeout:\n if p.poll() is not None:\n raise psutil.NoSuchProcess(p.pid)\n for kid in ps.get_children():\n if kid.name != bn:\n continue # guard against catching something other than\n # the target being launched by the debugger\n assert target_pid is None, \"debugger has multiple children\"\n target_pid = kid.pid\n if target_pid is not None:\n #log.debug(\"got child pid in %0.2fs\", (_common.prof_timer() - start_time))\n break\n time.sleep(POLL_SLEEP)\n assert target_pid is not None, \"Failed to get child pid\"\n except psutil.NoSuchProcess:\n # this means CDB is already gone. so we can't possibly hit a timeout and we\n # won't use target_pid for anything anyways\n log.debug(\"target done before pid was found\")\n target_pid = p.pid\n try:\n cb_res = _common._call_callback(callback, callback_args, target_pid)\n if cb_res == _common.CB_ERROR:\n raise RuntimeError(\"callback() returned error\")\n if p.poll() is None and target_cmd is None:\n try:\n p.send_signal(signal.CTRL_BREAK_EVENT)\n except WindowsError as e:\n f.write(\"alf.debug.cdb: failed to send Ctrl+Break to debugger (%s)\\n\" % e)\n log.warn(\"failed to send Ctrl+Break to debugger\")\n target_mon = _common.TargetMonitor(target_pid, idle_limit=idle_limit,\n memory_limit=memory_limit, time_limit=timeout)\n while p.poll() is None:\n if target_mon.check_memory():\n f.write(\"memory limit of %0.2f MB was exceeded\\n\" % (memory_limit/1048576))\n classification = _common.EXCESS_MEMORY_USAGE\n break\n if target_mon.check_idle():\n break\n if target_mon.check_timeout():\n classification = _common.TIMEOUT\n break\n time.sleep(POLL_SLEEP)\n finally:\n if p.poll() is None:\n attempt = 0\n pid = target_pid\n while True:\n if attempt == 1:\n try:\n p.send_signal(signal.CTRL_BREAK_EVENT)\n except WindowsError as e:\n f.write(\"alf.debug.cdb: failed to send Ctrl+Break to debugger (%s)\\n\"\n % e)\n log.warn(\"failed to send Ctrl+Break to debugger\")\n else:\n with open(os.devnull, \"w\") as fp:\n subprocess.call([\"taskkill\", \"/pid\", str(pid), \"/f\", \"/t\"],\n stdout=fp, stderr=fp)\n st = _common.prof_timer()\n while p.poll() is None and \\\n (_common.prof_timer() - st) < TIMEOUT_CHILD_EXIT_WAIT:\n time.sleep(POLL_SLEEP)\n if p.poll() is not None:\n break\n if attempt == 0:\n f.write(\"[%0.1f]alf.debug.cdb: failed to kill child pid %d, trying to \"\n \"break into debugger instead\\n\" % (time.time(), pid))\n elif attempt == 1:\n f.write(\"[%0.1f]alf.debug.cdb: failed to break into debugger, trying to \"\n \"kill parent pid %d instead\\n\" % (time.time(), pid))\n pid = p.pid\n attempt += 1\n assert attempt <= 3, \"Failed to kill the debugger twice !?!\"\n assert attempt <= 1, \"Shouldn't need to kill the debugger.\"\n exit_code = p.wait()\n f.seek(0, os.SEEK_SET)\n debug_log = f.read()\n backtrace = []\n m = re.search(r\"^The call to LoadLibrary\\((?P<lib>[a-z]+)\\) failed, Win32 error 0n2\",\n debug_log, re.MULTILINE)\n if m is not None:\n raise RuntimeError(\"cdb failed on call to LoadLibrary(%s)\" % m.group(\"lib\"))\n debug_class = _common.NOT_AN_EXCEPTION\n if (\"Last event: %x.\" % target_pid) in debug_log:\n backtrace, debug_class, exit_code = _common.process_exploitable_output(debug_log)\n if cb_res == _common.CB_HANG:\n classification = _common.TIMEOUT\n elif classification is None:\n if cb_res == _common.CB_FAIL:\n classification = _common.UNKNOWN\n else:\n classification = debug_class\n debug_log = _common._limit_output_length(debug_log)\n return _common.FuzzResult(classification, debug_log, backtrace, exit_code=exit_code)", "metadata": "root._cdb_common", "header": "['module', '___EOS___']", "index": 123 } ]
[ { "span": "\"!gflag;g;.lastevent;r;kb;!msec.exploitable -m;\" \\\n \"!heap -s 0;!heap -h;.echo;q\"]", "start_line": 138, "start_column": 21, "end_line": 139, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cdb", "\\u", "common_", "(_", "target", "\\u", "pid_", "=_", "None_", ",_", "target", "\\u", "cmd_", "=_", "None_", ",_", "symbols_", "=_", "None_", ",_", "env_", "=_", "None_", ",_", "callback_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback", "\\u", "args_", "=_", "None_", ",_", "timeout_", "=_", "\\u", "common_", "._", "DEF", "AUL", "T", "\\u", "TIMEOUT_", ",_", "memory", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "idle", "\\u", "limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "target", "\\u", "pid_", "is_", "not_", "None_", "or_", "target", "\\u", "cmd_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "target", "\\u", "pid_", "is_", "None_", "or_", "target", "\\u", "cmd_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classification_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "dict_", "(_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "[_", "\"", "LIB", "C", "\\u", "FATAL", "\\u", "STD", "ERR", "\\u\"_", "]_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "symbols_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "\"\\u", "NT", "\\u", "ALT", "\\u", "SYMBOL", "\\u", "PATH", "\"_", "]_", "=_", "symbols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target", "\\u", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "\"\\u", "NT", "\\u", "ALT", "\\u", "SYMBOL", "\\u", "PATH", "\"_", "]_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target", "\\u", "cmd_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cdb", "\\u", "cmd_", "=_", "[_", "TOOL", "\\u", "CD", "B_", ",_", "\"-", "x", "\"_", ",_", "\"-", "lines", "\"_", ",_", "\"-", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SRV", "*", "c", ":\\\\", "\\\\", "webs", "ymbo", "ls", "*", "http", "://", "msd", "l", ".", "micros", "oft", ".", "com", "/", "download", "/", "symbols", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "c", "\"_", ",_", "\"!", "gf", "lag", ";", "g", ";", ".", "last", "event", ";", "r", ";", "kb", ";", "!", "msec", ".", "exploit", "able", " ", "-", "m", ";\"_", "\"!", "heap", " ", "-", "s", " ", "0", ";", "!", "heap", " ", "-", "h", ";", ".", "echo", ";", "q", "\"_", "]_", "#", " ", "keep", " ", "-", "c", " ", "last_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "\\u", "common_", "._", "prof", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "tempfile_", "._", "Tempora", "ry", "File_", "(_", "mode_", "=_", "\"", "w", "+", "t", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target", "\\u", "pid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cdb", "\\u", "cmd_", "[_", "-_", "1_", "]_", "+=_", "\"", "d", "\"_", "#", " ", "change", " ", "final", " ", "'", "q", "'", " ", "to", " ", "'", "qd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cdb", "\\u", "cmd_", "+=_", "[_", "\"-", "p", "\"_", ",_", "\"%", "d", "\"_", "%_", "target", "\\u", "pid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cdb", "\\u", "cmd_", ",_", "stderr_", "=_", "f_", ",_", "stdout_", "=_", "f_", ",_", "env_", "=_", "env_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "creati", "onf", "lags_", "=_", "\\u", "common_", "._", "POP", "EN", "\\u", "FLAGS_", ")_", "\\u\\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_", "=_", "subprocess_", "._", "Popen_", "(_", "cdb", "\\u", "cmd_", "+_", "target", "\\u", "cmd_", ",_", "stderr_", "=_", "f_", ",_", "stdout_", "=_", "f_", ",_", "env_", "=_", "env_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "creati", "onf", "lags_", "=_", "\\u", "common_", "._", "POP", "EN", "\\u", "FLAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "=_", "psutil_", "._", "Process_", "(_", "p_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bn_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "target", "\\u", "cmd_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "(_", "\\u", "common_", "._", "prof", "\\u", "timer_", "(_", ")_", "-_", "start", "\\u", "time_", ")_", "<_", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "p_", "._", "poll_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "psutil_", "._", "No", "Suc", "h", "Process_", "(_", "p_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "kid", "_", "in_", "ps_", "._", "get", "\\u", "children_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "kid", "_", "._", "name_", "!=_", "bn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "#", " ", "guard", " ", "against", " ", "catch", "ing", " ", "somet", "hing", " ", "other", " ", "than_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "target", " ", "bei", "ng", " ", "launched", " ", "by", " ", "the", " ", "debugger_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "target", "\\u", "pid_", "is_", "None_", ",_", "\"", "debugg", "er", " ", "has", " ", "multiple", " ", "child", "ren", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "pid_", "=_", "kid", "_", "._", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target", "\\u", "pid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "log", ".", "debug", "(\"", "got", " ", "child", " ", "pid", " ", "in", " ", "%", "0.", "2f", "s", "\",", " ", "(\\u", "common", ".", "prof", "\\u", "timer", "()", " ", "-", " ", "start", "\\u", "time", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "POLL", "\\u", "SLEEP", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "target", "\\u", "pid_", "is_", "not_", "None_", ",_", "\"", "Fail", "ed", " ", "to", " ", "get", " ", "child", " ", "pid", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "psutil_", "._", "No", "Suc", "h", "Process_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "means", " ", "CD", "B", " ", "is", " ", "alr", "ead", "y", " ", "gone", ".", " ", "so", " ", "we", " ", "can", "'", "t", " ", "possib", "ly", " ", "hit", " ", "a", " ", "timeo", "ut", " ", "and", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "won", "'", "t", " ", "use", " ", "target", "\\u", "pid", " ", "for", " ", "anyt", "hing", " ", "anyway", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "target", " ", "don", "e", " ", "bef", "ore", " ", "pid", " ", "was", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "pid_", "=_", "p_", "._", "pid_", "\\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 ", " _", "cb", "\\u", "res_", "=_", "\\u", "common_", "._", "\\u", "call", "\\u", "callback_", "(_", "callback_", ",_", "callback", "\\u", "args_", ",_", "target", "\\u", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cb", "\\u", "res_", "==_", "\\u", "common_", "._", "CB", "\\u", "ERROR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "callback", "()", " ", "return", "ed", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "poll_", "(_", ")_", "is_", "None_", "and_", "target", "\\u", "cmd_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "p_", "._", "send", "\\u", "signal_", "(_", "signal_", "._", "CTR", "L", "\\u", "BREAK", "\\u", "EVENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "write_", "(_", "\"", "alf", ".", "debug", ".", "cdb", ":", " ", "fail", "ed", " ", "to", " ", "send", " ", "Ctrl", "+", "Break", " ", "to", " ", "debugg", "er", " ", "(%", "s", ")\\\\", "n", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "warn_", "(_", "\"", "fail", "ed", " ", "to", " ", "send", " ", "Ctrl", "+", "Break", " ", "to", " ", "debugg", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "mon_", "=_", "\\u", "common_", "._", "Target", "Monitor_", "(_", "target", "\\u", "pid_", ",_", "idle", "\\u", "limit_", "=_", "idle", "\\u", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "limit_", "=_", "memory", "\\u", "limit_", ",_", "time", "\\u", "limit_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "poll_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target", "\\u", "mon_", "._", "check", "\\u", "memory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "write_", "(_", "\"", "memory", " ", "limit", " ", "of", " ", "%", "0.", "2f", " ", "MB", " ", "was", " ", "exceed", "ed", "\\\\", "n", "\"_", "%_", "(_", "memory", "\\u", "limit_", "/_", "104857", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classification_", "=_", "\\u", "common_", "._", "EXCE", "SS", "\\u", "MEM", "ORY", "\\u", "USAGE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target", "\\u", "mon_", "._", "check", "\\u", "idle_", "(_", ")_", ":_", "\\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_", "target", "\\u", "mon_", "._", "check", "\\u", "timeout_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "classification_", "=_", "\\u", "common_", "._", "TIMEOUT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "POLL", "\\u", "SLEEP", "_", ")_", "\\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_", "p_", "._", "poll_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attempt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", "=_", "target", "\\u", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "attempt_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "p_", "._", "send", "\\u", "signal_", "(_", "signal_", "._", "CTR", "L", "\\u", "BREAK", "\\u", "EVENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "\"", "alf", ".", "debug", ".", "cdb", ":", " ", "fail", "ed", " ", "to", " ", "send", " ", "Ctrl", "+", "Break", " ", "to", " ", "debugg", "er", " ", "(%", "s", ")\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "warn_", "(_", "\"", "fail", "ed", " ", "to", " ", "send", " ", "Ctrl", "+", "Break", " ", "to", " ", "debugg", "er", "\"_", ")_", "\\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 ", " ", " _", "with_", "open_", "(_", "os_", "._", "devnull_", ",_", "\"", "w", "\"_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subprocess_", "._", "call_", "(_", "[_", "\"", "task", "kill", "\"_", ",_", "\"/", "pid", "\"_", ",_", "str_", "(_", "pid_", ")_", ",_", "\"/", "f", "\"_", ",_", "\"/", "t", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "fp_", ",_", "stderr_", "=_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "st_", "=_", "\\u", "common_", "._", "prof", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "poll_", "(_", ")_", "is_", "None_", "and_", "(_", "\\u", "common_", "._", "prof", "\\u", "timer_", "(_", ")_", "-_", "st_", ")_", "<_", "TIME", "OUT", "\\u", "CHILD", "\\u", "EXIT", "\\u", "WAIT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "time_", "._", "sleep_", "(_", "POLL", "\\u", "SLEEP", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "poll_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "attempt_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "\"[", "%", "0.", "1f", "]", "alf", ".", "debug", ".", "cdb", ":", " ", "fail", "ed", " ", "to", " ", "kill", " ", "child", " ", "pid", " ", "%", "d", ",", " ", "try", "ing", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "break", " ", "int", "o", " ", "debugg", "er", " ", "inst", "ead", "\\\\", "n", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", ",_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attempt_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "\"[", "%", "0.", "1f", "]", "alf", ".", "debug", ".", "cdb", ":", " ", "fail", "ed", " ", "to", " ", "break", " ", "int", "o", " ", "debugg", "er", ",", " ", "try", "ing", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kill", " ", "parent", " ", "pid", " ", "%", "d", " ", "inst", "ead", "\\\\", "n", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", ",_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pid_", "=_", "p_", "._", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attempt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "attempt_", "<=_", "3_", ",_", "\"", "Fail", "ed", " ", "to", " ", "kill", " ", "the", " ", "debugg", "er", " ", "twi", "ce", " ", "!", "?!", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "attempt_", "<=_", "1_", ",_", "\"", "Sho", "ul", "dn", "'", "t", " ", "need", " ", "to", " ", "kill", " ", "the", " ", "debugg", "er", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exit", "\\u", "code_", "=_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "seek_", "(_", "0_", ",_", "os_", "._", "SEE", "K", "\\u", "SET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "\\u", "log_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "backt", "race_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "\"", "^", "The", " ", "call", " ", "to", " ", "Load", "Libr", "ary", "\\\\((", "?", "P", "<", "lib", ">[", "a", "-", "z", "]+)\\\\", ")", " ", "fail", "ed", ",", " ", "Win", "32", " ", "error", " ", "0", "n2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug", "\\u", "log_", ",_", "re_", "._", "MULTILINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "cdb", " ", "fail", "ed", " ", "on", " ", "call", " ", "to", " ", "Load", "Libr", "ary", "(%", "s", ")\"_", "%_", "m_", "._", "group_", "(_", "\"", "lib", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug", "\\u", "class_", "=_", "\\u", "common_", "._", "NOT", "\\u", "AN", "\\u", "EXCEPTION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\"", "Las", "t", " ", "event", ":", " ", "%", "x", ".\"_", "%_", "target", "\\u", "pid_", ")_", "in_", "debug", "\\u", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backt", "race_", ",_", "debug", "\\u", "class_", ",_", "exit", "\\u", "code_", "=_", "\\u", "common_", "._", "process", "\\u", "exploit", "able", "\\u", "output_", "(_", "debug", "\\u", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cb", "\\u", "res_", "==_", "\\u", "common_", "._", "CB", "\\u", "HAN", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classification_", "=_", "\\u", "common_", "._", "TIMEOUT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "classification_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cb", "\\u", "res_", "==_", "\\u", "common_", "._", "CB", "\\u", "FAIL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classification_", "=_", "\\u", "common_", "._", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classification_", "=_", "debug", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug", "\\u", "log_", "=_", "\\u", "common_", "._", "\\u", "limit", "\\u", "output", "\\u", "length_", "(_", "debug", "\\u", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "common_", "._", "Fuzz", "Result_", "(_", "classification_", ",_", "debug", "\\u", "log_", ",_", "backt", "race_", ",_", "exit", "\\u", "code_", "=_", "exit", "\\u", "code_", ")_", "\\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,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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 ]
Non-callable called
nlloyd/SubliminalCollaborator/libs/twisted/internet/_sslverify.py
[ { "content": "def _handleattrhelper(Class, transport, methodName):\n \"\"\"\n (private) Helper for L{Certificate.peerFromTransport} and\n L{Certificate.hostFromTransport} which checks for incompatible handle types\n and null certificates and raises the appropriate exception or returns the\n appropriate certificate object.\n \"\"\"\n method = getattr(transport.getHandle(),\n \"get_%s_certificate\" % (methodName,), None)\n if method is None:\n raise CertificateError(\n \"non-TLS transport %r did not have %s certificate\" % (transport, methodName))\n cert = method()\n if cert is None:\n raise CertificateError(\n \"TLS transport %r did not have %s certificate\" % (transport, methodName))\n return Class(cert)", "metadata": "root._handleattrhelper", "header": "['module', '___EOS___']", "index": 139 }, { "content": "class Certificate(CertBase):\n \"\"\"\n An x509 certificate.\n \"\"\"\n\n\n\n\n\n load = classmethod(load)\n _load = load\n\n\n\n\n loadPEM = classmethod(loadPEM)\n\n\n peerFromTransport = classmethod(peerFromTransport)\n\n\n hostFromTransport = classmethod(hostFromTransport)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Certificate", "header": "['module', '___EOS___']", "index": 158 }, { "content": " def __repr__(self):\n return '<%s Subject=%s Issuer=%s>' % (self.__class__.__name__,\n self.getSubject().commonName,\n self.getIssuer().commonName)", "metadata": "root.Certificate.__repr__", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def __eq__(self, other):\n if isinstance(other, Certificate):\n return self.dump() == other.dump()\n return False", "metadata": "root.Certificate.__eq__", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 167 }, { "content": " def __ne__(self, other):\n return not self.__eq__(other)", "metadata": "root.Certificate.__ne__", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def load(Class, requestData, format=crypto.FILETYPE_ASN1, args=()):\n \"\"\"\n Load a certificate from an ASN.1- or PEM-format string.\n\n @rtype: C{Class}\n \"\"\"\n return Class(crypto.load_certificate(format, requestData), *args)", "metadata": "root.Certificate.load", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 177 }, { "content": " def dumpPEM(self):\n \"\"\"\n Dump this certificate to a PEM-format data string.\n\n @rtype: C{str}\n \"\"\"\n return self.dump(crypto.FILETYPE_PEM)", "metadata": "root.Certificate.dumpPEM", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 188 }, { "content": " def loadPEM(Class, data):\n \"\"\"\n Load a certificate from a PEM-format data string.\n\n @rtype: C{Class}\n \"\"\"\n return Class.load(data, crypto.FILETYPE_PEM)", "metadata": "root.Certificate.loadPEM", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 197 }, { "content": " def peerFromTransport(Class, transport):\n \"\"\"\n Get the certificate for the remote end of the given transport.\n\n @type: L{ISystemHandle}\n @rtype: C{Class}\n\n @raise: L{CertificateError}, if the given transport does not have a peer\n certificate.\n \"\"\"\n return _handleattrhelper(Class, transport, 'peer')", "metadata": "root.Certificate.peerFromTransport", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def hostFromTransport(Class, transport):\n \"\"\"\n Get the certificate for the local end of the given transport.\n\n @param transport: an L{ISystemHandle} provider; the transport we will\n\n @rtype: C{Class}\n\n @raise: L{CertificateError}, if the given transport does not have a host\n certificate.\n \"\"\"\n return _handleattrhelper(Class, transport, 'host')", "metadata": "root.Certificate.hostFromTransport", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def getPublicKey(self):\n \"\"\"\n Get the public key for this certificate.\n\n @rtype: L{PublicKey}\n \"\"\"\n return PublicKey(self.original.get_pubkey())", "metadata": "root.Certificate.getPublicKey", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 236 }, { "content": " def dump(self, format=crypto.FILETYPE_ASN1):\n return crypto.dump_certificate(format, self.original)", "metadata": "root.Certificate.dump", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def serialNumber(self):\n \"\"\"\n Retrieve the serial number of this certificate.\n\n @rtype: C{int}\n \"\"\"\n return self.original.get_serial_number()", "metadata": "root.Certificate.serialNumber", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def digest(self, method='md5'):\n \"\"\"\n Return a digest hash of this certificate using the specified hash\n algorithm.\n\n @param method: One of C{'md5'} or C{'sha'}.\n @rtype: C{str}\n \"\"\"\n return self.original.digest(method)", "metadata": "root.Certificate.digest", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def _inspect(self):\n return '\\n'.join(['Certificate For Subject:',\n self.getSubject().inspect(),\n '\\nIssuer:',\n self.getIssuer().inspect(),\n '\\nSerial Number: %d' % self.serialNumber(),\n 'Digest: %s' % self.digest()])", "metadata": "root.Certificate._inspect", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def inspect(self):\n \"\"\"\n Return a multi-line, human-readable representation of this\n Certificate, including information about the subject, issuer, and\n public key.\n \"\"\"\n return '\\n'.join((self._inspect(), self.getPublicKey().inspect()))", "metadata": "root.Certificate.inspect", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 278 }, { "content": " def getIssuer(self):\n \"\"\"\n Retrieve the issuer of this certificate.\n\n @rtype: L{DistinguishedName}\n @return: A copy of the issuer of this certificate.\n \"\"\"\n return self._copyName('issuer')", "metadata": "root.Certificate.getIssuer", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 287 }, { "content": " def options(self, *authorities):\n raise NotImplementedError('Possible, but doubtful we need this yet')", "metadata": "root.Certificate.options", "header": "['class', 'Certificate', '(', 'CertBase', ')', ':', '___EOS___']", "index": 297 }, { "content": "class CertificateRequest(CertBase):\n \"\"\"\n An x509 certificate request.\n\n Certificate requests are given to certificate authorities to be signed and\n returned resulting in an actual certificate.\n \"\"\"\n load = classmethod(load)\n\n", "metadata": "root.CertificateRequest", "header": "['module', '___EOS___']", "index": 302 }, { "content": " def load(Class, requestData, requestFormat=crypto.FILETYPE_ASN1):\n req = crypto.load_certificate_request(requestFormat, requestData)\n dn = DistinguishedName()\n dn._copyFrom(req.get_subject())\n if not req.verify(req.get_pubkey()):\n raise VerifyError(\"Can't verify that request for %r is self-signed.\" % (dn,))\n return Class(req)", "metadata": "root.CertificateRequest.load", "header": "['class', 'CertificateRequest', '(', 'CertBase', ')', ':', '___EOS___']", "index": 309 }, { "content": " def dump(self, format=crypto.FILETYPE_ASN1):\n return crypto.dump_certificate_request(format, self.original)", "metadata": "root.CertificateRequest.dump", "header": "['class', 'CertificateRequest', '(', 'CertBase', ')', ':', '___EOS___']", "index": 319 }, { "content": "class PrivateCertificate(Certificate):\n \"\"\"\n An x509 certificate and private key.\n \"\"\"\n\n\n\n\n\n\n load = classmethod(load)\n\n\n\n\n\n\n loadPEM = classmethod(loadPEM)\n\n\n fromCertificateAndKeyPair = classmethod(fromCertificateAndKeyPair)\n\n\n\n\n\n\n\n", "metadata": "root.PrivateCertificate", "header": "['module', '___EOS___']", "index": 324 }, { "content": " def __repr__(self):\n return Certificate.__repr__(self) + ' with ' + repr(self.privateKey)", "metadata": "root.PrivateCertificate.__repr__", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 328 }, { "content": " def _setPrivateKey(self, privateKey):\n if not privateKey.matches(self.getPublicKey()):\n raise VerifyError(\n \"Certificate public and private keys do not match.\")\n self.privateKey = privateKey\n return self", "metadata": "root.PrivateCertificate._setPrivateKey", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 332 }, { "content": " def newCertificate(self, newCertData, format=crypto.FILETYPE_ASN1):\n \"\"\"\n Create a new L{PrivateCertificate} from the given certificate data and\n this instance's private key.\n \"\"\"\n return self.load(newCertData, self.privateKey, format)", "metadata": "root.PrivateCertificate.newCertificate", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 340 }, { "content": " def load(Class, data, privateKey, format=crypto.FILETYPE_ASN1):\n return Class._load(data, format)._setPrivateKey(privateKey)", "metadata": "root.PrivateCertificate.load", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 348 }, { "content": " def inspect(self):\n return '\\n'.join([Certificate._inspect(self),\n self.privateKey.inspect()])", "metadata": "root.PrivateCertificate.inspect", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 353 }, { "content": " def dumpPEM(self):\n \"\"\"\n Dump both public and private parts of a private certificate to\n PEM-format data.\n \"\"\"\n return self.dump(crypto.FILETYPE_PEM) + self.privateKey.dump(crypto.FILETYPE_PEM)", "metadata": "root.PrivateCertificate.dumpPEM", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 358 }, { "content": " def loadPEM(Class, data):\n \"\"\"\n Load both private and public parts of a private certificate from a\n chunk of PEM-format data.\n \"\"\"\n return Class.load(data, KeyPair.load(data, crypto.FILETYPE_PEM),\n crypto.FILETYPE_PEM)", "metadata": "root.PrivateCertificate.loadPEM", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 366 }, { "content": " def fromCertificateAndKeyPair(Class, certificateInstance, privateKey):\n privcert = Class(certificateInstance.original)\n return privcert._setPrivateKey(privateKey)", "metadata": "root.PrivateCertificate.fromCertificateAndKeyPair", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 376 }, { "content": " def options(self, *authorities):\n options = dict(privateKey=self.privateKey.original,\n certificate=self.original)\n if authorities:\n options.update(dict(verify=True,\n requireCertificate=True,\n caCerts=[auth.original for auth in authorities]))\n return OpenSSLCertificateOptions(**options)", "metadata": "root.PrivateCertificate.options", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 382 }, { "content": " def certificateRequest(self, format=crypto.FILETYPE_ASN1,\n digestAlgorithm='md5'):\n return self.privateKey.certificateRequest(\n self.getSubject(),\n format,\n digestAlgorithm)", "metadata": "root.PrivateCertificate.certificateRequest", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 392 }, { "content": " def signCertificateRequest(self,\n requestData,\n verifyDNCallback,\n serialNumber,\n requestFormat=crypto.FILETYPE_ASN1,\n certificateFormat=crypto.FILETYPE_ASN1):\n issuer = self.getSubject()\n return self.privateKey.signCertificateRequest(\n issuer,\n requestData,\n verifyDNCallback,\n serialNumber,\n requestFormat,\n certificateFormat)", "metadata": "root.PrivateCertificate.signCertificateRequest", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 400 }, { "content": " def signRequestObject(self, certificateRequest, serialNumber,\n secondsToExpiry=60 * 60 * 24 * 365, # One year\n digestAlgorithm='md5'):\n return self.privateKey.signRequestObject(self.getSubject(),\n certificateRequest,\n serialNumber,\n secondsToExpiry,\n digestAlgorithm)", "metadata": "root.PrivateCertificate.signRequestObject", "header": "['class', 'PrivateCertificate', '(', 'Certificate', ')', ':', '___EOS___']", "index": 416 }, { "content": "class KeyPair(PublicKey):\n\n load = classmethod(load)\n\n\n\n\n\n\n\n\n\n\n\n\n generate = classmethod(generate)\n\n\n\n\n\n\n\n\n\n", "metadata": "root.KeyPair", "header": "['module', '___EOS___']", "index": 465 }, { "content": " def load(Class, data, format=crypto.FILETYPE_ASN1):\n return Class(crypto.load_privatekey(format, data))", "metadata": "root.KeyPair.load", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 467 }, { "content": " def dump(self, format=crypto.FILETYPE_ASN1):\n return crypto.dump_privatekey(format, self.original)", "metadata": "root.KeyPair.dump", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 472 }, { "content": " def __getstate__(self):\n return self.dump()", "metadata": "root.KeyPair.__getstate__", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 476 }, { "content": " def __setstate__(self, state):\n self.__init__(crypto.load_privatekey(crypto.FILETYPE_ASN1, state))", "metadata": "root.KeyPair.__setstate__", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 480 }, { "content": " def inspect(self):\n t = self.original.type()\n if t == crypto.TYPE_RSA:\n ts = 'RSA'\n elif t == crypto.TYPE_DSA:\n ts = 'DSA'\n else:\n ts = '(Unknown Type!)'\n L = (self.original.bits(), ts, self.keyHash())\n return '%s-bit %s Key Pair with Hash: %s' % L", "metadata": "root.KeyPair.inspect", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 484 }, { "content": " def generate(Class, kind=crypto.TYPE_RSA, size=1024):\n pkey = crypto.PKey()\n pkey.generate_key(kind, size)\n return Class(pkey)", "metadata": "root.KeyPair.generate", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 496 }, { "content": " def newCertificate(self, newCertData, format=crypto.FILETYPE_ASN1):\n return PrivateCertificate.load(newCertData, self, format)", "metadata": "root.KeyPair.newCertificate", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 502 }, { "content": " def requestObject(self, distinguishedName, digestAlgorithm='md5'):\n req = crypto.X509Req()\n req.set_pubkey(self.original)\n distinguishedName._copyInto(req.get_subject())\n req.sign(self.original, digestAlgorithm)\n return CertificateRequest(req)", "metadata": "root.KeyPair.requestObject", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 507 }, { "content": " def certificateRequest(self, distinguishedName,\n format=crypto.FILETYPE_ASN1,\n digestAlgorithm='md5'):\n \"\"\"Create a certificate request signed with this key.\n\n @return: a string, formatted according to the 'format' argument.\n \"\"\"\n return self.requestObject(distinguishedName, digestAlgorithm).dump(format)", "metadata": "root.KeyPair.certificateRequest", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 515 }, { "content": " def signCertificateRequest(self,\n issuerDistinguishedName,\n requestData,\n verifyDNCallback,\n serialNumber,\n requestFormat=crypto.FILETYPE_ASN1,\n certificateFormat=crypto.FILETYPE_ASN1,\n secondsToExpiry=60 * 60 * 24 * 365, # One year\n digestAlgorithm='md5'):\n \"\"\"\n Given a blob of certificate request data and a certificate authority's\n DistinguishedName, return a blob of signed certificate data.\n\n If verifyDNCallback returns a Deferred, I will return a Deferred which\n fires the data when that Deferred has completed.\n \"\"\"\n hlreq = CertificateRequest.load(requestData, requestFormat)\n\n dn = hlreq.getSubject()\n vval = verifyDNCallback(dn)\n\n def verified(value):\n if not value:\n raise VerifyError(\"DN callback %r rejected request DN %r\" % (verifyDNCallback, dn))\n return self.signRequestObject(issuerDistinguishedName, hlreq,\n serialNumber, secondsToExpiry, digestAlgorithm).dump(certificateFormat)\n\n if isinstance(vval, Deferred):\n return vval.addCallback(verified)\n else:\n return verified(vval)", "metadata": "root.KeyPair.signCertificateRequest", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 525 }, { "content": " def signRequestObject(self,\n issuerDistinguishedName,\n requestObject,\n serialNumber,\n secondsToExpiry=60 * 60 * 24 * 365, # One year\n digestAlgorithm='md5'):\n \"\"\"\n Sign a CertificateRequest instance, returning a Certificate instance.\n \"\"\"\n req = requestObject.original\n dn = requestObject.getSubject()\n cert = crypto.X509()\n issuerDistinguishedName._copyInto(cert.get_issuer())\n cert.set_subject(req.get_subject())\n cert.set_pubkey(req.get_pubkey())\n cert.gmtime_adj_notBefore(0)\n cert.gmtime_adj_notAfter(secondsToExpiry)\n cert.set_serial_number(serialNumber)\n cert.sign(self.original, digestAlgorithm)\n return Certificate(cert)", "metadata": "root.KeyPair.signRequestObject", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 558 }, { "content": " def selfSignedCert(self, serialNumber, **kw):\n dn = DN(**kw)\n return PrivateCertificate.fromCertificateAndKeyPair(\n self.signRequestObject(dn, self.requestObject(dn), serialNumber),\n self)", "metadata": "root.KeyPair.selfSignedCert", "header": "['class', 'KeyPair', '(', 'PublicKey', ')', ':', '___EOS___']", "index": 580 } ]
[ { "span": "Class(cert)", "start_line": 155, "start_column": 11, "end_line": 155, "end_column": 22 }, { "span": "Class(crypto.load_certificate(format, requestData), *args)", "start_line": 183, "start_column": 15, "end_line": 183, "end_column": 73 }, { "span": "Class(req)", "start_line": 315, "start_column": 15, "end_line": 315, "end_column": 25 }, { "span": "Class(certificateInstance.original)", "start_line": 377, "start_column": 19, "end_line": 377, "end_column": 54 }, { "span": "Class(crypto.load_privatekey(format, data))", "start_line": 468, "start_column": 15, "end_line": 468, "end_column": 58 }, { "span": "Class(pkey)", "start_line": 499, "start_column": 15, "end_line": 499, "end_column": 26 } ]
[ { "span": "class Certificate(CertBase):", "start_line": 158, "start_column": 0, "end_line": 158, "end_column": 28 }, { "span": "Class,", "start_line": 177, "start_column": 13, "end_line": 177, "end_column": 18 }, { "span": "Class,", "start_line": 207, "start_column": 26, "end_line": 207, "end_column": 31 }, { "span": "Class,", "start_line": 221, "start_column": 26, "end_line": 221, "end_column": 31 }, { "span": "class CertificateRequest(CertBase):", "start_line": 302, "start_column": 0, "end_line": 302, "end_column": 35 }, { "span": "Class,", "start_line": 309, "start_column": 13, "end_line": 309, "end_column": 18 }, { "span": "class PrivateCertificate(Certificate):", "start_line": 324, "start_column": 0, "end_line": 324, "end_column": 38 }, { "span": "Class,", "start_line": 376, "start_column": 34, "end_line": 376, "end_column": 39 }, { "span": "class KeyPair(PublicKey):", "start_line": 465, "start_column": 0, "end_line": 465, "end_column": 25 }, { "span": "Class,", "start_line": 467, "start_column": 13, "end_line": 467, "end_column": 18 }, { "span": "Class,", "start_line": 496, "start_column": 17, "end_line": 496, "end_column": 22 } ]
1
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "attr", "helper_", "(_", "Class_", ",_", "transport_", ",_", "method", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "(", "private", ")", " ", "Help", "er", " ", "for", " ", "L", "{", "Certificat", "e", ".", "peer", "Fro", "m", "Transp", "ort", "}", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Certificat", "e", ".", "host", "Fro", "m", "Transp", "ort", "}", " ", "whi", "ch", " ", "checks", " ", "for", " ", "incomp", "atible", " ", "handle", " ", "types", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "null", " ", "certificates", " ", "and", " ", "raise", "s", " ", "the", " ", "appropr", "iate", " ", "exception", " ", "or", " ", "return", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "certifica", "te", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "getattr_", "(_", "transport_", "._", "get", "Handle_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "get", "\\u", "%", "s", "\\u", "certifica", "te", "\"_", "%_", "(_", "method", "Name_", ",_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "method_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Certificat", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "non", "-", "TLS", " ", "transport", " ", "%", "r", " ", "did", " ", "not", " ", "have", " ", "%", "s", " ", "certifica", "te", "\"_", "%_", "(_", "transport_", ",_", "method", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cert_", "=_", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cert_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Certificat", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TLS", " ", "transport", " ", "%", "r", " ", "did", " ", "not", " ", "have", " ", "%", "s", " ", "certifica", "te", "\"_", "%_", "(_", "transport_", ",_", "method", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Class_", "(_", "cert_", ")_", "\\u\\u\\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_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "x5", "09", " ", "certifica", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load_", "=_", "classmethod_", "(_", "load_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "load_", "=_", "load_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load", "PEM", "_", "=_", "classmethod_", "(_", "load", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "peer", "Fro", "m", "Transport_", "=_", "classmethod_", "(_", "peer", "Fro", "m", "Transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host", "Fro", "m", "Transport_", "=_", "classmethod_", "(_", "host", "Fro", "m", "Transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "%", "s", " ", "Sub", "ject", "=", "%", "s", " ", "Issue", "r", "=", "%", "s", ">'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Subject_", "(_", ")_", "._", "common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Issue", "r_", "(_", ")_", "._", "common", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "Certificate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dump_", "(_", ")_", "==_", "other_", "._", "dump_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "Class_", ",_", "request", "Data_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "args_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "certifica", "te", " ", "from", " ", "an", " ", "AS", "N", ".1", "-", " ", "or", " ", "PEM", "-", "format", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "Class", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Class_", "(_", "crypto_", "._", "load", "\\u", "certificate_", "(_", "format_", ",_", "request", "Data_", ")_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dump", "PEM", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Dump", " ", "this", " ", "certifica", "te", " ", "to", " ", "a", " ", "PEM", "-", "format", " ", "data", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "str", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "dump_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "PEM", "_", "(_", "Class_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "certifica", "te", " ", "from", " ", "a", " ", "PEM", "-", "format", " ", "data", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "Class", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Class_", "._", "load_", "(_", "data_", ",_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "peer", "Fro", "m", "Transport_", "(_", "Class_", ",_", "transport_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "certifica", "te", " ", "for", " ", "the", " ", "remote", " ", "end", " ", "of", " ", "the", " ", "give", "n", " ", "transport", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "type", ":", " ", "L", "{", "IS", "yste", "m", "Handle", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "Class", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", ":", " ", "L", "{", "Certificat", "e", "Error", "},", " ", "if", " ", "the", " ", "give", "n", " ", "transport", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "peer", "\\", "10", ";", " ", " ", " ", " ", "certifica", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "handle", "attr", "helper_", "(_", "Class_", ",_", "transport_", ",_", "'", "peer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "host", "Fro", "m", "Transport_", "(_", "Class_", ",_", "transport_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "certifica", "te", " ", "for", " ", "the", " ", "local", " ", "end", " ", "of", " ", "the", " ", "give", "n", " ", "transport", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "transport", ":", " ", "an", " ", "L", "{", "IS", "yste", "m", "Handle", "}", " ", "provide", "r", ";", " ", "the", " ", "transport", " ", "we", " ", "will", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "Class", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", ":", " ", "L", "{", "Certificat", "e", "Error", "},", " ", "if", " ", "the", " ", "give", "n", " ", "transport", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "host", "\\", "10", ";", " ", " ", " ", " ", "certifica", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "handle", "attr", "helper_", "(_", "Class_", ",_", "transport_", ",_", "'", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Public", "Key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "public", " ", "key", " ", "for", " ", "this", " ", "certifica", "te", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "L", "{", "Public", "Key", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Public", "Key_", "(_", "self_", "._", "original_", "._", "get", "\\u", "pubkey_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump_", "(_", "self_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crypto_", "._", "dump", "\\u", "certificate_", "(_", "format_", ",_", "self_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serial", "Number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "the", " ", "serial", " ", "number", " ", "of", " ", "this", " ", "certifica", "te", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "int", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "original_", "._", "get", "\\u", "serial", "\\u", "number_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "digest_", "(_", "self_", ",_", "method_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "digest", " ", "hash", " ", "of", " ", "this", " ", "certifica", "te", " ", "usi", "ng", " ", "the", " ", "specified", " ", "hash", "\\", "10", ";", " ", " ", " ", " ", "algo", "rit", "hm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "method", ":", " ", "One", " ", "of", " ", "C", "{", "'", "md5", "'}", " ", "or", " ", "C", "{", "'", "sha", "'}", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "str", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "original_", "._", "digest_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "inspect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "'", "Certificat", "e", " ", "For", " ", "Sub", "ject", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Subject_", "(_", ")_", "._", "inspect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "Issue", "r", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Issue", "r_", "(_", ")_", "._", "inspect_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "Ser", "ial", " ", "Number", ":", " ", "%", "d", "'_", "%_", "self_", "._", "serial", "Number_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dig", "est", ":", " ", "%", "s", "'_", "%_", "self_", "._", "digest_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inspect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "multi", "-", "line", ",", " ", "human", "-", "reada", "ble", " ", "represent", "ation", " ", "of", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "Certificat", "e", ",", " ", "inclu", "ding", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "subject", ",", " ", "issue", "r", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "(_", "self_", "._", "\\u", "inspect_", "(_", ")_", ",_", "self_", "._", "get", "Public", "Key_", "(_", ")_", "._", "inspect_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Issue", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "the", " ", "issue", "r", " ", "of", " ", "this", " ", "certifica", "te", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "L", "{", "Dist", "ingu", "ish", "ed", "Name", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "A", " ", "copy", " ", "of", " ", "the", " ", "issue", "r", " ", "of", " ", "this", " ", "certifica", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "copy", "Name_", "(_", "'", "issue", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificate_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "options_", "(_", "self_", ",_", "*_", "authorities", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Poss", "ibl", "e", ",", " ", "but", " ", "dou", "bt", "ful", " ", "we", " ", "need", " ", "this", " ", "ye", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Certificat", "e", "Request_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "x5", "09", " ", "certifica", "te", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Certificat", "e", " ", "request", "s", " ", "are", " ", "give", "n", " ", "to", " ", "certifica", "te", " ", "authorities", " ", "to", " ", "be", " ", "sign", "ed", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", " ", "result", "ing", " ", "in", " ", "an", " ", "actual", " ", "certifica", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load_", "=_", "classmethod_", "(_", "load_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Certificat", "e", "Request_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "Class_", ",_", "request", "Data_", ",_", "request", "Format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "crypto_", "._", "load", "\\u", "certifica", "te", "\\u", "request_", "(_", "request", "Format_", ",_", "request", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn_", "=_", "Dist", "ingu", "ish", "ed", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn_", "._", "\\u", "copy", "From_", "(_", "req_", "._", "get", "\\u", "subject_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "req_", "._", "verify_", "(_", "req_", "._", "get", "\\u", "pubkey_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Verify", "Error_", "(_", "\"", "Can", "'", "t", " ", "verify", " ", "tha", "t", " ", "request", " ", "for", " ", "%", "r", " ", "is", " ", "self", "-", "sign", "ed", ".\"_", "%_", "(_", "dn_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Class_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Certificat", "e", "Request_", "(_", "Cert", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dump_", "(_", "self_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crypto_", "._", "dump", "\\u", "certifica", "te", "\\u", "request_", "(_", "format_", ",_", "self_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "x5", "09", " ", "certifica", "te", " ", "and", " ", "private", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load_", "=_", "classmethod_", "(_", "load_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load", "PEM", "_", "=_", "classmethod_", "(_", "load", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "Certificat", "e", "And", "Key", "Pair_", "=_", "classmethod_", "(_", "from", "Certificat", "e", "And", "Key", "Pair_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Certificate_", "._", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", "+_", "'", " ", "with", " ", "'_", "+_", "repr_", "(_", "self_", "._", "private", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Priva", "te", "Key_", "(_", "self_", ",_", "private", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "private", "Key_", "._", "matches_", "(_", "self_", "._", "get", "Public", "Key_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Verify", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Certificat", "e", " ", "public", " ", "and", " ", "private", " ", "keys", " ", "do", " ", "not", " ", "match", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "private", "Key_", "=_", "private", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "Certificate_", "(_", "self_", ",_", "new", "Cert", "Data_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "L", "{", "Priva", "te", "Certificat", "e", "}", " ", "from", " ", "the", " ", "give", "n", " ", "certifica", "te", " ", "data", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "instance", "'", "s", " ", "private", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "load_", "(_", "new", "Cert", "Data_", ",_", "self_", "._", "private", "Key_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "Class_", ",_", "data_", ",_", "private", "Key_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Class_", "._", "\\u", "load_", "(_", "data_", ",_", "format_", ")_", "._", "\\u", "set", "Priva", "te", "Key_", "(_", "private", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "inspect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "Certificate_", "._", "\\u", "inspect_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "private", "Key_", "._", "inspect_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump", "PEM", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Dump", " ", "bot", "h", " ", "public", " ", "and", " ", "private", " ", "part", "s", " ", "of", " ", "a", " ", "private", " ", "certifica", "te", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "PEM", "-", "format", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "dump_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", "+_", "self_", "._", "private", "Key_", "._", "dump_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "PEM", "_", "(_", "Class_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "bot", "h", " ", "private", " ", "and", " ", "public", " ", "part", "s", " ", "of", " ", "a", " ", "private", " ", "certifica", "te", " ", "from", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "chunk", " ", "of", " ", "PEM", "-", "format", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Class_", "._", "load_", "(_", "data_", ",_", "Key", "Pair_", "._", "load_", "(_", "data_", ",_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crypto_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "from", "Certificat", "e", "And", "Key", "Pair_", "(_", "Class_", ",_", "certifica", "te", "Instance_", ",_", "private", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "priv", "cert_", "=_", "Class_", "(_", "certifica", "te", "Instance_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "priv", "cert_", "._", "\\u", "set", "Priva", "te", "Key_", "(_", "private", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "options_", "(_", "self_", ",_", "*_", "authorities", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "dict_", "(_", "private", "Key_", "=_", "self_", "._", "private", "Key_", "._", "original_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certificate_", "=_", "self_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authorities", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "update_", "(_", "dict_", "(_", "verify_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "require", "Certificate_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ca", "Cert", "s_", "=_", "[_", "auth_", "._", "original_", "for_", "auth_", "in_", "authorities", "_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Open", "SS", "LC", "ert", "ifica", "te", "Options_", "(_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "certifica", "te", "Request_", "(_", "self_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "private", "Key_", "._", "certifica", "te", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Subject_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "Certificat", "e", "Request_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verify", "DN", "Callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certifica", "te", "Format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issuer_", "=_", "self_", "._", "get", "Subject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "private", "Key_", "._", "sign", "Certificat", "e", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "issuer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verify", "DN", "Callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certifica", "te", "Format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Certificate_", "(_", "Certificate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "Request", "Object_", "(_", "self_", ",_", "certifica", "te", "Request_", ",_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "second", "s", "To", "Expir", "y_", "=_", "60_", "*_", "60_", "*_", "24_", "*_", "365_", ",_", "#", " ", "One", " ", "year_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "private", "Key_", "._", "sign", "Request", "Object_", "(_", "self_", "._", "get", "Subject_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certifica", "te", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "second", "s", "To", "Expir", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "load_", "=_", "classmethod_", "(_", "load_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "generate_", "=_", "classmethod_", "(_", "generate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "load_", "(_", "Class_", ",_", "data_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Class_", "(_", "crypto_", "._", "load", "\\u", "private", "key_", "(_", "format_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dump_", "(_", "self_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crypto_", "._", "dump", "\\u", "private", "key_", "(_", "format_", ",_", "self_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getstate", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dump_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "init\\u\\u_", "(_", "crypto_", "._", "load", "\\u", "private", "key_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inspect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "self_", "._", "original_", "._", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "==_", "crypto_", "._", "TYPE", "\\u", "RSA", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", "=_", "'", "RSA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "==_", "crypto_", "._", "TYPE", "\\u", "DSA", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", "=_", "'", "DSA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", "=_", "'(", "Un", "know", "n", " ", "Type", "!)", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "L_", "=_", "(_", "self_", "._", "original_", "._", "bits_", "(_", ")_", ",_", "ts_", ",_", "self_", "._", "key", "Hash_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "-", "bit", " ", "%", "s", " ", "Key", " ", "Pair", " ", "with", " ", "Hash", ":", " ", "%", "s", "'_", "%_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generate_", "(_", "Class_", ",_", "kind_", "=_", "crypto_", "._", "TYPE", "\\u", "RSA", "_", ",_", "size_", "=_", "1024_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkey_", "=_", "crypto_", "._", "PK", "ey_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkey_", "._", "generat", "e\\u", "key_", "(_", "kind_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Class_", "(_", "pkey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "Certificate_", "(_", "self_", ",_", "new", "Cert", "Data_", ",_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Priva", "te", "Certificate_", "._", "load_", "(_", "new", "Cert", "Data_", ",_", "self_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "request", "Object_", "(_", "self_", ",_", "distinguish", "ed", "Name_", ",_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "crypto_", "._", "X509", "Req_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "set\\u", "pubkey_", "(_", "self_", "._", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distinguish", "ed", "Name_", "._", "\\u", "copy", "Int", "o_", "(_", "req_", "._", "get", "\\u", "subject_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "sign_", "(_", "self_", "._", "original_", ",_", "digest", "Algorithm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Certificat", "e", "Request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "certifica", "te", "Request_", "(_", "self_", ",_", "distinguish", "ed", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "certifica", "te", " ", "request", " ", "sign", "ed", " ", "with", " ", "this", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "a", " ", "string", ",", " ", "format", "ted", " ", "according", " ", "to", " ", "the", " ", "'", "format", "'", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "request", "Object_", "(_", "distinguish", "ed", "Name_", ",_", "digest", "Algorithm_", ")_", "._", "dump_", "(_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "Certificat", "e", "Request_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "issue", "r", "Dist", "ingu", "ish", "ed", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verify", "DN", "Callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certifica", "te", "Format_", "=_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "second", "s", "To", "Expir", "y_", "=_", "60_", "*_", "60_", "*_", "24_", "*_", "365_", ",_", "#", " ", "One", " ", "year_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "blob", " ", "of", " ", "certifica", "te", " ", "request", " ", "data", " ", "and", " ", "a", " ", "certifica", "te", " ", "authori", "ty", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "Dist", "ingu", "ish", "ed", "Name", ",", " ", "return", " ", "a", " ", "blob", " ", "of", " ", "sign", "ed", " ", "certifica", "te", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "verify", "DN", "Call", "back", " ", "return", "s", " ", "a", " ", "Defe", "rre", "d", ",", " ", "I", " ", "will", " ", "return", " ", "a", " ", "Defe", "rre", "d", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "fires", " ", "the", " ", "data", " ", "whe", "n", " ", "tha", "t", " ", "Defe", "rre", "d", " ", "has", " ", "complete", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hl", "req_", "=_", "Certificat", "e", "Request_", "._", "load_", "(_", "request", "Data_", ",_", "request", "Format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dn_", "=_", "hl", "req_", "._", "get", "Subject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vv", "al_", "=_", "verify", "DN", "Callback_", "(_", "dn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "verified_", "(_", "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 ", " _", "raise_", "Verify", "Error_", "(_", "\"", "DN", " ", "callback", " ", "%", "r", " ", "reject", "ed", " ", "request", " ", "DN", " ", "%", "r", "\"_", "%_", "(_", "verify", "DN", "Callback_", ",_", "dn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "sign", "Request", "Object_", "(_", "issue", "r", "Dist", "ingu", "ish", "ed", "Name_", ",_", "hl", "req_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "second", "s", "To", "Expir", "y_", ",_", "digest", "Algorithm_", ")_", "._", "dump_", "(_", "certifica", "te", "Format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "vv", "al_", ",_", "Deferred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "vv", "al_", "._", "add", "Callback_", "(_", "verified_", ")_", "\\u\\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_", "verified_", "(_", "vv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\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", "Request", "Object_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "issue", "r", "Dist", "ingu", "ish", "ed", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "second", "s", "To", "Expir", "y_", "=_", "60_", "*_", "60_", "*_", "24_", "*_", "365_", ",_", "#", " ", "One", " ", "year_", "\\u\\u\\uNL\\u\\u\\u_", "digest", "Algorithm_", "=_", "'", "md5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sign", " ", "a", " ", "Certificat", "e", "Request", " ", "instance", ",", " ", "return", "ing", " ", "a", " ", "Certificat", "e", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "request", "Object_", "._", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn_", "=_", "request", "Object_", "._", "get", "Subject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "=_", "crypto_", "._", "X509", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "issue", "r", "Dist", "ingu", "ish", "ed", "Name_", "._", "\\u", "copy", "Int", "o_", "(_", "cert_", "._", "get", "\\u", "issuer_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "set\\u", "subject_", "(_", "req_", "._", "get", "\\u", "subject_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "set\\u", "pubkey_", "(_", "req_", "._", "get", "\\u", "pubkey_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "gmt", "ime", "\\u", "adj", "\\u", "not", "Before_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "gmt", "ime", "\\u", "adj", "\\u", "not", "After_", "(_", "second", "s", "To", "Expir", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "set\\u", "serial", "\\u", "number_", "(_", "serial", "Number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "._", "sign_", "(_", "self_", "._", "original_", ",_", "digest", "Algorithm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Certificate_", "(_", "cert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pair_", "(_", "Public", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "self", "Signe", "d", "Cert", "_", "(_", "self_", ",_", "serial", "Number_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dn_", "=_", "DN_", "(_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Priva", "te", "Certificate_", "._", "from", "Certificat", "e", "And", "Key", "Pair_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sign", "Request", "Object_", "(_", "dn_", ",_", "self_", "._", "request", "Object_", "(_", "dn_", ")_", ",_", "serial", "Number_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/corehq/apps/sms/models.py
[ { "content": "#!/usr/bin/env python\n# vim: ai ts=4 sts=4 et sw=4\nimport json_field\nimport logging\nimport uuid\nimport uuidfield\nfrom dimagi.ext.couchdbkit import *\n\nfrom datetime import datetime, timedelta\nfrom django.db import models, transaction\nfrom collections import namedtuple\nfrom corehq.apps.app_manager.dbaccessors import get_app\nfrom corehq.apps.app_manager.models import Form\nfrom corehq.util.mixin import UUIDGeneratorMixin\nfrom corehq.apps.users.models import CouchUser\nfrom casexml.apps.case.models import CommCareCase\nfrom dimagi.utils.couch.migration import SyncSQLToCouchMixin\nfrom dimagi.utils.mixins import UnicodeMixIn\nfrom dimagi.utils.parsing import json_format_datetime\nfrom corehq.apps.sms.mixin import (CommCareMobileContactMixin,\n PhoneNumberInUseException, InvalidFormatException, VerifiedNumber,\n apply_leniency, BadSMSConfigException)\nfrom corehq.apps.sms import util as smsutil\nfrom corehq.apps.sms.messages import (MSG_MOBILE_WORKER_INVITATION_START,\n MSG_MOBILE_WORKER_ANDROID_INVITATION, MSG_MOBILE_WORKER_JAVA_INVITATION,\n get_message)\nfrom corehq.util.quickcache import quickcache\nfrom corehq.util.view_utils import absolute_reverse\nfrom dimagi.utils.couch.undo import DELETED_SUFFIX\nfrom dimagi.utils.couch import CouchDocLockableMixIn\nfrom dimagi.utils.load_balance import load_balance\nfrom dimagi.utils.logging import notify_exception\nfrom django.utils.translation import ugettext_noop, ugettext_lazy\n\n\nINCOMING = \"I\"\nOUTGOING = \"O\"\n\nCALLBACK_PENDING = \"PENDING\"\nCALLBACK_RECEIVED = \"RECEIVED\"\nCALLBACK_MISSED = \"MISSED\"\n\nFORWARD_ALL = \"ALL\"\nFORWARD_BY_KEYWORD = \"KEYWORD\"\nFORWARDING_CHOICES = [FORWARD_ALL, FORWARD_BY_KEYWORD]\n\nWORKFLOW_CALLBACK = \"CALLBACK\"\nWORKFLOW_REMINDER = \"REMINDER\"\nWORKFLOW_KEYWORD = \"KEYWORD\"\nWORKFLOW_FORWARD = \"FORWARD\"\nWORKFLOW_BROADCAST = \"BROADCAST\"\nWORKFLOW_PERFORMANCE = \"PERFORMANCE\"\nWORKFLOW_DEFAULT = 'default'\n\nDIRECTION_CHOICES = (\n (INCOMING, \"Incoming\"),\n (OUTGOING, \"Outgoing\"))\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom corehq.apps.sms import signals\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MessageLog(SafeSaveDocument, UnicodeMixIn):\n base_doc = \"MessageLog\"\n couch_recipient_doc_type = StringProperty() # \"CommCareCase\", \"CommCareUser\", \"WebUser\"\n couch_recipient = StringProperty() # _id of the contact who this sms was sent to/from\n phone_number = StringProperty()\n direction = StringProperty()\n date = DateTimeProperty()\n domain = StringProperty()\n backend_api = StringProperty() # This must be set to <backend module>.API_ID in order to process billing correctly\n backend_id = StringProperty()\n billed = BooleanProperty(default=False)\n billing_errors = ListProperty()\n chat_user_id = StringProperty() # For outgoing sms only: if this sms was sent from a chat window, the _id of the CouchUser who sent this sms; otherwise None\n workflow = StringProperty() # One of the WORKFLOW_* constants above describing what kind of workflow this sms was a part of\n # Points to the couch_id of an instance of SQLXFormsSession\n # that this message is tied to\n xforms_session_couch_id = StringProperty()\n reminder_id = StringProperty() # Points to the _id of an instance of corehq.apps.reminders.models.CaseReminder that this sms is tied to\n processed = BooleanProperty(default=True)\n datetime_to_process = DateTimeProperty()\n num_processing_attempts = IntegerProperty(default=0)\n error = BooleanProperty(default=False)\n system_error_message = StringProperty()\n # If the message was simulated from a domain, this is the domain\n domain_scope = StringProperty()\n queued_timestamp = DateTimeProperty()\n processed_timestamp = DateTimeProperty()\n # If this outgoing message is a reply to an inbound message, then this is\n # the _id of the inbound message\n # TODO: For now this is a placeholder and needs to be implemented\n in_reply_to = StringProperty()\n system_phone_number = StringProperty()\n # Set to True to send the message regardless of whether the destination\n # phone number has opted-out. Should only be used to send opt-out\n # replies or other info-related queries while opted-out.\n ignore_opt_out = BooleanProperty(default=False)\n location_id = StringProperty()\n\n\n\n\n \n \n\n\n\n\n \n", "metadata": "root.MessageLog", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def __unicode__(self):\n to_from = (self.direction == INCOMING) and \"from\" or \"to\"\n return \"Message %s %s\" % (to_from, self.phone_number)", "metadata": "root.MessageLog.__unicode__", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 98 }, { "content": " def set_system_error(self, message=None):\n self.error = True\n self.system_error_message = message\n self.save()", "metadata": "root.MessageLog.set_system_error", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 102 }, { "content": " @property\n def username(self):\n name = self.phone_number\n if self.couch_recipient:\n try:\n if self.couch_recipient_doc_type == \"CommCareCase\":\n name = CommCareCase.get(self.couch_recipient).name\n else:\n # Must be a user\n name = CouchUser.get_by_user_id(self.couch_recipient).username\n except Exception as e:\n pass\n return name", "metadata": "root.MessageLog.username", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 107 }, { "content": " @property\n def recipient(self):\n if self.couch_recipient_doc_type == \"CommCareCase\":\n return CommCareCase.get(self.couch_recipient)\n else:\n return CouchUser.get_by_user_id(self.couch_recipient)", "metadata": "root.MessageLog.recipient", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 121 }, { "content": " @classmethod\n def by_domain_asc(cls, domain):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n return cls.view(\"sms/by_domain\",\n reduce=False,\n startkey=[domain, cls.__name__],\n endkey=[domain, cls.__name__] + [{}],\n include_docs=True,\n descending=False)", "metadata": "root.MessageLog.by_domain_asc", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 128 }, { "content": " @classmethod\n def by_domain_dsc(cls, domain):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n return cls.view(\"sms/by_domain\",\n reduce=False,\n startkey=[domain, cls.__name__] + [{}],\n endkey=[domain, cls.__name__],\n include_docs=True,\n descending=True)", "metadata": "root.MessageLog.by_domain_dsc", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 139 }, { "content": " @classmethod\n def count_by_domain(cls, domain, start_date = None, end_date = {}):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n if not end_date:\n end_date = {}\n reduced = cls.view(\"sms/by_domain\",\n startkey=[domain, cls.__name__] + [start_date],\n endkey=[domain, cls.__name__] + [end_date],\n reduce=True).all()\n if reduced:\n return reduced[0]['value']\n return 0", "metadata": "root.MessageLog.count_by_domain", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 150 }, { "content": " @classmethod\n def count_incoming_by_domain(cls, domain, start_date = None, end_date = {}):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n if not end_date:\n end_date = {}\n reduced = cls.view(\"sms/direction_by_domain\",\n startkey=[domain, cls.__name__, \"I\"] + [start_date],\n endkey=[domain, cls.__name__, \"I\"] + [end_date],\n reduce=True).all()\n if reduced:\n return reduced[0]['value']\n return 0", "metadata": "root.MessageLog.count_incoming_by_domain", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 164 }, { "content": " @classmethod\n def count_outgoing_by_domain(cls, domain, start_date = None, end_date = {}):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n if not end_date:\n end_date = {}\n reduced = cls.view(\"sms/direction_by_domain\",\n startkey=[domain, cls.__name__, \"O\"] + [start_date],\n endkey=[domain, cls.__name__, \"O\"] + [end_date],\n reduce=True).all()\n if reduced:\n return reduced[0]['value']\n return 0", "metadata": "root.MessageLog.count_outgoing_by_domain", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 178 }, { "content": " @classmethod\n def by_domain_date(cls, domain, start_date = None, end_date = {}):\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Log queries not yet implemented for base class\")\n return cls.view(\"sms/by_domain\",\n reduce=False,\n startkey=[domain, cls.__name__] + [start_date],\n endkey=[domain, cls.__name__] + [end_date],\n include_docs=True)", "metadata": "root.MessageLog.by_domain_date", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 192 }, { "content": " @classmethod\n def inbound_entry_exists(cls, contact_doc_type, contact_id, from_timestamp, to_timestamp=None):\n \"\"\"\n Checks to see if an inbound sms or call exists for the given caller.\n\n contact_doc_type - The doc_type of the contact (e.g., \"CommCareCase\")\n contact_id - The _id of the contact\n after_timestamp - The datetime after which to check for the existence of an entry\n\n return True if an sms/call exists in the log, False if not.\n \"\"\"\n if cls.__name__ == \"MessageLog\":\n raise NotImplementedError(\"Not implemented for base class\")\n from_timestamp_str = json_format_datetime(from_timestamp)\n to_timestamp_str = json_format_datetime(to_timestamp or datetime.utcnow())\n reduced = cls.view(\"sms/by_recipient\",\n startkey=[contact_doc_type, contact_id, cls.__name__, INCOMING, from_timestamp_str],\n endkey=[contact_doc_type, contact_id, cls.__name__, INCOMING, to_timestamp_str],\n reduce=True).all()\n if reduced:\n return (reduced[0]['value'] > 0)\n else:\n return False", "metadata": "root.MessageLog.inbound_entry_exists", "header": "['class', 'MessageLog', '(', 'SafeSaveDocument', ',', 'UnicodeMixIn', ')', ':', '___EOS___']", "index": 202 }, { "content": "class SMSLog(MessageLog):\n text = StringProperty()\n # In cases where decoding must occur, this is the raw text received\n # from the gateway\n raw_text = StringProperty()\n # This is the unique message id that the gateway uses to track this\n # message, if applicable.\n backend_message_id = StringProperty()\n # True if this was an inbound message that was an\n # invalid response to a survey question\n invalid_survey_response = BooleanProperty(default=False)\n\n messaging_subevent_id = IntegerProperty()\n\n", "metadata": "root.SMSLog", "header": "['module', '___EOS___']", "index": 227 }, { "content": " @property\n def outbound_backend(self):\n \"\"\"appropriate outbound sms backend\"\"\"\n if self.backend_id:\n return SQLMobileBackend.load(self.backend_id, is_couch_id=True)\n else:\n return SQLMobileBackend.load_default_by_phone_and_domain(\n SQLMobileBackend.SMS,\n smsutil.clean_phone_number(self.phone_number),\n domain=self.domain\n )", "metadata": "root.SMSLog.outbound_backend", "header": "['class', 'SMSLog', '(', 'MessageLog', ')', ':', '___EOS___']", "index": 241 }, { "content": " def __unicode__(self):\n\n # crop the text (to avoid exploding the admin)\n if len(self.text) < 60: str = self.text\n else: str = \"%s...\" % (self.text[0:57])\n\n to_from = (self.direction == INCOMING) and \"from\" or \"to\"\n return \"%s (%s %s)\" % (str, to_from, self.phone_number)", "metadata": "root.SMSLog.__unicode__", "header": "['class', 'SMSLog', '(', 'MessageLog', ')', ':', '___EOS___']", "index": 253 }, { "content": "class Log(models.Model):\n class Meta:\n abstract = True\n app_label = \"sms\"\n\n domain = models.CharField(max_length=126, null=True, db_index=True)\n date = models.DateTimeField(null=True, db_index=True)\n couch_recipient_doc_type = models.CharField(max_length=126, null=True, db_index=True)\n couch_recipient = models.CharField(max_length=126, null=True, db_index=True)\n phone_number = models.CharField(max_length=126, null=True, db_index=True)\n direction = models.CharField(max_length=1, null=True)\n error = models.NullBooleanField(default=False)\n system_error_message = models.TextField(null=True)\n system_phone_number = models.CharField(max_length=126, null=True)\n backend_api = models.CharField(max_length=126, null=True)\n backend_id = models.CharField(max_length=126, null=True)\n billed = models.NullBooleanField(default=False)\n\n # Describes what kind of workflow this log was a part of\n workflow = models.CharField(max_length=126, null=True)\n\n # If this log is related to a survey, this points to the couch_id\n # of an instance of SQLXFormsSession that this log is tied to\n xforms_session_couch_id = models.CharField(max_length=126, null=True, db_index=True)\n\n # If this log is related to a reminder, this points to the _id of a\n # CaseReminder instance that it is tied to\n reminder_id = models.CharField(max_length=126, null=True)\n location_id = models.CharField(max_length=126, null=True)\n\n # The MessagingSubEvent that this log is tied to\n messaging_subevent = models.ForeignKey('MessagingSubEvent', null=True, on_delete=models.PROTECT)\n\n\n\n\n\n\n", "metadata": "root.Log", "header": "['module', '___EOS___']", "index": 263 }, { "content": " def set_system_error(self, message=None):\n self.error = True\n self.system_error_message = message\n self.save()", "metadata": "root.Log.set_system_error", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 296 }, { "content": " @classmethod\n def by_domain(cls, domain, start_date=None, end_date=None):\n qs = cls.objects.filter(domain=domain)\n\n if start_date:\n qs = qs.filter(date__gte=start_date)\n\n if end_date:\n qs = qs.filter(date__lte=end_date)\n\n return qs", "metadata": "root.Log.by_domain", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 301 }, { "content": " @classmethod\n def by_recipient(cls, contact_doc_type, contact_id):\n return cls.objects.filter(\n couch_recipient_doc_type=contact_doc_type,\n couch_recipient=contact_id,\n )", "metadata": "root.Log.by_recipient", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 313 }, { "content": " @classmethod\n def get_last_log_for_recipient(cls, contact_doc_type, contact_id, direction=None):\n qs = cls.by_recipient(contact_doc_type, contact_id)\n\n if direction:\n qs = qs.filter(direction=direction)\n\n qs = qs.order_by('-date')[:1]\n\n if qs:\n return qs[0]\n\n return None", "metadata": "root.Log.get_last_log_for_recipient", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 320 }, { "content": " @classmethod\n def count_by_domain(cls, domain, direction=None):\n qs = cls.objects.filter(domain=domain)\n\n if direction:\n qs = qs.filter(direction=direction)\n\n return qs.count()", "metadata": "root.Log.count_by_domain", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 334 }, { "content": " @property\n def recipient(self):\n if self.couch_recipient_doc_type == 'CommCareCase':\n return CommCareCase.get(self.couch_recipient)\n else:\n return CouchUser.get_by_user_id(self.couch_recipient)", "metadata": "root.Log.recipient", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 343 }, { "content": " @classmethod\n def inbound_entry_exists(cls, contact_doc_type, contact_id, from_timestamp, to_timestamp=None):\n qs = cls.by_recipient(\n contact_doc_type,\n contact_id\n ).filter(\n direction=INCOMING,\n date__gte=from_timestamp\n )\n\n if to_timestamp:\n qs = qs.filter(\n date__lte=to_timestamp\n )\n\n return len(qs[:1]) > 0", "metadata": "root.Log.inbound_entry_exists", "header": "['class', 'Log', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 350 }, { "content": "class SMSBase(UUIDGeneratorMixin, Log):\n ERROR_TOO_MANY_UNSUCCESSFUL_ATTEMPTS = 'TOO_MANY_UNSUCCESSFUL_ATTEMPTS'\n ERROR_MESSAGE_IS_STALE = 'MESSAGE_IS_STALE'\n ERROR_INVALID_DIRECTION = 'INVALID_DIRECTION'\n ERROR_PHONE_NUMBER_OPTED_OUT = 'PHONE_NUMBER_OPTED_OUT'\n ERROR_INVALID_DESTINATION_NUMBER = 'INVALID_DESTINATION_NUMBER'\n ERROR_MESSAGE_TOO_LONG = 'MESSAGE_TOO_LONG'\n\n ERROR_MESSAGES = {\n ERROR_TOO_MANY_UNSUCCESSFUL_ATTEMPTS:\n ugettext_noop('Gateway error.'),\n ERROR_MESSAGE_IS_STALE:\n ugettext_noop('Message is stale and will not be processed.'),\n ERROR_INVALID_DIRECTION:\n ugettext_noop('Unknown message direction.'),\n ERROR_PHONE_NUMBER_OPTED_OUT:\n ugettext_noop('Phone number has opted out of receiving SMS.'),\n ERROR_INVALID_DESTINATION_NUMBER:\n ugettext_noop(\"The gateway can't reach the destination number.\"),\n ERROR_MESSAGE_TOO_LONG:\n ugettext_noop(\"The gateway could not process the message because it was too long.\"),\n }\n\n UUIDS_TO_GENERATE = ['couch_id']\n\n couch_id = models.CharField(max_length=126, null=True, db_index=True)\n text = models.TextField(null=True)\n\n # In cases where decoding must occur, this is the raw text received\n # from the gateway\n raw_text = models.TextField(null=True)\n datetime_to_process = models.DateTimeField(null=True, db_index=True)\n processed = models.NullBooleanField(default=True, db_index=True)\n num_processing_attempts = models.IntegerField(default=0, null=True)\n queued_timestamp = models.DateTimeField(null=True)\n processed_timestamp = models.DateTimeField(null=True)\n\n # If the message was simulated from a domain, this is the domain\n domain_scope = models.CharField(max_length=126, null=True)\n\n # Set to True to send the message regardless of whether the destination\n # phone number has opted-out. Should only be used to send opt-out\n # replies or other info-related queries while opted-out.\n ignore_opt_out = models.NullBooleanField(default=False)\n\n # This is the unique message id that the gateway uses to track this\n # message, if applicable.\n backend_message_id = models.CharField(max_length=126, null=True)\n\n # For outgoing sms only: if this sms was sent from a chat window,\n # the _id of the CouchUser who sent this sms; otherwise None\n chat_user_id = models.CharField(max_length=126, null=True)\n\n # True if this was an inbound message that was an\n # invalid response to a survey question\n invalid_survey_response = models.NullBooleanField(default=False)\n\n \"\"\" Custom properties. For the initial migration, it makes it easier\n to put these here. Eventually they should be moved to a separate table. \"\"\"\n fri_message_bank_lookup_completed = models.NullBooleanField(default=False)\n fri_message_bank_message_id = models.CharField(max_length=126, null=True)\n fri_id = models.CharField(max_length=126, null=True)\n fri_risk_profile = models.CharField(max_length=1, null=True)\n\n class Meta:\n abstract = True\n app_label = 'sms'\n", "metadata": "root.SMSBase", "header": "['module', '___EOS___']", "index": 368 }, { "content": " @property\n def outbound_backend(self):\n if self.backend_id:\n return SQLMobileBackend.load(self.backend_id, is_couch_id=True)\n\n return SQLMobileBackend.load_default_by_phone_and_domain(\n SQLMobileBackend.SMS,\n smsutil.clean_phone_number(self.phone_number),\n domain=self.domain\n )", "metadata": "root.SMSBase.outbound_backend", "header": "['class', 'SMSBase', '(', 'UUIDGeneratorMixin', ',', 'Log', ')', ':', '___EOS___']", "index": 436 }, { "content": "class SMS(SMSBase):\n", "metadata": "root.SMS", "header": "['module', '___EOS___']", "index": 448 }, { "content": " def to_json(self):\n from corehq.apps.sms.serializers import SMSSerializer\n data = SMSSerializer(self).data\n return data", "metadata": "root.SMS.to_json", "header": "['class', 'SMS', '(', 'SMSBase', ')', ':', '___EOS___']", "index": 449 }, { "content": " def publish_change(self):\n from corehq.apps.sms.tasks import publish_sms_change\n publish_sms_change.delay(self)", "metadata": "root.SMS.publish_change", "header": "['class', 'SMS', '(', 'SMSBase', ')', ':', '___EOS___']", "index": 454 }, { "content": "class QueuedSMS(SMSBase):\n class Meta:\n db_table = 'sms_queued'\n", "metadata": "root.QueuedSMS", "header": "['module', '___EOS___']", "index": 459 }, { "content": " @classmethod\n def get_queued_sms(cls):\n return cls.objects.filter(\n datetime_to_process__lte=datetime.utcnow(),\n )", "metadata": "root.QueuedSMS.get_queued_sms", "header": "['class', 'QueuedSMS', '(', 'SMSBase', ')', ':', '___EOS___']", "index": 463 }, { "content": "class LastReadMessage(Document, CouchDocLockableMixIn):\n domain = StringProperty()\n # _id of CouchUser who read it\n read_by = StringProperty()\n # _id of the CouchUser or CommCareCase who the message was sent to\n # or from\n contact_id = StringProperty()\n # _id of the SMSLog entry\n message_id = StringProperty()\n # date of the SMSLog entry, stored here redundantly to prevent a lookup\n message_timestamp = DateTimeProperty()\n\n\n\n", "metadata": "root.LastReadMessage", "header": "['module', '___EOS___']", "index": 470 }, { "content": " @classmethod\n def get_obj(cls, domain, read_by, contact_id, *args, **kwargs):\n return LastReadMessage.view(\n \"sms/last_read_message\",\n key=[\"by_user\", domain, read_by, contact_id],\n include_docs=True\n ).one()", "metadata": "root.LastReadMessage.get_obj", "header": "['class', 'LastReadMessage', '(', 'Document', ',', 'CouchDocLockableMixIn', ')', ':', '___EOS___']", "index": 482 }, { "content": " @classmethod\n def create_obj(cls, domain, read_by, contact_id, *args, **kwargs):\n obj = LastReadMessage(\n domain=domain,\n read_by=read_by,\n contact_id=contact_id\n )\n obj.save()\n return obj", "metadata": "root.LastReadMessage.create_obj", "header": "['class', 'LastReadMessage', '(', 'Document', ',', 'CouchDocLockableMixIn', ')', ':', '___EOS___']", "index": 490 }, { "content": " @classmethod\n def by_user(cls, domain, user_id, contact_id):\n return cls.get_obj(domain, user_id, contact_id)", "metadata": "root.LastReadMessage.by_user", "header": "['class', 'LastReadMessage', '(', 'Document', ',', 'CouchDocLockableMixIn', ')', ':', '___EOS___']", "index": 500 }, { "content": " @classmethod\n def by_anyone(cls, domain, contact_id):\n return LastReadMessage.view(\n \"sms/last_read_message\",\n startkey=[\"by_anyone\", domain, contact_id, {}],\n endkey=[\"by_anyone\", domain, contact_id],\n descending=True,\n include_docs=True\n ).first()", "metadata": "root.LastReadMessage.by_anyone", "header": "['class', 'LastReadMessage', '(', 'Document', ',', 'CouchDocLockableMixIn', ')', ':', '___EOS___']", "index": 504 }, { "content": "class SQLLastReadMessage(UUIDGeneratorMixin, models.Model):\n class Meta:\n db_table = 'sms_lastreadmessage'\n app_label = 'sms'\n index_together = [\n ['domain', 'read_by', 'contact_id'],\n ['domain', 'contact_id'],\n ]\n\n UUIDS_TO_GENERATE = ['couch_id']\n\n couch_id = models.CharField(max_length=126, null=True, db_index=True)\n domain = models.CharField(max_length=126, null=True)\n\n # _id of CouchUser who read it\n read_by = models.CharField(max_length=126, null=True)\n\n # _id of the CouchUser or CommCareCase who the message was sent to\n # or from\n contact_id = models.CharField(max_length=126, null=True)\n\n # couch_id of the SMS\n message_id = models.CharField(max_length=126, null=True)\n\n # date of the SMS entry, stored here redundantly to prevent a lookup\n message_timestamp = models.DateTimeField(null=True)\n\n", "metadata": "root.SQLLastReadMessage", "header": "['module', '___EOS___']", "index": 515 }, { "content": " @classmethod\n def by_anyone(cls, domain, contact_id):\n \"\"\"\n Returns the SQLLastReadMessage representing the last chat message\n that was read by anyone in the given domain for the given contact_id.\n \"\"\"\n result = cls.objects.filter(\n domain=domain,\n contact_id=contact_id\n ).order_by('-message_timestamp')\n result = result[:1]\n\n if len(result) > 0:\n return result[0]\n\n return None", "metadata": "root.SQLLastReadMessage.by_anyone", "header": "['class', 'SQLLastReadMessage', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 542 }, { "content": " @classmethod\n def by_user(cls, domain, user_id, contact_id):\n \"\"\"\n Returns the SQLLastReadMessage representing the last chat message\n that was read in the given domain by the given user_id for the given\n contact_id.\n \"\"\"\n try:\n # It's not expected that this can raise MultipleObjectsReturned\n # since we lock out creation of these records with a CriticalSection.\n # So if that happens, let the exception raise.\n return cls.objects.get(\n domain=domain,\n read_by=user_id,\n contact_id=contact_id\n )\n except cls.DoesNotExist:\n return None", "metadata": "root.SQLLastReadMessage.by_user", "header": "['class', 'SQLLastReadMessage', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 559 }, { "content": "class CallLog(MessageLog):\n form_unique_id = StringProperty()\n answered = BooleanProperty(default=False)\n duration = IntegerProperty() # Length of the call in seconds\n gateway_session_id = StringProperty() # This is the session id returned from the backend\n xforms_session_id = StringProperty()\n error_message = StringProperty() # Error message from the gateway, if any\n submit_partial_form = BooleanProperty(default=False) # True to submit a partial form on hangup if it's not completed yet\n include_case_side_effects = BooleanProperty(default=False)\n max_question_retries = IntegerProperty() # Max number of times to retry a question with an invalid response before hanging up\n current_question_retry_count = IntegerProperty(default=0) # A counter of the number of invalid responses for the current question\n use_precached_first_response = BooleanProperty(default=False)\n first_response = StringProperty()\n # The id of the case to submit the form against\n case_id = StringProperty()\n case_for_case_submission = BooleanProperty(default=False)\n messaging_subevent_id = IntegerProperty()\n\n\n", "metadata": "root.CallLog", "header": "['module', '___EOS___']", "index": 579 }, { "content": " def __unicode__(self):\n to_from = (self.direction == INCOMING) and \"from\" or \"to\"\n return \"Call %s %s\" % (to_from, self.phone_number)", "metadata": "root.CallLog.__unicode__", "header": "['class', 'CallLog', '(', 'MessageLog', ')', ':', '___EOS___']", "index": 597 }, { "content": " @classmethod\n def answered_call_exists(cls, caller_doc_type, caller_id, after_timestamp,\n end_timestamp=None):\n \"\"\"\n Checks to see if an outbound call exists for the given caller that was successfully answered.\n \n caller_doc_type The doc_type of the caller (e.g., \"CommCareCase\").\n caller_id The _id of the caller's document.\n after_timestamp The datetime after which to check for the existence of a call.\n \n return True if a call exists in the CallLog, False if not.\n \"\"\"\n start_timestamp = json_format_datetime(after_timestamp)\n end_timestamp = json_format_datetime(end_timestamp or datetime.utcnow())\n calls = cls.view(\"sms/by_recipient\",\n startkey=[caller_doc_type, caller_id, \"CallLog\", OUTGOING, start_timestamp],\n endkey=[caller_doc_type, caller_id, \"CallLog\", OUTGOING, end_timestamp],\n reduce=False,\n include_docs=True).all()\n result = False\n for call in calls:\n if call.answered:\n result = True\n break\n return result", "metadata": "root.CallLog.answered_call_exists", "header": "['class', 'CallLog', '(', 'MessageLog', ')', ':', '___EOS___']", "index": 601 }, { "content": " @classmethod\n def get_call_by_gateway_session_id(cls, gateway_session_id):\n \"\"\"\n Returns the CallLog object, or None if not found.\n \"\"\"\n return CallLog.view('sms/call_by_session',\n startkey=[gateway_session_id, {}],\n endkey=[gateway_session_id],\n descending=True,\n include_docs=True,\n limit=1).one()", "metadata": "root.CallLog.get_call_by_gateway_session_id", "header": "['class', 'CallLog', '(', 'MessageLog', ')', ':', '___EOS___']", "index": 627 }, { "content": "class EventLog(SafeSaveDocument):\n base_doc = \"EventLog\"\n domain = StringProperty()\n date = DateTimeProperty()\n couch_recipient_doc_type = StringProperty()\n couch_recipient = StringProperty()", "metadata": "root.EventLog", "header": "['module', '___EOS___']", "index": 640 }, { "content": "class ExpectedCallbackEventLog(EventLog):\n status = StringProperty(choices=[CALLBACK_PENDING,CALLBACK_RECEIVED,CALLBACK_MISSED])\n ", "metadata": "root.ExpectedCallbackEventLog", "header": "['module', '___EOS___']", "index": 648 }, { "content": " @classmethod\n def by_domain(cls, domain, start_date=None, end_date={}):\n \"\"\"\n Note that start_date and end_date are expected in JSON format.\n \"\"\"\n return cls.view(\"sms/expected_callback_event\",\n startkey=[domain, start_date],\n endkey=[domain, end_date],\n include_docs=True).all()", "metadata": "root.ExpectedCallbackEventLog.by_domain", "header": "['class', 'ExpectedCallbackEventLog', '(', 'EventLog', ')', ':', '___EOS___']", "index": 651 }, { "content": "class ExpectedCallback(UUIDGeneratorMixin, models.Model):\n class Meta:\n app_label = 'sms'\n index_together = [\n ['domain', 'date'],\n ]\n\n STATUS_CHOICES = (\n (CALLBACK_PENDING, ugettext_lazy(\"Pending\")),\n (CALLBACK_RECEIVED, ugettext_lazy(\"Received\")),\n (CALLBACK_MISSED, ugettext_lazy(\"Missed\")),\n )\n\n UUIDS_TO_GENERATE = ['couch_id']\n\n couch_id = models.CharField(max_length=126, null=True, db_index=True)\n domain = models.CharField(max_length=126, null=True, db_index=True)\n date = models.DateTimeField(null=True)\n couch_recipient_doc_type = models.CharField(max_length=126, null=True)\n couch_recipient = models.CharField(max_length=126, null=True, db_index=True)\n status = models.CharField(max_length=126, null=True)\n\n", "metadata": "root.ExpectedCallback", "header": "['module', '___EOS___']", "index": 662 }, { "content": " @classmethod\n def by_domain(cls, domain, start_date=None, end_date=None):\n qs = cls.objects.filter(domain=domain)\n\n if start_date:\n qs = qs.filter(date__gte=start_date)\n\n if end_date:\n qs = qs.filter(date__lte=end_date)\n\n return qs", "metadata": "root.ExpectedCallback.by_domain", "header": "['class', 'ExpectedCallback', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 684 }, { "content": " @classmethod\n def by_domain_recipient_date(cls, domain, recipient_id, date):\n try:\n return cls.objects.get(\n domain=domain,\n couch_recipient=recipient_id,\n date=date\n )\n except cls.DoesNotExist:\n return None", "metadata": "root.ExpectedCallback.by_domain_recipient_date", "header": "['class', 'ExpectedCallback', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 696 }, { "content": "class ForwardingRule(Document):\n domain = StringProperty()\n forward_type = StringProperty(choices=FORWARDING_CHOICES)\n keyword = StringProperty()\n backend_id = StringProperty() # id of MobileBackend which will be used to do the forwarding\n ", "metadata": "root.ForwardingRule", "header": "['module', '___EOS___']", "index": 708 }, { "content": " def retire(self):\n self.doc_type += \"-Deleted\"\n self.save()", "metadata": "root.ForwardingRule.retire", "header": "['class', 'ForwardingRule', '(', 'Document', ')', ':', '___EOS___']", "index": 714 }, { "content": "class PhoneBlacklist(models.Model):\n \"\"\"\n Each entry represents a single phone number and whether we can send SMS\n to that number or make calls to that number.\n \"\"\"\n\n phone_number = models.CharField(max_length=30, unique=True, null=False, db_index=True)\n\n # True if it's ok to send SMS to this phone number, False if not\n send_sms = models.BooleanField(null=False, default=True)\n\n # True if it's ok to call this phone number, False if not\n # This is not yet implemented but will be in the future.\n send_ivr = models.BooleanField(null=False, default=True)\n\n # True to allow this phone number to opt back in, False if not\n can_opt_in = models.BooleanField(null=False, default=True)\n\n class Meta:\n app_label = 'sms'\n\n\n\n\n\n", "metadata": "root.PhoneBlacklist", "header": "['module', '___EOS___']", "index": 719 }, { "content": " @classmethod\n def get_by_phone_number(cls, phone_number):\n phone_number = smsutil.strip_plus(phone_number)\n return cls.objects.get(phone_number=phone_number)", "metadata": "root.PhoneBlacklist.get_by_phone_number", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 740 }, { "content": " @classmethod\n def get_by_phone_number_or_none(cls, phone_number):\n try:\n return cls.get_by_phone_number(phone_number)\n except cls.DoesNotExist:\n return None", "metadata": "root.PhoneBlacklist.get_by_phone_number_or_none", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 745 }, { "content": " @classmethod\n def get_or_create(cls, phone_number):\n \"\"\"\n phone_number - should be a string of digits\n \"\"\"\n phone_number = smsutil.strip_plus(phone_number)\n if not phone_number:\n return (None, False)\n return cls.objects.get_or_create(phone_number=phone_number)", "metadata": "root.PhoneBlacklist.get_or_create", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 752 }, { "content": " @classmethod\n def can_receive_sms(cls, phone_number):\n try:\n phone_obj = cls.get_by_phone_number(phone_number)\n return phone_obj.send_sms\n except cls.DoesNotExist:\n # This means the phone number has not opted-out\n return True", "metadata": "root.PhoneBlacklist.can_receive_sms", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 762 }, { "content": " @classmethod\n def opt_in_sms(cls, phone_number):\n \"\"\"\n Opts a phone number in to receive SMS.\n Returns True if the number was actually opted-in, False if not.\n \"\"\"\n try:\n phone_obj = cls.get_by_phone_number(phone_number)\n if phone_obj.can_opt_in:\n phone_obj.send_sms = True\n phone_obj.save()\n return True\n except cls.DoesNotExist:\n pass\n return False", "metadata": "root.PhoneBlacklist.opt_in_sms", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 771 }, { "content": " @classmethod\n def opt_out_sms(cls, phone_number):\n \"\"\"\n Opts a phone number out from receiving SMS.\n Returns True if the number was actually opted-out, False if not.\n \"\"\"\n phone_obj = cls.get_or_create(phone_number)[0]\n if phone_obj:\n phone_obj.send_sms = False\n phone_obj.save()\n return True\n return False", "metadata": "root.PhoneBlacklist.opt_out_sms", "header": "['class', 'PhoneBlacklist', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 787 }, { "content": "class PhoneNumber(SyncSQLToCouchMixin, models.Model):\n couch_id = models.CharField(max_length=126, db_index=True, null=True)\n domain = models.CharField(max_length=126, db_index=True, null=True)\n owner_doc_type = models.CharField(max_length=126, null=True)\n owner_id = models.CharField(max_length=126, db_index=True, null=True)\n phone_number = models.CharField(max_length=126, db_index=True, null=True)\n\n # Points to the name of a SQLMobileBackend (can be domain-level\n # or system-level) which represents the backend that will be used\n # when sending SMS to this number. Can be None to use domain/system\n # defaults.\n backend_id = models.CharField(max_length=126, null=True)\n\n # Points to the name of a SQLMobileBackend (can be domain-level\n # or system-level) which represents the backend that will be used\n # when making calls to this number. Can be None to use domain/system\n # defaults.\n ivr_backend_id = models.CharField(max_length=126, null=True)\n verified = models.NullBooleanField(default=False)\n contact_last_modified = models.DateTimeField(null=True)\n\n", "metadata": "root.PhoneNumber", "header": "['module', '___EOS___']", "index": 801 }, { "content": " @classmethod\n def _migration_get_fields(cls):\n return [\n 'domain',\n 'owner_doc_type',\n 'owner_id',\n 'phone_number',\n 'backend_id',\n 'ivr_backend_id',\n 'verified',\n 'contact_last_modified'\n ]", "metadata": "root.PhoneNumber._migration_get_fields", "header": "['class', 'PhoneNumber', '(', 'SyncSQLToCouchMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 822 }, { "content": " @classmethod\n def _migration_get_couch_model_class(cls):\n return VerifiedNumber", "metadata": "root.PhoneNumber._migration_get_couch_model_class", "header": "['class', 'PhoneNumber', '(', 'SyncSQLToCouchMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 835 }, { "content": "class MessagingStatusMixin(object):\n\n\n", "metadata": "root.MessagingStatusMixin", "header": "['module', '___EOS___']", "index": 840 }, { "content": " def refresh(self):\n return self.__class__.objects.get(pk=self.pk)", "metadata": "root.MessagingStatusMixin.refresh", "header": "['class', 'MessagingStatusMixin', '(', 'object', ')', ':', '___EOS___']", "index": 842 }, { "content": " def error(self, error_code, additional_error_text=None):\n self.status = MessagingEvent.STATUS_ERROR\n self.error_code = error_code\n self.additional_error_text = additional_error_text\n self.save()", "metadata": "root.MessagingStatusMixin.error", "header": "['class', 'MessagingStatusMixin', '(', 'object', ')', ':', '___EOS___']", "index": 845 }, { "content": " def completed(self):\n obj = self.refresh()\n if obj.status != MessagingEvent.STATUS_ERROR:\n obj.status = MessagingEvent.STATUS_COMPLETED\n obj.save()\n return obj", "metadata": "root.MessagingStatusMixin.completed", "header": "['class', 'MessagingStatusMixin', '(', 'object', ')', ':', '___EOS___']", "index": 851 }, { "content": "class MessagingEvent(models.Model, MessagingStatusMixin):\n \"\"\"\n Used to track the status of high-level events in the messaging\n framework. Examples of such high-level events include the firing\n of a reminder instance, the invoking of a keyword, or the sending\n of a broadcast.\n \"\"\"\n STATUS_IN_PROGRESS = 'PRG'\n STATUS_COMPLETED = 'CMP'\n STATUS_NOT_COMPLETED = 'NOT'\n STATUS_ERROR = 'ERR'\n\n STATUS_CHOICES = (\n (STATUS_IN_PROGRESS, ugettext_noop('In Progress')),\n (STATUS_COMPLETED, ugettext_noop('Completed')),\n (STATUS_NOT_COMPLETED, ugettext_noop('Not Completed')),\n (STATUS_ERROR, ugettext_noop('Error')),\n )\n\n SOURCE_BROADCAST = 'BRD'\n SOURCE_KEYWORD = 'KWD'\n SOURCE_REMINDER = 'RMD'\n SOURCE_UNRECOGNIZED = 'UNR'\n SOURCE_FORWARDED = 'FWD'\n SOURCE_OTHER = 'OTH'\n\n SOURCE_CHOICES = (\n (SOURCE_BROADCAST, ugettext_noop('Broadcast')),\n (SOURCE_KEYWORD, ugettext_noop('Keyword')),\n (SOURCE_REMINDER, ugettext_noop('Reminder')),\n (SOURCE_UNRECOGNIZED, ugettext_noop('Unrecognized')),\n (SOURCE_FORWARDED, ugettext_noop('Forwarded Message')),\n (SOURCE_OTHER, ugettext_noop('Other')),\n )\n\n CONTENT_NONE = 'NOP'\n CONTENT_SMS = 'SMS'\n CONTENT_SMS_CALLBACK = 'CBK'\n CONTENT_SMS_SURVEY = 'SVY'\n CONTENT_IVR_SURVEY = 'IVR'\n CONTENT_PHONE_VERIFICATION = 'VER'\n CONTENT_ADHOC_SMS = 'ADH'\n CONTENT_API_SMS = 'API'\n CONTENT_CHAT_SMS = 'CHT'\n CONTENT_EMAIL = 'EML'\n\n CONTENT_CHOICES = (\n (CONTENT_NONE, ugettext_noop('None')),\n (CONTENT_SMS, ugettext_noop('SMS Message')),\n (CONTENT_SMS_CALLBACK, ugettext_noop('SMS Expecting Callback')),\n (CONTENT_SMS_SURVEY, ugettext_noop('SMS Survey')),\n (CONTENT_IVR_SURVEY, ugettext_noop('IVR Survey')),\n (CONTENT_PHONE_VERIFICATION, ugettext_noop('Phone Verification')),\n (CONTENT_ADHOC_SMS, ugettext_noop('Manually Sent Message')),\n (CONTENT_API_SMS, ugettext_noop('Message Sent Via API')),\n (CONTENT_CHAT_SMS, ugettext_noop('Message Sent Via Chat')),\n (CONTENT_EMAIL, ugettext_noop('Email')),\n )\n\n RECIPIENT_CASE = 'CAS'\n RECIPIENT_MOBILE_WORKER = 'MOB'\n RECIPIENT_WEB_USER = 'WEB'\n RECIPIENT_USER_GROUP = 'UGP'\n RECIPIENT_CASE_GROUP = 'CGP'\n RECIPIENT_VARIOUS = 'MUL'\n RECIPIENT_LOCATION = 'LOC'\n RECIPIENT_LOCATION_PLUS_DESCENDANTS = 'LC+'\n RECIPIENT_VARIOUS_LOCATIONS = 'VLC'\n RECIPIENT_VARIOUS_LOCATIONS_PLUS_DESCENDANTS = 'VL+'\n RECIPIENT_UNKNOWN = 'UNK'\n\n RECIPIENT_CHOICES = (\n (RECIPIENT_CASE, ugettext_noop('Case')),\n (RECIPIENT_MOBILE_WORKER, ugettext_noop('Mobile Worker')),\n (RECIPIENT_WEB_USER, ugettext_noop('Web User')),\n (RECIPIENT_USER_GROUP, ugettext_noop('User Group')),\n (RECIPIENT_CASE_GROUP, ugettext_noop('Case Group')),\n (RECIPIENT_VARIOUS, ugettext_noop('Multiple Recipients')),\n (RECIPIENT_LOCATION, ugettext_noop('Location')),\n (RECIPIENT_LOCATION_PLUS_DESCENDANTS,\n ugettext_noop('Location (including child locations)')),\n (RECIPIENT_VARIOUS_LOCATIONS, ugettext_noop('Multiple Locations')),\n (RECIPIENT_VARIOUS_LOCATIONS_PLUS_DESCENDANTS,\n ugettext_noop('Multiple Locations (including child locations)')),\n (RECIPIENT_UNKNOWN, ugettext_noop('Unknown Contact')),\n )\n\n ERROR_NO_RECIPIENT = 'NO_RECIPIENT'\n ERROR_CANNOT_RENDER_MESSAGE = 'CANNOT_RENDER_MESSAGE'\n ERROR_UNSUPPORTED_COUNTRY = 'UNSUPPORTED_COUNTRY'\n ERROR_NO_PHONE_NUMBER = 'NO_PHONE_NUMBER'\n ERROR_NO_TWO_WAY_PHONE_NUMBER = 'NO_TWO_WAY_PHONE_NUMBER'\n ERROR_INVALID_CUSTOM_CONTENT_HANDLER = 'INVALID_CUSTOM_CONTENT_HANDLER'\n ERROR_CANNOT_LOAD_CUSTOM_CONTENT_HANDLER = 'CANNOT_LOAD_CUSTOM_CONTENT_HANDLER'\n ERROR_CANNOT_FIND_FORM = 'CANNOT_FIND_FORM'\n ERROR_FORM_HAS_NO_QUESTIONS = 'FORM_HAS_NO_QUESTIONS'\n ERROR_CASE_EXTERNAL_ID_NOT_FOUND = 'CASE_EXTERNAL_ID_NOT_FOUND'\n ERROR_MULTIPLE_CASES_WITH_EXTERNAL_ID_FOUND = 'MULTIPLE_CASES_WITH_EXTERNAL_ID_FOUND'\n ERROR_NO_CASE_GIVEN = 'NO_CASE_GIVEN'\n ERROR_NO_EXTERNAL_ID_GIVEN = 'NO_EXTERNAL_ID_GIVEN'\n ERROR_COULD_NOT_PROCESS_STRUCTURED_SMS = 'COULD_NOT_PROCESS_STRUCTURED_SMS'\n ERROR_SUBEVENT_ERROR = 'SUBEVENT_ERROR'\n ERROR_TOUCHFORMS_ERROR = 'TOUCHFORMS_ERROR'\n ERROR_INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR'\n ERROR_GATEWAY_ERROR = 'GATEWAY_ERROR'\n ERROR_NO_SUITABLE_GATEWAY = 'NO_SUITABLE_GATEWAY'\n ERROR_GATEWAY_NOT_FOUND = 'GATEWAY_NOT_FOUND'\n ERROR_NO_EMAIL_ADDRESS = 'NO_EMAIL_ADDRESS'\n ERROR_TRIAL_EMAIL_LIMIT_REACHED = 'TRIAL_EMAIL_LIMIT_REACHED'\n\n ERROR_MESSAGES = {\n ERROR_NO_RECIPIENT:\n ugettext_noop('No recipient'),\n ERROR_CANNOT_RENDER_MESSAGE:\n ugettext_noop('Error rendering message; please check syntax.'),\n ERROR_UNSUPPORTED_COUNTRY:\n ugettext_noop('Gateway does not support the destination country.'),\n ERROR_NO_PHONE_NUMBER:\n ugettext_noop('Contact has no phone number.'),\n ERROR_NO_TWO_WAY_PHONE_NUMBER:\n ugettext_noop('Contact has no two-way phone number.'),\n ERROR_INVALID_CUSTOM_CONTENT_HANDLER:\n ugettext_noop('Invalid custom content handler.'),\n ERROR_CANNOT_LOAD_CUSTOM_CONTENT_HANDLER:\n ugettext_noop('Cannot load custom content handler.'),\n ERROR_CANNOT_FIND_FORM:\n ugettext_noop('Cannot find form.'),\n ERROR_FORM_HAS_NO_QUESTIONS:\n ugettext_noop('No questions were available in the form. Please '\n 'check that the form has questions and that display conditions '\n 'are not preventing questions from being asked.'),\n ERROR_CASE_EXTERNAL_ID_NOT_FOUND:\n ugettext_noop('The case with the given external ID was not found.'),\n ERROR_MULTIPLE_CASES_WITH_EXTERNAL_ID_FOUND:\n ugettext_noop('Multiple cases were found with the given external ID.'),\n ERROR_NO_CASE_GIVEN:\n ugettext_noop('The form requires a case but no case was provided.'),\n ERROR_NO_EXTERNAL_ID_GIVEN:\n ugettext_noop('No external ID given; please include case external ID after keyword.'),\n ERROR_COULD_NOT_PROCESS_STRUCTURED_SMS:\n ugettext_noop('Error processing structured SMS.'),\n ERROR_SUBEVENT_ERROR:\n ugettext_noop('View details for more information.'),\n ERROR_TOUCHFORMS_ERROR:\n ugettext_noop('An error occurred in the formplayer service.'),\n ERROR_INTERNAL_SERVER_ERROR:\n ugettext_noop('Internal Server Error'),\n ERROR_GATEWAY_ERROR:\n ugettext_noop('Gateway error.'),\n ERROR_NO_SUITABLE_GATEWAY:\n ugettext_noop('No suitable gateway could be found.'),\n ERROR_GATEWAY_NOT_FOUND:\n ugettext_noop('Gateway could not be found.'),\n ERROR_NO_EMAIL_ADDRESS:\n ugettext_noop('Recipient has no email address.'),\n ERROR_TRIAL_EMAIL_LIMIT_REACHED:\n ugettext_noop(\"Cannot send any more reminder emails. The limit for \"\n \"sending reminder emails on a Trial plan has been reached.\"),\n }\n\n domain = models.CharField(max_length=126, null=False, db_index=True)\n date = models.DateTimeField(null=False, db_index=True)\n source = models.CharField(max_length=3, choices=SOURCE_CHOICES, null=False)\n source_id = models.CharField(max_length=126, null=True)\n content_type = models.CharField(max_length=3, choices=CONTENT_CHOICES, null=False)\n\n # Only used when content_type is CONTENT_SMS_SURVEY or CONTENT_IVR_SURVEY\n # This is redundantly stored here (as well as the subevent) so that it\n # doesn't have to be looked up for reporting.\n form_unique_id = models.CharField(max_length=126, null=True)\n form_name = models.TextField(null=True)\n\n # If any of the MessagingSubEvent status's are STATUS_ERROR, this is STATUS_ERROR\n status = models.CharField(max_length=3, choices=STATUS_CHOICES, null=False)\n error_code = models.CharField(max_length=126, null=True)\n additional_error_text = models.TextField(null=True)\n recipient_type = models.CharField(max_length=3, choices=RECIPIENT_CHOICES, null=True, db_index=True)\n recipient_id = models.CharField(max_length=126, null=True, db_index=True)\n\n class Meta:\n app_label = 'sms'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MessagingEvent", "header": "['module', '___EOS___']", "index": 859 }, { "content": " @classmethod\n def get_recipient_type_from_doc_type(cls, recipient_doc_type):\n return {\n 'CommCareUser': cls.RECIPIENT_MOBILE_WORKER,\n 'WebUser': cls.RECIPIENT_WEB_USER,\n 'CommCareCase': cls.RECIPIENT_CASE,\n 'Group': cls.RECIPIENT_USER_GROUP,\n 'CommCareCaseGroup': cls.RECIPIENT_CASE_GROUP,\n }.get(recipient_doc_type, cls.RECIPIENT_UNKNOWN)", "metadata": "root.MessagingEvent.get_recipient_type_from_doc_type", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1041 }, { "content": " @classmethod\n def get_recipient_type(cls, recipient):\n return cls.get_recipient_type_from_doc_type(recipient.doc_type)", "metadata": "root.MessagingEvent.get_recipient_type", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1051 }, { "content": " @classmethod\n def _get_recipient_doc_type(cls, recipient_type):\n return {\n MessagingEvent.RECIPIENT_MOBILE_WORKER: 'CommCareUser',\n MessagingEvent.RECIPIENT_WEB_USER: 'WebUser',\n MessagingEvent.RECIPIENT_CASE: 'CommCareCase',\n MessagingEvent.RECIPIENT_USER_GROUP: 'Group',\n MessagingEvent.RECIPIENT_CASE_GROUP: 'CommCareCaseGroup',\n MessagingEvent.RECIPIENT_LOCATION: 'SQLLocation',\n MessagingEvent.RECIPIENT_LOCATION_PLUS_DESCENDANTS: 'SQLLocation',\n }.get(recipient_type, None)", "metadata": "root.MessagingEvent._get_recipient_doc_type", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1055 }, { "content": " def get_recipient_doc_type(self):\n return MessagingEvent._get_recipient_doc_type(self.recipient_type)", "metadata": "root.MessagingEvent.get_recipient_doc_type", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1067 }, { "content": " def create_subevent(self, reminder_definition, reminder, recipient):\n recipient_type = MessagingEvent.get_recipient_type(recipient)\n content_type, form_unique_id, form_name = self.get_content_info_from_reminder(\n reminder_definition, reminder, parent=self)\n\n obj = MessagingSubEvent.objects.create(\n parent=self,\n date=datetime.utcnow(),\n recipient_type=recipient_type,\n recipient_id=recipient.get_id if recipient_type else None,\n content_type=content_type,\n form_unique_id=form_unique_id,\n form_name=form_name,\n case_id=reminder.case_id,\n status=MessagingEvent.STATUS_IN_PROGRESS,\n )\n return obj", "metadata": "root.MessagingEvent.create_subevent", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1070 }, { "content": " def create_ivr_subevent(self, recipient, form_unique_id, case_id=None):\n recipient_type = MessagingEvent.get_recipient_type(recipient)\n obj = MessagingSubEvent.objects.create(\n parent=self,\n date=datetime.utcnow(),\n recipient_type=recipient_type,\n recipient_id=recipient.get_id if recipient_type else None,\n content_type=MessagingEvent.CONTENT_IVR_SURVEY,\n form_unique_id=form_unique_id,\n form_name=MessagingEvent.get_form_name_or_none(form_unique_id),\n case_id=case_id,\n status=MessagingEvent.STATUS_IN_PROGRESS,\n )\n return obj", "metadata": "root.MessagingEvent.create_ivr_subevent", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1088 }, { "content": " @classmethod\n def create_event_for_adhoc_sms(cls, domain, recipient=None,\n content_type=CONTENT_ADHOC_SMS, source=SOURCE_OTHER):\n if recipient:\n recipient_type = cls.get_recipient_type(recipient)\n recipient_id = recipient.get_id\n else:\n recipient_type = cls.RECIPIENT_UNKNOWN\n recipient_id = None\n\n obj = cls.objects.create(\n domain=domain,\n date=datetime.utcnow(),\n source=source,\n content_type=content_type,\n status=cls.STATUS_IN_PROGRESS,\n recipient_type=recipient_type,\n recipient_id=recipient_id,\n )\n return obj", "metadata": "root.MessagingEvent.create_event_for_adhoc_sms", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1103 }, { "content": " def create_structured_sms_subevent(self, case_id):\n obj = MessagingSubEvent.objects.create(\n parent=self,\n date=datetime.utcnow(),\n recipient_type=self.recipient_type,\n recipient_id=self.recipient_id,\n content_type=MessagingEvent.CONTENT_SMS_SURVEY,\n form_unique_id=self.form_unique_id,\n form_name=self.form_name,\n case_id=case_id,\n status=MessagingEvent.STATUS_IN_PROGRESS,\n )\n return obj", "metadata": "root.MessagingEvent.create_structured_sms_subevent", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1124 }, { "content": " def create_subevent_for_single_sms(self, recipient_doc_type=None,\n recipient_id=None, case=None, completed=False):\n obj = MessagingSubEvent.objects.create(\n parent=self,\n date=datetime.utcnow(),\n recipient_type=MessagingEvent.get_recipient_type_from_doc_type(recipient_doc_type),\n recipient_id=recipient_id,\n content_type=MessagingEvent.CONTENT_SMS,\n case_id=case.get_id if case else None,\n status=(MessagingEvent.STATUS_COMPLETED\n if completed\n else MessagingEvent.STATUS_IN_PROGRESS),\n )\n return obj", "metadata": "root.MessagingEvent.create_subevent_for_single_sms", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1138 }, { "content": " @property\n def subevents(self):\n return self.messagingsubevent_set.all()", "metadata": "root.MessagingEvent.subevents", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1153 }, { "content": " @classmethod\n def get_source_from_reminder(cls, reminder_definition):\n from corehq.apps.reminders.models import (REMINDER_TYPE_ONE_TIME,\n REMINDER_TYPE_DEFAULT)\n\n default = (cls.SOURCE_OTHER, None)\n return {\n REMINDER_TYPE_ONE_TIME:\n (cls.SOURCE_BROADCAST, reminder_definition.get_id),\n REMINDER_TYPE_DEFAULT:\n (cls.SOURCE_REMINDER, reminder_definition.get_id),\n }.get(reminder_definition.reminder_type, default)", "metadata": "root.MessagingEvent.get_source_from_reminder", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1157 }, { "content": " @classmethod\n def get_form_name_or_none(cls, form_unique_id):\n try:\n form = Form.get_form(form_unique_id)\n return form.full_path_name\n except:\n return None", "metadata": "root.MessagingEvent.get_form_name_or_none", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1170 }, { "content": " @classmethod\n def get_content_info_from_reminder(cls, reminder_definition, reminder, parent=None):\n from corehq.apps.reminders.models import (METHOD_SMS, METHOD_SMS_CALLBACK,\n METHOD_SMS_SURVEY, METHOD_IVR_SURVEY, METHOD_EMAIL)\n content_type = {\n METHOD_SMS: cls.CONTENT_SMS,\n METHOD_SMS_CALLBACK: cls.CONTENT_SMS_CALLBACK,\n METHOD_SMS_SURVEY: cls.CONTENT_SMS_SURVEY,\n METHOD_IVR_SURVEY: cls.CONTENT_IVR_SURVEY,\n METHOD_EMAIL: cls.CONTENT_EMAIL,\n }.get(reminder_definition.method, cls.CONTENT_SMS)\n\n form_unique_id = reminder.current_event.form_unique_id\n if parent and parent.form_unique_id == form_unique_id:\n form_name = parent.form_name\n else:\n form_name = (cls.get_form_name_or_none(form_unique_id)\n if form_unique_id else None)\n\n return (content_type, form_unique_id, form_name)", "metadata": "root.MessagingEvent.get_content_info_from_reminder", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1178 }, { "content": " @classmethod\n def get_content_info_from_keyword(cls, keyword):\n from corehq.apps.reminders.models import (METHOD_SMS, METHOD_SMS_SURVEY,\n METHOD_STRUCTURED_SMS, RECIPIENT_SENDER)\n\n content_type = cls.CONTENT_NONE\n form_unique_id = None\n form_name = None\n\n for action in keyword.actions:\n if action.recipient == RECIPIENT_SENDER:\n if action.action in (METHOD_SMS_SURVEY, METHOD_STRUCTURED_SMS):\n content_type = cls.CONTENT_SMS_SURVEY\n form_unique_id = action.form_unique_id\n form_name = cls.get_form_name_or_none(action.form_unique_id)\n elif action.action == METHOD_SMS:\n content_type = cls.CONTENT_SMS\n\n return (content_type, form_unique_id, form_name)", "metadata": "root.MessagingEvent.get_content_info_from_keyword", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1199 }, { "content": " @classmethod\n def create_from_reminder(cls, reminder_definition, reminder, recipient=None):\n if reminder_definition.messaging_event_id:\n return cls.objects.get(pk=reminder_definition.messaging_event_id)\n\n source, source_id = cls.get_source_from_reminder(reminder_definition)\n content_type, form_unique_id, form_name = cls.get_content_info_from_reminder(\n reminder_definition, reminder)\n\n if recipient and reminder_definition.recipient_is_list_of_locations(recipient):\n if len(recipient) == 1:\n recipient_type = (cls.RECIPIENT_LOCATION_PLUS_DESCENDANTS\n if reminder_definition.include_child_locations\n else cls.RECIPIENT_LOCATION)\n recipient_id = recipient[0].location_id\n elif len(recipient) > 1:\n recipient_type = (cls.RECIPIENT_VARIOUS_LOCATIONS_PLUS_DESCENDANTS\n if reminder_definition.include_child_locations\n else cls.RECIPIENT_VARIOUS_LOCATIONS)\n recipient_id = None\n else:\n # len(recipient) should never be 0 when we invoke this method,\n # but catching this situation here just in case\n recipient_type = cls.RECIPIENT_UNKNOWN\n recipient_id = None\n elif isinstance(recipient, list):\n recipient_type = cls.RECIPIENT_VARIOUS\n recipient_id = None\n elif recipient is None:\n recipient_type = cls.RECIPIENT_UNKNOWN\n recipient_id = None\n else:\n recipient_type = cls.get_recipient_type(recipient)\n recipient_id = recipient.get_id if recipient_type else None\n\n return cls.objects.create(\n domain=reminder_definition.domain,\n date=datetime.utcnow(),\n source=source,\n source_id=source_id,\n content_type=content_type,\n form_unique_id=form_unique_id,\n form_name=form_name,\n status=cls.STATUS_IN_PROGRESS,\n recipient_type=recipient_type,\n recipient_id=recipient_id\n )", "metadata": "root.MessagingEvent.create_from_reminder", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1219 }, { "content": " @classmethod\n def create_from_keyword(cls, keyword, contact):\n \"\"\"\n keyword - the keyword object\n contact - the person who initiated the keyword\n \"\"\"\n content_type, form_unique_id, form_name = cls.get_content_info_from_keyword(\n keyword)\n recipient_type = cls.get_recipient_type(contact)\n\n return cls.objects.create(\n domain=keyword.domain,\n date=datetime.utcnow(),\n source=cls.SOURCE_KEYWORD,\n source_id=keyword.get_id,\n content_type=content_type,\n form_unique_id=form_unique_id,\n form_name=form_name,\n status=cls.STATUS_IN_PROGRESS,\n recipient_type=recipient_type,\n recipient_id=contact.get_id if recipient_type else None\n )", "metadata": "root.MessagingEvent.create_from_keyword", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1267 }, { "content": " @classmethod\n def create_verification_event(cls, domain, contact):\n recipient_type = cls.get_recipient_type(contact)\n return cls.objects.create(\n domain=domain,\n date=datetime.utcnow(),\n source=cls.SOURCE_OTHER,\n content_type=cls.CONTENT_PHONE_VERIFICATION,\n status=cls.STATUS_IN_PROGRESS,\n recipient_type=recipient_type,\n recipient_id=contact.get_id if recipient_type else None\n )", "metadata": "root.MessagingEvent.create_verification_event", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1290 }, { "content": " @classmethod\n def get_current_verification_event(cls, domain, contact_id, phone_number):\n \"\"\"\n Returns the latest phone verification event that is in progress\n for the given contact and phone number, or None if one does not exist.\n \"\"\"\n qs = cls.objects.filter(\n domain=domain,\n recipient_id=contact_id,\n messagingsubevent__sms__phone_number=smsutil.clean_phone_number(phone_number),\n content_type=cls.CONTENT_PHONE_VERIFICATION,\n status=cls.STATUS_IN_PROGRESS\n )\n return qs.order_by('-date')[0] if qs.count() > 0 else None", "metadata": "root.MessagingEvent.get_current_verification_event", "header": "['class', 'MessagingEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1303 }, { "content": "class MessagingSubEvent(models.Model, MessagingStatusMixin):\n \"\"\"\n Used to track the status of a MessagingEvent for each of its recipients.\n \"\"\"\n RECIPIENT_CHOICES = (\n (MessagingEvent.RECIPIENT_CASE, ugettext_noop('Case')),\n (MessagingEvent.RECIPIENT_MOBILE_WORKER, ugettext_noop('Mobile Worker')),\n (MessagingEvent.RECIPIENT_WEB_USER, ugettext_noop('Web User')),\n )\n\n parent = models.ForeignKey('MessagingEvent')\n date = models.DateTimeField(null=False, db_index=True)\n recipient_type = models.CharField(max_length=3, choices=RECIPIENT_CHOICES, null=False)\n recipient_id = models.CharField(max_length=126, null=True)\n content_type = models.CharField(max_length=3, choices=MessagingEvent.CONTENT_CHOICES, null=False)\n\n # Only used when content_type is CONTENT_SMS_SURVEY or CONTENT_IVR_SURVEY\n form_unique_id = models.CharField(max_length=126, null=True)\n form_name = models.TextField(null=True)\n xforms_session = models.ForeignKey('smsforms.SQLXFormsSession', null=True, on_delete=models.PROTECT)\n\n # If this was a reminder that spawned off of a case, this is the case's id\n case_id = models.CharField(max_length=126, null=True)\n status = models.CharField(max_length=3, choices=MessagingEvent.STATUS_CHOICES, null=False)\n error_code = models.CharField(max_length=126, null=True)\n additional_error_text = models.TextField(null=True)\n\n class Meta:\n app_label = 'sms'\n\n", "metadata": "root.MessagingSubEvent", "header": "['module', '___EOS___']", "index": 1319 }, { "content": " def save(self, *args, **kwargs):\n super(MessagingSubEvent, self).save(*args, **kwargs)\n parent = self.parent\n\n # If this event is in an errored state, also set the parent\n # event to an errored state.\n if self.status == MessagingEvent.STATUS_ERROR:\n parent.status = MessagingEvent.STATUS_ERROR\n parent.save()\n\n # If the parent event had various recipients, mark it as such,\n # unless the source was a keyword in which case the recipient\n # listed should always be the keyword initiator.\n if (parent.source != MessagingEvent.SOURCE_KEYWORD and\n (parent.recipient_id != self.recipient_id or self.recipient_id is None) and\n parent.recipient_type not in (\n MessagingEvent.RECIPIENT_USER_GROUP,\n MessagingEvent.RECIPIENT_CASE_GROUP,\n MessagingEvent.RECIPIENT_VARIOUS,\n MessagingEvent.RECIPIENT_LOCATION,\n MessagingEvent.RECIPIENT_LOCATION_PLUS_DESCENDANTS,\n MessagingEvent.RECIPIENT_VARIOUS_LOCATIONS,\n MessagingEvent.RECIPIENT_VARIOUS_LOCATIONS_PLUS_DESCENDANTS,\n ) and len(parent.subevents) > 1):\n parent.recipient_type = MessagingEvent.RECIPIENT_VARIOUS\n parent.recipient_id = None\n parent.save()", "metadata": "root.MessagingSubEvent.save", "header": "['class', 'MessagingSubEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1349 }, { "content": " def get_recipient_doc_type(self):\n return MessagingEvent._get_recipient_doc_type(self.recipient_type)", "metadata": "root.MessagingSubEvent.get_recipient_doc_type", "header": "['class', 'MessagingSubEvent', '(', 'models', '.', 'Model', ',', 'MessagingStatusMixin', ')', ':', '___EOS___']", "index": 1377 }, { "content": "class SelfRegistrationInvitation(models.Model):\n PHONE_TYPE_ANDROID = 'android'\n PHONE_TYPE_OTHER = 'other'\n PHONE_TYPE_CHOICES = (\n (PHONE_TYPE_ANDROID, ugettext_lazy('Android')),\n (PHONE_TYPE_OTHER, ugettext_lazy('Other')),\n )\n\n STATUS_PENDING = 'pending'\n STATUS_REGISTERED = 'registered'\n STATUS_EXPIRED = 'expired'\n\n domain = models.CharField(max_length=126, null=False, db_index=True)\n phone_number = models.CharField(max_length=30, null=False, db_index=True)\n token = models.CharField(max_length=126, null=False, unique=True, db_index=True)\n app_id = models.CharField(max_length=126, null=True)\n expiration_date = models.DateField(null=False)\n created_date = models.DateTimeField(null=False)\n odk_url = models.CharField(max_length=126, null=True)\n phone_type = models.CharField(max_length=20, null=True, choices=PHONE_TYPE_CHOICES)\n registered_date = models.DateTimeField(null=True)\n\n class Meta:\n app_label = 'sms'\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SelfRegistrationInvitation", "header": "['module', '___EOS___']", "index": 1381 }, { "content": " @property\n def already_registered(self):\n return self.registered_date is not None", "metadata": "root.SelfRegistrationInvitation.already_registered", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1406 }, { "content": " @property\n def expired(self):\n \"\"\"\n The invitation is valid until 11:59pm UTC on the expiration date.\n \"\"\"\n return datetime.utcnow().date() > self.expiration_date", "metadata": "root.SelfRegistrationInvitation.expired", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1410 }, { "content": " @property\n def status(self):\n if self.already_registered:\n return self.STATUS_REGISTERED\n elif self.expired:\n return self.STATUS_EXPIRED\n else:\n return self.STATUS_PENDING", "metadata": "root.SelfRegistrationInvitation.status", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1417 }, { "content": " def completed(self):\n self.registered_date = datetime.utcnow()\n self.save()", "metadata": "root.SelfRegistrationInvitation.completed", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1426 }, { "content": " def send_step1_sms(self):\n from corehq.apps.sms.api import send_sms\n send_sms(\n self.domain,\n None,\n self.phone_number,\n get_message(MSG_MOBILE_WORKER_INVITATION_START, domain=self.domain)\n )", "metadata": "root.SelfRegistrationInvitation.send_step1_sms", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1430 }, { "content": " def send_step2_java_sms(self):\n from corehq.apps.sms.api import send_sms\n send_sms(\n self.domain,\n None,\n self.phone_number,\n get_message(MSG_MOBILE_WORKER_JAVA_INVITATION, context=(self.domain,), domain=self.domain)\n )", "metadata": "root.SelfRegistrationInvitation.send_step2_java_sms", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1439 }, { "content": " def send_step2_android_sms(self):\n from corehq.apps.sms.api import send_sms\n from corehq.apps.sms.views import InvitationAppInfoView\n from corehq.apps.users.views.mobile.users import CommCareUserSelfRegistrationView\n\n registration_url = absolute_reverse(CommCareUserSelfRegistrationView.urlname,\n args=[self.domain, self.token])\n send_sms(\n self.domain,\n None,\n self.phone_number,\n get_message(MSG_MOBILE_WORKER_ANDROID_INVITATION, context=(registration_url,), domain=self.domain)\n )\n\n \"\"\"\n # Until odk 2.24 gets released to the Google Play store, this part won't work\n if self.odk_url:\n app_info_url = absolute_reverse(InvitationAppInfoView.urlname,\n args=[self.domain, self.token])\n message = '[commcare app - do not delete] %s' % app_info_url\n send_sms(\n self.domain,\n None,\n self.phone_number,\n message,\n )\n \"\"\"", "metadata": "root.SelfRegistrationInvitation.send_step2_android_sms", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1448 }, { "content": " def expire(self):\n self.expiration_date = datetime.utcnow().date() - timedelta(days=1)\n self.save()", "metadata": "root.SelfRegistrationInvitation.expire", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1476 }, { "content": " @classmethod\n def get_unexpired_invitations(cls, phone_number):\n current_date = datetime.utcnow().date()\n return cls.objects.filter(\n phone_number=phone_number,\n expiration_date__gte=current_date,\n registered_date__isnull=True\n )", "metadata": "root.SelfRegistrationInvitation.get_unexpired_invitations", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1480 }, { "content": " @classmethod\n def expire_invitations(cls, phone_number):\n \"\"\"\n Expire all invitations for the given phone number that have not\n yet expired.\n \"\"\"\n for invitation in cls.get_unexpired_invitations(phone_number):\n invitation.expire()", "metadata": "root.SelfRegistrationInvitation.expire_invitations", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1489 }, { "content": " @classmethod\n def by_token(cls, token):\n try:\n return cls.objects.get(token=token)\n except cls.DoesNotExist:\n return None", "metadata": "root.SelfRegistrationInvitation.by_token", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1498 }, { "content": " @classmethod\n def by_phone(cls, phone_number, expire_duplicates=True):\n \"\"\"\n Look up the unexpired invitation for the given phone number.\n In the case of duplicates, only the most recent invitation\n is returned.\n If expire_duplicates is True, then any duplicates are automatically\n expired.\n Returns the invitation, or None if no unexpired invitations exist.\n \"\"\"\n phone_number = apply_leniency(phone_number)\n result = cls.get_unexpired_invitations(phone_number).order_by('-created_date')\n\n if len(result) == 0:\n return None\n\n invitation = result[0]\n if expire_duplicates and len(result) > 1:\n for i in result[1:]:\n i.expire()\n\n return invitation", "metadata": "root.SelfRegistrationInvitation.by_phone", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1505 }, { "content": " @classmethod\n def get_app_odk_url(cls, domain, app_id):\n \"\"\"\n Get the latest starred build (or latest build if none are\n starred) for the app and return it's odk install url.\n \"\"\"\n app = get_app(domain, app_id, latest=True)\n\n if not app.copy_of:\n # If latest starred build is not found, use the latest build\n app = get_app(domain, app_id, latest=True, target='build')\n\n if not app.copy_of:\n # If no build is found, return None\n return None\n\n return app.get_short_odk_url(with_media=True)", "metadata": "root.SelfRegistrationInvitation.get_app_odk_url", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1528 }, { "content": " @classmethod\n def initiate_workflow(cls, domain, phone_numbers, app_id=None,\n days_until_expiration=30):\n \"\"\"\n If app_id is passed in, then an additional SMS will be sent to Android\n phones containing a link to the latest starred build (or latest\n build if no starred build exists) for the app. Once ODK is installed,\n it will automatically search for this SMS and install this app.\n\n If app_id is left blank, the additional SMS is not sent, and once\n ODK is installed it just skips the automatic app install step.\n \"\"\"\n success_numbers = []\n invalid_format_numbers = []\n numbers_in_use = []\n\n odk_url = None\n if app_id:\n odk_url = cls.get_app_odk_url(domain, app_id)\n\n for phone_number in phone_numbers:\n phone_number = apply_leniency(phone_number)\n try:\n CommCareMobileContactMixin.validate_number_format(phone_number)\n except InvalidFormatException:\n invalid_format_numbers.append(phone_number)\n continue\n\n if VerifiedNumber.by_phone(phone_number, include_pending=True):\n numbers_in_use.append(phone_number)\n continue\n\n cls.expire_invitations(phone_number)\n\n expiration_date = (datetime.utcnow().date() +\n timedelta(days=days_until_expiration))\n\n invitation = cls.objects.create(\n domain=domain,\n phone_number=phone_number,\n token=uuid.uuid4().hex,\n app_id=app_id,\n expiration_date=expiration_date,\n created_date=datetime.utcnow(),\n odk_url=odk_url,\n )\n\n invitation.send_step1_sms()\n success_numbers.append(phone_number)\n\n return (success_numbers, invalid_format_numbers, numbers_in_use)", "metadata": "root.SelfRegistrationInvitation.initiate_workflow", "header": "['class', 'SelfRegistrationInvitation', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1546 }, { "content": "class ActiveMobileBackendManager(models.Manager):", "metadata": "root.ActiveMobileBackendManager", "header": "['module', '___EOS___']", "index": 1599 }, { "content": " def get_queryset(self):\n return super(ActiveMobileBackendManager, self).get_queryset().filter(deleted=False)", "metadata": "root.ActiveMobileBackendManager.get_queryset", "header": "['class', 'ActiveMobileBackendManager', '(', 'models', '.', 'Manager', ')', ':', '___EOS___']", "index": 1600 }, { "content": "class SQLMobileBackend(UUIDGeneratorMixin, models.Model):\n SMS = 'SMS'\n IVR = 'IVR'\n\n TYPE_CHOICES = (\n (SMS, ugettext_lazy('SMS')),\n (IVR, ugettext_lazy('IVR')),\n )\n\n UUIDS_TO_GENERATE = ['couch_id', 'inbound_api_key']\n\n objects = models.Manager()\n active_objects = ActiveMobileBackendManager()\n\n # We can't really get rid of this until all the messaging models are in\n # postgres. Once that happens we can migrate references to the couch_id\n # as a foreign key to postgres id and get rid of this field.\n couch_id = models.CharField(max_length=126, db_index=True, unique=True)\n backend_type = models.CharField(max_length=3, choices=TYPE_CHOICES, default=SMS)\n\n # This is an api key that the gateway uses when making inbound requests to hq.\n # This enforces gateway security and also allows us to tie every inbound request\n # to a specific backend.\n inbound_api_key = models.CharField(max_length=126, unique=True, db_index=True)\n\n # This tells us which type of backend this is\n hq_api_id = models.CharField(max_length=126, null=True)\n\n # Global backends are system owned and can be used by anyone\n is_global = models.BooleanField(default=False)\n\n # This is the domain that the backend belongs to, or None for\n # global backends\n domain = models.CharField(max_length=126, null=True, db_index=True)\n\n # A short name for a backend instance which is referenced when\n # setting a case contact's preferred backend\n name = models.CharField(max_length=126)\n\n # Simple name to display to users - e.g. \"Twilio\"\n display_name = models.CharField(max_length=126, null=True)\n\n # Optionally, a description of this backend\n description = models.TextField(null=True)\n\n # A JSON list of countries that this backend supports.\n # This information is displayed in the gateway list UI.\n # If this backend represents an international gateway,\n # set this to: [\"*\"]\n supported_countries = json_field.JSONField(default=[])\n\n # To avoid having many tables with so few records in them, all\n # SMS backends are stored in this same table. This field is a\n # JSON dict which stores any additional fields that the SMS\n # backend subclasses need.\n # NOTE: Do not access this field directly, instead use get_extra_fields()\n # and set_extra_fields()\n extra_fields = json_field.JSONField(default={})\n\n # For a historical view of sms data, we can't delete backends.\n # Instead, set a deleted flag when a backend should no longer be used.\n deleted = models.BooleanField(default=False)\n\n # If the backend uses load balancing, this is a JSON list of the\n # phone numbers to load balance over.\n load_balancing_numbers = json_field.JSONField(default=[])\n\n # The phone number which you can text to or call in order to reply\n # to this backend\n reply_to_phone_number = models.CharField(max_length=126, null=True)\n\n class Meta:\n db_table = 'messaging_mobilebackend'\n app_label = 'sms'\n\n\n\n\n\n\n\n\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.SQLMobileBackend", "header": "['module', '___EOS___']", "index": 1604 }, { "content": " @quickcache(['self.pk', 'domain'], timeout=5 * 60)\n def domain_is_shared(self, domain):\n \"\"\"\n Returns True if this backend has been shared with domain and domain\n has accepted the invitation.\n \"\"\"\n count = self.mobilebackendinvitation_set.filter(domain=domain, accepted=True).count()\n return count > 0", "metadata": "root.SQLMobileBackend.domain_is_shared", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1679 }, { "content": " def domain_is_authorized(self, domain):\n \"\"\"\n Returns True if the given domain is authorized to use this backend.\n \"\"\"\n return (self.is_global or\n domain == self.domain or\n self.domain_is_shared(domain))", "metadata": "root.SQLMobileBackend.domain_is_authorized", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1688 }, { "content": " @classmethod\n def name_is_unique(cls, name, domain=None, backend_id=None):\n if domain:\n result = cls.objects.filter(\n is_global=False,\n domain=domain,\n name=name,\n deleted=False\n )\n else:\n result = cls.objects.filter(\n is_global=True,\n name=name,\n deleted=False\n )\n\n result = result.values_list('id', flat=True)\n if len(result) == 0:\n return True\n\n if len(result) == 1:\n return result[0] == backend_id\n\n return False", "metadata": "root.SQLMobileBackend.name_is_unique", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1696 }, { "content": " def get_authorized_domain_list(self):\n return (self.mobilebackendinvitation_set.filter(accepted=True)\n .order_by('domain').values_list('domain', flat=True))", "metadata": "root.SQLMobileBackend.get_authorized_domain_list", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1721 }, { "content": " @classmethod\n def get_domain_backends(cls, backend_type, domain, count_only=False, offset=None, limit=None):\n \"\"\"\n Returns all the backends that the given domain has access to (that is,\n owned backends, shared backends, and global backends).\n \"\"\"\n domain_owned_backends = models.Q(is_global=False, domain=domain)\n domain_shared_backends = models.Q(\n is_global=False,\n mobilebackendinvitation__domain=domain,\n mobilebackendinvitation__accepted=True\n )\n global_backends = models.Q(is_global=True)\n\n # The left join to MobileBackendInvitation may cause there to be\n # duplicates here, so we need to call .distinct()\n result = SQLMobileBackend.objects.filter(\n (domain_owned_backends | domain_shared_backends | global_backends),\n deleted=False,\n backend_type=backend_type\n ).distinct()\n\n if count_only:\n return result.count()\n\n result = result.order_by('name').values_list('id', flat=True)\n if offset is not None and limit is not None:\n result = result[offset:offset + limit]\n\n return [cls.load(pk) for pk in result]", "metadata": "root.SQLMobileBackend.get_domain_backends", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1725 }, { "content": " @classmethod\n def get_global_backends_for_this_class(cls, backend_type):\n return cls.objects.filter(\n is_global=True,\n deleted=False,\n backend_type=backend_type,\n hq_api_id=cls.get_api_id()\n ).all()", "metadata": "root.SQLMobileBackend.get_global_backends_for_this_class", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1756 }, { "content": " @classmethod\n def get_global_backend_ids(cls, backend_type, couch_id=False):\n id_field = 'couch_id' if couch_id else 'id'\n return SQLMobileBackend.active_objects.filter(\n backend_type=backend_type,\n is_global=True\n ).values_list(id_field, flat=True)", "metadata": "root.SQLMobileBackend.get_global_backend_ids", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1765 }, { "content": " @classmethod\n def get_global_backends(cls, backend_type, count_only=False, offset=None, limit=None):\n result = SQLMobileBackend.objects.filter(\n is_global=True,\n deleted=False,\n backend_type=backend_type\n )\n\n if count_only:\n return result.count()\n\n result = result.order_by('name').values_list('id', flat=True)\n if offset is not None and limit is not None:\n result = result[offset:offset + limit]\n\n return [cls.load(pk) for pk in result]", "metadata": "root.SQLMobileBackend.get_global_backends", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1773 }, { "content": " @classmethod\n def get_domain_default_backend(cls, backend_type, domain, id_only=False):\n result = SQLMobileBackendMapping.objects.filter(\n is_global=False,\n domain=domain,\n backend_type=backend_type,\n prefix='*'\n ).values_list('backend_id', flat=True)\n\n if len(result) > 1:\n raise cls.MultipleObjectsReturned(\n \"More than one default backend found for backend_type %s, \"\n \"domain %s\" % (backend_type, domain)\n )\n elif len(result) == 1:\n if id_only:\n return result[0]\n else:\n return cls.load(result[0])\n else:\n return None", "metadata": "root.SQLMobileBackend.get_domain_default_backend", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1790 }, { "content": " @classmethod\n def load_default_backend(cls, backend_type, phone_number, domain=None):\n \"\"\"\n Chooses the appropriate backend based on the phone number's\n prefix, or returns None if no catch-all backend is configured.\n\n backend_type - SQLMobileBackend.SMS or SQLMobileBackend.IVR\n phone_number - the phone number\n domain - pass in a domain to choose the default backend from the domain's\n configured backends, otherwise leave None to choose from the\n system's configured backends\n \"\"\"\n backend_map = SQLMobileBackendMapping.get_prefix_to_backend_map(\n backend_type, domain=domain)\n backend_id = backend_map.get_backend_id_by_prefix(phone_number)\n if backend_id:\n return cls.load(backend_id)\n return None", "metadata": "root.SQLMobileBackend.load_default_backend", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1812 }, { "content": " @classmethod\n def load_default_by_phone_and_domain(cls, backend_type, phone_number, domain=None):\n \"\"\"\n Get the appropriate outbound backend to communicate with phone_number.\n\n backend_type - SQLMobileBackend.SMS or SQLMobileBackend.IVR\n phone_number - the phone number\n domain - the domain\n \"\"\"\n backend = None\n\n if domain:\n backend = cls.load_default_backend(backend_type, phone_number, domain=domain)\n\n if not backend:\n backend = cls.load_default_backend(backend_type, phone_number)\n\n if not backend:\n raise BadSMSConfigException(\"No suitable backend found for phone \"\n \"number and domain %s, %s\" %\n (phone_number, domain))\n\n return backend", "metadata": "root.SQLMobileBackend.load_default_by_phone_and_domain", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1831 }, { "content": " @classmethod\n @quickcache(['hq_api_id', 'inbound_api_key'], timeout=60 * 60)\n def get_backend_info_by_api_key(cls, hq_api_id, inbound_api_key):\n \"\"\"\n Looks up a backend by inbound_api_key and returns a tuple of\n (domain, couch_id). Including hq_api_id in the filter is an\n implicit way of making sure that the returned backend info belongs\n to a backend of that type.\n\n (The entire backend is not returned to reduce the amount of data\n needed to be returned by the cache)\n\n Raises cls.DoesNotExist if not found.\n \"\"\"\n result = (cls.active_objects\n .filter(hq_api_id=hq_api_id, inbound_api_key=inbound_api_key)\n .values_list('domain', 'couch_id'))\n\n if len(result) == 0:\n raise cls.DoesNotExist\n\n return result[0]", "metadata": "root.SQLMobileBackend.get_backend_info_by_api_key", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1855 }, { "content": " @classmethod\n @quickcache(['backend_id', 'is_couch_id'], timeout=60 * 60)\n def get_backend_api_id(cls, backend_id, is_couch_id=False):\n filter_args = {'couch_id': backend_id} if is_couch_id else {'pk': backend_id}\n result = (cls.active_objects\n .filter(**filter_args)\n .values_list('hq_api_id', flat=True))\n\n if len(result) == 0:\n raise cls.DoesNotExist\n\n return result[0]", "metadata": "root.SQLMobileBackend.get_backend_api_id", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1878 }, { "content": " @classmethod\n @quickcache(['backend_id', 'is_couch_id', 'include_deleted'], timeout=5 * 60)\n def load(cls, backend_id, api_id=None, is_couch_id=False, include_deleted=False):\n \"\"\"\n backend_id - the pk of the SQLMobileBackend to load\n api_id - if you know the hq_api_id of the SQLMobileBackend, pass it\n here for a faster lookup; otherwise, it will be looked up\n automatically\n is_couch_id - if True, then backend_id should be the couch_id to use\n during lookup instead of the postgres model's pk;\n we have to support both for a little while until all\n foreign keys are migrated over\n \"\"\"\n backend_classes = smsutil.get_backend_classes()\n api_id = api_id or cls.get_backend_api_id(backend_id, is_couch_id=is_couch_id)\n\n if api_id not in backend_classes:\n raise BadSMSConfigException(\"Unexpected backend api id found '%s' for \"\n \"backend '%s'\" % (api_id, backend_id))\n\n klass = backend_classes[api_id]\n\n if include_deleted:\n result = klass.objects\n else:\n result = klass.active_objects\n\n if is_couch_id:\n return result.get(couch_id=backend_id)\n else:\n return result.get(pk=backend_id)", "metadata": "root.SQLMobileBackend.load", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1891 }, { "content": " @classmethod\n def get_backend_from_id_and_api_id_result(cls, result):\n if len(result) > 0:\n return cls.load(result[0]['id'], api_id=result[0]['hq_api_id'])\n\n return None", "metadata": "root.SQLMobileBackend.get_backend_from_id_and_api_id_result", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1923 }, { "content": " @classmethod\n def get_owned_backend_by_name(cls, backend_type, domain, name):\n name = name.strip().upper()\n result = cls.active_objects.filter(\n is_global=False,\n backend_type=backend_type,\n domain=domain,\n name=name\n ).values('id', 'hq_api_id')\n return cls.get_backend_from_id_and_api_id_result(result)", "metadata": "root.SQLMobileBackend.get_owned_backend_by_name", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1930 }, { "content": " @classmethod\n def get_shared_backend_by_name(cls, backend_type, domain, name):\n name = name.strip().upper()\n result = cls.active_objects.filter(\n is_global=False,\n backend_type=backend_type,\n mobilebackendinvitation__domain=domain,\n mobilebackendinvitation__accepted=True,\n name=name\n ).values('id', 'hq_api_id').order_by('domain')\n return cls.get_backend_from_id_and_api_id_result(result)", "metadata": "root.SQLMobileBackend.get_shared_backend_by_name", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1941 }, { "content": " @classmethod\n def get_global_backend_by_name(cls, backend_type, name):\n name = name.strip().upper()\n result = cls.active_objects.filter(\n is_global=True,\n backend_type=backend_type,\n name=name\n ).values('id', 'hq_api_id')\n return cls.get_backend_from_id_and_api_id_result(result)", "metadata": "root.SQLMobileBackend.get_global_backend_by_name", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1953 }, { "content": " @classmethod\n def load_by_name(cls, backend_type, domain, name):\n \"\"\"\n Attempts to load the backend with the given name.\n If no matching backend is found, a BadSMSConfigException is raised.\n\n backend_type - SQLMobileBackend.SMS or SQLMobileBackend.IVR\n domain - the domain\n name - the name of the backend (corresponding to SQLMobileBackend.name)\n \"\"\"\n backend = cls.get_owned_backend_by_name(backend_type, domain, name)\n\n if not backend:\n backend = cls.get_shared_backend_by_name(backend_type, domain, name)\n\n if not backend:\n backend = cls.get_global_backend_by_name(backend_type, name)\n\n if not backend:\n raise BadSMSConfigException(\"Could not find %s backend '%s' from \"\n \"domain '%s'\" % (backend_type, name, domain))\n\n return backend", "metadata": "root.SQLMobileBackend.load_by_name", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1963 }, { "content": " @classmethod\n def get_api_id(cls):\n \"\"\"\n This method should return the backend's api id.\n \"\"\"\n raise NotImplementedError(\"Please implement this method\")", "metadata": "root.SQLMobileBackend.get_api_id", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1987 }, { "content": " @classmethod\n def get_generic_name(cls):\n \"\"\"\n This method should return a descriptive name for this backend\n (such as \"Unicel\" or \"Tropo\"), for use in identifying it to an end user.\n \"\"\"\n raise NotImplementedError(\"Please implement this method\")", "metadata": "root.SQLMobileBackend.get_generic_name", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 1994 }, { "content": " @classmethod\n def get_form_class(cls):\n \"\"\"\n This method should return a subclass of corehq.apps.sms.forms.BackendForm\n \"\"\"\n raise NotImplementedError(\"Please implement this method\")", "metadata": "root.SQLMobileBackend.get_form_class", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2002 }, { "content": " @classmethod\n def get_available_extra_fields(cls):\n \"\"\"\n Should return a list of field names that are the keys in\n the extra_fields dict.\n \"\"\"\n raise NotImplementedError(\"Please implement this method\")", "metadata": "root.SQLMobileBackend.get_available_extra_fields", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2009 }, { "content": " @property\n def config(self):\n \"\"\"\n Returns self.get_extra_fields() converted into a namedtuple so that\n you can reference self.config.gateway_user_id, for example,\n instead of self.get_extra_fields()['gateway_user_id']\n \"\"\"\n BackendConfig = namedtuple('BackendConfig', self.get_available_extra_fields())\n return BackendConfig(**self.get_extra_fields())", "metadata": "root.SQLMobileBackend.config", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2017 }, { "content": " def get_extra_fields(self):\n result = {field: None for field in self.get_available_extra_fields()}\n result.update(self.extra_fields)\n return result", "metadata": "root.SQLMobileBackend.get_extra_fields", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2027 }, { "content": " def set_extra_fields(self, **kwargs):\n \"\"\"\n Only updates the fields that are passed as kwargs, and leaves\n the rest untouched.\n \"\"\"\n result = self.get_extra_fields()\n for k, v in kwargs.iteritems():\n if k not in self.get_available_extra_fields():\n raise Exception(\"Field %s is not an available extra field for %s\"\n % (k, self.__class__.__name__))\n result[k] = v\n\n self.extra_fields = result", "metadata": "root.SQLMobileBackend.set_extra_fields", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2032 }, { "content": " def __clear_shared_domain_cache(self, new_domains):\n current_domains = self.mobilebackendinvitation_set.values_list('domain', flat=True)\n # Clear the cache for domains in new_domains or current_domains, but not both\n for domain in set(current_domains) ^ set(new_domains):\n self.domain_is_shared.clear(self, domain)", "metadata": "root.SQLMobileBackend.__clear_shared_domain_cache", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2046 }, { "content": " def set_shared_domains(self, domains):\n if self.id is None:\n raise Exception(\"Please call .save() on the backend before \"\n \"calling set_shared_domains()\")\n with transaction.atomic():\n self.__clear_shared_domain_cache(domains)\n self.mobilebackendinvitation_set.all().delete()\n self.mobilebackendinvitation_set = [\n MobileBackendInvitation(\n domain=domain,\n accepted=True,\n ) for domain in domains\n ]", "metadata": "root.SQLMobileBackend.set_shared_domains", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2052 }, { "content": " def soft_delete(self):\n with transaction.atomic():\n self.deleted = True\n self.__clear_shared_domain_cache([])\n self.mobilebackendinvitation_set.all().delete()\n for mapping in self.sqlmobilebackendmapping_set.all():\n # Delete one at a time so the backend map cache gets cleared\n # for the respective domain(s)\n mapping.delete()\n self.save()", "metadata": "root.SQLMobileBackend.soft_delete", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2066 }, { "content": " def __clear_caches(self):\n if self.pk:\n self.load.clear(SQLMobileBackend, self.pk, is_couch_id=False)\n self.get_backend_api_id.clear(SQLMobileBackend, self.pk, is_couch_id=False)\n\n if self.couch_id:\n self.load.clear(SQLMobileBackend, self.couch_id, is_couch_id=True)\n self.get_backend_api_id.clear(SQLMobileBackend, self.couch_id, is_couch_id=True)", "metadata": "root.SQLMobileBackend.__clear_caches", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2077 }, { "content": " def save(self, *args, **kwargs):\n self.__clear_caches()\n return super(SQLMobileBackend, self).save(*args, **kwargs)", "metadata": "root.SQLMobileBackend.save", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2086 }, { "content": " def delete(self, *args, **kwargs):\n self.__clear_caches()\n return super(SQLMobileBackend, self).delete(*args, **kwargs)", "metadata": "root.SQLMobileBackend.delete", "header": "['class', 'SQLMobileBackend', '(', 'UUIDGeneratorMixin', ',', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2090 }, { "content": "class SQLSMSBackend(SQLMobileBackend):\n class Meta:\n proxy = True\n app_label = 'sms'\n\n\n\n", "metadata": "root.SQLSMSBackend", "header": "['module', '___EOS___']", "index": 2095 }, { "content": " def get_sms_rate_limit(self):\n \"\"\"\n Override to use rate limiting. Return None to not use rate limiting,\n otherwise return the maximum number of SMS that should be sent by\n this backend instance in a one minute period.\n \"\"\"\n return None", "metadata": "root.SQLSMSBackend.get_sms_rate_limit", "header": "['class', 'SQLSMSBackend', '(', 'SQLMobileBackend', ')', ':', '___EOS___']", "index": 2100 }, { "content": " def send(self, msg, *args, **kwargs):\n raise NotImplementedError(\"Please implement this method.\")", "metadata": "root.SQLSMSBackend.send", "header": "['class', 'SQLSMSBackend', '(', 'SQLMobileBackend', ')', ':', '___EOS___']", "index": 2108 }, { "content": " @classmethod\n def get_opt_in_keywords(cls):\n \"\"\"\n Override to specify a set of opt-in keywords to use for this\n backend type.\n \"\"\"\n return []", "metadata": "root.SQLSMSBackend.get_opt_in_keywords", "header": "['class', 'SQLSMSBackend', '(', 'SQLMobileBackend', ')', ':', '___EOS___']", "index": 2111 }, { "content": " @classmethod\n def get_opt_out_keywords(cls):\n \"\"\"\n Override to specify a set of opt-out keywords to use for this\n backend type.\n \"\"\"\n return []", "metadata": "root.SQLSMSBackend.get_opt_out_keywords", "header": "['class', 'SQLSMSBackend', '(', 'SQLMobileBackend', ')', ':', '___EOS___']", "index": 2119 }, { "content": "class PhoneLoadBalancingMixin(object):\n \"\"\"\n If you need a backend to balance the outbound SMS load over a set of\n phone numbers, use this mixin. To use it:\n\n 1) Include this mixin in your backend class.\n 2) Have the send() method expect an orig_phone_number kwarg, which will\n be the phone number to send from. This parameter is always sent in for\n instances of PhoneLoadBalancingMixin, even if there's just one phone\n number in self.load_balancing_numbers.\n 3) Have the backend's form class use the LoadBalancingBackendFormMixin to\n automatically set the load balancing phone numbers in the UI.\n\n If the backend also uses rate limiting, then each phone number is rate\n limited separately as you would expect.\n\n (We could also just define these methods on the backend class itself, but\n it's useful in other parts of the framework to check if a backend\n is an instance of this mixin for performing various operations.)\n \"\"\"\n\n", "metadata": "root.PhoneLoadBalancingMixin", "header": "['module', '___EOS___']", "index": 2128 }, { "content": " def get_load_balance_redis_key(self):\n return 'load-balance-phones-for-backend-%s' % self.pk", "metadata": "root.PhoneLoadBalancingMixin.get_load_balance_redis_key", "header": "['class', 'PhoneLoadBalancingMixin', '(', 'object', ')', ':', '___EOS___']", "index": 2149 }, { "content": " def get_next_phone_number(self):\n if (\n not isinstance(self.load_balancing_numbers, list) or\n len(self.load_balancing_numbers) == 0\n ):\n raise Exception(\"Expected load_balancing_numbers to not be \"\n \"empty for backend %s\" % self.pk)\n\n if len(self.load_balancing_numbers) == 1:\n # If there's just one number, no need to go through the\n # process to figure out which one is next.\n return self.load_balancing_numbers[0]\n\n redis_key = self.get_load_balance_redis_key()\n return load_balance(redis_key, self.load_balancing_numbers)", "metadata": "root.PhoneLoadBalancingMixin.get_next_phone_number", "header": "['class', 'PhoneLoadBalancingMixin', '(', 'object', ')', ':', '___EOS___']", "index": 2152 }, { "content": "class BackendMap(object):\n", "metadata": "root.BackendMap", "header": "['module', '___EOS___']", "index": 2169 }, { "content": " def __init__(self, catchall_backend_id, backend_map):\n \"\"\"\n catchall_backend_id - the pk of the backend that is the default if\n no prefixes match (can be None if there is no\n catch all)\n backend_map - a dictionary of {prefix: backend pk} which\n maps a phone prefix to the backend which should be\n used for that phone prefix\n \"\"\"\n self.catchall_backend_id = catchall_backend_id\n self.backend_map_dict = backend_map\n self.backend_map_tuples = backend_map.items()\n # Sort by length of prefix descending\n self.backend_map_tuples.sort(key=lambda x: len(x[0]), reverse=True)", "metadata": "root.BackendMap.__init__", "header": "['class', 'BackendMap', '(', 'object', ')', ':', '___EOS___']", "index": 2170 }, { "content": " def get_backend_id_by_prefix(self, phone_number):\n phone_number = smsutil.strip_plus(phone_number)\n for prefix, backend_id in self.backend_map_tuples:\n if phone_number.startswith(prefix):\n return backend_id\n return self.catchall_backend_id", "metadata": "root.BackendMap.get_backend_id_by_prefix", "header": "['class', 'BackendMap', '(', 'object', ')', ':', '___EOS___']", "index": 2185 }, { "content": "class SQLMobileBackendMapping(models.Model):\n \"\"\"\n A SQLMobileBackendMapping instance is used to map SMS or IVR traffic\n to a given backend based on phone prefix.\n \"\"\"\n class Meta:\n db_table = 'messaging_mobilebackendmapping'\n app_label = 'sms'\n unique_together = ('domain', 'backend_type', 'prefix')\n\n couch_id = models.CharField(max_length=126, null=True, db_index=True)\n\n # True if this mapping applies globally (system-wide). False if it only applies\n # to a domain\n is_global = models.BooleanField(default=False)\n\n # The domain for which this mapping is valid; ignored if is_global is True\n domain = models.CharField(max_length=126, null=True)\n\n # Specifies whether this mapping is valid for SMS or IVR backends\n backend_type = models.CharField(max_length=3, choices=SQLMobileBackend.TYPE_CHOICES)\n\n # The phone prefix, or '*' for catch-all\n prefix = models.CharField(max_length=25)\n\n # The backend to use for the given phone prefix\n backend = models.ForeignKey('SQLMobileBackend')\n\n\n\n\n\n\n", "metadata": "root.SQLMobileBackendMapping", "header": "['module', '___EOS___']", "index": 2193 }, { "content": " @classmethod\n def __set_default_domain_backend(cls, domain, backend_type, backend=None):\n fields = dict(\n is_global=False,\n domain=domain,\n backend_type=backend_type,\n prefix='*'\n )\n\n obj = None\n try:\n # We can't use get_or_create because backend is a\n # required field\n obj = cls.objects.get(**fields)\n except cls.DoesNotExist:\n pass\n\n if not backend:\n if obj:\n obj.delete()\n return\n\n if not obj:\n obj = cls(**fields)\n\n obj.backend = backend\n obj.save()", "metadata": "root.SQLMobileBackendMapping.__set_default_domain_backend", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2221 }, { "content": " @classmethod\n def set_default_domain_backend(cls, domain, backend, backend_type=SQLMobileBackend.SMS):\n cls.__set_default_domain_backend(domain, backend_type, backend=backend)", "metadata": "root.SQLMobileBackendMapping.set_default_domain_backend", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2249 }, { "content": " @classmethod\n def unset_default_domain_backend(cls, domain, backend_type=SQLMobileBackend.SMS):\n cls.__set_default_domain_backend(domain, backend_type)", "metadata": "root.SQLMobileBackendMapping.unset_default_domain_backend", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2253 }, { "content": " @classmethod\n @quickcache(['backend_type', 'domain'], timeout=5 * 60)\n def get_prefix_to_backend_map(cls, backend_type, domain=None):\n \"\"\"\n backend_type - SQLMobileBackend.SMS or SQLMobileBackend.IVR\n domain - the domain for which to retrieve the backend map, otherwise if left None\n the global backend map will be returned.\n Returns a BackendMap\n \"\"\"\n if domain:\n filter_args = {'backend_type': backend_type, 'is_global': False, 'domain': domain}\n else:\n filter_args = {'backend_type': backend_type, 'is_global': True}\n\n catchall_backend_id = None\n backend_map = {}\n for instance in cls.objects.filter(**filter_args):\n if instance.prefix == '*':\n catchall_backend_id = instance.backend_id\n else:\n backend_map[instance.prefix] = instance.backend_id\n\n return BackendMap(catchall_backend_id, backend_map)", "metadata": "root.SQLMobileBackendMapping.get_prefix_to_backend_map", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2257 }, { "content": " def __clear_prefix_to_backend_map_cache(self):\n self.get_prefix_to_backend_map.clear(self.__class__, self.backend_type, domain=self.domain)", "metadata": "root.SQLMobileBackendMapping.__clear_prefix_to_backend_map_cache", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2281 }, { "content": " def save(self, *args, **kwargs):\n self.__clear_prefix_to_backend_map_cache()\n return super(SQLMobileBackendMapping, self).save(*args, **kwargs)", "metadata": "root.SQLMobileBackendMapping.save", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2284 }, { "content": " def delete(self, *args, **kwargs):\n self.__clear_prefix_to_backend_map_cache()\n return super(SQLMobileBackendMapping, self).delete(*args, **kwargs)", "metadata": "root.SQLMobileBackendMapping.delete", "header": "['class', 'SQLMobileBackendMapping', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2288 }, { "content": "class MobileBackendInvitation(models.Model):\n class Meta:\n db_table = 'messaging_mobilebackendinvitation'\n app_label = 'sms'\n unique_together = ('backend', 'domain')\n\n # The domain that is being invited to share another domain's backend\n domain = models.CharField(max_length=126, null=True, db_index=True)\n\n # The backend that is being shared\n backend = models.ForeignKey('SQLMobileBackend')\n accepted = models.BooleanField(default=False)", "metadata": "root.MobileBackendInvitation", "header": "['module', '___EOS___']", "index": 2293 }, { "content": "class MigrationStatus(models.Model):\n \"\"\"\n A model to keep track of whether certain messaging migrations have\n been run yet or not.\n \"\"\"\n\n MIGRATION_BACKEND = 'backend'\n MIGRATION_BACKEND_MAP = 'backend_map'\n MIGRATION_DOMAIN_DEFAULT_BACKEND = 'domain_default_backend'\n MIGRATION_LOGS = 'logs'\n\n class Meta:\n db_table = 'messaging_migrationstatus'\n app_label = \"sms\"\n\n # The name of the migration (one of the MIGRATION_* constants above)\n name = models.CharField(max_length=126)\n\n # The timestamp that the migration was run\n timestamp = models.DateTimeField(null=True)\n\n", "metadata": "root.MigrationStatus", "header": "['module', '___EOS___']", "index": 2307 }, { "content": " @classmethod\n def set_migration_completed(cls, name):\n obj, created = cls.objects.get_or_create(name=name)\n obj.timestamp = datetime.utcnow()\n obj.save()", "metadata": "root.MigrationStatus.set_migration_completed", "header": "['class', 'MigrationStatus', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2328 }, { "content": " @classmethod\n def has_migration_completed(cls, name):\n try:\n cls.objects.get(name=name)\n return True\n except cls.DoesNotExist:\n return False", "metadata": "root.MigrationStatus.has_migration_completed", "header": "['class', 'MigrationStatus', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 2334 } ]
[ { "span": "import logging", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 }, { "span": "import uuidfield", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 16 }, { "span": "from corehq.apps.sms.mixin import (CommCareMobileContactMixin,\n PhoneNumberInUseException, InvalidFormatException, VerifiedNumber,\n apply_leniency, BadSMSConfigException)", "start_line": 19, "start_column": 0, "end_line": 21, "end_column": 42 }, { "span": "from dimagi.utils.couch.undo import DELETED_SUFFIX", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 50 }, { "span": "from dimagi.utils.logging import notify_exception", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 49 }, { "span": "from corehq.apps.sms import signals", "start_line": 2343, "start_column": 0, "end_line": 2343, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", " ", "ai", " ", "ts", "=", "4", " ", "sts", "=", "4", " ", "et", " ", "sw", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "ext_", "._", "couchdb", "kit_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "dba", "ccess", "ors_", "import_", "get", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "models_", "import_", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "mixin_", "import_", "UU", "ID", "Generat", "or", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "models_", "import_", "Cou", "ch", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "case_", "._", "models_", "import_", "Comm", "Care", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "couch", "_", "._", "migration_", "import_", "Sync", "SQL", "To", "Cou", "ch", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "mixins_", "import_", "Unic", "ode", "Mix", "In_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "parsing_", "import_", "json", "\\u", "format\\u", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "mixin_", "import_", "(_", "Comm", "Care", "Mob", "ile", "Conta", "ct", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Phone", "Number", "In", "Us", "e", "Exception_", ",_", "Inva", "lid", "Format", "Exception_", ",_", "Verifie", "d", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "appl", "y", "\\u", "len", "ien", "cy_", ",_", "Ba", "d", "SMS", "Config", "Exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "import_", "util_", "as_", "sms", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "messages_", "import_", "(_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "INVI", "TAT", "ION", "\\u", "START_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "ANDROID", "\\u", "INVI", "TAT", "ION_", ",_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "JAVA", "\\u", "INVI", "TAT", "ION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "quick", "cache_", "import_", "quick", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "view", "\\u", "utils_", "import_", "abs", "olute", "\\u", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "couch", "_", "._", "undo_", "import_", "DELETED", "\\u", "SUFFIX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "couch", "_", "import_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "load", "\\u", "balance_", "import_", "load", "\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "logging_", "import_", "notif", "y", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "noop_", ",_", "uge", "ttext", "\\u", "lazy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INCOM", "ING_", "=_", "\"", "I", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OUT", "GO", "ING_", "=_", "\"", "O", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CALL", "BACK", "\\u", "PENDING_", "=_", "\"", "PEND", "ING", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CALL", "BACK", "\\u", "RECEIVE", "D_", "=_", "\"", "RECEIVE", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CALL", "BACK", "\\u", "MIS", "SED", "_", "=_", "\"", "MIS", "SED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FORWARD", "\\u", "ALL_", "=_", "\"", "ALL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FORWARD", "\\u", "BY", "\\u", "KEYWORD", "_", "=_", "\"", "KEYWORD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FORWARD", "ING", "\\u", "CHOICES_", "=_", "[_", "FORWARD", "\\u", "ALL_", ",_", "FORWARD", "\\u", "BY", "\\u", "KEYWORD", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WORK", "FLOW", "\\u", "CALL", "BACK_", "=_", "\"", "CALL", "BACK", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "REM", "INDE", "R_", "=_", "\"", "REM", "INDE", "R", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "KEYWORD", "_", "=_", "\"", "KEYWORD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "FORWARD", "_", "=_", "\"", "FORWARD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "BROADCAST", "_", "=_", "\"", "BROADCAST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "PERF", "ORM", "ANCE", "_", "=_", "\"", "PERF", "ORM", "ANCE", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORK", "FLOW", "\\u", "DEFAULT_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIRECTION", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "INCOM", "ING_", ",_", "\"", "Inco", "ming", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "OUT", "GO", "ING_", ",_", "\"", "Out", "goi", "ng", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_",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\u\\u\\uDEDENT\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "import_", "signals_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "doc_", "=_", "\"", "Messag", "e", "Log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "String", "Property_", "(_", ")_", "#", " ", "\"", "Comm", "Care", "Case", "\",", " ", "\"", "Comm", "Care", "User", "\",", " ", "\"", "Web", "User", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "String", "Property_", "(_", ")_", "#", " ", "\\u", "id", " ", "of", " ", "the", " ", "contact", " ", "who", " ", "this", " ", "sms", " ", "was", " ", "sent", " ", "to", "/", "from_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "direction_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "api_", "=_", "String", "Property_", "(_", ")_", "#", " ", "Thi", "s", " ", "must", " ", "be", " ", "set", " ", "to", " ", "<", "back", "end", " ", "module", ">.", "API", "\\u", "ID", " ", "in", " ", "order", " ", "to", " ", "process", " ", "bill", "ing", " ", "correct", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bill", "ed_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bill", "ing", "\\u", "errors_", "=_", "List", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chat", "\\u", "user", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "#", " ", "For", " ", "outgoing", " ", "sms", " ", "only", ":", " ", "if", " ", "this", " ", "sms", " ", "was", " ", "sent", " ", "from", " ", "a", " ", "chat", " ", "window", ",", " ", "the", " ", "\\u", "id", " ", "of", " ", "the", " ", "Cou", "ch", "User", " ", "who", " ", "sent", " ", "this", " ", "sms", ";", " ", "other", "wis", "e", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "=_", "String", "Property_", "(_", ")_", "#", " ", "One", " ", "of", " ", "the", " ", "WORK", "FLOW", "\\u*", " ", "constant", "s", " ", "above", " ", "descri", "bing", " ", "what", " ", "kind", " ", "of", " ", "workf", "low", " ", "this", " ", "sms", " ", "was", " ", "a", " ", "part", " ", "of_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Point", "s", " ", "to", " ", "the", " ", "couch", "\\u", "id", " ", "of", " ", "an", " ", "instance", " ", "of", " ", "SQL", "XF", "orms", "Session_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "this", " ", "message", " ", "is", " ", "tied", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "xform", "s", "\\u", "session", "\\u", "couch", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reminder", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "#", " ", "Point", "s", " ", "to", " ", "the", " ", "\\u", "id", " ", "of", " ", "an", " ", "instance", " ", "of", " ", "core", "hq", ".", "apps", ".", "reminder", "s", ".", "model", "s", ".", "Case", "Remi", "nder", " ", "tha", "t", " ", "this", " ", "sms", " ", "is", " ", "tied", " ", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processed_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datetime", "\\u", "to", "\\u", "process_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "process", "ing", "\\u", "attempts_", "=_", "Integer", "Property_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "error", "\\u", "message_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "message", " ", "was", " ", "simulat", "ed", " ", "from", " ", "a", " ", "domain", ",", " ", "this", " ", "is", " ", "the", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "scope_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "d\\u", "timestamp_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "timestamp_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "outgoing", " ", "message", " ", "is", " ", "a", " ", "repl", "y", " ", "to", " ", "an", " ", "inbound", " ", "message", ",", " ", "then", " ", "this", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "\\u", "id", " ", "of", " ", "the", " ", "inbound", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "For", " ", "now", " ", "this", " ", "is", " ", "a", " ", "placehold", "er", " ", "and", " ", "need", "s", " ", "to", " ", "be", " ", "implemented", "_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "repl", "y", "\\u", "to_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "phone", "\\u", "number_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "to", " ", "Tru", "e", " ", "to", " ", "send", " ", "the", " ", "message", " ", "rega", "rd", "less", " ", "of", " ", "whe", "ther", " ", "the", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "phone", " ", "number", " ", "has", " ", "opt", "ed", "-", "out", ".", " ", "Sho", "ul", "d", " ", "only", " ", "be", " ", "used", " ", "to", " ", "send", " ", "opt", "-", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replies", " ", "or", " ", "other", " ", "info", "-", "relate", "d", " ", "querie", "s", " ", "whi", "le", " ", "opt", "ed", "-", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "opt", "\\u", "out_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "from_", "=_", "(_", "self_", "._", "direction_", "==_", "INCOM", "ING_", ")_", "and_", "\"", "from", "\"_", "or_", "\"", "to", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "Messag", "e", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "to", "\\u", "from_", ",_", "self_", "._", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "system", "\\u", "error_", "(_", "self_", ",_", "message_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "system", "\\u", "error", "\\u", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "phone", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "couch", "\\u", "recipient_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "==_", "\"", "Comm", "Care", "Case", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "Comm", "Care", "Case_", "._", "get_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mus", "t", " ", "be", " ", "a", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "Cou", "ch", "User_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "id_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "recipient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "==_", "\"", "Comm", "Care", "Case", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Comm", "Care", "Case_", "._", "get_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "\\u\\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_", "Cou", "ch", "User_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "id_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "domain", "\\u", "asc_", "(_", "cls_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "{_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "descend", "ing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "by", "\\u", "domain", "\\u", "dsc", "_", "(_", "cls_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "{_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "descend", "ing_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "count", "\\u", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "end", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "date_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reduced_", "=_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "start", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "end", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reduced_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reduced_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "count", "\\u", "inco", "ming", "\\u", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "end", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "date_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reduced_", "=_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "direction", "\\u", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "I", "\"_", "]_", "+_", "[_", "start", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "I", "\"_", "]_", "+_", "[_", "end", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reduced_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reduced_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "count", "\\u", "outgoing", "\\u", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "end", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "date_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reduced_", "=_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "direction", "\\u", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "O", "\"_", "]_", "+_", "[_", "start", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "O", "\"_", "]_", "+_", "[_", "end", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reduced_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reduced_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "by", "\\u", "domain", "\\u", "date_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Log", " ", "querie", "s", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "domain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "start", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", "]_", "+_", "[_", "end", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Log_", "(_", "Safe", "Save", "Document_", ",_", "Unic", "ode", "Mix", "In_", ")_", ":_", "\\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_", "inbound", "\\u", "entry", "\\u", "exists_", "(_", "cls_", ",_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ",_", "from", "\\u", "timestamp_", ",_", "to", "\\u", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "to", " ", "see", " ", "if", " ", "an", " ", "inbound", " ", "sms", " ", "or", " ", "call", " ", "exist", "s", " ", "for", " ", "the", " ", "give", "n", " ", "caller", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "contact", "\\u", "doc", "\\u", "type", " ", "-", " ", "The", " ", "doc", "\\u", "type", " ", "of", " ", "the", " ", "contact", " ", "(", "e", ".", "g", ".,", " ", "\"", "Comm", "Care", "Case", "\")", "\\", "10", ";", " ", " ", " ", " ", "contact", "\\u", "id", " ", "-", " ", "The", " ", "\\u", "id", " ", "of", " ", "the", " ", "contact", "\\", "10", ";", " ", " ", " ", " ", "after", "\\u", "timestamp", " ", "-", " ", "The", " ", "datetime", " ", "after", " ", "whi", "ch", " ", "to", " ", "check", " ", "for", " ", "the", " ", "existence", " ", "of", " ", "an", " ", "entry", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", " ", "Tru", "e", " ", "if", " ", "an", " ", "sms", "/", "call", " ", "exist", "s", " ", "in", " ", "the", " ", "log", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls_", "._", "\\u\\u", "name\\u\\u_", "==_", "\"", "Messag", "e", "Log", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Not", " ", "implemented", " ", "for", " ", "base", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "\\u", "timestamp", "\\u", "str_", "=_", "json", "\\u", "format\\u", "datetime_", "(_", "from", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "timestamp", "\\u", "str_", "=_", "json", "\\u", "format\\u", "datetime_", "(_", "to", "\\u", "timestamp_", "or_", "datetime_", "._", "utcnow_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduced_", "=_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "recip", "ient", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "INCOM", "ING_", ",_", "from", "\\u", "timestamp", "\\u", "str_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "INCOM", "ING_", ",_", "to", "\\u", "timestamp", "\\u", "str_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reduced_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "reduced_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SMS", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "case", "s", " ", "where", " ", "deco", "ding", " ", "must", " ", "occur", ",", " ", "this", " ", "is", " ", "the", " ", "raw", " ", "text", " ", "received_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "gateway_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "text_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "unique", " ", "message", " ", "id", " ", "tha", "t", " ", "the", " ", "gateway", " ", "use", "s", " ", "to", " ", "track", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", ",", " ", "if", " ", "applica", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "message", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "this", " ", "was", " ", "an", " ", "inbound", " ", "message", " ", "tha", "t", " ", "was", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalid", " ", "response", " ", "to", " ", "a", " ", "survey", " ", "question_", "\\u\\u\\uNL\\u\\u\\u_", "invalid", "\\u", "survey", "\\u", "response_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mess", "agin", "g", "\\u", "sube", "vent", "\\u", "id_", "=_", "Integer", "Property_", "(_", ")_", "\\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_", "SMS", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "outb", "ound", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "appropr", "iate", " ", "outb", "ound", " ", "sms", " ", "back", "end", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "back", "end", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SQL", "Mob", "ile", "Backend_", "._", "load_", "(_", "self_", "._", "back", "end", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SQL", "Mob", "ile", "Backend_", "._", "load", "\\u", "default", "\\u", "by", "\\u", "phone", "\\u", "and", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "SQL", "Mob", "ile", "Backend_", "._", "SMS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sms", "util_", "._", "clean", "\\u", "phone", "\\u", "number_", "(_", "self_", "._", "phone", "\\u", "number_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "self_", "._", "domain_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMS", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "crop", " ", "the", " ", "text", " ", "(", "to", " ", "avoid", " ", "expl", "odi", "ng", " ", "the", " ", "admin", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "text_", ")_", "<_", "60_", ":_", "str_", "=_", "self_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "str_", "=_", "\"%", "s", "...\"_", "%_", "(_", "self_", "._", "text_", "[_", "0_", ":_", "57_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "from_", "=_", "(_", "self_", "._", "direction_", "==_", "INCOM", "ING_", ")_", "and_", "\"", "from", "\"_", "or_", "\"", "to", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", " ", "(%", "s", " ", "%", "s", ")\"_", "%_", "(_", "str_", ",_", "to", "\\u", "from_", ",_", "self_", "._", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "\"", "sms", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "direction_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "1_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "error", "\\u", "message_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "api_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bill", "ed_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Describe", "s", " ", "what", " ", "kind", " ", "of", " ", "workf", "low", " ", "this", " ", "log", " ", "was", " ", "a", " ", "part", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "log", " ", "is", " ", "relate", "d", " ", "to", " ", "a", " ", "survey", ",", " ", "this", " ", "points", " ", "to", " ", "the", " ", "couch", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "an", " ", "instance", " ", "of", " ", "SQL", "XF", "orms", "Sess", "ion", " ", "tha", "t", " ", "this", " ", "log", " ", "is", " ", "tied", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "xform", "s", "\\u", "session", "\\u", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "log", " ", "is", " ", "relate", "d", " ", "to", " ", "a", " ", "reminder", ",", " ", "this", " ", "points", " ", "to", " ", "the", " ", "\\u", "id", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Case", "Remi", "nder", " ", "instance", " ", "tha", "t", " ", "it", " ", "is", " ", "tied", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "reminder", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Messag", "ing", "Sub", "Event", " ", "tha", "t", " ", "this", " ", "log", " ", "is", " ", "tied", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "mess", "agin", "g", "\\u", "sube", "vent_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "Messag", "ing", "Sub", "Event", "'_", ",_", "null_", "=_", "True_", ",_", "on", "\\u", "delete_", "=_", "models_", "._", "PROTECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "system", "\\u", "error_", "(_", "self_", ",_", "message_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "system", "\\u", "error", "\\u", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "date", "\\u\\u", "gte_", "=_", "start", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "date", "\\u\\u", "lte_", "=_", "end", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "by", "\\u", "recipient_", "(_", "cls_", ",_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "contact", "\\u", "doc", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "contact", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "last", "\\u", "log", "\\u", "for", "\\u", "recipient_", "(_", "cls_", ",_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ",_", "direction_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "by", "\\u", "recipient_", "(_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "direction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "direction_", "=_", "direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qs_", "=_", "qs_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "[_", ":_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "qs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "qs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "count", "\\u", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "direction_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "direction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "direction_", "=_", "direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "qs_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "recipient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "==_", "'", "Comm", "Care", "Case", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Comm", "Care", "Case_", "._", "get_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "\\u\\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_", "Cou", "ch", "User_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "id_", "(_", "self_", "._", "couch", "\\u", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inbound", "\\u", "entry", "\\u", "exists_", "(_", "cls_", ",_", "contact", "\\u", "doc", "\\u", "type_", ",_", "contact", "\\u", "id_", ",_", "from", "\\u", "timestamp_", ",_", "to", "\\u", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "by", "\\u", "recipient_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "doc", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "direction_", "=_", "INCOM", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u\\u", "gte_", "=_", "from", "\\u", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "to", "\\u", "timestamp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u\\u", "lte_", "=_", "to", "\\u", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "len_", "(_", "qs_", "[_", ":_", "1_", "]_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SMS", "Base_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "Log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ERROR", "\\u", "TOO", "\\u", "MAN", "Y", "\\u", "UNSU", "CC", "ESS", "FU", "L", "\\u", "ATTE", "MPT", "S_", "=_", "'", "TOO", "\\u", "MAN", "Y", "\\u", "UNSU", "CC", "ESS", "FU", "L", "\\u", "ATTE", "MPT", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "MESSAGE", "\\u", "IS", "\\u", "STA", "LE_", "=_", "'", "MESSAGE", "\\u", "IS", "\\u", "STA", "LE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "DIRECTION", "_", "=_", "'", "INVALID", "\\u", "DIRECTION", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "PHONE", "\\u", "NUMB", "ER", "\\u", "OPT", "ED", "\\u", "OUT_", "=_", "'", "PHONE", "\\u", "NUMB", "ER", "\\u", "OPT", "ED", "\\u", "OUT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "DEST", "INATION", "\\u", "NUMBER_", "=_", "'", "INVALID", "\\u", "DEST", "INATION", "\\u", "NUMB", "ER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "MESSAGE", "\\u", "TOO", "\\u", "LONG_", "=_", "'", "MESSAGE", "\\u", "TOO", "\\u", "LONG", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "MESSAGES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "TOO", "\\u", "MAN", "Y", "\\u", "UNSU", "CC", "ESS", "FU", "L", "\\u", "ATTE", "MPT", "S_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Gat", "ewa", "y", " ", "error", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "MESSAGE", "\\u", "IS", "\\u", "STA", "LE_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Messag", "e", " ", "is", " ", "stale", " ", "and", " ", "will", " ", "not", " ", "be", " ", "process", "ed", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "DIRECTION", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Un", "know", "n", " ", "message", " ", "direction", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "PHONE", "\\u", "NUMB", "ER", "\\u", "OPT", "ED", "\\u", "OUT_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Phone", " ", "number", " ", "has", " ", "opt", "ed", " ", "out", " ", "of", " ", "receiv", "ing", " ", "SMS", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "DEST", "INATION", "\\u", "NUMBER_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "The", " ", "gateway", " ", "can", "'", "t", " ", "reach", " ", "the", " ", "destinat", "ion", " ", "number", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "MESSAGE", "\\u", "TOO", "\\u", "LONG_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "The", " ", "gateway", " ", "coul", "d", " ", "not", " ", "process", " ", "the", " ", "message", " ", "bec", "aus", "e", " ", "it", " ", "was", " ", "too", " ", "long", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "IDS", "\\u", "TO", "\\u", "GENERATE", "_", "=_", "[_", "'", "couch", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "case", "s", " ", "where", " ", "deco", "ding", " ", "must", " ", "occur", ",", " ", "this", " ", "is", " ", "the", " ", "raw", " ", "text", " ", "received_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "gateway_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "text_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datetime", "\\u", "to", "\\u", "process_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processed_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "process", "ing", "\\u", "attempts_", "=_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "d\\u", "timestamp_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "timestamp_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "message", " ", "was", " ", "simulat", "ed", " ", "from", " ", "a", " ", "domain", ",", " ", "this", " ", "is", " ", "the", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "scope_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "to", " ", "Tru", "e", " ", "to", " ", "send", " ", "the", " ", "message", " ", "rega", "rd", "less", " ", "of", " ", "whe", "ther", " ", "the", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "phone", " ", "number", " ", "has", " ", "opt", "ed", "-", "out", ".", " ", "Sho", "ul", "d", " ", "only", " ", "be", " ", "used", " ", "to", " ", "send", " ", "opt", "-", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replies", " ", "or", " ", "other", " ", "info", "-", "relate", "d", " ", "querie", "s", " ", "whi", "le", " ", "opt", "ed", "-", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "opt", "\\u", "out_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "unique", " ", "message", " ", "id", " ", "tha", "t", " ", "the", " ", "gateway", " ", "use", "s", " ", "to", " ", "track", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", ",", " ", "if", " ", "applica", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "message", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "outgoing", " ", "sms", " ", "only", ":", " ", "if", " ", "this", " ", "sms", " ", "was", " ", "sent", " ", "from", " ", "a", " ", "chat", " ", "window", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "\\u", "id", " ", "of", " ", "the", " ", "Cou", "ch", "User", " ", "who", " ", "sent", " ", "this", " ", "sms", ";", " ", "other", "wis", "e", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "chat", "\\u", "user", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "this", " ", "was", " ", "an", " ", "inbound", " ", "message", " ", "tha", "t", " ", "was", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalid", " ", "response", " ", "to", " ", "a", " ", "survey", " ", "question_", "\\u\\u\\uNL\\u\\u\\u_", "invalid", "\\u", "survey", "\\u", "response_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Custom", " ", "proper", "ties", ".", " ", "For", " ", "the", " ", "initial", " ", "migrati", "on", ",", " ", "it", " ", "make", "s", " ", "it", " ", "easi", "er", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "put", " ", "these", " ", "here", ".", " ", "Event", "ual", "ly", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "moved", " ", "to", " ", "a", " ", "separate", " ", "table", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fri", "\\u", "message", "\\u", "bank", "\\u", "look", "up", "\\u", "completed_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fri", "\\u", "message", "\\u", "bank", "\\u", "message", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fri", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fri", "\\u", "risk", "\\u", "profile_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "1_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SMS", "Base_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "Log_", ")_", ":_", "\\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_", "outb", "ound", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "back", "end", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SQL", "Mob", "ile", "Backend_", "._", "load_", "(_", "self_", "._", "back", "end", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "SQL", "Mob", "ile", "Backend_", "._", "load", "\\u", "default", "\\u", "by", "\\u", "phone", "\\u", "and", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "SQL", "Mob", "ile", "Backend_", "._", "SMS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sms", "util_", "._", "clean", "\\u", "phone", "\\u", "number_", "(_", "self_", "._", "phone", "\\u", "number_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "self_", "._", "domain_", "\\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_", "SMS", "_", "(_", "SMS", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SMS", "_", "(_", "SMS", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "to", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "serializers_", "import_", "SMS", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "SMS", "Serializer_", "(_", "self_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMS", "_", "(_", "SMS", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "tasks_", "import_", "publi", "sh", "\\u", "sms", "\\u", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publi", "sh", "\\u", "sms", "\\u", "change_", "._", "delay_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Queued", "SMS", "_", "(_", "SMS", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "sms", "\\u", "queue", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Queued", "SMS", "_", "(_", "SMS", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "queue", "d\\u", "sms_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datetime", "\\u", "to", "\\u", "process", "\\u\\u", "lte_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\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_", "Las", "t", "Read", "Message_", "(_", "Document_", ",_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "id", " ", "of", " ", "Cou", "ch", "User", " ", "who", " ", "read", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "by_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "id", " ", "of", " ", "the", " ", "Cou", "ch", "User", " ", "or", " ", "Comm", "Care", "Case", " ", "who", " ", "the", " ", "message", " ", "was", " ", "sent", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "id", " ", "of", " ", "the", " ", "SMS", "Log", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "date", " ", "of", " ", "the", " ", "SMS", "Log", " ", "entry", ",", " ", "store", "d", " ", "here", " ", "redundant", "ly", " ", "to", " ", "prevent", " ", "a", " ", "lookup_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "timestamp_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Las", "t", "Read", "Message_", "(_", "Document_", ",_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "obj_", "(_", "cls_", ",_", "domain_", ",_", "read", "\\u", "by_", ",_", "contact", "\\u", "id_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Las", "t", "Read", "Message_", "._", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "/", "last", "\\u", "read", "\\u", "message", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "[_", "\"", "by", "\\u", "user", "\"_", ",_", "domain_", ",_", "read", "\\u", "by_", ",_", "contact", "\\u", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "t", "Read", "Message_", "(_", "Document_", ",_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", ")_", ":_", "\\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_", "create", "\\u", "obj_", "(_", "cls_", ",_", "domain_", ",_", "read", "\\u", "by_", ",_", "contact", "\\u", "id_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "Las", "t", "Read", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "by_", "=_", "read", "\\u", "by_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "contact", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "t", "Read", "Message_", "(_", "Document_", ",_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", ")_", ":_", "\\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_", "by", "\\u", "user_", "(_", "cls_", ",_", "domain_", ",_", "user", "\\u", "id_", ",_", "contact", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "get", "\\u", "obj_", "(_", "domain_", ",_", "user", "\\u", "id_", ",_", "contact", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "t", "Read", "Message_", "(_", "Document_", ",_", "Cou", "ch", "Doc", "Lock", "able", "Mix", "In_", ")_", ":_", "\\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_", "by", "\\u", "any", "one_", "(_", "cls_", ",_", "domain_", ",_", "contact", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Las", "t", "Read", "Message_", "._", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "/", "last", "\\u", "read", "\\u", "message", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "\"", "by", "\\u", "any", "one", "\"_", ",_", "domain_", ",_", "contact", "\\u", "id_", ",_", "{_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "\"", "by", "\\u", "any", "one", "\"_", ",_", "domain_", ",_", "contact", "\\u", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "descend", "ing_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SQL", "Las", "t", "Read", "Message_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "sms", "\\u", "lastr", "ead", "message", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "together_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "domain", "'_", ",_", "'", "read", "\\u", "by", "'_", ",_", "'", "contact", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "domain", "'_", ",_", "'", "contact", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "UU", "IDS", "\\u", "TO", "\\u", "GENERATE", "_", "=_", "[_", "'", "couch", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "id", " ", "of", " ", "Cou", "ch", "User", " ", "who", " ", "read", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "by_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "id", " ", "of", " ", "the", " ", "Cou", "ch", "User", " ", "or", " ", "Comm", "Care", "Case", " ", "who", " ", "the", " ", "message", " ", "was", " ", "sent", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "couch", "\\u", "id", " ", "of", " ", "the", " ", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "date", " ", "of", " ", "the", " ", "SMS", " ", "entry", ",", " ", "store", "d", " ", "here", " ", "redundant", "ly", " ", "to", " ", "prevent", " ", "a", " ", "lookup_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "timestamp_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "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_", "[SEP]_", "class_", "SQL", "Las", "t", "Read", "Message_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "any", "one_", "(_", "cls_", ",_", "domain_", ",_", "contact", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "SQL", "Las", "t", "Read", "Messag", "e", " ", "represent", "ing", " ", "the", " ", "last", " ", "chat", " ", "message", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "was", " ", "read", " ", "by", " ", "any", "one", " ", "in", " ", "the", " ", "give", "n", " ", "domain", " ", "for", " ", "the", " ", "give", "n", " ", "contact", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "contact", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "message", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "result_", "[_", ":_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Las", "t", "Read", "Message_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "by", "\\u", "user_", "(_", "cls_", ",_", "domain_", ",_", "user", "\\u", "id_", ",_", "contact", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "SQL", "Las", "t", "Read", "Messag", "e", " ", "represent", "ing", " ", "the", " ", "last", " ", "chat", " ", "message", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "was", " ", "read", " ", "in", " ", "the", " ", "give", "n", " ", "domain", " ", "by", " ", "the", " ", "give", "n", " ", "user", "\\u", "id", " ", "for", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "contact", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "not", " ", "expected", " ", "tha", "t", " ", "this", " ", "can", " ", "raise", " ", "Multipl", "e", "Object", "s", "Return", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "we", " ", "lock", " ", "out", " ", "creati", "on", " ", "of", " ", "these", " ", "record", "s", " ", "with", " ", "a", " ", "Crit", "ical", "Sect", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "if", " ", "tha", "t", " ", "happ", "ens", ",", " ", "let", " ", "the", " ", "exception", " ", "raise", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "by_", "=_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "contact", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Call", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "unique", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer", "ed_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "Integer", "Property_", "(_", ")_", "#", " ", "Length", " ", "of", " ", "the", " ", "call", " ", "in", " ", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gateway", "\\u", "session", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "session", " ", "id", " ", "return", "ed", " ", "from", " ", "the", " ", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xform", "s", "\\u", "session", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "message_", "=_", "String", "Property_", "(_", ")_", "#", " ", "Error", " ", "message", " ", "from", " ", "the", " ", "gateway", ",", " ", "if", " ", "any_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submit", "\\u", "partial", "\\u", "form_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "#", " ", "Tru", "e", " ", "to", " ", "submit", " ", "a", " ", "partial", " ", "form", " ", "on", " ", "hang", "up", " ", "if", " ", "it", "'", "s", " ", "not", " ", "complete", "d", " ", "ye", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "include", "\\u", "case", "\\u", "side", "\\u", "effects_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "question", "\\u", "retries_", "=_", "Integer", "Property_", "(_", ")_", "#", " ", "Max", " ", "number", " ", "of", " ", "times", " ", "to", " ", "retr", "y", " ", "a", " ", "question", " ", "with", " ", "an", " ", "invalid", " ", "response", " ", "bef", "ore", " ", "hang", "ing", " ", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "question", "\\u", "retr", "y", "\\u", "count_", "=_", "Integer", "Property_", "(_", "default_", "=_", "0_", ")_", "#", " ", "A", " ", "counter", " ", "of", " ", "the", " ", "number", " ", "of", " ", "invalid", " ", "response", "s", " ", "for", " ", "the", " ", "current", " ", "question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "prec", "ache", "d\\u", "first", "\\u", "response_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "response_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "id", " ", "of", " ", "the", " ", "case", " ", "to", " ", "submit", " ", "the", " ", "form", " ", "against", "_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "for", "\\u", "case", "\\u", "submission_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mess", "agin", "g", "\\u", "sube", "vent", "\\u", "id_", "=_", "Integer", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Call", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "from_", "=_", "(_", "self_", "._", "direction_", "==_", "INCOM", "ING_", ")_", "and_", "\"", "from", "\"_", "or_", "\"", "to", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "Call", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "to", "\\u", "from_", ",_", "self_", "._", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Call", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\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_", "answer", "ed", "\\u", "call", "\\u", "exists_", "(_", "cls_", ",_", "caller", "\\u", "doc", "\\u", "type_", ",_", "caller", "\\u", "id_", ",_", "after", "\\u", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "to", " ", "see", " ", "if", " ", "an", " ", "outb", "ound", " ", "call", " ", "exist", "s", " ", "for", " ", "the", " ", "give", "n", " ", "caller", " ", "tha", "t", " ", "was", " ", "success", "full", "y", " ", "answer", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "caller", "\\u", "doc", "\\u", "type", " ", "The", " ", "doc", "\\u", "type", " ", "of", " ", "the", " ", "caller", " ", "(", "e", ".", "g", ".,", " ", "\"", "Comm", "Care", "Case", "\")", ".", "\\", "10", ";", " ", " ", " ", " ", "caller", "\\u", "id", " ", " ", " ", "The", " ", "\\u", "id", " ", "of", " ", "the", " ", "caller", "'", "s", " ", "document", ".", "\\", "10", ";", " ", " ", " ", " ", "after", "\\u", "timestamp", " ", "The", " ", "datetime", " ", "after", " ", "whi", "ch", " ", "to", " ", "check", " ", "for", " ", "the", " ", "existence", " ", "of", " ", "a", " ", "call", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "return", " ", " ", "Tru", "e", " ", "if", " ", "a", " ", "call", " ", "exist", "s", " ", "in", " ", "the", " ", "Call", "Log", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "timestamp_", "=_", "json", "\\u", "format\\u", "datetime_", "(_", "after", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "timestamp_", "=_", "json", "\\u", "format\\u", "datetime_", "(_", "end", "\\u", "timestamp_", "or_", "datetime_", "._", "utcnow_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calls_", "=_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "by", "\\u", "recip", "ient", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "caller", "\\u", "doc", "\\u", "type_", ",_", "caller", "\\u", "id_", ",_", "\"", "Call", "Log", "\"_", ",_", "OUT", "GO", "ING_", ",_", "start", "\\u", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "caller", "\\u", "doc", "\\u", "type_", ",_", "caller", "\\u", "id_", ",_", "\"", "Call", "Log", "\"_", ",_", "OUT", "GO", "ING_", ",_", "end", "\\u", "timestamp_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "call_", "in_", "calls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "call_", "._", "answer", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "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_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Call", "Log_", "(_", "Messag", "e", "Log_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "call", "\\u", "by", "\\u", "gateway", "\\u", "session", "\\u", "id_", "(_", "cls_", ",_", "gateway", "\\u", "session", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "Call", "Log", " ", "object", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Call", "Log_", "._", "view_", "(_", "'", "sms", "/", "call", "\\u", "by", "\\u", "session", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "gateway", "\\u", "session", "\\u", "id_", ",_", "{_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "gateway", "\\u", "session", "\\u", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "descend", "ing_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "1_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Event", "Log_", "(_", "Safe", "Save", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "doc_", "=_", "\"", "Event", "Log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "Date", "Time", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\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_", "Expect", "ed", "Call", "back", "Event", "Log_", "(_", "Event", "Log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "String", "Property_", "(_", "choices_", "=_", "[_", "CALL", "BACK", "\\u", "PENDING_", ",_", "CALL", "BACK", "\\u", "RECEIVE", "D_", ",_", "CALL", "BACK", "\\u", "MIS", "SED", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Expect", "ed", "Call", "back", "Event", "Log_", "(_", "Event", "Log_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "start", "\\u", "date", " ", "and", " ", "end", "\\u", "date", " ", "are", " ", "expected", " ", "in", " ", "JSO", "N", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "view_", "(_", "\"", "sms", "/", "expected", "\\u", "callback", "\\u", "event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "[_", "domain_", ",_", "start", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "key_", "=_", "[_", "domain_", ",_", "end", "\\u", "date_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "docs_", "=_", "True_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Expect", "ed", "Callback_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "together_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "domain", "'_", ",_", "'", "date", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "STATUS", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CALL", "BACK", "\\u", "PENDING_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Pend", "ing", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CALL", "BACK", "\\u", "RECEIVE", "D_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Receive", "d", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CALL", "BACK", "\\u", "MIS", "SED", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Miss", "ed", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "IDS", "\\u", "TO", "\\u", "GENERATE", "_", "=_", "[_", "'", "couch", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "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_", "[SEP]_", "class_", "Expect", "ed", "Callback_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "domain_", "(_", "cls_", ",_", "domain_", ",_", "start", "\\u", "date_", "=_", "None_", ",_", "end", "\\u", "date_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "date", "\\u\\u", "gte_", "=_", "start", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "date", "\\u\\u", "lte_", "=_", "end", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expect", "ed", "Callback_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "by", "\\u", "domain", "\\u", "recip", "ient", "\\u", "date_", "(_", "cls_", ",_", "domain_", ",_", "recip", "ient", "\\u", "id_", ",_", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "recipient_", "=_", "recip", "ient", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "date_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Forward", "ing", "Rule_", "(_", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward", "\\u", "type_", "=_", "String", "Property_", "(_", "choices_", "=_", "FORWARD", "ING", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyword_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "String", "Property_", "(_", ")_", "#", " ", "id", " ", "of", " ", "Mob", "ile", "Back", "end", " ", "whi", "ch", " ", "will", " ", "be", " ", "used", " ", "to", " ", "do", " ", "the", " ", "forward", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Forward", "ing", "Rule_", "(_", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "retire", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "doc", "\\u", "type_", "+=_", "\"-", "Delete", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "entry", " ", "represent", "s", " ", "a", " ", "single", " ", "phone", " ", "number", " ", "and", " ", "whe", "ther", " ", "we", " ", "can", " ", "send", " ", "SMS", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "tha", "t", " ", "number", " ", "or", " ", "make", " ", "calls", " ", "to", " ", "tha", "t", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "30_", ",_", "unique_", "=_", "True_", ",_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "it", "'", "s", " ", "ok", " ", "to", " ", "send", " ", "SMS", " ", "to", " ", "this", " ", "phone", " ", "number", ",", " ", "Fal", "se", " ", "if", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "send", "\\u", "sms_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "null_", "=_", "False_", ",_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "it", "'", "s", " ", "ok", " ", "to", " ", "call", " ", "this", " ", "phone", " ", "number", ",", " ", "Fal", "se", " ", "if", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "not", " ", "ye", "t", " ", "implemented", " ", "but", " ", "will", " ", "be", " ", "in", " ", "the", " ", "future", "._", "\\u\\u\\uNL\\u\\u\\u_", "send", "\\u", "iv", "r_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "null_", "=_", "False_", ",_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "to", " ", "allow", " ", "this", " ", "phone", " ", "number", " ", "to", " ", "opt", " ", "back", " ", "in", ",", " ", "Fal", "se", " ", "if", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "opt", "\\u", "in_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "null_", "=_", "False_", ",_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "by", "\\u", "phone", "\\u", "number_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "number_", "=_", "sms", "util_", "._", "strip", "\\u", "plus_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "get_", "(_", "phone", "\\u", "number_", "=_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "by", "\\u", "phone", "\\u", "number", "\\u", "or", "\\u", "none_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "get", "\\u", "by", "\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "or", "\\u", "create_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "phone", "\\u", "number", " ", "-", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", " ", "of", " ", "digit", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "sms", "util_", "._", "strip", "\\u", "plus_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "phone", "\\u", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "phone", "\\u", "number_", "=_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "can", "\\u", "receive", "\\u", "sms_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\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 ", " _", "phone", "\\u", "obj_", "=_", "cls_", "._", "get", "\\u", "by", "\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "phone", "\\u", "obj_", "._", "send", "\\u", "sms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "means", " ", "the", " ", "phone", " ", "number", " ", "has", " ", "not", " ", "opt", "ed", "-", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "opt", "\\u", "in", "\\u", "sms_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Opt", "s", " ", "a", " ", "phone", " ", "number", " ", "in", " ", "to", " ", "receive", " ", "SMS", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "number", " ", "was", " ", "actual", "ly", " ", "opt", "ed", "-", "in", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "obj_", "=_", "cls_", "._", "get", "\\u", "by", "\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "phone", "\\u", "obj_", "._", "can", "\\u", "opt", "\\u", "in_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "obj_", "._", "send", "\\u", "sms_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Black", "list_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "opt", "\\u", "out", "\\u", "sms_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Opt", "s", " ", "a", " ", "phone", " ", "number", " ", "out", " ", "from", " ", "receiv", "ing", " ", "SMS", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "number", " ", "was", " ", "actual", "ly", " ", "opt", "ed", "-", "out", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "obj_", "=_", "cls_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "phone", "\\u", "number_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "phone", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "obj_", "._", "send", "\\u", "sms_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Phone", "Number_", "(_", "Sync", "SQL", "To", "Cou", "ch", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owner", "\\u", "doc", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owner", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Point", "s", " ", "to", " ", "the", " ", "name", " ", "of", " ", "a", " ", "SQL", "Mob", "ile", "Back", "end", " ", "(", "can", " ", "be", " ", "domain", "-", "level_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "system", "-", "level", ")", " ", "whi", "ch", " ", "represent", "s", " ", "the", " ", "back", "end", " ", "tha", "t", " ", "will", " ", "be", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "sendin", "g", " ", "SMS", " ", "to", " ", "this", " ", "number", ".", " ", "Can", " ", "be", " ", "Non", "e", " ", "to", " ", "use", " ", "domain", "/", "system_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Point", "s", " ", "to", " ", "the", " ", "name", " ", "of", " ", "a", " ", "SQL", "Mob", "ile", "Back", "end", " ", "(", "can", " ", "be", " ", "domain", "-", "level_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "system", "-", "level", ")", " ", "whi", "ch", " ", "represent", "s", " ", "the", " ", "back", "end", " ", "tha", "t", " ", "will", " ", "be", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "mak", "ing", " ", "calls", " ", "to", " ", "this", " ", "number", ".", " ", "Can", " ", "be", " ", "Non", "e", " ", "to", " ", "use", " ", "domain", "/", "system_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "iv", "r", "\\u", "back", "end", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verified_", "=_", "models_", "._", "Null", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "last", "\\u", "modified_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "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_", "[SEP]_", "class_", "Phone", "Number_", "(_", "Sync", "SQL", "To", "Cou", "ch", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "migrati", "on", "\\u", "get", "\\u", "fields_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "doc", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "\\u", "number", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "end", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "iv", "r", "\\u", "back", "end", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verifie", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "\\u", "last", "\\u", "modifi", "ed", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Number_", "(_", "Sync", "SQL", "To", "Cou", "ch", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "migrati", "on", "\\u", "get", "\\u", "couch", "\\u", "model", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Verifie", "d", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Messag", "ing", "Status", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Status", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "refresh_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "self_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Status", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "error_", "(_", "self_", ",_", "error", "\\u", "code_", ",_", "addition", "al", "\\u", "error", "\\u", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "ERROR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "code_", "=_", "error", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addition", "al", "\\u", "error", "\\u", "text_", "=_", "addition", "al", "\\u", "error", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Status", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "completed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "refresh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "status_", "!=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "ERROR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "COMPLETED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "track", " ", "the", " ", "status", " ", "of", " ", "high", "-", "level", " ", "events", " ", "in", " ", "the", " ", "mess", "agin", "g", "\\", "10", ";", " ", " ", " ", " ", "frame", "work", ".", " ", "Exam", "ples", " ", "of", " ", "suc", "h", " ", "high", "-", "level", " ", "events", " ", "include", " ", "the", " ", "fir", "ing", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "reminder", " ", "instance", ",", " ", "the", " ", "inv", "oki", "ng", " ", "of", " ", "a", " ", "keyw", "ord", ",", " ", "or", " ", "the", " ", "sendin", "g", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "broadcast", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", "=_", "'", "PR", "G", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "COMPLETED", "_", "=_", "'", "CMP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "NOT", "\\u", "COMPLETED", "_", "=_", "'", "NOT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "ERROR_", "=_", "'", "ERR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STATUS", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "In", " ", "Progres", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "STATUS", "\\u", "COMPLETED", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Complete", "d", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "STATUS", "\\u", "NOT", "\\u", "COMPLETED", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Not", " ", "Complete", "d", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "STATUS", "\\u", "ERROR_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Error", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SOU", "RC", "E", "\\u", "BROADCAST", "_", "=_", "'", "BR", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "KEYWORD", "_", "=_", "'", "KW", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "REM", "INDE", "R_", "=_", "'", "RM", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "UNRE", "CO", "GN", "IZED", "_", "=_", "'", "UN", "R", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "FORWARD", "ED_", "=_", "'", "FW", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOU", "RC", "E", "\\u", "OTHER", "_", "=_", "'", "OTH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SOU", "RC", "E", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "BROADCAST", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Broad", "cast", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "KEYWORD", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Key", "word", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "REM", "INDE", "R_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Remi", "nder", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "UNRE", "CO", "GN", "IZED", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Unre", "cogni", "zed", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "FORWARD", "ED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Forward", "ed", " ", "Messag", "e", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SOU", "RC", "E", "\\u", "OTHER", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Ot", "her", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONTE", "NT", "\\u", "NONE_", "=_", "'", "NOP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "SMS", "_", "=_", "'", "SMS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "SMS", "\\u", "CALL", "BACK_", "=_", "'", "CB", "K", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", "=_", "'", "SV", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", "=_", "'", "IV", "R", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "PHONE", "\\u", "VERI", "FICATION", "_", "=_", "'", "VER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "AD", "HO", "C", "\\u", "SMS", "_", "=_", "'", "AD", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "API", "\\u", "SMS", "_", "=_", "'", "API", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "CHAT", "\\u", "SMS", "_", "=_", "'", "CH", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTE", "NT", "\\u", "EMAIL_", "=_", "'", "EM", "L", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONTE", "NT", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "NONE_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Non", "e", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "SMS", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "SMS", " ", "Messag", "e", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "SMS", "\\u", "CALL", "BACK_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "SMS", " ", "Expecti", "ng", " ", "Call", "back", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "SMS", " ", "Surv", "ey", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "IV", "R", " ", "Surv", "ey", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "PHONE", "\\u", "VERI", "FICATION", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Phone", " ", "Veri", "fication", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "AD", "HO", "C", "\\u", "SMS", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Manu", "ally", " ", "Sent", " ", "Messag", "e", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "API", "\\u", "SMS", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Messag", "e", " ", "Sent", " ", "Via", " ", "API", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "CHAT", "\\u", "SMS", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Messag", "e", " ", "Sent", " ", "Via", " ", "Cha", "t", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CONTE", "NT", "\\u", "EMAIL_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Ema", "il", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RECIP", "IENT", "\\u", "CASE", "_", "=_", "'", "CAS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", "=_", "'", "MOB", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "WEB", "\\u", "USER_", "=_", "'", "WEB", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "USER", "\\u", "GROUP_", "=_", "'", "UG", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "CASE", "\\u", "GROUP_", "=_", "'", "CG", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "VAR", "IO", "US_", "=_", "'", "MUL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "LOCATION_", "=_", "'", "LOC", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "LOCATION", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", "=_", "'", "LC", "+'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S_", "=_", "'", "VL", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", "=_", "'", "VL", "+'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "UNKNOWN_", "=_", "'", "UNK", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RECIP", "IENT", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "CASE", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Case", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Mob", "ile", " ", "Worke", "r", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "WEB", "\\u", "USER_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Web", " ", "User", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "USER", "\\u", "GROUP_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "User", " ", "Group", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "CASE", "\\u", "GROUP_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Case", " ", "Group", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "VAR", "IO", "US_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Multipl", "e", " ", "Recipient", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "LOCATION_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Locat", "ion", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "LOCATION", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Locat", "ion", " ", "(", "inclu", "ding", " ", "child", " ", "location", "s", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Multipl", "e", " ", "Locat", "ion", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Multipl", "e", " ", "Locat", "ion", "s", " ", "(", "inclu", "ding", " ", "child", " ", "location", "s", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "RECIP", "IENT", "\\u", "UNKNOWN_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Un", "know", "n", " ", "Conta", "ct", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "RECIP", "IENT", "_", "=_", "'", "NO", "\\u", "RECIP", "IENT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "RENDER", "\\u", "MESSAGE_", "=_", "'", "CANNO", "T", "\\u", "RENDER", "\\u", "MESSAGE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "UNSU", "PPO", "RTED", "\\u", "COUNTRY", "_", "=_", "'", "UNSU", "PPO", "RTED", "\\u", "COUNTRY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "PHONE", "\\u", "NUMBER_", "=_", "'", "NO", "\\u", "PHONE", "\\u", "NUMB", "ER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "TWO", "\\u", "WAY", "\\u", "PHONE", "\\u", "NUMBER_", "=_", "'", "NO", "\\u", "TWO", "\\u", "WAY", "\\u", "PHONE", "\\u", "NUMB", "ER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "_", "=_", "'", "INVALID", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "LOAD", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "_", "=_", "'", "CANNO", "T", "\\u", "LOAD", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "FIND", "\\u", "FORM", "_", "=_", "'", "CANNO", "T", "\\u", "FIND", "\\u", "FORM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "FORM", "\\u", "HAS", "\\u", "NO", "\\u", "QUESTION", "S_", "=_", "'", "FORM", "\\u", "HAS", "\\u", "NO", "\\u", "QUESTION", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "CASE", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "NOT", "\\u", "FOUND_", "=_", "'", "CASE", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "NOT", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "MULTIPLE", "\\u", "CASE", "S", "\\u", "WITH", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "FOUND_", "=_", "'", "MULTIPLE", "\\u", "CASE", "S", "\\u", "WITH", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "CASE", "\\u", "GI", "VEN", "_", "=_", "'", "NO", "\\u", "CASE", "\\u", "GI", "VEN", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "GI", "VEN", "_", "=_", "'", "NO", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "GI", "VEN", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "COU", "LD", "\\u", "NOT", "\\u", "PROCESS", "\\u", "STRUCTUR", "ED", "\\u", "SMS", "_", "=_", "'", "COU", "LD", "\\u", "NOT", "\\u", "PROCESS", "\\u", "STRUCTUR", "ED", "\\u", "SMS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "SUB", "EVENT", "\\u", "ERROR_", "=_", "'", "SUB", "EVENT", "\\u", "ERROR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "TOU", "CH", "FORM", "S", "\\u", "ERROR_", "=_", "'", "TOU", "CH", "FORM", "S", "\\u", "ERROR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "INTERN", "AL", "\\u", "SERVER", "\\u", "ERROR_", "=_", "'", "INTERN", "AL", "\\u", "SERVER", "\\u", "ERROR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "GATEWAY", "\\u", "ERROR_", "=_", "'", "GATEWAY", "\\u", "ERROR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "SU", "ITA", "BL", "E", "\\u", "GATEWAY", "_", "=_", "'", "NO", "\\u", "SU", "ITA", "BL", "E", "\\u", "GATEWAY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "GATEWAY", "\\u", "NOT", "\\u", "FOUND_", "=_", "'", "GATEWAY", "\\u", "NOT", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "EMA", "IL", "\\u", "ADDRESS_", "=_", "'", "NO", "\\u", "EMA", "IL", "\\u", "ADDR", "ESS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR", "\\u", "TRIA", "L", "\\u", "EMA", "IL", "\\u", "LIMIT", "\\u", "REAC", "HED", "_", "=_", "'", "TRIA", "L", "\\u", "EMA", "IL", "\\u", "LIMIT", "\\u", "REAC", "HED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "MESSAGES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "RECIP", "IENT", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "No", " ", "recip", "ient", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "RENDER", "\\u", "MESSAGE_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Error", " ", "render", "ing", " ", "message", ";", " ", "plea", "se", " ", "check", " ", "synta", "x", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "UNSU", "PPO", "RTED", "\\u", "COUNTRY", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Gat", "ewa", "y", " ", "doe", "s", " ", "not", " ", "support", " ", "the", " ", "destinat", "ion", " ", "countr", "y", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "PHONE", "\\u", "NUMBER_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Conta", "ct", " ", "has", " ", "no", " ", "phone", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "TWO", "\\u", "WAY", "\\u", "PHONE", "\\u", "NUMBER_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Conta", "ct", " ", "has", " ", "no", " ", "two", "-", "way", " ", "phone", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "INVALID", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Inva", "lid", " ", "custom", " ", "content", " ", "handler", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "LOAD", "\\u", "CUSTOM", "\\u", "CONTE", "NT", "\\u", "HANDLER", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Cann", "ot", " ", "load", " ", "custom", " ", "content", " ", "handler", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "CANNO", "T", "\\u", "FIND", "\\u", "FORM", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Cann", "ot", " ", "find", " ", "form", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "FORM", "\\u", "HAS", "\\u", "NO", "\\u", "QUESTION", "S_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "No", " ", "question", "s", " ", "wer", "e", " ", "avail", "able", " ", "in", " ", "the", " ", "form", ".", " ", "Ple", "ase", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", " ", "tha", "t", " ", "the", " ", "form", " ", "has", " ", "question", "s", " ", "and", " ", "tha", "t", " ", "display", " ", "condition", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "are", " ", "not", " ", "prevent", "ing", " ", "question", "s", " ", "from", " ", "bei", "ng", " ", "ask", "ed", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "CASE", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "The", " ", "case", " ", "with", " ", "the", " ", "give", "n", " ", "external", " ", "ID", " ", "was", " ", "not", " ", "found", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "MULTIPLE", "\\u", "CASE", "S", "\\u", "WITH", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "FOUND_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Multipl", "e", " ", "case", "s", " ", "wer", "e", " ", "found", " ", "with", " ", "the", " ", "give", "n", " ", "external", " ", "ID", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "CASE", "\\u", "GI", "VEN", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "The", " ", "form", " ", "require", "s", " ", "a", " ", "case", " ", "but", " ", "no", " ", "case", " ", "was", " ", "provided", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "EXTERNAL", "\\u", "ID", "\\u", "GI", "VEN", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "No", " ", "external", " ", "ID", " ", "give", "n", ";", " ", "plea", "se", " ", "include", " ", "case", " ", "external", " ", "ID", " ", "after", " ", "keyw", "ord", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "COU", "LD", "\\u", "NOT", "\\u", "PROCESS", "\\u", "STRUCTUR", "ED", "\\u", "SMS", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Error", " ", "process", "ing", " ", "structure", "d", " ", "SMS", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "SUB", "EVENT", "\\u", "ERROR_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "View", " ", "deta", "il", "s", " ", "for", " ", "more", " ", "informati", "on", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "TOU", "CH", "FORM", "S", "\\u", "ERROR_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "An", " ", "error", " ", "occur", "red", " ", "in", " ", "the", " ", "form", "player", " ", "service", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "INTERN", "AL", "\\u", "SERVER", "\\u", "ERROR_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "GATEWAY", "\\u", "ERROR_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Gat", "ewa", "y", " ", "error", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "SU", "ITA", "BL", "E", "\\u", "GATEWAY", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "No", " ", "suit", "able", " ", "gateway", " ", "coul", "d", " ", "be", " ", "found", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "GATEWAY", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Gat", "ewa", "y", " ", "coul", "d", " ", "not", " ", "be", " ", "found", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "NO", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Recipient", " ", "has", " ", "no", " ", "email", " ", "address", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ERROR", "\\u", "TRIA", "L", "\\u", "EMA", "IL", "\\u", "LIMIT", "\\u", "REAC", "HED", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Cann", "ot", " ", "send", " ", "any", " ", "more", " ", "reminder", " ", "email", "s", ".", " ", "The", " ", "limit", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sendin", "g", " ", "reminder", " ", "email", "s", " ", "on", " ", "a", " ", "Trial", " ", "plan", " ", "has", " ", "bee", "n", " ", "reache", "d", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "SOU", "RC", "E", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "CONTE", "NT", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "used", " ", "whe", "n", " ", "content", "\\u", "type", " ", "is", " ", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y", " ", "or", " ", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "redundant", "ly", " ", "store", "d", " ", "here", " ", "(", "as", " ", "well", " ", "as", " ", "the", " ", "sube", "vent", ")", " ", "so", " ", "tha", "t", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "have", " ", "to", " ", "be", " ", "looke", "d", " ", "up", " ", "for", " ", "reporting", "._", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "name_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "any", " ", "of", " ", "the", " ", "Messag", "ing", "Sub", "Event", " ", "status", "'", "s", " ", "are", " ", "STATUS", "\\u", "ERROR", ",", " ", "this", " ", "is", " ", "STATUS", "\\u", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "STATUS", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "al", "\\u", "error", "\\u", "text_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "RECIP", "IENT", "\\u", "CHOICES_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "recip", "ient", "\\u", "type", "\\u", "from", "\\u", "doc", "\\u", "type_", "(_", "cls_", ",_", "recip", "ient", "\\u", "doc", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Comm", "Care", "User", "'_", ":_", "cls_", "._", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Web", "User", "'_", ":_", "cls_", "._", "RECIP", "IENT", "\\u", "WEB", "\\u", "USER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Comm", "Care", "Case", "'_", ":_", "cls_", "._", "RECIP", "IENT", "\\u", "CASE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Group", "'_", ":_", "cls_", "._", "RECIP", "IENT", "\\u", "USER", "\\u", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Comm", "Care", "Case", "Group", "'_", ":_", "cls_", "._", "RECIP", "IENT", "\\u", "CASE", "\\u", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "recip", "ient", "\\u", "doc", "\\u", "type_", ",_", "cls_", "._", "RECIP", "IENT", "\\u", "UNKNOWN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "cls_", ",_", "recipient_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "get", "\\u", "recip", "ient", "\\u", "type", "\\u", "from", "\\u", "doc", "\\u", "type_", "(_", "recipient_", "._", "doc", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "(_", "cls_", ",_", "recip", "ient", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ":_", "'", "Comm", "Care", "User", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "WEB", "\\u", "USER_", ":_", "'", "Web", "User", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "CASE", "_", ":_", "'", "Comm", "Care", "Case", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "USER", "\\u", "GROUP_", ":_", "'", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "CASE", "\\u", "GROUP_", ":_", "'", "Comm", "Care", "Case", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "LOCATION_", ":_", "'", "SQL", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "LOCATION", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", ":_", "'", "SQL", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "recip", "ient", "\\u", "type_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Messag", "ing", "Event_", "._", "\\u", "get", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "(_", "self_", "._", "recip", "ient", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "sube", "vent_", "(_", "self_", ",_", "reminder", "\\u", "definition_", ",_", "reminder", "_", ",_", "recipient_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "form", "\\u", "name_", "=_", "self_", "._", "get", "\\u", "content", "\\u", "info", "\\u", "from", "\\u", "reminder", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reminder", "\\u", "definition_", ",_", "reminder", "_", ",_", "parent_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "Messag", "ing", "Sub", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recipient_", "._", "get", "\\u", "id_", "if_", "recip", "ient", "\\u", "type_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "form", "\\u", "unique", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", "=_", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "reminder", "_", "._", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "iv", "r", "\\u", "sube", "vent_", "(_", "self_", ",_", "recipient_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "case", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "Messag", "ing", "Sub", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recipient_", "._", "get", "\\u", "id_", "if_", "recip", "ient", "\\u", "type_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "form", "\\u", "unique", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", "=_", "Messag", "ing", "Event_", "._", "get", "\\u", "form", "\\u", "name", "\\u", "or", "\\u", "none_", "(_", "form", "\\u", "unique", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "event", "\\u", "for", "\\u", "adh", "oc", "\\u", "sms_", "(_", "cls_", ",_", "domain_", ",_", "recipient_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "CONTE", "NT", "\\u", "AD", "HO", "C", "\\u", "SMS", "_", ",_", "source_", "=_", "SOU", "RC", "E", "\\u", "OTHER", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "recipient_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recipient_", "._", "get", "\\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 ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "RECIP", "IENT", "\\u", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "cls_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "cls_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recip", "ient", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "structure", "d\\u", "sms", "\\u", "sube", "vent_", "(_", "self_", ",_", "case", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "Messag", "ing", "Sub", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "self_", "._", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "self_", "._", "recip", "ient", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "self_", "._", "form", "\\u", "unique", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", "=_", "self_", "._", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "sube", "vent", "\\u", "for", "\\u", "single", "\\u", "sms_", "(_", "self_", ",_", "recip", "ient", "\\u", "doc", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", ",_", "case_", "=_", "None_", ",_", "completed_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "Messag", "ing", "Sub", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "get", "\\u", "recip", "ient", "\\u", "type", "\\u", "from", "\\u", "doc", "\\u", "type_", "(_", "recip", "ient", "\\u", "doc", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recip", "ient", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "CONTE", "NT", "\\u", "SMS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "case_", "._", "get", "\\u", "id_", "if_", "case_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "(_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "completed_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\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_", "sube", "vent", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "mess", "agin", "gsu", "bev", "ent", "\\u", "set_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "source", "\\u", "from", "\\u", "reminder", "_", "(_", "cls_", ",_", "reminder", "\\u", "definition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "reminder", "s_", "._", "models_", "import_", "(_", "REM", "INDE", "R", "\\u", "TYPE", "\\u", "ONE", "\\u", "TIME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REM", "INDE", "R", "\\u", "TYPE", "\\u", "DEFAULT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "(_", "cls_", "._", "SOU", "RC", "E", "\\u", "OTHER", "_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "REM", "INDE", "R", "\\u", "TYPE", "\\u", "ONE", "\\u", "TIME_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cls_", "._", "SOU", "RC", "E", "\\u", "BROADCAST", "_", ",_", "reminder", "\\u", "definition_", "._", "get", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REM", "INDE", "R", "\\u", "TYPE", "\\u", "DEFAULT_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cls_", "._", "SOU", "RC", "E", "\\u", "REM", "INDE", "R_", ",_", "reminder", "\\u", "definition_", "._", "get", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "reminder", "\\u", "definition_", "._", "reminder", "\\u", "type_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "form", "\\u", "name", "\\u", "or", "\\u", "none_", "(_", "cls_", ",_", "form", "\\u", "unique", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Form_", "._", "get", "\\u", "form_", "(_", "form", "\\u", "unique", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form_", "._", "full", "\\u", "path", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "content", "\\u", "info", "\\u", "from", "\\u", "reminder", "_", "(_", "cls_", ",_", "reminder", "\\u", "definition_", ",_", "reminder", "_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "reminder", "s_", "._", "models_", "import_", "(_", "METH", "OD", "\\u", "SMS", "_", ",_", "METH", "OD", "\\u", "SMS", "\\u", "CALL", "BACK_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "METH", "OD", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", ",_", "METH", "OD", "\\u", "EMAIL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "SMS", "_", ":_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "SMS", "\\u", "CALL", "BACK_", ":_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "\\u", "CALL", "BACK_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ":_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", ":_", "cls_", "._", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "EMAIL_", ":_", "cls_", "._", "CONTE", "NT", "\\u", "EMAIL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "reminder", "\\u", "definition_", "._", "method_", ",_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "reminder", "_", "._", "current", "\\u", "event_", "._", "form", "\\u", "unique", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent_", "and_", "parent_", "._", "form", "\\u", "unique", "\\u", "id_", "==_", "form", "\\u", "unique", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "name_", "=_", "parent_", "._", "form", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "name_", "=_", "(_", "cls_", "._", "get", "\\u", "form", "\\u", "name", "\\u", "or", "\\u", "none_", "(_", "form", "\\u", "unique", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "form", "\\u", "unique", "\\u", "id_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "content", "\\u", "type_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "form", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "content", "\\u", "info", "\\u", "from", "\\u", "keyword_", "(_", "cls_", ",_", "keyword_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "reminder", "s_", "._", "models_", "import_", "(_", "METH", "OD", "\\u", "SMS", "_", ",_", "METH", "OD", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "METH", "OD", "\\u", "STRUCTUR", "ED", "\\u", "SMS", "_", ",_", "RECIP", "IENT", "\\u", "SEND", "ER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "cls_", "._", "CONTE", "NT", "\\u", "NONE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "action_", "in_", "keyword_", "._", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "recipient_", "==_", "RECIP", "IENT", "\\u", "SEND", "ER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "action_", "in_", "(_", "METH", "OD", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", ",_", "METH", "OD", "\\u", "STRUCTUR", "ED", "\\u", "SMS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content", "\\u", "type_", "=_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "action_", "._", "form", "\\u", "unique", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "name_", "=_", "cls_", "._", "get", "\\u", "form", "\\u", "name", "\\u", "or", "\\u", "none_", "(_", "action_", "._", "form", "\\u", "unique", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "._", "action_", "==_", "METH", "OD", "\\u", "SMS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content", "\\u", "type_", "=_", "cls_", "._", "CONTE", "NT", "\\u", "SMS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "content", "\\u", "type_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "form", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "from", "\\u", "reminder", "_", "(_", "cls_", ",_", "reminder", "\\u", "definition_", ",_", "reminder", "_", ",_", "recipient_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reminder", "\\u", "definition_", "._", "mess", "agin", "g", "\\u", "event", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "reminder", "\\u", "definition_", "._", "mess", "agin", "g", "\\u", "event", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", ",_", "source", "\\u", "id_", "=_", "cls_", "._", "get", "\\u", "source", "\\u", "from", "\\u", "reminder", "_", "(_", "reminder", "\\u", "definition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "form", "\\u", "name_", "=_", "cls_", "._", "get", "\\u", "content", "\\u", "info", "\\u", "from", "\\u", "reminder", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reminder", "\\u", "definition_", ",_", "reminder", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "recipient_", "and_", "reminder", "\\u", "definition_", "._", "recip", "ient", "\\u", "is", "\\u", "list", "\\u", "of", "\\u", "locations_", "(_", "recipient_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "recipient_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "(_", "cls_", "._", "RECIP", "IENT", "\\u", "LOCATION", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "reminder", "\\u", "definition_", "._", "include", "\\u", "child", "\\u", "locations_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "cls_", "._", "RECIP", "IENT", "\\u", "LOCATION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recipient_", "[_", "0_", "]_", "._", "location", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "recipient_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "(_", "cls_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "reminder", "\\u", "definition_", "._", "include", "\\u", "child", "\\u", "locations_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "cls_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "len", "(", "recip", "ient", ")", " ", "shou", "ld", " ", "neve", "r", " ", "be", " ", "0", " ", "whe", "n", " ", "we", " ", "invoke", " ", "this", " ", "method", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "catch", "ing", " ", "this", " ", "situation", " ", "here", " ", "just", " ", "in", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "RECIP", "IENT", "\\u", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "recipient_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "recipient_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "RECIP", "IENT", "\\u", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "recipient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recipient_", "._", "get", "\\u", "id_", "if_", "recip", "ient", "\\u", "type_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "reminder", "\\u", "definition_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "source", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "form", "\\u", "unique", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", "=_", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "cls_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "recip", "ient", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "from", "\\u", "keyword_", "(_", "cls_", ",_", "keyword_", ",_", "contact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "keyw", "ord", " ", "-", " ", "the", " ", "keyw", "ord", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "contact", " ", "-", " ", "the", " ", "person", " ", "who", " ", "initiate", "d", " ", "the", " ", "keyw", "ord", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", ",_", "form", "\\u", "unique", "\\u", "id_", ",_", "form", "\\u", "name_", "=_", "cls_", "._", "get", "\\u", "content", "\\u", "info", "\\u", "from", "\\u", "keyword_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keyword_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "keyword_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "cls_", "._", "SOU", "RC", "E", "\\u", "KEYWORD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "keyword_", "._", "get", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "form", "\\u", "unique", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", "=_", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "cls_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "contact_", "._", "get", "\\u", "id_", "if_", "recip", "ient", "\\u", "type_", "else_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "verification", "\\u", "event_", "(_", "cls_", ",_", "domain_", ",_", "contact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recip", "ient", "\\u", "type_", "=_", "cls_", "._", "get", "\\u", "recip", "ient", "\\u", "type_", "(_", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "cls_", "._", "SOU", "RC", "E", "\\u", "OTHER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "cls_", "._", "CONTE", "NT", "\\u", "PHONE", "\\u", "VERI", "FICATION", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "cls_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "recip", "ient", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "contact_", "._", "get", "\\u", "id_", "if_", "recip", "ient", "\\u", "type_", "else_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "current", "\\u", "verification", "\\u", "event_", "(_", "cls_", ",_", "domain_", ",_", "contact", "\\u", "id_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "late", "st", " ", "phone", " ", "verification", " ", "event", " ", "tha", "t", " ", "is", " ", "in", " ", "progress", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "give", "n", " ", "contact", " ", "and", " ", "phone", " ", "number", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "one", " ", "doe", "s", " ", "not", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "contact", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mess", "agin", "gsu", "bev", "ent", "\\u\\u", "sms", "\\u\\u", "phone", "\\u", "number_", "=_", "sms", "util_", "._", "clean", "\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "cls_", "._", "CONTE", "NT", "\\u", "PHONE", "\\u", "VERI", "FICATION", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "cls_", "._", "STATUS", "\\u", "IN", "\\u", "PROGRESS", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "[_", "0_", "]_", "if_", "qs_", "._", "count_", "(_", ")_", ">_", "0_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Messag", "ing", "Sub", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "track", " ", "the", " ", "status", " ", "of", " ", "a", " ", "Messag", "ing", "Event", " ", "for", " ", "each", " ", "of", " ", "its", " ", "recip", "ients", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RECIP", "IENT", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "CASE", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Case", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Mob", "ile", " ", "Worke", "r", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "WEB", "\\u", "USER_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Web", " ", "User", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "Messag", "ing", "Event", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "RECIP", "IENT", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "Messag", "ing", "Event_", "._", "CONTE", "NT", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "used", " ", "whe", "n", " ", "content", "\\u", "type", " ", "is", " ", "CONTE", "NT", "\\u", "SMS", "\\u", "SUR", "VE", "Y", " ", "or", " ", "CONTE", "NT", "\\u", "IV", "R", "\\u", "SUR", "VE", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "unique", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "name_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xform", "s", "\\u", "session_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "sms", "forms", ".", "SQL", "XF", "orms", "Sess", "ion", "'_", ",_", "null_", "=_", "True_", ",_", "on", "\\u", "delete_", "=_", "models_", "._", "PROTECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "was", " ", "a", " ", "reminder", " ", "tha", "t", " ", "spawne", "d", " ", "off", " ", "of", " ", "a", " ", "case", ",", " ", "this", " ", "is", " ", "the", " ", "case", "'", "s", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "CHOICES_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "al", "\\u", "error", "\\u", "text_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\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_", "Messag", "ing", "Sub", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Messag", "ing", "Sub", "Event_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "self_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "event", " ", "is", " ", "in", " ", "an", " ", "errore", "d", " ", "state", ",", " ", "als", "o", " ", "set", " ", "the", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "event", " ", "to", " ", "an", " ", "errore", "d", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "status_", "==_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "ERROR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "._", "status_", "=_", "Messag", "ing", "Event_", "._", "STATUS", "\\u", "ERROR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "parent", " ", "event", " ", "had", " ", "vari", "ous", " ", "recip", "ients", ",", " ", "mark", " ", "it", " ", "as", " ", "suc", "h", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unl", "ess", " ", "the", " ", "source", " ", "was", " ", "a", " ", "keyw", "ord", " ", "in", " ", "whi", "ch", " ", "case", " ", "the", " ", "recipient_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "liste", "d", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "the", " ", "keyw", "ord", " ", "initiator", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "parent_", "._", "source_", "!=_", "Messag", "ing", "Event_", "._", "SOU", "RC", "E", "\\u", "KEYWORD", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "parent_", "._", "recip", "ient", "\\u", "id_", "!=_", "self_", "._", "recip", "ient", "\\u", "id_", "or_", "self_", "._", "recip", "ient", "\\u", "id_", "is_", "None_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "._", "recip", "ient", "\\u", "type_", "not_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "USER", "\\u", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "CASE", "\\u", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "LOCATION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "LOCATION", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US", "\\u", "LOCATION", "S", "\\u", "PLUS", "\\u", "DESC", "END", "ANT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "len_", "(_", "parent_", "._", "sube", "vent", "s_", ")_", ">_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "._", "recip", "ient", "\\u", "type_", "=_", "Messag", "ing", "Event_", "._", "RECIP", "IENT", "\\u", "VAR", "IO", "US_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "recip", "ient", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "ing", "Sub", "Event_", "(_", "models_", "._", "Model_", ",_", "Messag", "ing", "Status", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Messag", "ing", "Event_", "._", "\\u", "get", "\\u", "recip", "ient", "\\u", "doc", "\\u", "type_", "(_", "self_", "._", "recip", "ient", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PHONE", "\\u", "TYPE", "\\u", "ANDROID", "_", "=_", "'", "android", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PHONE", "\\u", "TYPE", "\\u", "OTHER", "_", "=_", "'", "other", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PHONE", "\\u", "TYPE", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "PHONE", "\\u", "TYPE", "\\u", "ANDROID", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "And", "roid", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "PHONE", "\\u", "TYPE", "\\u", "OTHER", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "Ot", "her", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STATUS", "\\u", "PENDING_", "=_", "'", "pend", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "REGISTER", "ED_", "=_", "'", "register", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATUS", "\\u", "EXPIRE", "D_", "=_", "'", "expir", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "30_", ",_", "null_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "False_", ",_", "unique_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expir", "ation", "\\u", "date_", "=_", "models_", "._", "Date", "Field_", "(_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "od", "k", "\\u", "url_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "20_", ",_", "null_", "=_", "True_", ",_", "choices_", "=_", "PHONE", "\\u", "TYPE", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "ed", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "alr", "ead", "y", "\\u", "registered_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "register", "ed", "\\u", "date_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "expired_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "invitation", " ", "is", " ", "valid", " ", "unti", "l", " ", "11", ":", "5", "9", "pm", " ", "UT", "C", " ", "on", " ", "the", " ", "expir", "ation", " ", "date", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "date_", "(_", ")_", ">_", "self_", "._", "expir", "ation", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "alr", "ead", "y", "\\u", "registered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "STATUS", "\\u", "REGISTER", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "STATUS", "\\u", "EXPIRE", "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_", "._", "STATUS", "\\u", "PENDING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "completed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "register", "ed", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "step", "1", "\\u", "sms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "api_", "import_", "send", "\\u", "sms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "sms_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", "(_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "INVI", "TAT", "ION", "\\u", "START_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "step", "2", "\\u", "java", "\\u", "sms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "api_", "import_", "send", "\\u", "sms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "sms_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", "(_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "JAVA", "\\u", "INVI", "TAT", "ION_", ",_", "context_", "=_", "(_", "self_", "._", "domain_", ",_", ")_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "step", "2", "\\u", "android", "\\u", "sms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "api_", "import_", "send", "\\u", "sms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "views_", "import_", "Invitation", "App", "Info", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "views_", "._", "mobile_", "._", "users_", "import_", "Comm", "Care", "User", "Self", "Registration", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registration", "\\u", "url_", "=_", "abs", "olute", "\\u", "reverse_", "(_", "Comm", "Care", "User", "Self", "Registration", "View_", "._", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "domain_", ",_", "self_", "._", "token_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "sms_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", "(_", "MS", "G", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "ANDROID", "\\u", "INVI", "TAT", "ION_", ",_", "context_", "=_", "(_", "registration", "\\u", "url_", ",_", ")_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Unti", "l", " ", "od", "k", " ", "2.2", "4", " ", "gets", " ", "released", " ", "to", " ", "the", " ", "Goo", "gle", " ", "Play", " ", "store", ",", " ", "this", " ", "part", " ", "won", "'", "t", " ", "work", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "od", "k", "\\u", "url", ":", "\\", "10", ";", " ", " ", " ", " ", "app", "\\u", "info", "\\u", "url", " ", "=", " ", "abs", "olute", "\\u", "reverse", "(", "Invitation", "App", "Info", "View", ".", "url", "name", ",", "\\", "10", ";", " ", " ", " ", " ", "args", "=[", "self", ".", "domain", ",", " ", "self", ".", "token", "])", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "=", " ", "'[", "comm", "care", " ", "app", " ", "-", " ", "do", " ", "not", " ", "delete", "]", " ", "%", "s", "'", " ", "%", " ", "app", "\\u", "info", "\\u", "url", "\\", "10", ";", " ", " ", " ", " ", "send", "\\u", "sms", "(", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "domain", ",", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "phone", "\\u", "number", ",", "\\", "10", ";", " ", " ", " ", " ", "message", ",", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expire_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "expir", "ation", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "date_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "une", "xp", "ired", "\\u", "invitation", "s_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "phone", "\\u", "number_", "=_", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expir", "ation", "\\u", "date", "\\u\\u", "gte_", "=_", "current", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "register", "ed", "\\u", "date", "\\u\\u", "isnull_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "expir", "e\\u", "invitation", "s_", "(_", "cls_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expire", " ", "all", " ", "invitation", "s", " ", "for", " ", "the", " ", "give", "n", " ", "phone", " ", "number", " ", "tha", "t", " ", "have", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "ye", "t", " ", "expir", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "invitation", "_", "in_", "cls_", "._", "get", "\\u", "une", "xp", "ired", "\\u", "invitation", "s_", "(_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invitation", "_", "._", "expire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "token_", "(_", "cls_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "get_", "(_", "token_", "=_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "phone_", "(_", "cls_", ",_", "phone", "\\u", "number_", ",_", "expir", "e\\u", "duplicates_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Look", " ", "up", " ", "the", " ", "une", "xp", "ired", " ", "invitation", " ", "for", " ", "the", " ", "give", "n", " ", "phone", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "the", " ", "case", " ", "of", " ", "duplicat", "es", ",", " ", "only", " ", "the", " ", "most", " ", "recent", " ", "invitation", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "expir", "e\\u", "duplicat", "es", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "any", " ", "duplicat", "es", " ", "are", " ", "automati", "call", "y", "\\", "10", ";", " ", " ", " ", " ", "expir", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "invitation", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "une", "xp", "ired", " ", "invitation", "s", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "number_", "=_", "appl", "y", "\\u", "len", "ien", "cy_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "get", "\\u", "une", "xp", "ired", "\\u", "invitation", "s_", "(_", "phone", "\\u", "number_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "created", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "0_", ":_", "\\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_", "invitation", "_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expir", "e\\u", "duplicates_", "and_", "len_", "(_", "result_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "result_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "._", "expire_", "(_", ")_", "\\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_", "invitation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "app", "\\u", "od", "k", "\\u", "url_", "(_", "cls_", ",_", "domain_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "late", "st", " ", "starred", " ", "build", " ", "(", "or", " ", "late", "st", " ", "build", " ", "if", " ", "none", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "starred", ")", " ", "for", " ", "the", " ", "app", " ", "and", " ", "return", " ", "it", "'", "s", " ", "od", "k", " ", "install", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "get", "\\u", "app_", "(_", "domain_", ",_", "app", "\\u", "id_", ",_", "latest_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "app_", "._", "copy", "\\u", "of_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "late", "st", " ", "starred", " ", "build", " ", "is", " ", "not", " ", "found", ",", " ", "use", " ", "the", " ", "late", "st", " ", "build_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "get", "\\u", "app_", "(_", "domain_", ",_", "app", "\\u", "id_", ",_", "latest_", "=_", "True_", ",_", "target_", "=_", "'", "build", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "app_", "._", "copy", "\\u", "of_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "build", " ", "is", " ", "found", ",", " ", "return", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "app_", "._", "get", "\\u", "short", "\\u", "od", "k", "\\u", "url_", "(_", "with", "\\u", "media_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Self", "Registration", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "initiate", "\\u", "workflow_", "(_", "cls_", ",_", "domain_", ",_", "phone", "\\u", "numbers_", ",_", "app", "\\u", "id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "day", "s", "\\u", "unti", "l\\u", "expiration_", "=_", "30_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "app", "\\u", "id", " ", "is", " ", "pass", "ed", " ", "in", ",", " ", "then", " ", "an", " ", "addition", "al", " ", "SMS", " ", "will", " ", "be", " ", "sent", " ", "to", " ", "And", "roid", "\\", "10", ";", " ", " ", " ", " ", "phone", "s", " ", "contain", "ing", " ", "a", " ", "link", " ", "to", " ", "the", " ", "late", "st", " ", "starred", " ", "build", " ", "(", "or", " ", "late", "st", "\\", "10", ";", " ", " ", " ", " ", "build", " ", "if", " ", "no", " ", "starred", " ", "build", " ", "exist", "s", ")", " ", "for", " ", "the", " ", "app", ".", " ", "On", "ce", " ", "OD", "K", " ", "is", " ", "install", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "will", " ", "automati", "call", "y", " ", "search", " ", "for", " ", "this", " ", "SMS", " ", "and", " ", "install", " ", "this", " ", "app", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "app", "\\u", "id", " ", "is", " ", "left", " ", "blank", ",", " ", "the", " ", "addition", "al", " ", "SMS", " ", "is", " ", "not", " ", "sent", ",", " ", "and", " ", "onc", "e", "\\", "10", ";", " ", " ", " ", " ", "OD", "K", " ", "is", " ", "install", "ed", " ", "it", " ", "just", " ", "skips", " ", "the", " ", "automati", "c", " ", "app", " ", "install", " ", "step", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success", "\\u", "numbers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invalid", "\\u", "format\\u", "numbers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numbers", "\\u", "in", "\\u", "use_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "od", "k", "\\u", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "od", "k", "\\u", "url_", "=_", "cls_", "._", "get", "\\u", "app", "\\u", "od", "k", "\\u", "url_", "(_", "domain_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "phone", "\\u", "number_", "in_", "phone", "\\u", "numbers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "number_", "=_", "appl", "y", "\\u", "len", "ien", "cy_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Comm", "Care", "Mob", "ile", "Conta", "ct", "Mixin_", "._", "validat", "e\\u", "number", "\\u", "format_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inva", "lid", "Format", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invalid", "\\u", "format\\u", "numbers_", "._", "append_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Verifie", "d", "Number_", "._", "by", "\\u", "phone_", "(_", "phone", "\\u", "number_", ",_", "include", "\\u", "pending_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numbers", "\\u", "in", "\\u", "use_", "._", "append_", "(_", "phone", "\\u", "number_", ")_", "\\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_", "cls_", "._", "expir", "e\\u", "invitation", "s_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expir", "ation", "\\u", "date_", "=_", "(_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "date_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "timedelta_", "(_", "days_", "=_", "day", "s", "\\u", "unti", "l\\u", "expiration_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invitation", "_", "=_", "cls_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "phone", "\\u", "number_", "=_", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "uuid_", "._", "uuid4_", "(_", ")_", "._", "hex_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "id_", "=_", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expir", "ation", "\\u", "date_", "=_", "expir", "ation", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "created", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "od", "k", "\\u", "url_", "=_", "od", "k", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invitation", "_", "._", "send", "\\u", "step", "1", "\\u", "sms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success", "\\u", "numbers_", "._", "append_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "success", "\\u", "numbers_", ",_", "invalid", "\\u", "format\\u", "numbers_", ",_", "numbers", "\\u", "in", "\\u", "use_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Activ", "e", "Mob", "ile", "Back", "end", "Manager_", "(_", "models_", "._", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Activ", "e", "Mob", "ile", "Back", "end", "Manager_", "(_", "models_", "._", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Activ", "e", "Mob", "ile", "Back", "end", "Manager_", ",_", "self_", ")_", "._", "get", "\\u", "queryset_", "(_", ")_", "._", "filter_", "(_", "deleted_", "=_", "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_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SMS", "_", "=_", "'", "SMS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IV", "R_", "=_", "'", "IV", "R", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TYPE", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SMS", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "SMS", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "IV", "R_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "IV", "R", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "IDS", "\\u", "TO", "\\u", "GENERATE", "_", "=_", "[_", "'", "couch", "\\u", "id", "'_", ",_", "'", "inbound", "\\u", "api", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "=_", "models_", "._", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "objects_", "=_", "Activ", "e", "Mob", "ile", "Back", "end", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "reall", "y", " ", "get", " ", "rid", " ", "of", " ", "this", " ", "unti", "l", " ", "all", " ", "the", " ", "mess", "agin", "g", " ", "model", "s", " ", "are", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "postgres", ".", " ", "On", "ce", " ", "tha", "t", " ", "happ", "ens", " ", "we", " ", "can", " ", "migr", "ate", " ", "reference", "s", " ", "to", " ", "the", " ", "couch", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "a", " ", "foreign", " ", "key", " ", "to", " ", "postgres", " ", "id", " ", "and", " ", "get", " ", "rid", " ", "of", " ", "this", " ", "field", "._", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "TYPE", "\\u", "CHOICES_", ",_", "default_", "=_", "SMS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "an", " ", "api", " ", "key", " ", "tha", "t", " ", "the", " ", "gateway", " ", "use", "s", " ", "whe", "n", " ", "mak", "ing", " ", "inbound", " ", "request", "s", " ", "to", " ", "hq", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "enforce", "s", " ", "gateway", " ", "security", " ", "and", " ", "als", "o", " ", "allow", "s", " ", "us", " ", "to", " ", "tie", " ", "every", " ", "inbound", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "specific", " ", "back", "end", "._", "\\u\\u\\uNL\\u\\u\\u_", "inbound", "\\u", "api", "\\u", "key_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "unique_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "tell", "s", " ", "us", " ", "whi", "ch", " ", "type", " ", "of", " ", "back", "end", " ", "this", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "\\u", "api", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Global", " ", "back", "ends", " ", "are", " ", "system", " ", "owned", " ", "and", " ", "can", " ", "be", " ", "used", " ", "by", " ", "any", "one_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "domain", " ", "tha", "t", " ", "the", " ", "back", "end", " ", "belo", "ngs", " ", "to", ",", " ", "or", " ", "Non", "e", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "global", " ", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "short", " ", "name", " ", "for", " ", "a", " ", "back", "end", " ", "instance", " ", "whi", "ch", " ", "is", " ", "referenced", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setti", "ng", " ", "a", " ", "case", " ", "contact", "'", "s", " ", "prefer", "red", " ", "backend_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "name", " ", "to", " ", "display", " ", "to", " ", "users", " ", "-", " ", "e", ".", "g", ".", " ", "\"", "Twi", "lio", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", "ly", ",", " ", "a", " ", "description", " ", "of", " ", "this", " ", "backend_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "models_", "._", "Text", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "JSO", "N", " ", "list", " ", "of", " ", "countr", "ies", " ", "tha", "t", " ", "this", " ", "back", "end", " ", "support", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "informati", "on", " ", "is", " ", "displaye", "d", " ", "in", " ", "the", " ", "gateway", " ", "list", " ", "UI", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "back", "end", " ", "represent", "s", " ", "an", " ", "international", " ", "gateway", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "this", " ", "to", ":", " ", "[\"", "*\"", "]_", "\\u\\u\\uNL\\u\\u\\u_", "support", "ed", "\\u", "countries_", "=_", "json", "\\u", "field_", "._", "JSO", "NF", "ield_", "(_", "default_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "avoid", " ", "hav", "ing", " ", "many", " ", "tables", " ", "with", " ", "so", " ", "few", " ", "record", "s", " ", "in", " ", "them", ",", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SMS", " ", "back", "ends", " ", "are", " ", "store", "d", " ", "in", " ", "this", " ", "same", " ", "table", ".", " ", "Thi", "s", " ", "field", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "JSO", "N", " ", "dict", " ", "whi", "ch", " ", "store", "s", " ", "any", " ", "addition", "al", " ", "fields", " ", "tha", "t", " ", "the", " ", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "back", "end", " ", "subclasses", " ", "need", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Do", " ", "not", " ", "access", " ", "this", " ", "field", " ", "direct", "ly", ",", " ", "inst", "ead", " ", "use", " ", "get", "\\u", "extra", "\\u", "fields", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "set\\u", "extra", "\\u", "fields", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "fields_", "=_", "json", "\\u", "field_", "._", "JSO", "NF", "ield_", "(_", "default_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "a", " ", "historical", " ", "view", " ", "of", " ", "sms", " ", "data", ",", " ", "we", " ", "can", "'", "t", " ", "delete", " ", "back", "ends", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ins", "tea", "d", ",", " ", "set", " ", "a", " ", "delete", "d", " ", "flag", " ", "whe", "n", " ", "a", " ", "back", "end", " ", "shou", "ld", " ", "no", " ", "long", "er", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "back", "end", " ", "use", "s", " ", "load", " ", "balancing", ",", " ", "this", " ", "is", " ", "a", " ", "JSO", "N", " ", "list", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "phone", " ", "numbers", " ", "to", " ", "load", " ", "balance", " ", "over", "._", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "balancing", "\\u", "numbers_", "=_", "json", "\\u", "field_", "._", "JSO", "NF", "ield_", "(_", "default_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "phone", " ", "number", " ", "whi", "ch", " ", "you", " ", "can", " ", "text", " ", "to", " ", "or", " ", "call", " ", "in", " ", "order", " ", "to", " ", "reply_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "backend_", "\\u\\u\\uNL\\u\\u\\u_", "repl", "y", "\\u", "to", "\\u", "phone", "\\u", "number_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "mess", "agin", "g", "\\u", "mobile", "back", "end", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "quick", "cache_", "(_", "[_", "'", "self", ".", "pk", "'_", ",_", "'", "domain", "'_", "]_", ",_", "timeout_", "=_", "5_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "domain", "\\u", "is", "\\u", "shared_", "(_", "self_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "this", " ", "back", "end", " ", "has", " ", "bee", "n", " ", "shared", " ", "with", " ", "domain", " ", "and", " ", "domain", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "accept", "ed", " ", "the", " ", "invitation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "._", "filter_", "(_", "domain_", "=_", "domain_", ",_", "accepted_", "=_", "True_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "count_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "domain", "\\u", "is", "\\u", "authorized_", "(_", "self_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "give", "n", " ", "domain", " ", "is", " ", "authoriz", "ed", " ", "to", " ", "use", " ", "this", " ", "back", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "is", "\\u", "global_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "==_", "self_", "._", "domain_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain", "\\u", "is", "\\u", "shared_", "(_", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "name", "\\u", "is", "\\u", "unique_", "(_", "cls_", ",_", "name_", ",_", "domain_", "=_", "None_", ",_", "back", "end", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", "\\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 ", " _", "result_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "result_", "._", "values", "\\u", "list_", "(_", "'", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "[_", "0_", "]_", "==_", "back", "end", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "authoriz", "ed", "\\u", "domain", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "._", "filter_", "(_", "accepted_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "order", "\\u", "by_", "(_", "'", "domain", "'_", ")_", "._", "values", "\\u", "list_", "(_", "'", "domain", "'_", ",_", "flat_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "domain", "\\u", "backends_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "count", "\\u", "only_", "=_", "False_", ",_", "offset_", "=_", "None_", ",_", "limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "the", " ", "back", "ends", " ", "tha", "t", " ", "the", " ", "give", "n", " ", "domain", " ", "has", " ", "access", " ", "to", " ", "(", "tha", "t", " ", "is", ",", "\\", "10", ";", " ", " ", " ", " ", "owned", " ", "back", "ends", ",", " ", "shared", " ", "back", "ends", ",", " ", "and", " ", "global", " ", "back", "ends", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "owned", "\\u", "backends_", "=_", "models_", "._", "Q_", "(_", "is", "\\u", "global_", "=_", "False_", ",_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "shared", "\\u", "backends_", "=_", "models_", "._", "Q_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mobile", "back", "endi", "nvi", "tation", "\\u\\u", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mobile", "back", "endi", "nvi", "tation", "\\u\\u", "accepted_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "backends_", "=_", "models_", "._", "Q_", "(_", "is", "\\u", "global_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "left", " ", "join", " ", "to", " ", "Mob", "ile", "Back", "end", "Invitation", " ", "may", " ", "caus", "e", " ", "there", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "duplicat", "es", " ", "here", ",", " ", "so", " ", "we", " ", "need", " ", "to", " ", "call", " ", ".", "distinct", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "domain", "\\u", "owned", "\\u", "backends_", "|_", "domain", "\\u", "shared", "\\u", "backends_", "|_", "global", "\\u", "backends_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "count", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "result_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "._", "values", "\\u", "list_", "(_", "'", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "offset_", "is_", "not_", "None_", "and_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "[_", "offset_", ":_", "offset_", "+_", "limit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "cls_", "._", "load_", "(_", "pk_", ")_", "for_", "pk_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "global", "\\u", "back", "ends", "\\u", "for", "\\u", "this", "\\u", "class_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "\\u", "api", "\\u", "id_", "=_", "cls_", "._", "get", "\\u", "api", "\\u", "id_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "global", "\\u", "back", "end", "\\u", "ids_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "couch", "\\u", "id_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "\\u", "field_", "=_", "'", "couch", "\\u", "id", "'_", "if_", "couch", "\\u", "id_", "else_", "'", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "SQL", "Mob", "ile", "Backend_", "._", "active", "\\u", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "values", "\\u", "list_", "(_", "id", "\\u", "field_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "global", "\\u", "backends_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "count", "\\u", "only_", "=_", "False_", ",_", "offset_", "=_", "None_", ",_", "limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "count", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "result_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "._", "values", "\\u", "list_", "(_", "'", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "offset_", "is_", "not_", "None_", "and_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "[_", "offset_", ":_", "offset_", "+_", "limit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "cls_", "._", "load_", "(_", "pk_", ")_", "for_", "pk_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "domain", "\\u", "default", "\\u", "backend_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "id", "\\u", "only_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "'*'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "values", "\\u", "list_", "(_", "'", "back", "end", "\\u", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "cls_", "._", "Multipl", "e", "Object", "s", "Return", "ed_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mor", "e", " ", "than", " ", "one", " ", "default", " ", "back", "end", " ", "found", " ", "for", " ", "back", "end", "\\u", "type", " ", "%", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", " ", "%", "s", "\"_", "%_", "(_", "back", "end", "\\u", "type_", ",_", "domain_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "result_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "[_", "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_", "cls_", "._", "load_", "(_", "result_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load", "\\u", "default", "\\u", "backend_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "phone", "\\u", "number_", ",_", "domain_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Choose", "s", " ", "the", " ", "appropr", "iate", " ", "back", "end", " ", "based", " ", "on", " ", "the", " ", "phone", " ", "number", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "prefix", ",", " ", "or", " ", "return", "s", " ", "Non", "e", " ", "if", " ", "no", " ", "catch", "-", "all", " ", "back", "end", " ", "is", " ", "configur", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "type", " ", "-", " ", "SQL", "Mob", "ile", "Back", "end", ".", "SMS", " ", "or", " ", "SQL", "Mob", "ile", "Back", "end", ".", "IV", "R", "\\", "10", ";", " ", " ", " ", " ", "phone", "\\u", "number", " ", "-", " ", "the", " ", "phone", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "domain", " ", "-", " ", "pass", " ", "in", " ", "a", " ", "domain", " ", "to", " ", "choose", " ", "the", " ", "default", " ", "back", "end", " ", "from", " ", "the", " ", "domain", "'", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "configur", "ed", " ", "back", "ends", ",", " ", "other", "wis", "e", " ", "lea", "ve", " ", "Non", "e", " ", "to", " ", "choose", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "system", "'", "s", " ", "configur", "ed", " ", "back", "ends", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "map_", "=_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "._", "get", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", ",_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "back", "end", "\\u", "map_", "._", "get", "\\u", "back", "end", "\\u", "id", "\\u", "by", "\\u", "prefix_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "back", "end", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "load_", "(_", "back", "end", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "load", "\\u", "default", "\\u", "by", "\\u", "phone", "\\u", "and", "\\u", "domain_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "phone", "\\u", "number_", ",_", "domain_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "appropr", "iate", " ", "outb", "ound", " ", "back", "end", " ", "to", " ", "communi", "cate", " ", "with", " ", "phone", "\\u", "number", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "type", " ", "-", " ", "SQL", "Mob", "ile", "Back", "end", ".", "SMS", " ", "or", " ", "SQL", "Mob", "ile", "Back", "end", ".", "IV", "R", "\\", "10", ";", " ", " ", " ", " ", "phone", "\\u", "number", " ", "-", " ", "the", " ", "phone", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "domain", " ", "-", " ", "the", " ", "domain", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "cls_", "._", "load", "\\u", "default", "\\u", "backend_", "(_", "back", "end", "\\u", "type_", ",_", "phone", "\\u", "number_", ",_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "cls_", "._", "load", "\\u", "default", "\\u", "backend_", "(_", "back", "end", "\\u", "type_", ",_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "SMS", "Config", "Exception_", "(_", "\"", "No", " ", "suit", "able", " ", "back", "end", " ", "found", " ", "for", " ", "phone", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", " ", "and", " ", "domain", " ", "%", "s", ",", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "phone", "\\u", "number_", ",_", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "@_", "quick", "cache_", "(_", "[_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ",_", "'", "inbound", "\\u", "api", "\\u", "key", "'_", "]_", ",_", "timeout_", "=_", "60_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "back", "end", "\\u", "info", "\\u", "by", "\\u", "api", "\\u", "key_", "(_", "cls_", ",_", "hq", "\\u", "api", "\\u", "id_", ",_", "inbound", "\\u", "api", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Look", "s", " ", "up", " ", "a", " ", "back", "end", " ", "by", " ", "inbound", "\\u", "api", "\\u", "key", " ", "and", " ", "return", "s", " ", "a", " ", "tuple", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "(", "domain", ",", " ", "couch", "\\u", "id", ").", " ", "Includi", "ng", " ", "hq", "\\u", "api", "\\u", "id", " ", "in", " ", "the", " ", "filter", " ", "is", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "implicit", " ", "way", " ", "of", " ", "mak", "ing", " ", "sure", " ", "tha", "t", " ", "the", " ", "return", "ed", " ", "back", "end", " ", "info", " ", "belo", "ngs", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "back", "end", " ", "of", " ", "tha", "t", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "The", " ", "entire", " ", "back", "end", " ", "is", " ", "not", " ", "return", "ed", " ", "to", " ", "reduce", " ", "the", " ", "amo", "unt", " ", "of", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "need", "ed", " ", "to", " ", "be", " ", "return", "ed", " ", "by", " ", "the", " ", "cache", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "cls", ".", "Do", "es", "Not", "Exist", " ", "if", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "(_", "cls_", "._", "active", "\\u", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "hq", "\\u", "api", "\\u", "id_", "=_", "hq", "\\u", "api", "\\u", "id_", ",_", "inbound", "\\u", "api", "\\u", "key_", "=_", "inbound", "\\u", "api", "\\u", "key_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "values", "\\u", "list_", "(_", "'", "domain", "'_", ",_", "'", "couch", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "cls_", "._", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "@_", "quick", "cache_", "(_", "[_", "'", "back", "end", "\\u", "id", "'_", ",_", "'", "is", "\\u", "couch", "\\u", "id", "'_", "]_", ",_", "timeout_", "=_", "60_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "back", "end", "\\u", "api", "\\u", "id_", "(_", "cls_", ",_", "back", "end", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "args_", "=_", "{_", "'", "couch", "\\u", "id", "'_", ":_", "back", "end", "\\u", "id_", "}_", "if_", "is", "\\u", "couch", "\\u", "id_", "else_", "{_", "'", "pk", "'_", ":_", "back", "end", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "(_", "cls_", "._", "active", "\\u", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "**_", "filter", "\\u", "args_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "values", "\\u", "list_", "(_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ",_", "flat_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "cls_", "._", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "@_", "quick", "cache_", "(_", "[_", "'", "back", "end", "\\u", "id", "'_", ",_", "'", "is", "\\u", "couch", "\\u", "id", "'_", ",_", "'", "include", "\\u", "delete", "d", "'_", "]_", ",_", "timeout_", "=_", "5_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "cls_", ",_", "back", "end", "\\u", "id_", ",_", "api", "\\u", "id_", "=_", "None_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "False_", ",_", "include", "\\u", "deleted_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "id", " ", "-", " ", "the", " ", "pk", " ", "of", " ", "the", " ", "SQL", "Mob", "ile", "Back", "end", " ", "to", " ", "load", "\\", "10", ";", " ", " ", " ", " ", "api", "\\u", "id", " ", "-", " ", "if", " ", "you", " ", "know", " ", "the", " ", "hq", "\\u", "api", "\\u", "id", " ", "of", " ", "the", " ", "SQL", "Mob", "ile", "Back", "end", ",", " ", "pass", " ", "it", "\\", "10", ";", " ", " ", " ", " ", " ", "here", " ", "for", " ", "a", " ", "faste", "r", " ", "look", "up", ";", " ", "other", "wis", "e", ",", " ", "it", " ", "will", " ", "be", " ", "looke", "d", " ", "up", "\\", "10", ";", " ", " ", " ", " ", " ", "automati", "call", "y", "\\", "10", ";", " ", " ", " ", " ", "is", "\\u", "couch", "\\u", "id", " ", "-", " ", "if", " ", "Tru", "e", ",", " ", "then", " ", "back", "end", "\\u", "id", " ", "shou", "ld", " ", "be", " ", "the", " ", "couch", "\\u", "id", " ", "to", " ", "use", "\\", "10", ";", " ", "dur", "ing", " ", "look", "up", " ", "inst", "ead", " ", "of", " ", "the", " ", "postgres", " ", "model", "'", "s", " ", "pk", ";", "\\", "10", ";", " ", "we", " ", "have", " ", "to", " ", "support", " ", "bot", "h", " ", "for", " ", "a", " ", "litt", "le", " ", "whi", "le", " ", "unti", "l", " ", "all", "\\", "10", ";", " ", "foreign", " ", "keys", " ", "are", " ", "migrated", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "classes_", "=_", "sms", "util_", "._", "get", "\\u", "back", "end", "\\u", "classes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "id_", "=_", "api", "\\u", "id_", "or_", "cls_", "._", "get", "\\u", "back", "end", "\\u", "api", "\\u", "id_", "(_", "back", "end", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "is", "\\u", "couch", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "api", "\\u", "id_", "not_", "in_", "back", "end", "\\u", "classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "SMS", "Config", "Exception_", "(_", "\"", "Une", "xpe", "cte", "d", " ", "back", "end", " ", "api", " ", "id", " ", "found", " ", "'%", "s", "'", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "back", "end", " ", "'%", "s", "'\"_", "%_", "(_", "api", "\\u", "id_", ",_", "back", "end", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "klass_", "=_", "back", "end", "\\u", "classes_", "[_", "api", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "include", "\\u", "deleted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "klass_", "._", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "klass_", "._", "active", "\\u", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "couch", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "._", "get_", "(_", "couch", "\\u", "id_", "=_", "back", "end", "\\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 ", " _", "return_", "result_", "._", "get_", "(_", "pk_", "=_", "back", "end", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "back", "end", "\\u", "from", "\\u", "id", "\\u", "and", "\\u", "api", "\\u", "id", "\\u", "result_", "(_", "cls_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "result_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "load_", "(_", "result_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ",_", "api", "\\u", "id_", "=_", "result_", "[_", "0_", "]_", "[_", "'", "hq", "\\u", "api", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "owned", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "active", "\\u", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "values_", "(_", "'", "id", "'_", ",_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "get", "\\u", "back", "end", "\\u", "from", "\\u", "id", "\\u", "and", "\\u", "api", "\\u", "id", "\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "shared", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "active", "\\u", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mobile", "back", "endi", "nvi", "tation", "\\u\\u", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mobile", "back", "endi", "nvi", "tation", "\\u\\u", "accepted_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "values_", "(_", "'", "id", "'_", ",_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "get", "\\u", "back", "end", "\\u", "from", "\\u", "id", "\\u", "and", "\\u", "api", "\\u", "id", "\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "global", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "active", "\\u", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "values_", "(_", "'", "id", "'_", ",_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "get", "\\u", "back", "end", "\\u", "from", "\\u", "id", "\\u", "and", "\\u", "api", "\\u", "id", "\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "load", "\\u", "by", "\\u", "name_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attempts", " ", "to", " ", "load", " ", "the", " ", "back", "end", " ", "with", " ", "the", " ", "give", "n", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "matchi", "ng", " ", "back", "end", " ", "is", " ", "found", ",", " ", "a", " ", "Ba", "d", "SMS", "Config", "Except", "ion", " ", "is", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "type", " ", "-", " ", "SQL", "Mob", "ile", "Back", "end", ".", "SMS", " ", "or", " ", "SQL", "Mob", "ile", "Back", "end", ".", "IV", "R", "\\", "10", ";", " ", " ", " ", " ", "domain", " ", "-", " ", "the", " ", "domain", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "-", " ", "the", " ", "name", " ", "of", " ", "the", " ", "back", "end", " ", "(", "correspond", "ing", " ", "to", " ", "SQL", "Mob", "ile", "Back", "end", ".", "name", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "cls_", "._", "get", "\\u", "owned", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "cls_", "._", "get", "\\u", "shared", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "back", "end", "\\u", "type_", ",_", "domain_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "cls_", "._", "get", "\\u", "global", "\\u", "back", "end", "\\u", "by", "\\u", "name_", "(_", "back", "end", "\\u", "type_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "SMS", "Config", "Exception_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "%", "s", " ", "back", "end", " ", "'%", "s", "'", " ", "from", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", " ", "'%", "s", "'\"_", "%_", "(_", "back", "end", "\\u", "type_", ",_", "name_", ",_", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "id_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "shou", "ld", " ", "return", " ", "the", " ", "back", "end", "'", "s", " ", "api", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ple", "ase", " ", "implement", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "gener", "ic", "\\u", "name_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "shou", "ld", " ", "return", " ", "a", " ", "descripti", "ve", " ", "name", " ", "for", " ", "this", " ", "back", "end", "\\", "10", ";", " ", " ", " ", " ", "(", "suc", "h", " ", "as", " ", "\"", "Unic", "el", "\"", " ", "or", " ", "\"", "Trop", "o", "\")", ",", " ", "for", " ", "use", " ", "in", " ", "identify", "ing", " ", "it", " ", "to", " ", "an", " ", "end", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ple", "ase", " ", "implement", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "form", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "shou", "ld", " ", "return", " ", "a", " ", "subclass", " ", "of", " ", "core", "hq", ".", "apps", ".", "sms", ".", "forms", ".", "Back", "end", "Form", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ple", "ase", " ", "implement", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "avail", "able", "\\u", "extra", "\\u", "fields_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "return", " ", "a", " ", "list", " ", "of", " ", "field", " ", "names", " ", "tha", "t", " ", "are", " ", "the", " ", "keys", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "extra", "\\u", "fields", " ", "dict", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ple", "ase", " ", "implement", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\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_", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "self", ".", "get", "\\u", "extra", "\\u", "fields", "()", " ", "convert", "ed", " ", "int", "o", " ", "a", " ", "namedtupl", "e", " ", "so", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "can", " ", "reference", " ", "self", ".", "config", ".", "gateway", "\\u", "user", "\\u", "id", ",", " ", "for", " ", "example", ",", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", " ", "of", " ", "self", ".", "get", "\\u", "extra", "\\u", "fields", "()[", "'", "gateway", "\\u", "user", "\\u", "id", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Back", "end", "Config_", "=_", "namedtuple_", "(_", "'", "Back", "end", "Config", "'_", ",_", "self_", "._", "get", "\\u", "avail", "able", "\\u", "extra", "\\u", "fields_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Back", "end", "Config_", "(_", "**_", "self_", "._", "get", "\\u", "extra", "\\u", "fields_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "extra", "\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "field_", ":_", "None_", "for_", "field_", "in_", "self_", "._", "get", "\\u", "avail", "able", "\\u", "extra", "\\u", "fields_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "update_", "(_", "self_", "._", "extra", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "extra", "\\u", "fields_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "update", "s", " ", "the", " ", "fields", " ", "tha", "t", " ", "are", " ", "pass", "ed", " ", "as", " ", "kwarg", "s", ",", " ", "and", " ", "lea", "ves", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "rest", " ", "unto", "uche", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "get", "\\u", "extra", "\\u", "fields_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "kwargs_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "not_", "in_", "self_", "._", "get", "\\u", "avail", "able", "\\u", "extra", "\\u", "fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Field", " ", "%", "s", " ", "is", " ", "not", " ", "an", " ", "avail", "able", " ", "extra", " ", "field", " ", "for", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "k_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "extra", "\\u", "fields_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "clear", "\\u", "shared", "\\u", "domain", "\\u", "cache_", "(_", "self_", ",_", "new", "\\u", "domains_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "domains_", "=_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "._", "values", "\\u", "list_", "(_", "'", "domain", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "the", " ", "cache", " ", "for", " ", "domains", " ", "in", " ", "new", "\\u", "domains", " ", "or", " ", "current", "\\u", "domains", ",", " ", "but", " ", "not", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "domain_", "in_", "set_", "(_", "current", "\\u", "domains_", ")_", "^_", "set_", "(_", "new", "\\u", "domains_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "domain", "\\u", "is", "\\u", "shared_", "._", "clear_", "(_", "self_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "shared", "\\u", "domains_", "(_", "self_", ",_", "domains_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Ple", "ase", " ", "call", " ", ".", "save", "()", " ", "on", " ", "the", " ", "back", "end", " ", "bef", "ore", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "calling", " ", "set\\u", "shared", "\\u", "domains", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "transaction_", "._", "atomic_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "clear", "\\u", "shared", "\\u", "domain", "\\u", "cache_", "(_", "domains_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "._", "all_", "(_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Mob", "ile", "Back", "end", "Invitation", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "accepted_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "domain_", "in_", "domains_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "soft", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "transaction_", "._", "atomic_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "clear", "\\u", "shared", "\\u", "domain", "\\u", "cache_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mobile", "back", "endi", "nvi", "tation", "\\u", "set_", "._", "all_", "(_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mapping_", "in_", "self_", "._", "sql", "mobile", "back", "end", "mapping", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "one", " ", "at", " ", "a", " ", "time", " ", "so", " ", "the", " ", "back", "end", " ", "map", " ", "cache", " ", "gets", " ", "clear", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "respec", "tiv", "e", " ", "domain", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapping_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "clear", "\\u", "caches_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "load_", "._", "clear_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", "._", "pk_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "\\u", "back", "end", "\\u", "api", "\\u", "id_", "._", "clear_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", "._", "pk_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "couch", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "load_", "._", "clear_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", "._", "couch", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "\\u", "back", "end", "\\u", "api", "\\u", "id_", "._", "clear_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", "._", "couch", "\\u", "id_", ",_", "is", "\\u", "couch", "\\u", "id_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "clear", "\\u", "caches_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Backend_", "(_", "UU", "ID", "Generat", "or", "Mixin_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "clear", "\\u", "caches_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "SQL", "Mob", "ile", "Backend_", ",_", "self_", ")_", "._", "delete_", "(_", "*_", "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_", "SQL", "SMS", "Backend_", "(_", "SQL", "Mob", "ile", "Backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "SQL", "SMS", "Backend_", "(_", "SQL", "Mob", "ile", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sms", "\\u", "rate", "\\u", "limit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "to", " ", "use", " ", "rate", " ", "limit", "ing", ".", " ", "Return", " ", "Non", "e", " ", "to", " ", "not", " ", "use", " ", "rate", " ", "limit", "ing", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", " ", "return", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "SMS", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "sent", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "back", "end", " ", "instance", " ", "in", " ", "a", " ", "one", " ", "minute", " ", "period", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "SMS", "Backend_", "(_", "SQL", "Mob", "ile", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "msg_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ple", "ase", " ", "implement", " ", "this", " ", "method", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "SMS", "Backend_", "(_", "SQL", "Mob", "ile", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "opt", "\\u", "in", "\\u", "keywords_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "to", " ", "speci", "fy", " ", "a", " ", "set", " ", "of", " ", "opt", "-", "in", " ", "keywords", " ", "to", " ", "use", " ", "for", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "back", "end", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "SMS", "Backend_", "(_", "SQL", "Mob", "ile", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "opt", "\\u", "out", "\\u", "keywords_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "to", " ", "speci", "fy", " ", "a", " ", "set", " ", "of", " ", "opt", "-", "out", " ", "keywords", " ", "to", " ", "use", " ", "for", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "back", "end", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Phone", "Load", "Bal", "anci", "ng", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "need", " ", "a", " ", "back", "end", " ", "to", " ", "balance", " ", "the", " ", "outb", "ound", " ", "SMS", " ", "load", " ", "over", " ", "a", " ", "set", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "phone", " ", "numbers", ",", " ", "use", " ", "this", " ", "mix", "in", ".", " ", "To", " ", "use", " ", "it", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Include", " ", "this", " ", "mix", "in", " ", "in", " ", "your", " ", "back", "end", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Ha", "ve", " ", "the", " ", "send", "()", " ", "method", " ", "expect", " ", "an", " ", "orig", "\\u", "phone", "\\u", "number", " ", "kwarg", ",", " ", "whi", "ch", " ", "will", "\\", "10", ";", " ", " ", " ", "be", " ", "the", " ", "phone", " ", "number", " ", "to", " ", "send", " ", "from", ".", " ", "Thi", "s", " ", "parameter", " ", "is", " ", "alw", "ay", "s", " ", "sent", " ", "in", " ", "for", "\\", "10", ";", " ", " ", " ", "instance", "s", " ", "of", " ", "Phone", "Load", "Bal", "anci", "ng", "Mix", "in", ",", " ", "even", " ", "if", " ", "there", "'", "s", " ", "just", " ", "one", " ", "phone", "\\", "10", ";", " ", " ", " ", "number", " ", "in", " ", "self", ".", "load", "\\u", "balancing", "\\u", "numbers", ".", "\\", "10", ";", " ", " ", " ", " ", "3", ")", " ", "Ha", "ve", " ", "the", " ", "back", "end", "'", "s", " ", "form", " ", "class", " ", "use", " ", "the", " ", "Load", "Bal", "anci", "ng", "Back", "end", "Form", "Mix", "in", " ", "to", "\\", "10", ";", " ", " ", " ", "automati", "call", "y", " ", "set", " ", "the", " ", "load", " ", "balancing", " ", "phone", " ", "numbers", " ", "in", " ", "the", " ", "UI", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "back", "end", " ", "als", "o", " ", "use", "s", " ", "rate", " ", "limit", "ing", ",", " ", "then", " ", "each", " ", "phone", " ", "number", " ", "is", " ", "rate", "\\", "10", ";", " ", " ", " ", " ", "limited", " ", "separately", " ", "as", " ", "you", " ", "wou", "ld", " ", "expect", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "We", " ", "coul", "d", " ", "als", "o", " ", "just", " ", "defin", "e", " ", "these", " ", "method", "s", " ", "on", " ", "the", " ", "back", "end", " ", "class", " ", "its", "elf", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "it", "'", "s", " ", "usef", "ul", " ", "in", " ", "other", " ", "part", "s", " ", "of", " ", "the", " ", "frame", "work", " ", "to", " ", "check", " ", "if", " ", "a", " ", "back", "end", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "an", " ", "instance", " ", "of", " ", "this", " ", "mix", "in", " ", "for", " ", "perform", "ing", " ", "vari", "ous", " ", "operati", "ons", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Load", "Bal", "anci", "ng", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "load", "\\u", "balance", "\\u", "redis", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "load", "-", "balance", "-", "phone", "s", "-", "for", "-", "back", "end", "-%", "s", "'_", "%_", "self_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Load", "Bal", "anci", "ng", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "next", "\\u", "phone", "\\u", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "isinstance_", "(_", "self_", "._", "load", "\\u", "balancing", "\\u", "numbers_", ",_", "list_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "load", "\\u", "balancing", "\\u", "numbers_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Expect", "ed", " ", "load", "\\u", "balancing", "\\u", "numbers", " ", "to", " ", "not", " ", "be", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "empty", " ", "for", " ", "back", "end", " ", "%", "s", "\"_", "%_", "self_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "load", "\\u", "balancing", "\\u", "numbers_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", "'", "s", " ", "just", " ", "one", " ", "number", ",", " ", "no", " ", "need", " ", "to", " ", "go", " ", "through", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "to", " ", "figure", " ", "out", " ", "whi", "ch", " ", "one", " ", "is", " ", "next", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "load", "\\u", "balancing", "\\u", "numbers_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "redis", "\\u", "key_", "=_", "self_", "._", "get", "\\u", "load", "\\u", "balance", "\\u", "redis", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "load", "\\u", "balance_", "(_", "redis", "\\u", "key_", ",_", "self_", "._", "load", "\\u", "balancing", "\\u", "numbers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Back", "end", "Map_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "catch", "all", "\\u", "back", "end", "\\u", "id_", ",_", "back", "end", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "catch", "all", "\\u", "back", "end", "\\u", "id", " ", "-", " ", "the", " ", "pk", " ", "of", " ", "the", " ", "back", "end", " ", "tha", "t", " ", "is", " ", "the", " ", "default", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "no", " ", "prefix", "es", " ", "match", " ", "(", "can", " ", "be", " ", "Non", "e", " ", "if", " ", "there", " ", "is", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "catch", " ", "all", ")", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "map", " ", "-", " ", "a", " ", "dictionar", "y", " ", "of", " ", "{", "prefix", ":", " ", "back", "end", " ", "pk", "}", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "maps", " ", "a", " ", "phone", " ", "prefix", " ", "to", " ", "the", " ", "back", "end", " ", "whi", "ch", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "for", " ", "tha", "t", " ", "phone", " ", "prefix", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "catch", "all", "\\u", "back", "end", "\\u", "id_", "=_", "catch", "all", "\\u", "back", "end", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "back", "end", "\\u", "map", "\\u", "dict_", "=_", "back", "end", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "back", "end", "\\u", "map", "\\u", "tuples_", "=_", "back", "end", "\\u", "map_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sort", " ", "by", " ", "length", " ", "of", " ", "prefix", " ", "descend", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "back", "end", "\\u", "map", "\\u", "tuples_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "back", "end", "\\u", "id", "\\u", "by", "\\u", "prefix_", "(_", "self_", ",_", "phone", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "number_", "=_", "sms", "util_", "._", "strip", "\\u", "plus_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prefix_", ",_", "back", "end", "\\u", "id_", "in_", "self_", "._", "back", "end", "\\u", "map", "\\u", "tuples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "phone", "\\u", "number_", "._", "startswith_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "back", "end", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "catch", "all", "\\u", "back", "end", "\\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_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "SQL", "Mob", "ile", "Back", "end", "Map", "ping", " ", "instance", " ", "is", " ", "used", " ", "to", " ", "map", " ", "SMS", " ", "or", " ", "IV", "R", " ", "traffic", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "give", "n", " ", "back", "end", " ", "based", " ", "on", " ", "phone", " ", "prefix", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "mess", "agin", "g", "\\u", "mobile", "back", "end", "mapping", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "\\u", "together_", "=_", "(_", "'", "domain", "'_", ",_", "'", "back", "end", "\\u", "type", "'_", ",_", "'", "prefix", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "couch", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "this", " ", "mapping", " ", "appli", "es", " ", "global", "ly", " ", "(", "system", "-", "wide", ").", " ", "Fal", "se", " ", "if", " ", "it", " ", "only", " ", "appli", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "domain", " ", "for", " ", "whi", "ch", " ", "this", " ", "mapping", " ", "is", " ", "valid", ";", " ", "ignore", "d", " ", "if", " ", "is", "\\u", "global", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Specifie", "s", " ", "whe", "ther", " ", "this", " ", "mapping", " ", "is", " ", "valid", " ", "for", " ", "SMS", " ", "or", " ", "IV", "R", " ", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "3_", ",_", "choices_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "TYPE", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "phone", " ", "prefix", ",", " ", "or", " ", "'*", "'", " ", "for", " ", "catch", "-", "all_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "back", "end", " ", "to", " ", "use", " ", "for", " ", "the", " ", "give", "n", " ", "phone", " ", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "SQL", "Mob", "ile", "Back", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "set\\u", "default", "\\u", "domain", "\\u", "backend_", "(_", "cls_", ",_", "domain_", ",_", "back", "end", "\\u", "type_", ",_", "backend_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "global_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "type_", "=_", "back", "end", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "'*'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "use", " ", "get", "\\u", "or", "\\u", "create", " ", "bec", "aus", "e", " ", "back", "end", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "cls_", "._", "objects_", "._", "get_", "(_", "**_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "cls_", "(_", "**_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "backend_", "=_", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "set\\u", "default", "\\u", "domain", "\\u", "backend_", "(_", "cls_", ",_", "domain_", ",_", "backend_", ",_", "back", "end", "\\u", "type_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "SMS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u\\u", "set\\u", "default", "\\u", "domain", "\\u", "backend_", "(_", "domain_", ",_", "back", "end", "\\u", "type_", ",_", "backend_", "=_", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "unse", "t", "\\u", "default", "\\u", "domain", "\\u", "backend_", "(_", "cls_", ",_", "domain_", ",_", "back", "end", "\\u", "type_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "SMS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u\\u", "set\\u", "default", "\\u", "domain", "\\u", "backend_", "(_", "domain_", ",_", "back", "end", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "@_", "quick", "cache_", "(_", "[_", "'", "back", "end", "\\u", "type", "'_", ",_", "'", "domain", "'_", "]_", ",_", "timeout_", "=_", "5_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map_", "(_", "cls_", ",_", "back", "end", "\\u", "type_", ",_", "domain_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "back", "end", "\\u", "type", " ", "-", " ", "SQL", "Mob", "ile", "Back", "end", ".", "SMS", " ", "or", " ", "SQL", "Mob", "ile", "Back", "end", ".", "IV", "R", "\\", "10", ";", " ", " ", " ", " ", "domain", " ", "-", " ", "the", " ", "domain", " ", "for", " ", "whi", "ch", " ", "to", " ", "retrieve", " ", "the", " ", "back", "end", " ", "map", ",", " ", "other", "wis", "e", " ", "if", " ", "left", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "global", " ", "back", "end", " ", "map", " ", "will", " ", "be", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Back", "end", "Map", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "args_", "=_", "{_", "'", "back", "end", "\\u", "type", "'_", ":_", "back", "end", "\\u", "type_", ",_", "'", "is", "\\u", "global", "'_", ":_", "False_", ",_", "'", "domain", "'_", ":_", "domain_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "args_", "=_", "{_", "'", "back", "end", "\\u", "type", "'_", ":_", "back", "end", "\\u", "type_", ",_", "'", "is", "\\u", "global", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "catch", "all", "\\u", "back", "end", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "cls_", "._", "objects_", "._", "filter_", "(_", "**_", "filter", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance_", "._", "prefix_", "==_", "'*'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catch", "all", "\\u", "back", "end", "\\u", "id_", "=_", "instance_", "._", "back", "end", "\\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 ", " _", "back", "end", "\\u", "map_", "[_", "instance_", "._", "prefix_", "]_", "=_", "instance_", "._", "back", "end", "\\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_", "Back", "end", "Map_", "(_", "catch", "all", "\\u", "back", "end", "\\u", "id_", ",_", "back", "end", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "clear", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map", "\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map_", "._", "clear_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "back", "end", "\\u", "type_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "clear", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "clear", "\\u", "prefix", "\\u", "to", "\\u", "back", "end", "\\u", "map", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "SQL", "Mob", "ile", "Back", "end", "Mapping_", ",_", "self_", ")_", "._", "delete_", "(_", "*_", "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_", "Mob", "ile", "Back", "end", "Invitation", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "mess", "agin", "g", "\\u", "mobile", "back", "endi", "nvi", "tation", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "sms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "\\u", "together_", "=_", "(_", "'", "back", "end", "'_", ",_", "'", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "domain", " ", "tha", "t", " ", "is", " ", "bei", "ng", " ", "invite", "d", " ", "to", " ", "share", " ", "anot", "her", " ", "domain", "'", "s", " ", "backend_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ",_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "back", "end", " ", "tha", "t", " ", "is", " ", "bei", "ng", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "SQL", "Mob", "ile", "Back", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accepted_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "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_", "class_", "Migrat", "ion", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "model", " ", "to", " ", "keep", " ", "track", " ", "of", " ", "whe", "ther", " ", "cert", "ain", " ", "mess", "agin", "g", " ", "migrati", "ons", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "bee", "n", " ", "run", " ", "ye", "t", " ", "or", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIGRAT", "ION", "\\u", "BACKEND_", "=_", "'", "back", "end", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MIGRAT", "ION", "\\u", "BACK", "END", "\\u", "MAP_", "=_", "'", "back", "end", "\\u", "map", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MIGRAT", "ION", "\\u", "DOM", "AIN", "\\u", "DEF", "AUL", "T", "\\u", "BACKEND_", "=_", "'", "domain", "\\u", "default", "\\u", "back", "end", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MIGRAT", "ION", "\\u", "LOG", "S_", "=_", "'", "logs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "mess", "agin", "g", "\\u", "migrati", "ons", "tat", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "\"", "sms", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "migrati", "on", " ", "(", "one", " ", "of", " ", "the", " ", "MIGRAT", "ION", "\\u*", " ", "constant", "s", " ", "above", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "126_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "timestamp", " ", "tha", "t", " ", "the", " ", "migrati", "on", " ", "was", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "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_", "[SEP]_", "class_", "Migrat", "ion", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "migrati", "on", "\\u", "completed_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", ",_", "created_", "=_", "cls_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "timestamp_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migrat", "ion", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "has", "\\u", "migrati", "on", "\\u", "completed_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "name_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
google/transitfeed/tests/transitfeed/testschedule.py
[ { "content": " def testTooNear(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140\\n\"\n \"BULLFROG,Bullfrog,48.20001,140\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StopsTooClose')\n self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testTooNear", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def testJustFarEnough(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140\\n\"\n \"BULLFROG,Bullfrog,48.20002,140\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140\\n\")\n schedule = self.MakeLoaderAndLoad()\n # Stops are 2.2m apart\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testJustFarEnough", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 226 }, { "content": " def testSameLocation(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon\\n\"\n \"BEATTY_AIRPORT,Airport,48.2,140\\n\"\n \"BULLFROG,Bullfrog,48.2,140\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StopsTooClose')\n self.assertTrue(e.FormatProblem().find(\"0.00m apart\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testSameLocation", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 237 }, { "content": " def testStationsTooNear(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140,,BEATTY_AIRPORT_STATION\\n\"\n \"BULLFROG,Bullfrog,48.20003,140,,BULLFROG_STATION\\n\"\n \"BEATTY_AIRPORT_STATION,Airport,48.20001,140,1,\\n\"\n \"BULLFROG_STATION,Bullfrog,48.20002,140,1,\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140,,\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StationsTooClose')\n self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)\n self.assertTrue(e.FormatProblem().find(\"BEATTY_AIRPORT_STATION\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testStationsTooNear", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def testStopNearNonParentStation(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140,,\\n\"\n \"BULLFROG,Bullfrog,48.20005,140,,\\n\"\n \"BULLFROG_STATION,Bullfrog,48.20006,140,1,\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140,,\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('DifferentStationTooClose')\n fmt = e.FormatProblem()\n self.assertTrue(re.search(\n r\"parent_station of.*BULLFROG.*station.*BULLFROG_STATION.* 1.11m apart\",\n fmt), fmt)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testStopNearNonParentStation", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 264 }, { "content": " def testNoCalendarDates(self):\n self.RemoveArchive(\"calendar_dates.txt\")\n self.MakeLoaderAndLoad()\n e = self.accumulator.PopException(\"NoServiceExceptions\")\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.NoServiceExceptionsTestCase.testNoCalendarDates", "header": "['class', 'NoServiceExceptionsTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " def testEmptyCalendarDates(self):\n self.SetArchiveContents(\n \"calendar_dates.txt\",\n \"\")\n self.MakeLoaderAndLoad()\n e = self.accumulator.PopException(\"EmptyFile\")\n e = self.accumulator.PopException(\"NoServiceExceptions\")\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.NoServiceExceptionsTestCase.testEmptyCalendarDates", "header": "['class', 'NoServiceExceptionsTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def testCalendarDatesWithHeaderOnly(self):\n self.SetArchiveContents(\n \"calendar_dates.txt\",\n \"service_id,date,exception_type\\n\")\n self.MakeLoaderAndLoad()\n e = self.accumulator.PopException(\"NoServiceExceptions\")\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.NoServiceExceptionsTestCase.testCalendarDatesWithHeaderOnly", "header": "['class', 'NoServiceExceptionsTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 309 }, { "content": " def runTest(self):\n schedule = transitfeed.Schedule(problem_reporter=self.problems)\n schedule.AddAgency(\"Sample Agency\", \"http://example.com\",\n \"America/Los_Angeles\")\n route = transitfeed.Route()\n route.route_id = \"SAMPLE_ID\"\n route.route_type = 3\n route.route_long_name = \"Sample Route\"\n schedule.AddRouteObject(route)\n\n service_period = transitfeed.ServicePeriod(\"WEEK\")\n service_period.SetStartDate(\"20070101\")\n service_period.SetEndDate(\"20071231\")\n service_period.SetWeekdayService(True)\n schedule.AddServicePeriodObject(service_period)\n\n trip = transitfeed.Trip()\n trip.route_id = \"SAMPLE_ID\"\n trip.service_id = \"WEEK\"\n trip.trip_id = \"SAMPLE_TRIP\"\n schedule.AddTripObject(trip)\n\n stop1 = transitfeed.Stop()\n stop1.stop_id = \"STOP1\"\n stop1.stop_name = \"Stop 1\"\n stop1.stop_lat = 78.243587\n stop1.stop_lon = 32.258937\n schedule.AddStopObject(stop1)\n trip.AddStopTime(stop1, arrival_time=\"12:00:00\", departure_time=\"12:00:00\")\n\n stop2 = transitfeed.Stop()\n stop2.stop_id = \"STOP2\"\n stop2.stop_name = \"Stop 2\"\n stop2.stop_lat = 78.253587\n stop2.stop_lon = 32.258937\n schedule.AddStopObject(stop2)\n trip.AddStopTime(stop2, arrival_time=\"12:05:00\", departure_time=\"12:05:00\")\n schedule.Validate()\n\n stop3 = transitfeed.Stop()\n stop3.stop_id = \"STOP3\"\n stop3.stop_name = \"Stop 3\"\n stop3.stop_lat = 78.243587\n stop3.stop_lon = 32.268937\n schedule.AddStopObject(stop3)\n trip.AddStopTime(stop3, arrival_time=\"12:10:00\", departure_time=\"12:10:00\")\n schedule.Validate()\n self.accumulator.AssertNoMoreExceptions()\n\n stop4 = transitfeed.Stop()\n stop4.stop_id = \"STOP4\"\n stop4.stop_name = \"Stop 4\"\n stop4.stop_lat = 78.243588\n stop4.stop_lon = 32.268936\n schedule.AddStopObject(stop4)\n trip.AddStopTime(stop4, arrival_time=\"12:15:00\", departure_time=\"12:15:00\")\n schedule.Validate()\n e = self.accumulator.PopException('StopsTooClose')\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.DuplicateStopValidationTestCase.runTest", "header": "['class', 'DuplicateStopValidationTestCase', '(', 'util', '.', 'ValidationTestCase', ')', ':', '___EOS___']", "index": 649 }, { "content": " def test_AssumeSingleAgencyIsDefault(self):\n schedule = transitfeed.Schedule()\n agency1 = self.freeAgency()\n schedule.AddAgencyObject(agency1)\n agency2 = self.freeAgency('2') # don't add to schedule\n # agency1 is default because it is the only Agency in schedule\n self.assertEqual(agency1, schedule.GetDefaultAgency())", "metadata": "root.DefaultAgencyTestCase.test_AssumeSingleAgencyIsDefault", "header": "['class', 'DefaultAgencyTestCase', '(', 'util', '.', 'TestCase', ')', ':', '___EOS___']", "index": 834 } ]
[ { "span": "schedule ", "start_line": 221, "start_column": 4, "end_line": 221, "end_column": 12 }, { "span": "schedule ", "start_line": 233, "start_column": 4, "end_line": 233, "end_column": 12 }, { "span": "schedule ", "start_line": 244, "start_column": 4, "end_line": 244, "end_column": 12 }, { "span": "schedule ", "start_line": 258, "start_column": 4, "end_line": 258, "end_column": 12 }, { "span": "schedule ", "start_line": 272, "start_column": 4, "end_line": 272, "end_column": 12 }, { "span": "e ", "start_line": 286, "start_column": 4, "end_line": 286, "end_column": 5 }, { "span": "e ", "start_line": 306, "start_column": 4, "end_line": 306, "end_column": 5 }, { "span": "e ", "start_line": 314, "start_column": 4, "end_line": 314, "end_column": 5 }, { "span": "e ", "start_line": 706, "start_column": 4, "end_line": 706, "end_column": 5 }, { "span": "agency2 ", "start_line": 838, "start_column": 4, "end_line": 838, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Too", "Near", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "1", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Stops", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "1.1", "1", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ju", "st", "Far", "En", "ou", "gh_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "2", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stops", " ", "are", " ", "2.2", "m", " ", "apart", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sam", "e", "Location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "2", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Stops", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "0.", "00", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Station", "s", "Too", "Near", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", ",", "location", "\\u", "type", ",", "parent", "\\u", "station", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", ",", ",", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "3", ",", "140", ",", ",", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", ",", "Air", "port", ",", "48.", "2000", "1", ",", "140", ",", "1", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", ",", "Bul", "lf", "rog", ",", "48.", "2000", "2", ",", "140", ",", "1", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", ",", ",\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Station", "s", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "1.1", "1", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sto", "p", "Near", "Non", "Parent", "Station_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", ",", "location", "\\u", "type", ",", "parent", "\\u", "station", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", ",", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "5", ",", "140", ",", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", ",", "Bul", "lf", "rog", ",", "48.", "2000", "6", ",", "140", ",", "1", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", ",", ",\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Different", "Station", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "e_", "._", "Format", "Problem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "re_", "._", "search_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"", "parent", "\\u", "station", " ", "of", ".*", "BUL", "LF", "RO", "G", ".*", "station", ".*", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", ".*", " ", "1.1", "1", "m", " ", "apart", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fmt_", ")_", ",_", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Service", "Except", "ion", "s", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "No", "Cal", "enda", "r", "Dates", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Remove", "Archive_", "(_", "\"", "calendar", "\\u", "dates", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "No", "Service", "Except", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Service", "Except", "ion", "s", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Emp", "ty", "Cal", "enda", "r", "Dates", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "calendar", "\\u", "dates", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Emp", "ty", "File", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "No", "Service", "Except", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Service", "Except", "ion", "s", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Cal", "enda", "r", "Dates", "With", "Head", "er", "Only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "calendar", "\\u", "dates", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "service", "\\u", "id", ",", "date", ",", "exception", "\\u", "type", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "No", "Service", "Except", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duplicate", "Sto", "p", "Validat", "ion", "Test", "Case_", "(_", "util_", "._", "Validat", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule_", "=_", "transit", "feed_", "._", "Schedule_", "(_", "problem", "\\u", "reporter_", "=_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Agency", "_", "(_", "\"", "Sampl", "e", " ", "Agency", "\"_", ",_", "\"", "http", "://", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ame", "rica", "/", "Lo", "s", "\\u", "Angel", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "=_", "transit", "feed_", "._", "Route_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "._", "route", "\\u", "id_", "=_", "\"", "SAMPLE", "\\u", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "._", "route", "\\u", "type_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "._", "route", "\\u", "long", "\\u", "name_", "=_", "\"", "Sampl", "e", " ", "Route", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Route", "Object_", "(_", "route_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "period_", "=_", "transit", "feed_", "._", "Service", "Period_", "(_", "\"", "WEEK", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "period_", "._", "Set", "Start", "Date_", "(_", "\"", "2007", "0101", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "period_", "._", "Set", "End", "Date_", "(_", "\"", "2007", "1231", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "period_", "._", "Set", "Week", "day", "Service_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Service", "Period", "Object_", "(_", "service", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip_", "=_", "transit", "feed_", "._", "Tri", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "route", "\\u", "id_", "=_", "\"", "SAMPLE", "\\u", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "service", "\\u", "id_", "=_", "\"", "WEEK", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "trip", "\\u", "id_", "=_", "\"", "SAMPLE", "\\u", "TRI", "P", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Tri", "p", "Object_", "(_", "trip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "1_", "=_", "transit", "feed_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "1_", "._", "stop", "\\u", "id_", "=_", "\"", "STOP", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "1_", "._", "stop", "\\u", "name_", "=_", "\"", "Sto", "p", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "1_", "._", "stop", "\\u", "lat_", "=_", "78.", "243", "587", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "1_", "._", "stop", "\\u", "lon_", "=_", "32.", "258", "937", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "1", "2", ":", "00", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "1", "2", ":", "00", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "2_", "=_", "transit", "feed_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "2_", "._", "stop", "\\u", "id_", "=_", "\"", "STOP", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "2_", "._", "stop", "\\u", "name_", "=_", "\"", "Sto", "p", " ", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "2_", "._", "stop", "\\u", "lat_", "=_", "78.", "253", "587", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "2_", "._", "stop", "\\u", "lon_", "=_", "32.", "258", "937", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "2_", ",_", "arrival", "\\u", "time_", "=_", "\"", "1", "2", ":", "05", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "1", "2", ":", "05", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Validate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "3_", "=_", "transit", "feed_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "3_", "._", "stop", "\\u", "id_", "=_", "\"", "STOP", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "3_", "._", "stop", "\\u", "name_", "=_", "\"", "Sto", "p", " ", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "3_", "._", "stop", "\\u", "lat_", "=_", "78.", "243", "587", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "3_", "._", "stop", "\\u", "lon_", "=_", "32.", "268", "937", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "3_", ",_", "arrival", "\\u", "time_", "=_", "\"", "1", "2", ":", "10", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "1", "2", ":", "10", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Validate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "4_", "=_", "transit", "feed_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "4_", "._", "stop", "\\u", "id_", "=_", "\"", "STOP", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "4_", "._", "stop", "\\u", "name_", "=_", "\"", "Sto", "p", " ", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "4_", "._", "stop", "\\u", "lat_", "=_", "78.", "243", "588", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "4_", "._", "stop", "\\u", "lon_", "=_", "32.", "268", "936", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "4_", ",_", "arrival", "\\u", "time_", "=_", "\"", "1", "2", ":", "15", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "1", "2", ":", "15", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Validate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Stops", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Default", "Agency", "Test", "Case_", "(_", "util_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Assume", "Sing", "le", "Agency", "Is", "Default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule_", "=_", "transit", "feed_", "._", "Schedule_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agency", "1_", "=_", "self_", "._", "free", "Agency", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Agency", "Object_", "(_", "agency", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agency", "2_", "=_", "self_", "._", "free", "Agency", "_", "(_", "'", "2", "'_", ")_", "#", " ", "don", "'", "t", " ", "add", " ", "to", " ", "schedule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "agency", "1", " ", "is", " ", "default", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "the", " ", "only", " ", "Agency", " ", "in", " ", "schedule_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "agency", "1_", ",_", "schedule_", "._", "Get", "Default", "Agency", "_", "(_", ")_", ")_", "\\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, 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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
hhatto/autopep8/test/suite/E50.py
[ { "content": "#: E501\na = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'\n#: E502\na = ('123456789012345678901234567890123456789012345678901234567890123456789' \\\n '01234567890')\n#: E502\na = ('AAA \\\n BBB' \\\n 'CCC')\n#: E502\nif (foo is None and bar is \"e000\" and \\\n blah == 'yeah'):\n blah = 'yeahnah'\n#\n#: Okay\na = ('AAA'\n 'BBB')\n\na = ('AAA \\\n BBB'\n 'CCC')\n\na = 'AAA' \\\n 'BBB' \\\n 'CCC'\n\na = ('AAA\\\nBBBBBBBBB\\\nCCCCCCCCC\\\nDDDDDDDDD')\n#\n#: Okay\nif aaa:\n pass\nelif bbb or \\\n ccc:\n pass\n\nddd = \\\n ccc\n\n('\\\n ' + ' \\\n')\n('''\n ''' + ' \\\n')\n#: E501 E225 E226\nvery_long_identifiers=and_terrible_whitespace_habits(are_no_excuse+for_long_lines)\n#\n#: E501\n'''multiline string\nwith a long long long long long long long long long long long long long long long long line\n'''\n#: E501\n'''same thing, but this time without a terminal newline in the string\nlong long long long long long long long long long long long long long long long line'''\n#\n# issue 224 (unavoidable long lines in docstrings)\n#: Okay\n\"\"\"\nI'm some great documentation. Because I'm some great documentation, I'm\ngoing to give you a reference to some valuable information about some API\nthat I'm calling:\n\n http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\n\"\"\"\n#: E501\n\"\"\"\nlongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces\"\"\"\n#: Okay\n\"\"\"\nThis\n almost_empty_line\n\"\"\"\n#: E501\n\"\"\"\nThis\n almost_empty_line\n\"\"\"\n#: E501\n# A basic comment\n# with a long long long long long long long long long long long long long long long long line\n\n#\n#: Okay\n# I'm some great comment. Because I'm so great, I'm going to give you a\n# reference to some valuable information about some API that I'm calling:\n#\n# http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\n\nimport this\n\n# longnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces\n\n#\n#: Okay\n# This\n# almost_empty_line\n\n#\n#: E501\n# This\n# almost_empty_line\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import this", "start_line": 91, "start_column": 0, "end_line": 91, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "'", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "02_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "(_", "'", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "12345678", "9", "'_", "'", "0123456", "7890", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "02_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "(_", "'", "AAA", " ", " ", "\\\\", "\\", "10", ";", " ", " ", "BBB", "'_", "'", "CCC", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "02_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "foo_", "is_", "None_", "and_", "bar_", "is_", "\"", "e0", "00", "\"_", "and_", "bla", "h_", "==_", "'", "ye", "ah", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bla", "h_", "=_", "'", "ye", "ah", "na", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "(_", "'", "AAA", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BBB", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "(_", "'", "AAA", " ", " ", "\\\\", "\\", "10", ";", " ", " ", "BBB", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CCC", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "'", "AAA", "'_", "'", "BBB", "'_", "'", "CCC", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "(_", "'", "AAA", "\\\\", "\\", "10", ";", "BBBB", "BBBB", "B", "\\\\", "\\", "10", ";", "CCCC", "CCCC", "C", "\\\\", "\\", "10", ";", "DDD", "DDD", "DDD", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "aaa", "_", ":_", "\\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_", "bbb", "_", "or_", "ccc", "_", ":_", "\\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_", "ddd", "_", "=_", "ccc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "\\", "10", ";", " ", " ", " ", " ", "'_", "+_", "'", " ", "\\\\", "\\", "10", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "'''_", "+_", "'", " ", "\\\\", "\\", "10", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "01", " ", "E2", "25", " ", "E2", "26_", "\\u\\u\\uNL\\u\\u\\u_", "very", "\\u", "long", "\\u", "identifiers_", "=_", "and", "\\u", "terr", "ibl", "e\\u", "whitespace", "\\u", "habit", "s_", "(_", "are", "\\u", "no", "\\u", "excu", "se_", "+_", "for", "\\u", "long", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "multiline", " ", "string", "\\", "10", ";", "with", " ", "a", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "line", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "same", " ", "thing", ",", " ", "but", " ", "this", " ", "time", " ", "with", "out", " ", "a", " ", "termina", "l", " ", "newline", " ", "in", " ", "the", " ", "string", "\\", "10", ";", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "line", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "issue", " ", "224", " ", "(", "una", "voi", "dable", " ", "long", " ", "lines", " ", "in", " ", "docstrings", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "I", "'", "m", " ", "some", " ", "great", " ", "documentation", ".", " ", " ", "Be", "caus", "e", " ", "I", "'", "m", " ", "some", " ", "great", " ", "documentation", ",", " ", "I", "'", "m", "\\", "10", ";", "goi", "ng", " ", "to", " ", "give", " ", "you", " ", "a", " ", "reference", " ", "to", " ", "some", " ", "valu", "able", " ", "informati", "on", " ", "abo", "ut", " ", "some", " ", "API", "\\", "10", ";", "tha", "t", " ", "I", "'", "m", " ", "calling", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "windows", "/", "desk", "top", "/", "aa", "363", "858", "(", "v", "=", "vs", ".8", "5", ").", "asp", "x", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", "alm", "ost", "\\u", "empty", "\\u", "line", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "alm", "ost", "\\u", "empty", "\\u", "line", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "basic", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "a", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "long", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "m", " ", "some", " ", "great", " ", "comment", ".", " ", " ", "Be", "caus", "e", " ", "I", "'", "m", " ", "so", " ", "great", ",", " ", "I", "'", "m", " ", "goi", "ng", " ", "to", " ", "give", " ", "you", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", " ", "to", " ", "some", " ", "valu", "able", " ", "informati", "on", " ", "abo", "ut", " ", "some", " ", "API", " ", "tha", "t", " ", "I", "'", "m", " ", "calling", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "windows", "/", "desk", "top", "/", "aa", "363", "858", "(", "v", "=", "vs", ".8", "5", ").", "asp", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "long", "nos", "paces", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Ok", "ay_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "alm", "ost", "\\u", "empty", "\\u", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "E5", "01_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", " ", "alm", "ost", "\\u", "empty", "\\u", "line_", "\\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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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, 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 ]
Unnecessary pass
shaunduncan/breezeminder/breezeminder/models/reminder.py
[ { "content": " def _check_available_balance_reminder(self, card, last_state):\n \"\"\" Check if card stored value has increased \"\"\"\n if card.stored_value is not None and last_state.stored_value is not None:\n try:\n if float(card.stored_value) > float(last_state.stored_value):\n return True\n except:\n app.logger.exception('Exception checking available balance')\n pass\n\n return False", "metadata": "root.Reminder._check_available_balance_reminder", "header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']", "index": 152 }, { "content": " def _check_balance_reminder(self, card, last_state=None):\n \"\"\" Check card stored value \"\"\"\n if card.stored_value is not None:\n try:\n current_value = float(card.stored_value)\n\n # Pedantic - make sure the last value isn't identical\n if last_state is not None and last_state.stored_value is not None:\n last_value = float(last_state.stored_value)\n if current_value == last_value:\n app.logger.info('No change in stored value %s since last reminder: %s' % (current_value, card.last_four))\n return False\n\n return current_value > 0 and current_value <= float(self.threshold)\n except:\n app.logger.exception('Exception checking balance')\n pass\n\n return False", "metadata": "root.Reminder._check_balance_reminder", "header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']", "index": 183 }, { "content": " def _check_round_trip_reminder(self, card, last_state=None):\n \"\"\" Checks products for remaining round trips that have fallen below threshold \"\"\"\n remind = False\n threshold = int(self.threshold)\n\n for product in card.products:\n if product.remaining_rides is None:\n continue\n\n try:\n # This does take into consideration half trips\n round_trips = product.remaining_rides / 2.0\n should_remind = round_trips < threshold\n\n # Pedantic - check last state products for name match\n # and number of round trips\n if last_state:\n last_trips = None\n\n # Find a matching product to compare\n for last in last_state.products:\n if last.name != product.name or last.remaining_rides is None:\n continue\n last_trips = last.remaining_rides / 2.0\n break\n\n if last_trips is not None:\n pedantic_remind = last_trips != round_trips and should_remind\n\n app.logger.info('Ensuring a change in %s round trips for %s: %s' % (round_trips, product.name, pedantic_remind))\n remind = remind or pedantic_remind\n continue\n\n # The default case\n remind = remind or should_remind\n except:\n app.logger.exception('Exception checking round trips')\n pass\n\n return remind", "metadata": "root.Reminder._check_round_trip_reminder", "header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']", "index": 232 }, { "content": " def _check_ride_reminder(self, card, last_state=None):\n \"\"\" Checks products for remaining rides that have fallen below threshold \"\"\"\n remind = False\n threshold = int(self.threshold)\n for product in card.products:\n if product.remaining_rides is None:\n continue\n\n try:\n remaining_rides = int(product.remaining_rides)\n should_remind = remaining_rides <= threshold\n\n # Pedantic - check last state products for name match\n # and number of remaining rides\n if last_state:\n last_rides = None\n\n for last in last_state.products:\n if last.name != product.name or last.remaining_rides is None:\n continue\n last_rides = int(last.remaining_rides)\n break\n\n if last_rides is not None:\n pedantic_remind = last_rides != remaining_rides and should_remind\n\n app.logger.info('Ensuring a change in %s rides for %s: %s' % (remaining_rides, product.name, pedantic_remind))\n remind = remind or pedantic_remind\n continue\n\n remind = remind or should_remind\n except:\n app.logger.exception('Exception checking rides')\n pass\n\n return remind", "metadata": "root.Reminder._check_ride_reminder", "header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']", "index": 273 } ]
[ { "span": "pass", "start_line": 160, "start_column": 16, "end_line": 160, "end_column": 20 }, { "span": "pass", "start_line": 199, "start_column": 16, "end_line": 199, "end_column": 20 }, { "span": "pass", "start_line": 269, "start_column": 16, "end_line": 269, "end_column": 20 }, { "span": "pass", "start_line": 306, "start_column": 16, "end_line": 306, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Remi", "nder", "_", "(_", "Base", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "avail", "able", "\\u", "balance", "\\u", "reminder", "_", "(_", "self_", ",_", "card_", ",_", "last", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "if", " ", "card", " ", "store", "d", " ", "value", " ", "has", " ", "increase", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "card_", "._", "store", "d\\u", "value_", "is_", "not_", "None_", "and_", "last", "\\u", "state_", "._", "store", "d\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "float_", "(_", "card_", "._", "store", "d\\u", "value_", ")_", ">_", "float_", "(_", "last", "\\u", "state_", "._", "store", "d\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "logger_", "._", "exception_", "(_", "'", "Except", "ion", " ", "checking", " ", "avail", "able", " ", "balance", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remi", "nder", "_", "(_", "Base", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "balance", "\\u", "reminder", "_", "(_", "self_", ",_", "card_", ",_", "last", "\\u", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "card", " ", "store", "d", " ", "value", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "card_", "._", "store", "d\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "value_", "=_", "float_", "(_", "card_", "._", "store", "d\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ped", "antic", " ", "-", " ", "make", " ", "sure", " ", "the", " ", "last", " ", "value", " ", "isn", "'", "t", " ", "identical_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "last", "\\u", "state_", "is_", "not_", "None_", "and_", "last", "\\u", "state_", "._", "store", "d\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "\\u", "value_", "=_", "float_", "(_", "last", "\\u", "state_", "._", "store", "d\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "value_", "==_", "last", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "app_", "._", "logger_", "._", "info_", "(_", "'", "No", " ", "change", " ", "in", " ", "store", "d", " ", "value", " ", "%", "s", " ", "sinc", "e", " ", "last", " ", "reminder", ":", " ", "%", "s", "'_", "%_", "(_", "current", "\\u", "value_", ",_", "card_", "._", "last", "\\u", "four", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "current", "\\u", "value_", ">_", "0_", "and_", "current", "\\u", "value_", "<=_", "float_", "(_", "self_", "._", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "logger_", "._", "exception_", "(_", "'", "Except", "ion", " ", "checking", " ", "balance", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remi", "nder", "_", "(_", "Base", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "round", "\\u", "trip", "\\u", "reminder", "_", "(_", "self_", ",_", "card_", ",_", "last", "\\u", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", "s", " ", "products", " ", "for", " ", "rema", "inin", "g", " ", "round", " ", "trips", " ", "tha", "t", " ", "have", " ", "fall", "en", " ", "belo", "w", " ", "threshol", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remi", "nd_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threshold_", "=_", "int_", "(_", "self_", "._", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "product_", "in_", "card_", "._", "products_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "product_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "doe", "s", " ", "take", " ", "int", "o", " ", "consider", "ation", " ", "half", " ", "trips", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "round", "\\u", "trips", "_", "=_", "product_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shou", "ld", "\\u", "remi", "nd_", "=_", "round", "\\u", "trips", "_", "<_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ped", "antic", " ", "-", " ", "check", " ", "last", " ", "state", " ", "products", " ", "for", " ", "name", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "number", " ", "of", " ", "round", " ", "trips", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "last", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "\\u", "trips", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "a", " ", "matchi", "ng", " ", "product", " ", "to", " ", "compare_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "last_", "in_", "last", "\\u", "state_", "._", "products_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "last_", "._", "name_", "!=_", "product_", "._", "name_", "or_", "last_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "trips", "_", "=_", "last_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "\\u", "trips", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ped", "antic", "\\u", "remi", "nd_", "=_", "last", "\\u", "trips", "_", "!=_", "round", "\\u", "trips", "_", "and_", "shou", "ld", "\\u", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "logger_", "._", "info_", "(_", "'", "Ensur", "ing", " ", "a", " ", "change", " ", "in", " ", "%", "s", " ", "round", " ", "trips", " ", "for", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "round", "\\u", "trips", "_", ",_", "product_", "._", "name_", ",_", "ped", "antic", "\\u", "remi", "nd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remi", "nd_", "=_", "remi", "nd_", "or_", "ped", "antic", "\\u", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remi", "nd_", "=_", "remi", "nd_", "or_", "shou", "ld", "\\u", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "logger_", "._", "exception_", "(_", "'", "Except", "ion", " ", "checking", " ", "round", " ", "trips", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remi", "nder", "_", "(_", "Base", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "ride", "\\u", "reminder", "_", "(_", "self_", ",_", "card_", ",_", "last", "\\u", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", "s", " ", "products", " ", "for", " ", "rema", "inin", "g", " ", "ride", "s", " ", "tha", "t", " ", "have", " ", "fall", "en", " ", "belo", "w", " ", "threshol", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remi", "nd_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threshold_", "=_", "int_", "(_", "self_", "._", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "product_", "in_", "card_", "._", "products_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "product_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rema", "inin", "g", "\\u", "ride", "s_", "=_", "int_", "(_", "product_", "._", "rema", "inin", "g", "\\u", "ride", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shou", "ld", "\\u", "remi", "nd_", "=_", "rema", "inin", "g", "\\u", "ride", "s_", "<=_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ped", "antic", " ", "-", " ", "check", " ", "last", " ", "state", " ", "products", " ", "for", " ", "name", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "number", " ", "of", " ", "rema", "inin", "g", " ", "ride", "s_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "last", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "\\u", "ride", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "last_", "in_", "last", "\\u", "state_", "._", "products_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "last_", "._", "name_", "!=_", "product_", "._", "name_", "or_", "last_", "._", "rema", "inin", "g", "\\u", "ride", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "ride", "s_", "=_", "int_", "(_", "last_", "._", "rema", "inin", "g", "\\u", "ride", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "\\u", "ride", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ped", "antic", "\\u", "remi", "nd_", "=_", "last", "\\u", "ride", "s_", "!=_", "rema", "inin", "g", "\\u", "ride", "s_", "and_", "shou", "ld", "\\u", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "logger_", "._", "info_", "(_", "'", "Ensur", "ing", " ", "a", " ", "change", " ", "in", " ", "%", "s", " ", "ride", "s", " ", "for", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "rema", "inin", "g", "\\u", "ride", "s_", ",_", "product_", "._", "name_", ",_", "ped", "antic", "\\u", "remi", "nd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remi", "nd_", "=_", "remi", "nd_", "or_", "ped", "antic", "\\u", "remi", "nd_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remi", "nd_", "=_", "remi", "nd_", "or_", "shou", "ld", "\\u", "remi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "logger_", "._", "exception_", "(_", "'", "Except", "ion", " ", "checking", " ", "ride", "s", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "remi", "nd_", "\\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,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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, 0, 2, 2, 2, 2, 2, 2, 2, 2 ]
Modification of parameter with default
Akagi201/learning-python/trips/append.py
[ { "content": "def test(a=[]):\n a.append(1)\n return a", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "a.", "start_line": 1, "start_column": 4, "end_line": 1, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "test_", "(_", "a_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
coleifer/peewee/playhouse/tests/test_helpers.py
[ { "content": " def test_topological_sort_fundamentals(self):\n FKF = ForeignKeyField\n # we will be topo-sorting the following models\n class A(Model): pass\n class B(Model): a = FKF(A) # must follow A\n class C(Model): a, b = FKF(A), FKF(B) # must follow A and B\n class D(Model): c = FKF(C) # must follow A and B and C\n class E(Model): e = FKF('self')\n # but excluding this model, which is a child of E\n class Excluded(Model): e = FKF(E)\n\n # property 1: output ordering must not depend upon input order\n repeatable_ordering = None\n for input_ordering in permutations([A, B, C, D, E]):\n output_ordering = sort_models_topologically(input_ordering)\n repeatable_ordering = repeatable_ordering or output_ordering\n self.assertEqual(repeatable_ordering, output_ordering)\n\n # property 2: output ordering must have same models as input\n self.assertEqual(len(output_ordering), 5)\n self.assertFalse(Excluded in output_ordering)\n\n # property 3: parents must precede children\n def assert_precedes(X, Y):\n lhs, rhs = map(output_ordering.index, [X, Y])\n self.assertTrue(lhs < rhs)\n assert_precedes(A, B)\n assert_precedes(B, C) # if true, C follows A by transitivity\n assert_precedes(C, D) # if true, D follows A and B by transitivity\n\n # property 4: independent model hierarchies must be in name order\n assert_precedes(A, E)", "metadata": "root.TestTopologicalSorting.test_topological_sort_fundamentals", "header": "['class', 'TestTopologicalSorting', '(', 'PeeweeTestCase', ')', ':', '___EOS___']", "index": 34 } ]
[ { "span": "self.assertFalse(Excluded in output_ordering)", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 53 }, { "span": "self.assertTrue(lhs < rhs)", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Topo", "logical", "Sort", "ing_", "(_", "Pe", "ew", "ee", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "topologi", "cal", "\\u", "sort", "\\u", "fund", "amental", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FK", "F_", "=_", "Fore", "ign", "Key", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "will", " ", "be", " ", "topo", "-", "sorting", " ", "the", " ", "follow", "ing", " ", "models_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "A_", "(_", "Model_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "B_", "(_", "Model_", ")_", ":_", "a_", "=_", "FK", "F_", "(_", "A_", ")_", "#", " ", "must", " ", "follow", " ", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "C_", "(_", "Model_", ")_", ":_", "a_", ",_", "b_", "=_", "FK", "F_", "(_", "A_", ")_", ",_", "FK", "F_", "(_", "B_", ")_", "#", " ", "must", " ", "follow", " ", "A", " ", "and", " ", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "D_", "(_", "Model_", ")_", ":_", "c_", "=_", "FK", "F_", "(_", "C_", ")_", "#", " ", "must", " ", "follow", " ", "A", " ", "and", " ", "B", " ", "and", " ", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "E_", "(_", "Model_", ")_", ":_", "e_", "=_", "FK", "F_", "(_", "'", "self", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "but", " ", "excluding", " ", "this", " ", "model", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "child", " ", "of", " ", "E_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Exclude", "d_", "(_", "Model_", ")_", ":_", "e_", "=_", "FK", "F_", "(_", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "property", " ", "1", ":", " ", "output", " ", "orderi", "ng", " ", "must", " ", "not", " ", "depend", " ", "upo", "n", " ", "input", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "repeat", "able", "\\u", "ordering_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "input", "\\u", "ordering_", "in_", "permutations_", "(_", "[_", "A_", ",_", "B_", ",_", "C_", ",_", "D_", ",_", "E_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "ordering_", "=_", "sort", "\\u", "model", "s", "\\u", "topologi", "call", "y_", "(_", "input", "\\u", "ordering_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repeat", "able", "\\u", "ordering_", "=_", "repeat", "able", "\\u", "ordering_", "or_", "output", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repeat", "able", "\\u", "ordering_", ",_", "output", "\\u", "ordering_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "property", " ", "2", ":", " ", "output", " ", "orderi", "ng", " ", "must", " ", "have", " ", "same", " ", "model", "s", " ", "as", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "output", "\\u", "ordering_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Exclude", "d_", "in_", "output", "\\u", "ordering_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "property", " ", "3", ":", " ", "parents", " ", "must", " ", "prece", "de", " ", "children_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "assert", "\\u", "prece", "des_", "(_", "X_", ",_", "Y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lhs_", ",_", "rhs_", "=_", "map_", "(_", "output", "\\u", "ordering_", "._", "index_", ",_", "[_", "X_", ",_", "Y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "lhs_", "<_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "prece", "des_", "(_", "A_", ",_", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "prece", "des_", "(_", "B_", ",_", "C_", ")_", "#", " ", "if", " ", "true", ",", " ", "C", " ", "follow", "s", " ", "A", " ", "by", " ", "transiti", "vity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "prece", "des_", "(_", "C_", ",_", "D_", ")_", "#", " ", "if", " ", "true", ",", " ", "D", " ", "follow", "s", " ", "A", " ", "and", " ", "B", " ", "by", " ", "transiti", "vity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "property", " ", "4", ":", " ", "independent", " ", "model", " ", "hier", "archi", "es", " ", "must", " ", "be", " ", "in", " ", "name", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "prece", "des_", "(_", "A_", ",_", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
`__iter__` method returns a non-iterator
babble/babble/include/jython/Lib/test/test_itertools.py
[ { "content": "class StopNow:\n 'Class emulating an empty iterable.'", "metadata": "root.StopNow", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __iter__(self):\n return self", "metadata": "root.StopNow.__iter__", "header": "['class', 'StopNow', ':', '___EOS___']", "index": 31 }, { "content": "class I:\n 'Sequence using iterator protocol'", "metadata": "root.I", "header": "['module', '___EOS___']", "index": 497 }, { "content": " def __iter__(self):\n return self", "metadata": "root.I.__iter__", "header": "['class', 'I', ':', '___EOS___']", "index": 502 }, { "content": "class N:\n 'Iterator missing next()'", "metadata": "root.N", "header": "['module', '___EOS___']", "index": 530 }, { "content": " def __iter__(self):\n return self", "metadata": "root.N.__iter__", "header": "['class', 'N', ':', '___EOS___']", "index": 535 }, { "content": "class E:\n 'Test propagation of exceptions'", "metadata": "root.E", "header": "['module', '___EOS___']", "index": 538 }, { "content": " def __iter__(self):\n return self", "metadata": "root.E.__iter__", "header": "['class', 'E', ':', '___EOS___']", "index": 543 }, { "content": "class S:\n 'Test immediate stop'", "metadata": "root.S", "header": "['module', '___EOS___']", "index": 548 }, { "content": " def __iter__(self):\n return self", "metadata": "root.S.__iter__", "header": "['class', 'S', ':', '___EOS___']", "index": 552 } ]
[ { "span": "class StopNow:", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 14 }, { "span": "class I:", "start_line": 497, "start_column": 0, "end_line": 497, "end_column": 8 }, { "span": "class N:", "start_line": 530, "start_column": 0, "end_line": 530, "end_column": 8 }, { "span": "class E:", "start_line": 538, "start_column": 0, "end_line": 538, "end_column": 8 }, { "span": "class S:", "start_line": 548, "start_column": 0, "end_line": 548, "end_column": 8 } ]
[ { "span": "def __iter__(self):", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 502, "start_column": 4, "end_line": 502, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 535, "start_column": 4, "end_line": 535, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 543, "start_column": 4, "end_line": 543, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 552, "start_column": 4, "end_line": 552, "end_column": 23 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "iter\\u\\u_", "`_", "method_", "returns_", "a_", "non", "_", "-_", "iterator_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sto", "p", "Now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Class", " ", "emu", "latin", "g", " ", "an", " ", "empty", " ", "iterable", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Now_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "I_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Sequ", "ence", " ", "usi", "ng", " ", "iter", "ator", " ", "protoc", "ol", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Iterat", "or", " ", "missi", "ng", " ", "next", "()'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "N_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Test", " ", "propagat", "ion", " ", "of", " ", "exception", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "E_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Test", " ", "immediate", " ", "stop", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 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, 4, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
sympy/sympy/sympy/polys/domains/domain.py
[ { "content": " def from_FF_python(K1, a, K0):\n \"\"\"Convert ``ModularInteger(int)`` to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_FF_python", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " def from_ZZ_python(K1, a, K0):\n \"\"\"Convert a Python ``int`` object to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_ZZ_python", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 172 }, { "content": " def from_QQ_python(K1, a, K0):\n \"\"\"Convert a Python ``Fraction`` object to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_QQ_python", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def from_FF_gmpy(K1, a, K0):\n \"\"\"Convert ``ModularInteger(mpz)`` to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_FF_gmpy", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " def from_ZZ_gmpy(K1, a, K0):\n \"\"\"Convert a GMPY ``mpz`` object to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_ZZ_gmpy", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 184 }, { "content": " def from_QQ_gmpy(K1, a, K0):\n \"\"\"Convert a GMPY ``mpq`` object to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_QQ_gmpy", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 188 }, { "content": " def from_RealField(K1, a, K0):\n \"\"\"Convert a real element object to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_RealField", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def from_ComplexField(K1, a, K0):\n \"\"\"Convert a complex element to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_ComplexField", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 196 }, { "content": " def from_AlgebraicField(K1, a, K0):\n \"\"\"Convert an algebraic number to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_AlgebraicField", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def from_PolynomialRing(K1, a, K0):\n \"\"\"Convert a polynomial to ``dtype``. \"\"\"\n if a.is_ground:\n return K1.convert(a.LC, K0.dom)", "metadata": "root.Domain.from_PolynomialRing", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": " def from_FractionField(K1, a, K0):\n \"\"\"Convert a rational function to ``dtype``. \"\"\"\n return None", "metadata": "root.Domain.from_FractionField", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 209 }, { "content": " def from_ExpressionDomain(K1, a, K0):\n \"\"\"Convert a ``EX`` object to ``dtype``. \"\"\"\n return K1.from_sympy(a.ex)", "metadata": "root.Domain.from_ExpressionDomain", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def from_GlobalPolynomialRing(K1, a, K0):\n \"\"\"Convert a polynomial to ``dtype``. \"\"\"\n if a.degree() <= 0:\n return K1.convert(a.LC(), K0.dom)", "metadata": "root.Domain.from_GlobalPolynomialRing", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " def from_GeneralizedPolynomialRing(K1, a, K0):\n return K1.from_FractionField(a, K0)", "metadata": "root.Domain.from_GeneralizedPolynomialRing", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 222 }, { "content": " def unify_with_symbols(K0, K1, symbols):\n if (K0.is_Composite and (set(K0.symbols) & set(symbols))) or (K1.is_Composite and (set(K1.symbols) & set(symbols))):\n raise UnificationFailed(\"can't unify %s with %s, given %s generators\" % (K0, K1, tuple(symbols)))\n\n return K0.unify(K1)", "metadata": "root.Domain.unify_with_symbols", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 225 }, { "content": " def unify(K0, K1, symbols=None):\n \"\"\"\n Construct a minimal domain that contains elements of ``K0`` and ``K1``.\n\n Known domains (from smallest to largest):\n\n - ``GF(p)``\n - ``ZZ``\n - ``QQ``\n - ``RR(prec, tol)``\n - ``CC(prec, tol)``\n - ``ALG(a, b, c)``\n - ``K[x, y, z]``\n - ``K(x, y, z)``\n - ``EX``\n\n \"\"\"\n if symbols is not None:\n return K0.unify_with_symbols(K1, symbols)\n\n if K0 == K1:\n return K0\n\n if K0.is_EX:\n return K0\n if K1.is_EX:\n return K1\n\n if K0.is_Composite or K1.is_Composite:\n K0_ground = K0.dom if K0.is_Composite else K0\n K1_ground = K1.dom if K1.is_Composite else K1\n\n K0_symbols = K0.symbols if K0.is_Composite else ()\n K1_symbols = K1.symbols if K1.is_Composite else ()\n\n domain = K0_ground.unify(K1_ground)\n symbols = _unify_gens(K0_symbols, K1_symbols)\n order = K0.order if K0.is_Composite else K1.order\n\n if ((K0.is_FractionField and K1.is_PolynomialRing or\n K1.is_FractionField and K0.is_PolynomialRing) and\n (not K0_ground.has_Field or not K1_ground.has_Field) and domain.has_Field):\n domain = domain.get_ring()\n\n if K0.is_Composite and (not K1.is_Composite or K0.is_FractionField or K1.is_PolynomialRing):\n cls = K0.__class__\n else:\n cls = K1.__class__\n\n return cls(domain, symbols, order)\n\n def mkinexact(cls, K0, K1):\n prec = max(K0.precision, K1.precision)\n tol = max(K0.tolerance, K1.tolerance)\n return cls(prec=prec, tol=tol)\n\n if K0.is_ComplexField and K1.is_ComplexField:\n return mkinexact(K0.__class__, K0, K1)\n if K0.is_ComplexField and K1.is_RealField:\n return mkinexact(K0.__class__, K0, K1)\n if K0.is_RealField and K1.is_ComplexField:\n return mkinexact(K1.__class__, K1, K0)\n if K0.is_RealField and K1.is_RealField:\n return mkinexact(K0.__class__, K0, K1)\n if K0.is_ComplexField or K0.is_RealField:\n return K0\n if K1.is_ComplexField or K1.is_RealField:\n return K1\n\n if K0.is_AlgebraicField and K1.is_AlgebraicField:\n return K0.__class__(K0.dom.unify(K1.dom), *_unify_gens(K0.orig_ext, K1.orig_ext))\n elif K0.is_AlgebraicField:\n return K0\n elif K1.is_AlgebraicField:\n return K1\n\n if K0.is_RationalField:\n return K0\n if K1.is_RationalField:\n return K1\n\n if K0.is_IntegerRing:\n return K0\n if K1.is_IntegerRing:\n return K1\n\n if K0.is_FiniteField and K1.is_FiniteField:\n return K0.__class__(max(K0.mod, K1.mod, key=default_sort_key))\n\n from sympy.polys.domains import EX\n return EX", "metadata": "root.Domain.unify", "header": "['class', 'Domain', '(', 'object', ')', ':', '___EOS___']", "index": 231 } ]
[ { "span": "def from_FF_python(K1, a, K0):", "start_line": 168, "start_column": 4, "end_line": 168, "end_column": 34 }, { "span": "def from_ZZ_python(K1, a, K0):", "start_line": 172, "start_column": 4, "end_line": 172, "end_column": 34 }, { "span": "def from_QQ_python(K1, a, K0):", "start_line": 176, "start_column": 4, "end_line": 176, "end_column": 34 }, { "span": "def from_FF_gmpy(K1, a, K0):", "start_line": 180, "start_column": 4, "end_line": 180, "end_column": 32 }, { "span": "def from_ZZ_gmpy(K1, a, K0):", "start_line": 184, "start_column": 4, "end_line": 184, "end_column": 32 }, { "span": "def from_QQ_gmpy(K1, a, K0):", "start_line": 188, "start_column": 4, "end_line": 188, "end_column": 32 }, { "span": "def from_RealField(K1, a, K0):", "start_line": 192, "start_column": 4, "end_line": 192, "end_column": 34 }, { "span": "def from_ComplexField(K1, a, K0):", "start_line": 196, "start_column": 4, "end_line": 196, "end_column": 37 }, { "span": "def from_AlgebraicField(K1, a, K0):", "start_line": 200, "start_column": 4, "end_line": 200, "end_column": 39 }, { "span": "def from_PolynomialRing(K1, a, K0):", "start_line": 204, "start_column": 4, "end_line": 204, "end_column": 39 }, { "span": "def from_FractionField(K1, a, K0):", "start_line": 209, "start_column": 4, "end_line": 209, "end_column": 38 }, { "span": "def from_ExpressionDomain(K1, a, K0):", "start_line": 213, "start_column": 4, "end_line": 213, "end_column": 41 }, { "span": "def from_GlobalPolynomialRing(K1, a, K0):", "start_line": 217, "start_column": 4, "end_line": 217, "end_column": 45 }, { "span": "def from_GeneralizedPolynomialRing(K1, a, K0):", "start_line": 222, "start_column": 4, "end_line": 222, "end_column": 50 }, { "span": "def unify_with_symbols(K0, K1, symbols):", "start_line": 225, "start_column": 4, "end_line": 225, "end_column": 44 }, { "span": "def unify(K0, K1, symbols=None):", "start_line": 231, "start_column": 4, "end_line": 231, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "FF", "\\u", "python_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "``", "Modul", "ar", "Integer", "(", "int", ")`", "`", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "ZZ", "\\u", "python_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "Pyth", "on", " ", "``", "int", "``", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "QQ", "\\u", "python_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "Pyth", "on", " ", "``", "Frac", "tion", "``", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "FF", "\\u", "gmp", "y_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "``", "Modul", "ar", "Integer", "(", "mp", "z", ")`", "`", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "ZZ", "\\u", "gmp", "y_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "GM", "PY", " ", "``", "mp", "z", "``", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "QQ", "\\u", "gmp", "y_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "GM", "PY", " ", "``", "mp", "q", "``", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Real", "Field_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "real", " ", "element", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Comple", "x", "Field_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "complex", " ", "element", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Alg", "ebra", "ic", "Field_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "an", " ", "algebra", "ic", " ", "number", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Polynomial", "Ring_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "polynomial", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "is", "\\u", "ground_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "._", "convert_", "(_", "a_", "._", "LC", "_", ",_", "K", "0_", "._", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "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_", "from", "\\u", "Frac", "tion", "Field_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "rational", " ", "function", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Expression", "Domain_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "``", "EX", "``", " ", "object", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "K1", "_", "._", "from", "\\u", "sympy_", "(_", "a_", "._", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "Global", "Polynomial", "Ring_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "polynomial", " ", "to", " ", "``", "dt", "ype", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "degree_", "(_", ")_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "._", "convert_", "(_", "a_", "._", "LC", "_", "(_", ")_", ",_", "K", "0_", "._", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "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_", "from", "\\u", "General", "ize", "d", "Polynomial", "Ring_", "(_", "K1", "_", ",_", "a_", ",_", "K", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "._", "from", "\\u", "Frac", "tion", "Field_", "(_", "a_", ",_", "K", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unify", "\\u", "with", "\\u", "symbols_", "(_", "K", "0_", ",_", "K1", "_", ",_", "symbols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "and_", "(_", "set_", "(_", "K", "0_", "._", "symbols_", ")_", "&_", "set_", "(_", "symbols_", ")_", ")_", ")_", "or_", "(_", "K1", "_", "._", "is", "\\u", "Composit", "e_", "and_", "(_", "set_", "(_", "K1", "_", "._", "symbols_", ")_", "&_", "set_", "(_", "symbols_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", ",", " ", "give", "n", " ", "%", "s", " ", "generat", "ors", "\"_", "%_", "(_", "K", "0_", ",_", "K1", "_", ",_", "tuple_", "(_", "symbols_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "K", "0_", "._", "unify", "_", "(_", "K1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Domain_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unify", "_", "(_", "K", "0_", ",_", "K1", "_", ",_", "symbols_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Construct", " ", "a", " ", "minima", "l", " ", "domain", " ", "tha", "t", " ", "contain", "s", " ", "element", "s", " ", "of", " ", "``", "K", "0", "``", " ", "and", " ", "``", "K1", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Kno", "wn", " ", "domains", " ", "(", "from", " ", "smallest", " ", "to", " ", "large", "st", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "GF", "(", "p", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "ZZ", "``", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "QQ", "``", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "RR", "(", "prec", ",", " ", "tol", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "CC", "(", "prec", ",", " ", "tol", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "AL", "G", "(", "a", ",", " ", "b", ",", " ", "c", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "K", "[", "x", ",", " ", "y", ",", " ", "z", "]``", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "K", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "``", "EX", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "symbols_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "._", "unify", "\\u", "with", "\\u", "symbols_", "(_", "K1", "_", ",_", "symbols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "==_", "K1", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "EX_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K1", "_", "._", "is", "\\u", "EX_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "or_", "K1", "_", "._", "is", "\\u", "Composit", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "K", "0", "\\u", "ground_", "=_", "K", "0_", "._", "dom_", "if_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "else_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K1", "\\u", "ground_", "=_", "K1", "_", "._", "dom_", "if_", "K1", "_", "._", "is", "\\u", "Composit", "e_", "else_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "K", "0", "\\u", "symbols_", "=_", "K", "0_", "._", "symbols_", "if_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "else_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K1", "\\u", "symbols_", "=_", "K1", "_", "._", "symbols_", "if_", "K1", "_", "._", "is", "\\u", "Composit", "e_", "else_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "K", "0", "\\u", "ground_", "._", "unify", "_", "(_", "K1", "\\u", "ground_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbols_", "=_", "\\u", "unify", "\\u", "gens_", "(_", "K", "0", "\\u", "symbols_", ",_", "K1", "\\u", "symbols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "K", "0_", "._", "order_", "if_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "else_", "K1", "_", "._", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "(_", "K", "0_", "._", "is", "\\u", "Frac", "tion", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Polynomial", "Ring_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "K1", "_", "._", "is", "\\u", "Frac", "tion", "Field_", "and_", "K", "0_", "._", "is", "\\u", "Polynomial", "Ring_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "K", "0", "\\u", "ground_", "._", "has", "\\u", "Field_", "or_", "not_", "K1", "\\u", "ground_", "._", "has", "\\u", "Field_", ")_", "and_", "domain_", "._", "has", "\\u", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "domain_", "._", "get", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Composit", "e_", "and_", "(_", "not_", "K1", "_", "._", "is", "\\u", "Composit", "e_", "or_", "K", "0_", "._", "is", "\\u", "Frac", "tion", "Field_", "or_", "K1", "_", "._", "is", "\\u", "Polynomial", "Ring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "K", "0_", "._", "\\u\\u", "class\\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 ", " _", "cls_", "=_", "K1", "_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "domain_", ",_", "symbols_", ",_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "ine", "xac", "t_", "(_", "cls_", ",_", "K", "0_", ",_", "K1", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prec_", "=_", "max_", "(_", "K", "0_", "._", "precision_", ",_", "K1", "_", "._", "precision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tol_", "=_", "max_", "(_", "K", "0_", "._", "tolerance_", ",_", "K1", "_", "._", "tolerance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "prec_", "=_", "prec_", ",_", "tol_", "=_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Comple", "x", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Comple", "x", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mk", "ine", "xac", "t_", "(_", "K", "0_", "._", "\\u\\u", "class\\u\\u_", ",_", "K", "0_", ",_", "K1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Comple", "x", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Real", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mk", "ine", "xac", "t_", "(_", "K", "0_", "._", "\\u\\u", "class\\u\\u_", ",_", "K", "0_", ",_", "K1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Real", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Comple", "x", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mk", "ine", "xac", "t_", "(_", "K1", "_", "._", "\\u\\u", "class\\u\\u_", ",_", "K1", "_", ",_", "K", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Real", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Real", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mk", "ine", "xac", "t_", "(_", "K", "0_", "._", "\\u\\u", "class\\u\\u_", ",_", "K", "0_", ",_", "K1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Comple", "x", "Field_", "or_", "K", "0_", "._", "is", "\\u", "Real", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K1", "_", "._", "is", "\\u", "Comple", "x", "Field_", "or_", "K1", "_", "._", "is", "\\u", "Real", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Alg", "ebra", "ic", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Alg", "ebra", "ic", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "._", "\\u\\u", "class\\u\\u_", "(_", "K", "0_", "._", "dom_", "._", "unify", "_", "(_", "K1", "_", "._", "dom_", ")_", ",_", "*_", "\\u", "unify", "\\u", "gens_", "(_", "K", "0_", "._", "orig", "\\u", "ext_", ",_", "K1", "_", "._", "orig", "\\u", "ext_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "K", "0_", "._", "is", "\\u", "Alg", "ebra", "ic", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "K1", "_", "._", "is", "\\u", "Alg", "ebra", "ic", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Rational", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K1", "_", "._", "is", "\\u", "Rational", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Integer", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K1", "_", "._", "is", "\\u", "Integer", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "K", "0_", "._", "is", "\\u", "Fini", "te", "Field_", "and_", "K1", "_", "._", "is", "\\u", "Fini", "te", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "K", "0_", "._", "\\u\\u", "class\\u\\u_", "(_", "max_", "(_", "K", "0_", "._", "mod_", ",_", "K1", "_", "._", "mod_", ",_", "key_", "=_", "default", "\\u", "sort", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "sympy_", "._", "polys", "_", "._", "domains_", "import_", "EX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "EX_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/tosca/resources/CORDUser.py
[ { "content": "import os\nimport pdb\nimport sys\nimport tempfile\nsys.path.append(\"/opt/tosca\")\nfrom translator.toscalib.tosca_template import ToscaTemplate\nimport pdb\n\nfrom core.models import User\nfrom services.cord.models import CordSubscriberRoot\n\nfrom xosresource import XOSResource\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class XOSCORDUser(XOSResource):\n provides = \"tosca.nodes.CORDUser\"\n\n\n\n\n\n\n\n\n", "metadata": "root.XOSCORDUser", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def get_model_class_name(self):\n return \"CORDUser\"", "metadata": "root.XOSCORDUser.get_model_class_name", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 16 }, { "content": " def get_subscriber_root(self, throw_exception=True):\n sub_name = self.get_requirement(\"tosca.relationships.SubscriberDevice\", throw_exception=throw_exception)\n sub = self.get_xos_object(CordSubscriberRoot, name=sub_name, throw_exception=throw_exception)\n return sub", "metadata": "root.XOSCORDUser.get_subscriber_root", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 19 }, { "content": " def get_existing_objs(self):\n result = []\n sub = self.get_subscriber_root(throw_exception=False)\n if not sub:\n return []\n for user in sub.users:\n if user[\"name\"] == self.obj_name:\n result.append(user)\n return result", "metadata": "root.XOSCORDUser.get_existing_objs", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_xos_args(self):\n args = {\"name\": self.obj_name,\n \"level\": self.get_property(\"level\"),\n \"mac\": self.get_property(\"mac\")}\n return args", "metadata": "root.XOSCORDUser.get_xos_args", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 34 }, { "content": " def create(self):\n xos_args = self.get_xos_args()\n sub = self.get_subscriber_root()\n\n sub.create_user(**xos_args)\n sub.save()\n\n self.info(\"Created CORDUser %s for Subscriber %s\" % (self.obj_name, sub.name))", "metadata": "root.XOSCORDUser.create", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 41 }, { "content": " def update(self, obj):\n pass", "metadata": "root.XOSCORDUser.update", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 50 }, { "content": " def delete(self, obj):\n if (self.can_delete(obj)):\n self.info(\"destroying CORDUser %s\" % obj[\"name\"])\n sub = self.get_subscriber_root()\n sub.delete_user(obj[\"id\"])\n sub.save()", "metadata": "root.XOSCORDUser.delete", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 53 }, { "content": " def can_delete(self, obj):\n return True", "metadata": "root.XOSCORDUser.can_delete", "header": "['class', 'XOSCORDUser', '(', 'XOSResource', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import pdb", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import tempfile", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 }, { "span": "from translator.toscalib.tosca_template import ToscaTemplate", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 60 }, { "span": "import pdb", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 10 }, { "span": "from core.models import User", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "\"/", "opt", "/", "tosc", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "translator_", "._", "tosc", "ali", "b_", "._", "tosc", "a", "\\u", "template_", "import_", "Tos", "ca", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "services_", "._", "cord", "_", "._", "models_", "import_", "Cor", "d", "Subscrib", "er", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "xo", "sre", "source_", "import_", "XO", "SR", "esource", "_", "\\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_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provides_", "=_", "\"", "tosc", "a", ".", "nodes", ".", "COR", "DU", "ser", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "model", "\\u", "class", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "COR", "DU", "ser", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "subscribe", "r", "\\u", "root_", "(_", "self_", ",_", "throw", "\\u", "exception_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "name_", "=_", "self_", "._", "get", "\\u", "requirement_", "(_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Subscrib", "er", "Dev", "ice", "\"_", ",_", "throw", "\\u", "exception_", "=_", "throw", "\\u", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "get", "\\u", "xo", "s", "\\u", "object_", "(_", "Cor", "d", "Subscrib", "er", "Root_", ",_", "name_", "=_", "sub\\u", "name_", ",_", "throw", "\\u", "exception_", "=_", "throw", "\\u", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "exist", "ing", "\\u", "objs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "get", "\\u", "subscribe", "r", "\\u", "root_", "(_", "throw", "\\u", "exception_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sub_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "sub_", "._", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "[_", "\"", "name", "\"_", "]_", "==_", "self_", "._", "obj", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "xo", "s", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "{_", "\"", "name", "\"_", ":_", "self_", "._", "obj", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "level", "\"_", ":_", "self_", "._", "get", "\\u", "property_", "(_", "\"", "level", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "self_", "._", "get", "\\u", "property_", "(_", "\"", "mac", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xo", "s", "\\u", "args_", "=_", "self_", "._", "get", "\\u", "xo", "s", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "get", "\\u", "subscribe", "r", "\\u", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sub_", "._", "create", "\\u", "user_", "(_", "**_", "xo", "s", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "COR", "DU", "ser", " ", "%", "s", " ", "for", " ", "Subscrib", "er", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "obj", "\\u", "name_", ",_", "sub_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "can", "\\u", "delete_", "(_", "obj_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "destroy", "ing", " ", "COR", "DU", "ser", " ", "%", "s", "\"_", "%_", "obj_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "get", "\\u", "subscribe", "r", "\\u", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "._", "delete", "\\u", "user_", "(_", "obj_", "[_", "\"", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SCO", "RD", "User_", "(_", "XO", "SR", "esource", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "can", "\\u", "delete_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 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
graphite-project/whisper/contrib/whisper-auto-resize.py
[ { "content": "#!/usr/bin/env python\nimport sys, os, fnmatch\nfrom subprocess import call\nfrom optparse import OptionParser\n\noption_parser = OptionParser(\n usage='''%prog storagePath configPath\n\nstoragePath the Path to the directory containing whisper files (CAN NOT BE A SUBDIR, use --subdir for that)\nconfigPath the path to your carbon config files\n''', version=\"%prog 0.1\")\n\noption_parser.add_option(\n '--doit', default=False, action='store_true',\n help=\"This is not a drill, lets do it\")\noption_parser.add_option(\n '-q', '--quiet', default=False, action='store_true',\n help=\"Display extra debugging info\")\noption_parser.add_option(\n '--subdir', default=None,\n type='string', help=\"only process a subdir of whisper files\")\noption_parser.add_option(\n '--carbonlib', default=None,\n type='string', help=\"folder where the carbon lib files are if its not in your path already\")\noption_parser.add_option(\n '--whisperlib', default=None,\n type='string', help=\"folder where the whisper lib files are if its not in your path already\")\noption_parser.add_option(\n '--confirm', default=False, action='store_true',\n help=\"ask for comfirmation prior to resizing a whisper file\")\noption_parser.add_option(\n '-x', '--extra_args', default='',\n type='string', help=\"pass any additional arguments to the whisper-resize.py script\")\n\n(options, args) = option_parser.parse_args()\n\nif len(args) < 2:\n option_parser.print_help()\n sys.exit(1)\n\nstoragePath = args[0]\nconfigPath = args[1]\n\n#check to see if we are processing a subfolder\n# we need to have a separate config option for this since\n# otherwise the metric test thinks the metric is at the root\n# of the storage path and can match schemas incorrectly\nif options.subdir is None:\n processPath = args[0]\nelse:\n processPath = options.subdir\n\n# Injecting the Whisper Lib Path if needed\nif options.whisperlib is not None:\n sys.path.insert(0, options.whisperlib)\n\ntry:\n import whisper\nexcept ImportError:\n raise SystemExit('[ERROR] Can\\'t find the whisper module, try using --whisperlib to explicitly include the path')\n\n# Injecting the Carbon Lib Path if needed\nif options.carbonlib is not None:\n sys.path.insert(0, options.carbonlib)\n\ntry:\n from carbon import conf\n from carbon.conf import settings\nexcept ImportError:\n raise SystemExit('[ERROR] Can\\'t find the carbon module, try using --carbonlib to explicitly include the path')\n\n#carbon.conf not seeing the config files so give it a nudge\nsettings.CONF_DIR = configPath\nsettings.LOCAL_DATA_DIR = storagePath\n\n# import these once we have the settings figured out\nfrom carbon.storage import loadStorageSchemas, loadAggregationSchemas\n\n# Load the Defined Schemas from our config files\nschemas = loadStorageSchemas()\nagg_schemas = loadAggregationSchemas()\n\n# check to see if a metric needs to be resized based on the current config\n\n\n\nfor root, _, files in os.walk(processPath):\n # we only want to deal with non-hidden whisper files\n for f in fnmatch.filter(files, '*.wsp'):\n fullpath = os.path.join(root, f)\n processMetric(fullpath, schemas, agg_schemas)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def processMetric(fullPath, schemas, agg_schemas):\n \"\"\"\n method to process a given metric, and resize it if necessary\n\n Parameters:\n fullPath - full path to the metric whisper file\n schemas - carbon storage schemas loaded from config\n agg_schemas - carbon storage aggregation schemas load from confg\n\n \"\"\"\n schema_config_args = ''\n schema_file_args = ''\n rebuild = False\n messages = ''\n\n # get archive info from whisper file\n info = whisper.info(fullpath)\n\n # get graphite metric name from fullPath\n metric = getMetricFromPath(fullpath)\n\n # loop the carbon-storage schemas\n for schema in schemas:\n if schema.matches(metric):\n # returns secondsPerPoint and points for this schema in tuple format\n archive_config = [archive.getTuple() for archive in schema.archives]\n break\n\n # loop through the carbon-aggregation schemas\n for agg_schema in agg_schemas:\n if agg_schema.matches(metric):\n xFilesFactor, aggregationMethod = agg_schema.archives\n break\n\n # loop through the bucket tuples and convert to string format for resizing\n for retention in archive_config:\n current_schema = '%s:%s ' % (retention[0], retention[1])\n schema_config_args += current_schema\n\n # loop through the current files bucket sizes and convert to string format to compare for resizing\n for fileRetention in info['archives']:\n current_schema = '%s:%s ' % (fileRetention['secondsPerPoint'], fileRetention['points'])\n schema_file_args += current_schema\n\n # check to see if the current and configured schemas are the same or rebuild\n if (schema_config_args != schema_file_args):\n rebuild = True\n messages += 'updating Retentions from: %s to: %s \\n' % (schema_file_args, schema_config_args)\n\n # only care about the first two decimals in the comparison since there is floaty stuff going on.\n info_xFilesFactor = \"{0:.2f}\".format(info['xFilesFactor'])\n str_xFilesFactor = \"{0:.2f}\".format(xFilesFactor)\n\n # check to see if the current and configured aggregationMethods are the same\n if (str_xFilesFactor != info_xFilesFactor):\n rebuild = True\n messages += '%s xFilesFactor differs real: %s should be: %s \\n' % (metric, info_xFilesFactor, str_xFilesFactor)\n if (aggregationMethod != info['aggregationMethod']):\n rebuild = True\n messages += '%s aggregation schema differs real: %s should be: %s \\n' % (metric, info['aggregationMethod'], aggregationMethod)\n\n # check to see if the current and configured xFilesFactor are the same\n if (xFilesFactor != info['xFilesFactor']):\n rebuild = True\n messages += '%s xFilesFactor differs real: %s should be: %s \\n' % (metric, info['xFilesFactor'], xFilesFactor)\n\n # if we need to rebuild, lets do it.\n if (rebuild == True):\n cmd = 'whisper-resize.py \"%s\" %s --xFilesFactor=%s --aggregationMethod=%s %s' % (fullPath, options.extra_args, xFilesFactor, aggregationMethod, schema_config_args)\n if (options.quiet != True or options.confirm == True):\n print(messages)\n print(cmd)\n\n if (options.confirm == True):\n options.doit = confirm(\"Would you like to run this command? [y/n]: \")\n if (options.doit == False):\n print(\"Skipping command \\n\")\n\n if (options.doit == True):\n exitcode = call(cmd, shell=True)\n # if the command failed lets bail so we can take a look before proceeding\n if (exitcode > 0):\n print('Error running: %s' % (cmd))\n sys.exit(1)", "metadata": "root.processMetric", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def getMetricFromPath(filePath):\n \"\"\"\n this method takes the full file path of a whisper file an converts it to a gaphite metric name\n\n Parameters:\n filePath - full file path to a whisper file\n\n Returns a string representing the metric name\n \"\"\"\n # sanitize directory since we may get a trailing slash or not, and if we don't it creates a leading .\n data_dir = os.path.normpath(settings.LOCAL_DATA_DIR) + os.sep\n\n # pull the data dir off and convert to the graphite metric name\n metric_name = filePath.replace(data_dir, '')\n metric_name = metric_name.replace('.wsp', '')\n metric_name = metric_name.replace('/', '.')\n return metric_name", "metadata": "root.getMetricFromPath", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def confirm(question, error_response='Valid options : yes or no'):\n \"\"\"\n ask the user if they would like to perform the action\n\n Parameters:\n question - the question you would like to ask the user to confirm.\n error_response - the message to display if an invalid option is given.\n \"\"\"\n while True:\n answer = raw_input(question).lower()\n if answer in ('y', 'yes'):\n return True\n if answer in ('n', 'no' ):\n return False\n print(error_response)", "metadata": "root.confirm", "header": "['module', '___EOS___']", "index": 186 } ]
[ { "span": "from carbon import conf", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "option", "\\u", "parser_", "=_", "Optio", "n", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "'''", "%", "prog", " ", "storage", "Path", " ", "config", "Path", "\\", "10", ";", "\\", "10", ";", "storage", "Path", " ", " ", " ", "the", " ", "Path", " ", "to", " ", "the", " ", "director", "y", " ", "contain", "ing", " ", "whis", "per", " ", "files", " ", "(", "CAN", " ", "NOT", " ", "BE", " ", "A", " ", "SUB", "DIR", ",", " ", "use", " ", "--", "subdir", " ", "for", " ", "tha", "t", ")", "\\", "10", ";", "config", "Path", " ", " ", " ", " ", "the", " ", "path", " ", "to", " ", "your", " ", "carbon", " ", "config", " ", "files", "\\", "10", ";'", "''_", ",_", "version_", "=_", "\"%", "prog", " ", "0.", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "doit", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Thi", "s", " ", "is", " ", "not", " ", "a", " ", "drill", ",", " ", "lets", " ", "do", " ", "it", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "q", "'_", ",_", "'--", "quie", "t", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Display", " ", "extra", " ", "debugg", "ing", " ", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "subdir", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "help_", "=_", "\"", "only", " ", "process", " ", "a", " ", "subdir", " ", "of", " ", "whis", "per", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "carbon", "lib", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "help_", "=_", "\"", "folder", " ", "where", " ", "the", " ", "carbon", " ", "lib", " ", "files", " ", "are", " ", "if", " ", "its", " ", "not", " ", "in", " ", "your", " ", "path", " ", "alr", "ead", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "whis", "perl", "ib", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "help_", "=_", "\"", "folder", " ", "where", " ", "the", " ", "whis", "per", " ", "lib", " ", "files", " ", "are", " ", "if", " ", "its", " ", "not", " ", "in", " ", "your", " ", "path", " ", "alr", "ead", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "confirm", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "ask", " ", "for", " ", "com", "firm", "ation", " ", "prior", " ", "to", " ", "resiz", "ing", " ", "a", " ", "whis", "per", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "x", "'_", ",_", "'--", "extra", "\\u", "args", "'_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "string", "'_", ",_", "help_", "=_", "\"", "pass", " ", "any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "to", " ", "the", " ", "whis", "per", "-", "resiz", "e", ".", "py", " ", "script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "option", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "\\u", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\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_", "storage", "Path_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "Path_", "=_", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "are", " ", "process", "ing", " ", "a", " ", "subfolder", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "have", " ", "a", " ", "separate", " ", "config", " ", "option", " ", "for", " ", "this", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "the", " ", "metric", " ", "test", " ", "think", "s", " ", "the", " ", "metric", " ", "is", " ", "at", " ", "the", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "storage", " ", "path", " ", "and", " ", "can", " ", "match", " ", "schema", "s", " ", "incorrect", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "subdir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process", "Path_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process", "Path_", "=_", "options_", "._", "subdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inject", "ing", " ", "the", " ", "Whi", "sper", " ", "Lib", " ", "Path", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "whis", "perl", "ib_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "options_", "._", "whis", "perl", "ib_", ")_", "\\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_", "whis", "per_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "System", "Exit_", "(_", "'[", "ERROR", "]", " ", "Can", "\\\\'", "t", " ", "find", " ", "the", " ", "whis", "per", " ", "module", ",", " ", "try", " ", "usi", "ng", " ", "--", "whis", "perl", "ib", " ", "to", " ", "explicit", "ly", " ", "include", " ", "the", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inject", "ing", " ", "the", " ", "Car", "bon", " ", "Lib", " ", "Path", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "carbon", "lib_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "options_", "._", "carbon", "lib_", ")_", "\\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_", "carbon", "_", "import_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "carbon", "_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "System", "Exit_", "(_", "'[", "ERROR", "]", " ", "Can", "\\\\'", "t", " ", "find", " ", "the", " ", "carbon", " ", "module", ",", " ", "try", " ", "usi", "ng", " ", "--", "carbon", "lib", " ", "to", " ", "explicit", "ly", " ", "include", " ", "the", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "carbon", ".", "conf", " ", "not", " ", "see", "ing", " ", "the", " ", "config", " ", "files", " ", "so", " ", "give", " ", "it", " ", "a", " ", "nud", "ge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "settings_", "._", "CONF", "\\u", "DIR_", "=_", "config", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "LOCAL", "\\u", "DATA", "\\u", "DIR_", "=_", "storage", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "these", " ", "onc", "e", " ", "we", " ", "have", " ", "the", " ", "settings", " ", "figure", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "carbon", "_", "._", "storage_", "import_", "load", "Stor", "age", "Schema", "s_", ",_", "load", "Aggregation", "Schema", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "the", " ", "Define", "d", " ", "Schema", "s", " ", "from", " ", "our", " ", "config", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "schemas_", "=_", "load", "Stor", "age", "Schema", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agg", "\\u", "schemas_", "=_", "load", "Aggregation", "Schema", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "a", " ", "metric", " ", "need", "s", " ", "to", " ", "be", " ", "resized", " ", "based", " ", "on", " ", "the", " ", "current", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "for_", "root_", ",_", "\\u_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "process", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "only", " ", "want", " ", "to", " ", "deal", " ", "with", " ", "non", "-", "hidden", " ", "whis", "per", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "fnmatch_", "._", "filter_", "(_", "files_", ",_", "'*", ".", "wsp", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fullpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "Metric_", "(_", "fullpath_", ",_", "schemas_", ",_", "agg", "\\u", "schemas_", ")_", "\\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_", "process", "Metric_", "(_", "full", "Path_", ",_", "schemas_", ",_", "agg", "\\u", "schemas_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "to", " ", "process", " ", "a", " ", "give", "n", " ", "metric", ",", " ", "and", " ", "resiz", "e", " ", "it", " ", "if", " ", "necessar", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "full", "Path", " ", " ", " ", " ", "-", " ", "full", " ", "path", " ", "to", " ", "the", " ", "metric", " ", "whis", "per", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "schema", "s", " ", "-", " ", "carbon", " ", "storage", " ", "schema", "s", " ", "load", "ed", " ", "from", " ", "config", "\\", "10", ";", " ", " ", " ", " ", "agg", "\\u", "schema", "s", " ", "-", " ", "carbon", " ", "storage", " ", "aggregation", " ", "schema", "s", " ", "load", " ", "from", " ", "conf", "g", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "\\u", "config", "\\u", "args_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "\\u", "file", "\\u", "args_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rebuild_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "archive", " ", "info", " ", "from", " ", "whis", "per", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "whis", "per_", "._", "info_", "(_", "fullpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "graphite", " ", "metric", " ", "name", " ", "from", " ", "full", "Path_", "\\u\\u\\uNL\\u\\u\\u_", "metric_", "=_", "get", "Met", "ric", "Fro", "m", "Path_", "(_", "fullpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "the", " ", "carbon", "-", "storage", " ", "schemas_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "schema_", "in_", "schemas_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "schema_", "._", "matches_", "(_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", "s", " ", "second", "s", "Per", "Point", " ", "and", " ", "points", " ", "for", " ", "this", " ", "schema", " ", "in", " ", "tuple", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive", "\\u", "config_", "=_", "[_", "archive_", "._", "get", "Tuple_", "(_", ")_", "for_", "archive_", "in_", "schema_", "._", "archives", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "the", " ", "carbon", "-", "aggregation", " ", "schemas_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "agg", "\\u", "schema_", "in_", "agg", "\\u", "schemas_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "agg", "\\u", "schema_", "._", "matches_", "(_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "Files", "Factor_", ",_", "aggregation", "Method_", "=_", "agg", "\\u", "schema_", "._", "archives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "the", " ", "bucket", " ", "tuple", "s", " ", "and", " ", "convert", " ", "to", " ", "string", " ", "format", " ", "for", " ", "resiz", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "retention", "_", "in_", "archive", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "schema_", "=_", "'%", "s", ":", "%", "s", " ", "'_", "%_", "(_", "retention", "_", "[_", "0_", "]_", ",_", "retention", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "\\u", "config", "\\u", "args_", "+=_", "current", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "the", " ", "current", " ", "files", " ", "bucket", " ", "size", "s", " ", "and", " ", "convert", " ", "to", " ", "string", " ", "format", " ", "to", " ", "compare", " ", "for", " ", "resiz", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file", "Ret", "enti", "on_", "in_", "info_", "[_", "'", "archives", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "schema_", "=_", "'%", "s", ":", "%", "s", " ", "'_", "%_", "(_", "file", "Ret", "enti", "on_", "[_", "'", "second", "s", "Per", "Point", "'_", "]_", ",_", "file", "Ret", "enti", "on_", "[_", "'", "points", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "\\u", "file", "\\u", "args_", "+=_", "current", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "current", " ", "and", " ", "configur", "ed", " ", "schema", "s", " ", "are", " ", "the", " ", "same", " ", "or", " ", "rebuild_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "schema", "\\u", "config", "\\u", "args_", "!=_", "schema", "\\u", "file", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "+=_", "'", "updat", "ing", " ", "Ret", "enti", "ons", " ", "from", ":", " ", "%", "s", " ", "to", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "(_", "schema", "\\u", "file", "\\u", "args_", ",_", "schema", "\\u", "config", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "care", " ", "abo", "ut", " ", "the", " ", "first", " ", "two", " ", "decima", "ls", " ", "in", " ", "the", " ", "compa", "ris", "on", " ", "sinc", "e", " ", "there", " ", "is", " ", "float", "y", " ", "stu", "ff", " ", "goi", "ng", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "x", "Files", "Factor_", "=_", "\"{", "0", ":.", "2f", "}\"_", "._", "format_", "(_", "info_", "[_", "'", "x", "Files", "Factor", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str", "\\u", "x", "Files", "Factor_", "=_", "\"{", "0", ":.", "2f", "}\"_", "._", "format_", "(_", "x", "Files", "Factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "current", " ", "and", " ", "configur", "ed", " ", "aggregation", "Meth", "ods", " ", "are", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "str", "\\u", "x", "Files", "Factor_", "!=_", "info", "\\u", "x", "Files", "Factor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "+=_", "'%", "s", " ", "x", "Files", "Factor", " ", "differs", " ", "real", ":", " ", "%", "s", " ", "shou", "ld", " ", "be", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "(_", "metric_", ",_", "info", "\\u", "x", "Files", "Factor_", ",_", "str", "\\u", "x", "Files", "Factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "aggregation", "Method_", "!=_", "info_", "[_", "'", "aggregation", "Meth", "od", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "+=_", "'%", "s", " ", "aggregation", " ", "schema", " ", "differs", " ", "real", ":", " ", "%", "s", " ", "shou", "ld", " ", "be", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "(_", "metric_", ",_", "info_", "[_", "'", "aggregation", "Meth", "od", "'_", "]_", ",_", "aggregation", "Method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "current", " ", "and", " ", "configur", "ed", " ", "x", "Files", "Factor", " ", "are", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "x", "Files", "Factor_", "!=_", "info_", "[_", "'", "x", "Files", "Factor", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "+=_", "'%", "s", " ", "x", "Files", "Factor", " ", "differs", " ", "real", ":", " ", "%", "s", " ", "shou", "ld", " ", "be", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "(_", "metric_", ",_", "info_", "[_", "'", "x", "Files", "Factor", "'_", "]_", ",_", "x", "Files", "Factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "need", " ", "to", " ", "rebu", "ild", ",", " ", "lets", " ", "do", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "rebuild_", "==_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "whis", "per", "-", "resiz", "e", ".", "py", " ", "\"%", "s", "\"", " ", "%", "s", " ", "--", "x", "Files", "Factor", "=", "%", "s", " ", "--", "aggregation", "Meth", "od", "=", "%", "s", " ", "%", "s", "'_", "%_", "(_", "full", "Path_", ",_", "options_", "._", "extra", "\\u", "args_", ",_", "x", "Files", "Factor_", ",_", "aggregation", "Method_", ",_", "schema", "\\u", "config", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "options_", "._", "quiet_", "!=_", "True_", "or_", "options_", "._", "confirm_", "==_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "options_", "._", "confirm_", "==_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "doit", "_", "=_", "confirm_", "(_", "\"", "Wo", "ul", "d", " ", "you", " ", "like", " ", "to", " ", "run", " ", "this", " ", "command", "?", " ", "[", "y", "/", "n", "]:", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "options_", "._", "doit", "_", "==_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Ski", "ppi", "ng", " ", "command", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "options_", "._", "doit", "_", "==_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exitcode_", "=_", "call_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "command", " ", "fail", "ed", " ", "lets", " ", "bai", "l", " ", "so", " ", "we", " ", "can", " ", "take", " ", "a", " ", "look", " ", "bef", "ore", " ", "proceed", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "exitcode_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Error", " ", "runn", "ing", ":", " ", "%", "s", "'_", "%_", "(_", "cmd_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Met", "ric", "Fro", "m", "Path_", "(_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", " ", "take", "s", " ", "the", " ", "full", " ", "file", " ", "path", " ", "of", " ", "a", " ", "whis", "per", " ", "file", " ", "an", " ", "convert", "s", " ", "it", " ", "to", " ", "a", " ", "gap", "hit", "e", " ", "metric", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "file", "Path", " ", "-", " ", "full", " ", "file", " ", "path", " ", "to", " ", "a", " ", "whis", "per", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "string", " ", "represent", "ing", " ", "the", " ", "metric", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sanitize", " ", "director", "y", " ", "sinc", "e", " ", "we", " ", "may", " ", "get", " ", "a", " ", "trail", "ing", " ", "slash", " ", "or", " ", "not", ",", " ", "and", " ", "if", " ", "we", " ", "don", "'", "t", " ", "it", " ", "create", "s", " ", "a", " ", "lead", "ing", " ", "._", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "dir_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "settings_", "._", "LOCAL", "\\u", "DATA", "\\u", "DIR_", ")_", "+_", "os_", "._", "sep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pull", " ", "the", " ", "data", " ", "dir", " ", "off", " ", "and", " ", "convert", " ", "to", " ", "the", " ", "graphite", " ", "metric", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "name_", "=_", "file", "Path_", "._", "replace_", "(_", "data\\u", "dir_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "\\u", "name_", "=_", "metric", "\\u", "name_", "._", "replace_", "(_", "'.", "wsp", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "\\u", "name_", "=_", "metric", "\\u", "name_", "._", "replace_", "(_", "'/'_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "metric", "\\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_", "confirm_", "(_", "question_", ",_", "error", "\\u", "response_", "=_", "'", "Valid", " ", "options", " ", ":", " ", "ye", "s", " ", "or", " ", "no", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", " ", "ask", " ", "the", " ", "user", " ", "if", " ", "the", "y", " ", "wou", "ld", " ", "like", " ", "to", " ", "perform", " ", "the", " ", "action", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "question", " ", " ", " ", "-", " ", "the", " ", "question", " ", "you", " ", "wou", "ld", " ", "like", " ", "to", " ", "ask", " ", "the", " ", "user", " ", "to", " ", "confirm", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "error", "\\u", "response", " ", "-", " ", "the", " ", "message", " ", "to", " ", "display", " ", "if", " ", "an", " ", "invalid", " ", "option", " ", "is", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "answer_", "=_", "raw", "\\u", "input_", "(_", "question_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "answer_", "in_", "(_", "'", "y", "'_", ",_", "'", "ye", "s", "'_", ")_", ":_", "\\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_", "answer_", "in_", "(_", "'", "n", "'_", ",_", "'", "no", "'_", ")_", ":_", "\\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_", "print_", "(_", "error", "\\u", "response_", ")_", "\\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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
dfdx/masque/masque/playground/lm_series.py
[ { "content": "\"\"\"\nPlayground for landmark-based experiments\n\"\"\"\nfrom __future__ import print_function\nimport numpy as np\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.cross_validation import train_test_split\nfrom sklearn.grid_search import GridSearchCV\nfrom sklearn.metrics import classification_report\nfrom sklearn.neural_network import BernoulliRBM\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.naive_bayes import MultinomialNB\nfrom sklearn.svm import SVC\n\nfrom masque import datasets\nfrom masque.transform import PatchTransformer\nfrom masque.rbm import GaussianBernoulliRBM\nfrom masque.playground.runners import plain_classify, pretrain_classify\n\n\n\nrbm_svc = {\n 'pretrain_model' : BernoulliRBM(n_components=1024, verbose=True),\n 'model' : SVC(kernel='linear', verbose=True),\n 'pretrain_data' : lambda: _norm(*datasets.ck_lm_series()),\n 'data' : lambda: _norm(*datasets.ck_lm_series(labeled_only=True)),\n}\n\n# TODO: sample\ndbn_svc = {\n 'pretrain_model' : Pipeline([\n ('rbm0', BernoulliRBM(n_components=60, verbose=True)),\n ('rbm1', BernoulliRBM(n_components=80, verbose=True)),\n ('rbm2', BernoulliRBM(n_components=32, verbose=True)),\n ]),\n 'model' : SVC(kernel='linear', verbose=True),\n 'pretrain_data' : lambda: datasets.cohn_kanade_shapes(),\n 'data' : lambda: datasets.cohn_kanade_shapes(labeled_only=True),\n}\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _norm(X, y):\n \"\"\"Scales data to [0..1] interval\"\"\"\n X = X.astype(np.float32) / (X.max() - X.min())\n return X, y", "metadata": "root._norm", "header": "['module', '___EOS___']", "index": 20 }, { "content": "def grid_search_svc(X, y):\n X_train, X_test, y_train, y_test = train_test_split(\n X, y, test_size=0.1, random_state=0)\n tuned_parameters = [{'kernel': ['rbf'], 'gamma': [1e-3, 1e-4],\n 'C': [0.025, 0.1, 1, 10, 100, 1000]},\n {'kernel': ['linear'],\n 'C': [0.025, 0.1, 1, 10, 100, 1000]}]\n scorings = ['accuracy']\n for scoring in scorings:\n model = GridSearchCV(SVC(), tuned_parameters, cv=10, scoring=scoring)\n model.fit(X_test, y_test)\n print(\"Best parameters set found on development set:\")\n print()\n print(model.best_estimator_)\n print()\n print(\"Grid scores on development set:\")\n print()\n for params, mean_score, scores in model.grid_scores_:\n print(\"%0.3f (+/-%0.03f) for %r\"\n % (mean_score, scores.std() / 2, params))\n print()\n\n print(\"Detailed classification report:\")\n print()\n print(\"The model is trained on the full development set.\")\n print(\"The scores are computed on the full evaluation set.\")\n print()\n y_true, y_pred = y_test, model.predict(X_test)\n print(classification_report(y_true, y_pred))\n print()", "metadata": "root.grid_search_svc", "header": "['module', '___EOS___']", "index": 45 } ]
[ { "span": "from sklearn.linear_model import LogisticRegression", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 51 }, { "span": "from sklearn.naive_bayes import MultinomialNB", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 45 }, { "span": "from masque.transform import PatchTransformer", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 45 }, { "span": "from masque.rbm import GaussianBernoulliRBM", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 43 }, { "span": "from masque.playground.runners import plain_classify, pretrain_classify", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Play", "ground", " ", "for", " ", "landmark", "-", "based", " ", "experiment", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "pipeline_", "import_", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "cross", "\\u", "validation_", "import_", "train", "\\u", "test\\u", "split_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "grid", "\\u", "search_", "import_", "Grid", "Sear", "ch", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "classificati", "on", "\\u", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "neural", "\\u", "network_", "import_", "Bern", "oulli", "RB", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "linear", "\\u", "model_", "import_", "Logi", "stic", "Regression_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "naive", "\\u", "bayes", "_", "import_", "Multi", "nomi", "al", "NB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "svm_", "import_", "SVC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mas", "que_", "import_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mas", "que_", "._", "transform_", "import_", "Pat", "ch", "Transformer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mas", "que_", "._", "rb", "m_", "import_", "Gaussian", "Bern", "oulli", "RB", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mas", "que_", "._", "play", "ground_", "._", "runners", "_", "import_", "plain", "\\u", "classify_", ",_", "pretr", "ain", "\\u", "classify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "rb", "m", "\\u", "svc_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pretr", "ain", "\\u", "model", "'_", ":_", "Bern", "oulli", "RB", "M_", "(_", "n", "\\u", "components_", "=_", "1024_", ",_", "verbose_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "SVC_", "(_", "kernel_", "=_", "'", "linear", "'_", ",_", "verbose_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pretr", "ain", "\\u", "data", "'_", ":_", "lambda_", ":_", "\\u", "norm_", "(_", "*_", "datasets_", "._", "ck", "\\u", "lm", "\\u", "series_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "lambda_", ":_", "\\u", "norm_", "(_", "*_", "datasets_", "._", "ck", "\\u", "lm", "\\u", "series_", "(_", "label", "ed", "\\u", "only_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "db", "n", "\\u", "svc_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pretr", "ain", "\\u", "model", "'_", ":_", "Pipeline_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rb", "m", "0", "'_", ",_", "Bern", "oulli", "RB", "M_", "(_", "n", "\\u", "components_", "=_", "60_", ",_", "verbose_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rb", "m1", "'_", ",_", "Bern", "oulli", "RB", "M_", "(_", "n", "\\u", "components_", "=_", "80_", ",_", "verbose_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rb", "m2", "'_", ",_", "Bern", "oulli", "RB", "M_", "(_", "n", "\\u", "components_", "=_", "32_", ",_", "verbose_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "SVC_", "(_", "kernel_", "=_", "'", "linear", "'_", ",_", "verbose_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pretr", "ain", "\\u", "data", "'_", ":_", "lambda_", ":_", "datasets_", "._", "coh", "n", "\\u", "kana", "de", "\\u", "shapes_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "lambda_", ":_", "datasets_", "._", "coh", "n", "\\u", "kana", "de", "\\u", "shapes_", "(_", "label", "ed", "\\u", "only_", "=_", "True_", ")_", ",_", "\\u\\u\\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_", "\\u", "norm_", "(_", "X_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Scale", "s", " ", "data", " ", "to", " ", "[", "0.", ".1", "]", " ", "interval", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "X_", "._", "astype_", "(_", "np_", "._", "float32_", ")_", "/_", "(_", "X_", "._", "max_", "(_", ")_", "-_", "X_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "X_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "grid", "\\u", "search", "\\u", "svc_", "(_", "X_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X", "\\u", "train_", ",_", "X", "\\u", "test_", ",_", "y", "\\u", "train_", ",_", "y", "\\u", "test_", "=_", "train", "\\u", "test\\u", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "y_", ",_", "test\\u", "size_", "=_", "0.1_", ",_", "random", "\\u", "state_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tune", "d\\u", "parameters_", "=_", "[_", "{_", "'", "kernel", "'_", ":_", "[_", "'", "rbf", "'_", "]_", ",_", "'", "gamma", "'_", ":_", "[_", "1e-3_", ",_", "1e-4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "C", "'_", ":_", "[_", "0.025", "_", ",_", "0.1_", ",_", "1_", ",_", "10_", ",_", "100_", ",_", "1000_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "kernel", "'_", ":_", "[_", "'", "linear", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "C", "'_", ":_", "[_", "0.025", "_", ",_", "0.1_", ",_", "1_", ",_", "10_", ",_", "100_", ",_", "1000_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scor", "ings_", "=_", "[_", "'", "accu", "rac", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "scoring_", "in_", "scor", "ings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Grid", "Sear", "ch", "CV_", "(_", "SVC_", "(_", ")_", ",_", "tune", "d\\u", "parameters_", ",_", "cv_", "=_", "10_", ",_", "scoring_", "=_", "scoring_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "fit_", "(_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Bes", "t", " ", "parameter", "s", " ", "set", " ", "found", " ", "on", " ", "develop", "ment", " ", "set", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "model_", "._", "best", "\\u", "esti", "mat", "or\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Grid", " ", "score", "s", " ", "on", " ", "develop", "ment", " ", "set", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "params_", ",_", "mean", "\\u", "score_", ",_", "scores_", "in_", "model_", "._", "grid", "\\u", "score", "s\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "0.", "3f", " ", "(", "+/-", "%", "0.03", "f", ")", " ", "for", " ", "%", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "mean", "\\u", "score_", ",_", "scores_", "._", "std_", "(_", ")_", "/_", "2_", ",_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Det", "ail", "ed", " ", "classificati", "on", " ", "report", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "The", " ", "model", " ", "is", " ", "trained", " ", "on", " ", "the", " ", "full", " ", "develop", "ment", " ", "set", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "The", " ", "score", "s", " ", "are", " ", "compute", "d", " ", "on", " ", "the", " ", "full", " ", "evaluat", "ion", " ", "set", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "true_", ",_", "y", "\\u", "pred_", "=_", "y", "\\u", "test_", ",_", "model_", "._", "predict_", "(_", "X", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "classificati", "on", "\\u", "report_", "(_", "y", "\\u", "true_", ",_", "y", "\\u", "pred_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_" ]
[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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 ]
Unused import
lukaszb/django-projector/projector/views/project_task.py
[ { "content": "import datetime\n\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.core.exceptions import PermissionDenied\nfrom django.contrib import messages\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth.models import User\nfrom django.http import HttpResponse\nfrom django.utils.translation import ugettext as _\nfrom django.utils.decorators import method_decorator\nfrom django.utils.simplejson import dumps\n\nfrom projector.models import Task\nfrom projector.forms import TaskForm, TaskEditForm\nfrom projector.filters import TaskFilter\nfrom projector.views.project import ProjectView\n\nfrom richtemplates.shortcuts import get_json_response\n\nlogin_required_m = method_decorator(login_required)\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TaskListView(ProjectView):\n \"\"\"\n Task for project listing view.\n \"\"\"\n\n template_name='projector/project/task/list.html'\n perms_private = ['view_project', 'can_view_tasks']\n", "metadata": "root.TaskListView", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def response(self, request, username, project_slug):\n task_list = Task.objects.filter(project__id=self.project.id)\\\n .select_related('priority', 'status', 'author', 'project')\n filters = TaskFilter(self.request.GET, queryset=task_list,\n project=self.project)\n if self.request.GET and 'id' in self.request.GET and \\\n self.request.GET['id'] and filters.qs.count() == 1:\n task = filters.qs[0]\n messages.info(self.request, _(\"One task matched - redirecting...\"))\n return redirect(task.get_absolute_url())\n self.context['filters'] = filters\n return self.context", "metadata": "root.TaskListView.response", "header": "['class', 'TaskListView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 29 }, { "content": "class TaskListDataView(ProjectView):\n \"\"\"\n Tasks data for charts.\n \"\"\"\n", "metadata": "root.TaskListDataView", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def response(self, request, username, project_slug):\n import random\n import pyofc2\n t = pyofc2.title(text=_(\"Tasks\"))\n b1 = pyofc2.bar()\n b1.values = range(10)\n b2 = pyofc2.bar()\n b2.values = [random.randint(0,9) for i in range(9)]\n b2.colour = '#56acde'\n chart = pyofc2.open_flash_chart()\n chart.title = t\n chart.add_element(b1)\n chart.add_element(b2)\n return HttpResponse(chart.render())", "metadata": "root.TaskListDataView.response", "header": "['class', 'TaskListDataView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 48 }, { "content": "class TaskDetailView(ProjectView):\n \"\"\"\n Task detail view.\n Users may update task here.\n \"\"\"\n\n template_name = 'projector/project/task/detail.html'\n perms_private = ['view_project', 'can_view_tasks']\n perms_POST = ['can_change_task']\n", "metadata": "root.TaskDetailView", "header": "['module', '___EOS___']", "index": 64 }, { "content": " def response(self, request, username, project_slug, task_id):\n task = get_object_or_404(\n Task.objects.select_related('type', 'priority', 'status', 'owner',\n 'author', 'editor', 'milestone', 'component', 'project'),\n id = task_id,\n project__author__username = username,\n project__slug = project_slug)\n\n self.context['task'] = task\n self.context['is_watched'] = task.is_watched(request.user)\n self.context['now'] = datetime.datetime.now()\n\n return self.context", "metadata": "root.TaskDetailView.response", "header": "['class', 'TaskDetailView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 74 }, { "content": "class TaskCreateView(ProjectView):\n \"\"\"\n New Task creation view.\n \"\"\"\n\n template_name = 'projector/project/task/create.html'\n perms = ProjectView.perms + ['can_add_task']\n", "metadata": "root.TaskCreateView", "header": "['module', '___EOS___']", "index": 88 }, { "content": " @login_required_m\n def response(self, request, username, project_slug):\n initial = {\n 'owner': request.user.username, # form's owner is UserByNameField\n }\n instance = Task.objects.get_for_project(self.project)\n instance.author = request.user\n instance.author_ip = request.META.get('REMOTE_ADDR', '')\n instance.editor = instance.author\n instance.editor_ip = instance.author_ip\n\n form = TaskForm(request.POST or None, initial=initial, instance=instance)\n\n if request.method == 'POST':\n if form.is_valid():\n task = form.save(\n editor = request.user,\n editor_ip = request.META.get('REMOTE_ADDR', ''),\n )\n task.create_revision()\n messages.success(request, _(\"Task created succesfully.\"))\n task.notify()\n return redirect(task.get_absolute_url())\n\n self.context['form'] = form\n\n return self.context", "metadata": "root.TaskCreateView.response", "header": "['class', 'TaskCreateView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 96 }, { "content": "class TaskEditView(ProjectView):\n \"\"\"\n Edit Task meta information. task_detail edits the rest.\n \"\"\"\n\n template_name = 'projector/project/task/create.html'\n perms = ['can_change_task']\n", "metadata": "root.TaskEditView", "header": "['module', '___EOS___']", "index": 124 }, { "content": " @login_required_m\n def response(self, request, username, project_slug, task_id):\n task = get_object_or_404(Task, id=task_id,\n project__author__username=username, project__slug=project_slug)\n\n if request.method == 'POST':\n form = TaskEditForm(request.POST, instance=task)\n if form.is_valid():\n if request.user.is_authenticated():\n editor = request.user\n else:\n editor = User.get_anonymous() # available from guardian\n task = form.save(\n editor=editor,\n editor_ip=request.META.get('REMOTE_ADDR', ''),\n )\n task.create_revision()\n messages.success(request, _(\"Task updated successfully.\"))\n task.notify()\n return redirect(task.get_absolute_url())\n else:\n form = TaskEditForm(instance=task, initial={\n 'owner': task.owner and task.owner.username or None,\n })\n\n self.context['form'] = form\n\n return self.context", "metadata": "root.TaskEditView.response", "header": "['class', 'TaskEditView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 132 }, { "content": "class TaskWatchView(ProjectView):\n \"\"\"\n Makes request's user watching this task.\n \"\"\"\n\n perms_private = ['view_project', 'can_view_tasks']\n", "metadata": "root.TaskWatchView", "header": "['module', '___EOS___']", "index": 162 }, { "content": " def response(self, request, username, project_slug, task_id):\n task = get_object_or_404(Task, id=task_id,\n project__author__username=username, project__slug=project_slug)\n if request.method == 'POST':\n task.watch(request.user)\n if request.is_ajax():\n return get_json_response()\n return redirect(task.get_absolute_url())\n else:\n # Only POST methods are allowed here\n raise PermissionDenied()", "metadata": "root.TaskWatchView.response", "header": "['class', 'TaskWatchView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 169 }, { "content": "class TaskUnwatchView(ProjectView):\n \"\"\"\n Makes request's user watching this task.\n \"\"\"\n\n perms_private = ['view_project', 'can_view_tasks']\n", "metadata": "root.TaskUnwatchView", "header": "['module', '___EOS___']", "index": 181 }, { "content": " def response(self, request, username, project_slug, task_id):\n task = get_object_or_404(Task, id=task_id,\n project__author__username=username, project__slug=project_slug)\n if request.method == 'POST':\n if request.is_ajax():\n return get_json_response()\n task.unwatch(request.user)\n return redirect(task.get_absolute_url())\n else:\n # Only POST methods are allowed here\n raise PermissionDenied()", "metadata": "root.TaskUnwatchView.response", "header": "['class', 'TaskUnwatchView', '(', 'ProjectView', ')', ':', '___EOS___']", "index": 188 } ]
[ { "span": "from django.utils.simplejson import dumps", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 41 } ]
[]
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_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "decorators_", "import_", "method", "\\u", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "simplejson_", "import_", "dumps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "projector", "_", "._", "models_", "import_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "projector", "_", "._", "forms_", "import_", "Task", "Form_", ",_", "Task", "Edit", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "projector", "_", "._", "filters_", "import_", "Task", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "projector", "_", "._", "views_", "._", "project_", "import_", "Project", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rich", "templates_", "._", "shortcuts_", "import_", "get", "\\u", "json", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "login", "\\u", "require", "d\\u", "m_", "=_", "method", "\\u", "decorator_", "(_", "login", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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", "List", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Task", " ", "for", " ", "project", " ", "listi", "ng", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "projector", "/", "project", "/", "task", "/", "list", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perm", "s", "\\u", "private_", "=_", "[_", "'", "view", "\\u", "project", "'_", ",_", "'", "can", "\\u", "view", "\\u", "task", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "List", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "list_", "=_", "Task_", "._", "objects_", "._", "filter_", "(_", "project", "\\u\\u", "id_", "=_", "self_", "._", "project_", "._", "id_", ")_", "._", "select", "\\u", "related_", "(_", "'", "priorit", "y", "'_", ",_", "'", "status", "'_", ",_", "'", "author", "'_", ",_", "'", "project", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "Task", "Filter_", "(_", "self_", "._", "request_", "._", "GET_", ",_", "queryset_", "=_", "task", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "self_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "GET_", "and_", "'", "id", "'_", "in_", "self_", "._", "request_", "._", "GET_", "and_", "self_", "._", "request_", "._", "GET_", "[_", "'", "id", "'_", "]_", "and_", "filters_", "._", "qs_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "filters_", "._", "qs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "info_", "(_", "self_", "._", "request_", ",_", "\\u_", "(_", "\"", "One", " ", "task", " ", "matche", "d", " ", "-", " ", "redirec", "ting", "...\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "task_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "context_", "[_", "'", "filter", "s", "'_", "]_", "=_", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "List", "Data", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Task", "s", " ", "data", " ", "for", " ", "charts", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "List", "Data", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyo", "fc", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "pyo", "fc", "2_", "._", "title_", "(_", "text_", "=_", "\\u_", "(_", "\"", "Task", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "pyo", "fc", "2_", "._", "bar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "._", "values_", "=_", "range_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "pyo", "fc", "2_", "._", "bar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "._", "values_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "9_", ")_", "for_", "i_", "in_", "range_", "(_", "9_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "._", "colour_", "=_", "'#", "56", "acd", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "=_", "pyo", "fc", "2_", "._", "open", "\\u", "flash", "\\u", "chart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "title_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "add", "\\u", "element_", "(_", "b1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "add", "\\u", "element_", "(_", "b2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "chart_", "._", "render_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "Det", "ail", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Task", " ", "deta", "il", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "User", "s", " ", "may", " ", "update", " ", "task", " ", "here", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "projector", "/", "project", "/", "task", "/", "deta", "il", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perm", "s", "\\u", "private_", "=_", "[_", "'", "view", "\\u", "project", "'_", ",_", "'", "can", "\\u", "view", "\\u", "task", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perm", "s", "\\u", "POST_", "=_", "[_", "'", "can", "\\u", "change", "\\u", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Det", "ail", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ",_", "task", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "type", "'_", ",_", "'", "priorit", "y", "'_", ",_", "'", "status", "'_", ",_", "'", "owner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ",_", "'", "editor", "'_", ",_", "'", "milestone", "'_", ",_", "'", "component", "'_", ",_", "'", "project", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "task", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "author", "\\u\\u", "username_", "=_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "[_", "'", "task", "'_", "]_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "[_", "'", "is", "\\u", "watched", "'_", "]_", "=_", "task_", "._", "is", "\\u", "watched", "_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "[_", "'", "now", "'_", "]_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "Creat", "e", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "New", " ", "Task", " ", "creati", "on", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "projector", "/", "project", "/", "task", "/", "create", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "=_", "Project", "View_", "._", "perms_", "+_", "[_", "'", "can", "\\u", "add", "\\u", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Creat", "e", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "require", "d\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "request_", "._", "user_", "._", "username_", ",_", "#", " ", "form", "'", "s", " ", "owner", " ", "is", " ", "User", "By", "Name", "Field_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "Task_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "project_", "(_", "self_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "author_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "author", "\\u", "ip_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "REMO", "TE", "\\u", "ADDR", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "editor_", "=_", "instance_", "._", "author_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "editor", "\\u", "ip_", "=_", "instance_", "._", "author", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Task", "Form_", "(_", "request_", "._", "POST_", "or_", "None_", ",_", "initial_", "=_", "initial_", ",_", "instance_", "=_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "form_", "._", "save_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "editor_", "=_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editor", "\\u", "ip_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "REMO", "TE", "\\u", "ADDR", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "create", "\\u", "revision_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\\u_", "(_", "\"", "Task", " ", "created", " ", "succe", "sfu", "ll", "y", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "notify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "task_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\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_", "._", "context_", "[_", "'", "form", "'_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "Edit", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Edit", " ", "Task", " ", "meta", " ", "informati", "on", ".", " ", "task", "\\u", "deta", "il", " ", "edits", " ", "the", " ", "rest", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "projector", "/", "project", "/", "task", "/", "create", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "=_", "[_", "'", "can", "\\u", "change", "\\u", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Edit", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "require", "d\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ",_", "task", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Task_", ",_", "id_", "=_", "task", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "author", "\\u\\u", "username_", "=_", "username_", ",_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Task", "Edit", "Form_", "(_", "request_", "._", "POST_", ",_", "instance_", "=_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "editor_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "editor_", "=_", "User_", "._", "get", "\\u", "anonymous_", "(_", ")_", "#", " ", "avail", "able", " ", "from", " ", "guard", "ian_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "task_", "=_", "form_", "._", "save_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "editor_", "=_", "editor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editor", "\\u", "ip_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "REMO", "TE", "\\u", "ADDR", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "create", "\\u", "revision_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\\u_", "(_", "\"", "Task", " ", "update", "d", " ", "success", "full", "y", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "notify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "task_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Task", "Edit", "Form_", "(_", "instance_", "=_", "task_", ",_", "initial_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "task_", "._", "owner_", "and_", "task_", "._", "owner_", "._", "username_", "or_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "context_", "[_", "'", "form", "'_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "Watch", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "request", "'", "s", " ", "user", " ", "watch", "ing", " ", "this", " ", "task", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perm", "s", "\\u", "private_", "=_", "[_", "'", "view", "\\u", "project", "'_", ",_", "'", "can", "\\u", "view", "\\u", "task", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Watch", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ",_", "task", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Task_", ",_", "id_", "=_", "task", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "author", "\\u\\u", "username_", "=_", "username_", ",_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "watch_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "json", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "redirect_", "(_", "task_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "POST", " ", "method", "s", " ", "are", " ", "allow", "ed", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Task", "Un", "watch", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "request", "'", "s", " ", "user", " ", "watch", "ing", " ", "this", " ", "task", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perm", "s", "\\u", "private_", "=_", "[_", "'", "view", "\\u", "project", "'_", ",_", "'", "can", "\\u", "view", "\\u", "task", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Un", "watch", "View_", "(_", "Project", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "request_", ",_", "username_", ",_", "project", "\\u", "slug_", ",_", "task", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Task_", ",_", "id_", "=_", "task", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "author", "\\u\\u", "username_", "=_", "username_", ",_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "json", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "task_", "._", "unwa", "tch_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "task_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "POST", " ", "method", "s", " ", "are", " ", "allow", "ed", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-nonrel/djangoappengine/djangoappengine/storage.py
[ { "content": "import datetime\nimport email\nimport mimetypes\nimport urlparse\n\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.files.base import File\nfrom django.core.files.storage import Storage\nfrom django.core.files.uploadedfile import UploadedFile\nfrom django.core.files.uploadhandler import FileUploadHandler, \\\n StopFutureHandlers\nfrom django.http import HttpResponse\nfrom django.utils.encoding import smart_str, force_unicode, filepath_to_uri\n\ntry:\n import cloudstorage\nexcept ImportError:\n cloudstorage = None\n\nfrom google.appengine.api import files\nfrom google.appengine.api.images import get_serving_url, NotImageError, \\\n TransformationError, BlobKeyRequiredError\nfrom google.appengine.ext.blobstore import BlobInfo, BlobKey, delete, \\\n create_upload_url, BLOB_KEY_HEADER, BLOB_RANGE_HEADER, BlobReader, \\\n create_gs_key, CLOUD_STORAGE_OBJECT_HEADER\n\nAPPENGINE_STORAGE_SERVICE_KEY = 'APPENGINE_STORAGE_SERVICE'\nCLOUD_STORAGE_DEFAULT_BUCKET_KEY = 'CLOUD_STORAGE_DEFAULT_BUCKET'\n\nBLOBSTORE_SERVICE = 'blobstore'\nCLOUD_STORAGE_SERVICE = 'gs'\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Backwards compatibility\nBlobstoreStorage = AppEngineStorage\nDevBlobstoreStorage = AppEngineStorage\nBlobstoreFile = AppEngineFile\nBlobstoreFileUploadHandler = AppEngineFileUploadHandler\nBlobstoreUploadedFile = AppEngineUploadedFile\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def prepare_upload(request, url, storage_service=None, cloud_storage_bucket=None, **kwargs):\n if not storage_service:\n storage_service = getattr(settings, APPENGINE_STORAGE_SERVICE_KEY, BLOBSTORE_SERVICE)\n\n upload_kwargs = {}\n if storage_service == 'gs':\n if not cloud_storage_bucket:\n cloud_storage_bucket = getattr(settings, CLOUD_STORAGE_DEFAULT_BUCKET_KEY, None)\n if not cloud_storage_bucket:\n raise ImproperlyConfigured(\"'cloud_storage_bucket' keyword argument or \"\n \"settings.CLOUD_STORAGE_DEFAULT_BUCKET must be set when using Google Cloud Storage.\")\n upload_kwargs['gs_bucket_name'] = cloud_storage_bucket\n return create_upload_url(url, **upload_kwargs), {}", "metadata": "root.prepare_upload", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def serve_file(request, file, save_as, content_type, **kwargs):\n if hasattr(file, 'file') and hasattr(file.file, 'blobstore_info'):\n blobkey = file.file.blobstore_info.key()\n elif hasattr(file, 'blobstore_info'):\n blobkey = file.blobstore_info.key()\n else:\n raise ValueError(\"The provided file can't be served via the \"\n \"App Engine Blobstore or Google Cloud Storage.\")\n response = HttpResponse(content_type=content_type)\n response[BLOB_KEY_HEADER] = str(blobkey)\n response['Accept-Ranges'] = 'bytes'\n http_range = request.META.get('HTTP_RANGE')\n if http_range is not None:\n response[BLOB_RANGE_HEADER] = http_range\n if save_as:\n response['Content-Disposition'] = smart_str(\n u'attachment; filename=%s' % save_as)\n if file.size is not None:\n response['Content-Length'] = file.size\n return response", "metadata": "root.serve_file", "header": "['module', '___EOS___']", "index": 53 }, { "content": "class AppEngineStorage(Storage):\n \"\"\"\n Google App Engine storage backend.\n Supports Blobstore and Cloud Storage.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AppEngineStorage", "header": "['module', '___EOS___']", "index": 75 }, { "content": " def __init__(self, storage_service=None, cloud_storage_bucket=None):\n super(AppEngineStorage, self).__init__()\n if not storage_service:\n storage_service = getattr(settings, APPENGINE_STORAGE_SERVICE_KEY, BLOBSTORE_SERVICE)\n if not cloud_storage_bucket:\n cloud_storage_bucket = getattr(settings, CLOUD_STORAGE_DEFAULT_BUCKET_KEY, None)\n\n if storage_service not in (BLOBSTORE_SERVICE, CLOUD_STORAGE_SERVICE):\n raise ImproperlyConfigured(\"APPENGINE_STORAGE_SERVICE must be either \"\n \"'gs' or 'blobstore', not %s.\" % storage_service)\n if storage_service == CLOUD_STORAGE_SERVICE and not cloud_storage_bucket:\n raise ImproperlyConfigured(\"CLOUD_STORAGE_DEFAULT_BUCKET must be set \"\n \"when using Google Cloud Storage.\")\n\n self.storage_service = storage_service\n self.cloud_storage_bucket = cloud_storage_bucket", "metadata": "root.AppEngineStorage.__init__", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 80 }, { "content": " def _open(self, name, mode='rb'):\n return AppEngineFile(name, mode, self)", "metadata": "root.AppEngineStorage._open", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 97 }, { "content": " def _save(self, name, content):\n name = name.replace('\\\\', '/')\n\n if isinstance(content, (AppEngineFile, AppEngineUploadedFile)):\n data = content.blobstore_info\n elif hasattr(content, 'file') and \\\n isinstance(content.file, (AppEngineFile, AppEngineUploadedFile)):\n data = content.file.blobstore_info\n elif isinstance(content, File):\n guessed_type = mimetypes.guess_type(name)[0]\n\n if self.storage_service == CLOUD_STORAGE_SERVICE:\n assert cloudstorage, 'cloudstorage module is not available.'\n\n file_name = '/%s/%s' % (self.cloud_storage_bucket, name)\n\n with cloudstorage.open(file_name, 'w', guessed_type or 'application/octet-stream') as f:\n for chunk in content.chunks():\n f.write(chunk)\n\n data = self._get_info('/gs' + file_name)\n else:\n # TODO deprecated\n\n file_name = files.blobstore.create(mime_type=guessed_type or 'application/octet-stream',\n _blobinfo_uploaded_filename=name)\n\n with files.open(file_name, 'a') as f:\n for chunk in content.chunks():\n f.write(chunk)\n\n files.finalize(file_name)\n\n data = files.blobstore.get_blob_key(file_name)\n else:\n raise ValueError(\"The App Engine storage backend only supports \"\n \"AppEngineFile instances or File instances.\")\n\n if isinstance(data, CloudStorageInfo):\n return '/gs' + data.fullname\n\n if isinstance(data, BlobInfo):\n data = data.key()\n\n if isinstance(data, BlobKey):\n return '%s/%s' % (data, name.lstrip('/'))\n\n raise ValueError(\"Unknown type returned from saving: %s\" % type(data))", "metadata": "root.AppEngineStorage._save", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 100 }, { "content": " def delete(self, name):\n self._get_info(name).delete()", "metadata": "root.AppEngineStorage.delete", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 149 }, { "content": " def exists(self, name):\n info = self._get_info(name)\n return info is not None and (not hasattr(info, 'exists') or info.exists())", "metadata": "root.AppEngineStorage.exists", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 152 }, { "content": " def size(self, name):\n return self._get_info(name).size", "metadata": "root.AppEngineStorage.size", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 156 }, { "content": " def url(self, name):\n try:\n info = self._get_info(name)\n if not info:\n raise BlobKeyRequiredError('No blob info found for %s.' % name)\n return get_serving_url(info.key())\n except (NotImageError, TransformationError):\n return None\n except BlobKeyRequiredError:\n if settings.DEBUG:\n return urlparse.urljoin(settings.MEDIA_URL, filepath_to_uri(name))\n else:\n raise", "metadata": "root.AppEngineStorage.url", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 159 }, { "content": " def created_time(self, name):\n return self._get_info(name).creation", "metadata": "root.AppEngineStorage.created_time", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 173 }, { "content": " def get_valid_name(self, name):\n return force_unicode(name).strip().replace('\\\\', '/')", "metadata": "root.AppEngineStorage.get_valid_name", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 176 }, { "content": " def get_available_name(self, name):\n return name.replace('\\\\', '/')", "metadata": "root.AppEngineStorage.get_available_name", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 179 }, { "content": " def _get_info(self, name):\n if name.startswith('/gs/'):\n assert cloudstorage, 'cloudstorage module is not available.'\n return CloudStorageInfo(name)\n else:\n key = BlobKey(name.split('/', 1)[0])\n return BlobInfo.get(key)", "metadata": "root.AppEngineStorage._get_info", "header": "['class', 'AppEngineStorage', '(', 'Storage', ')', ':', '___EOS___']", "index": 182 }, { "content": "class CloudStorageInfo(object):\n\n\n\n\n\n", "metadata": "root.CloudStorageInfo", "header": "['module', '___EOS___']", "index": 191 }, { "content": " def __init__(self, name):\n self.fullname = name[3:]\n self.filename = self.fullname.split('/', 2)[2]", "metadata": "root.CloudStorageInfo.__init__", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def delete(self):\n cloudstorage.delete(self.fullname)", "metadata": "root.CloudStorageInfo.delete", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 196 }, { "content": " def exists(self):\n try:\n cloudstorage.stat(self.fullname)\n return True\n except cloudstorage.NotFoundError:\n return False", "metadata": "root.CloudStorageInfo.exists", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 199 }, { "content": " def key(self):\n return create_gs_key('/gs' + self.fullname)", "metadata": "root.CloudStorageInfo.key", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 206 }, { "content": " def open(self):\n return cloudstorage.open(self.fullname, 'r')", "metadata": "root.CloudStorageInfo.open", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 209 }, { "content": " @property\n def creation(self):\n return datetime.datetime.fromtimestamp(cloudstorage.stat(self.fullname).st_ctime)", "metadata": "root.CloudStorageInfo.creation", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 212 }, { "content": " @property\n def size(self):\n return cloudstorage.stat(self.fullname).st_size", "metadata": "root.CloudStorageInfo.size", "header": "['class', 'CloudStorageInfo', '(', 'object', ')', ':', '___EOS___']", "index": 216 }, { "content": "class AppEngineFile(File):\n\n\n", "metadata": "root.AppEngineFile", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def __init__(self, name, mode, storage):\n self.name = name\n self._storage = storage\n self._mode = mode\n self.blobstore_info = storage._get_info(name)", "metadata": "root.AppEngineFile.__init__", "header": "['class', 'AppEngineFile', '(', 'File', ')', ':', '___EOS___']", "index": 222 }, { "content": " @property\n def size(self):\n return self.blobstore_info.size", "metadata": "root.AppEngineFile.size", "header": "['class', 'AppEngineFile', '(', 'File', ')', ':', '___EOS___']", "index": 228 }, { "content": " def write(self, content):\n raise NotImplementedError()", "metadata": "root.AppEngineFile.write", "header": "['class', 'AppEngineFile', '(', 'File', ')', ':', '___EOS___']", "index": 232 }, { "content": " @property\n def file(self):\n if not hasattr(self, '_file'):\n self._file = self.blobstore_info.open()\n return self._file", "metadata": "root.AppEngineFile.file", "header": "['class', 'AppEngineFile', '(', 'File', ')', ':', '___EOS___']", "index": 235 }, { "content": "class AppEngineFileUploadHandler(FileUploadHandler):\n \"\"\"\n File upload handler for Google App Engine. Supports both\n Blobstore and Google Cloud Storage\n \"\"\"\n\n\n", "metadata": "root.AppEngineFileUploadHandler", "header": "['module', '___EOS___']", "index": 241 }, { "content": " def new_file(self, *args, **kwargs):\n super(AppEngineFileUploadHandler, self).new_file(*args, **kwargs)\n blobkey = self.content_type_extra.get('blob-key')\n self.activated = blobkey is not None\n if self.activated:\n self.blobkey = BlobKey(blobkey)\n self.filename = kwargs.get('file_name', None)\n self.file = StringIO()\n raise StopFutureHandlers()", "metadata": "root.AppEngineFileUploadHandler.new_file", "header": "['class', 'AppEngineFileUploadHandler', '(', 'FileUploadHandler', ')', ':', '___EOS___']", "index": 247 }, { "content": " def receive_data_chunk(self, raw_data, start):\n \"\"\"\n Add the data to the StringIO file.\n \"\"\"\n if self.activated:\n self.file.write(raw_data)\n else:\n return raw_data", "metadata": "root.AppEngineFileUploadHandler.receive_data_chunk", "header": "['class', 'AppEngineFileUploadHandler', '(', 'FileUploadHandler', ')', ':', '___EOS___']", "index": 257 }, { "content": " def file_complete(self, file_size):\n \"\"\"\n Return a file object if we're activated.\n \"\"\"\n if not self.activated:\n return\n\n self.file.seek(0)\n upload_content = email.message_from_file(self.file)\n\n def get_value(dict, name):\n value = dict.get(name, None)\n if value is None:\n raise Exception('Missing field %s.' % (field_name, name))\n return value\n\n content_type = get_value(upload_content, 'content-type')\n size = get_value(upload_content, 'content-length')\n gs_object_name = upload_content.get(CLOUD_STORAGE_OBJECT_HEADER, None)\n\n kwargs = {\n 'blob_key': self.blobkey,\n 'name': self.file_name,\n 'content_type': content_type,\n 'size': int(size),\n 'charset': self.charset,\n }\n\n return AppEngineUploadedFile(**kwargs)", "metadata": "root.AppEngineFileUploadHandler.file_complete", "header": "['class', 'AppEngineFileUploadHandler', '(', 'FileUploadHandler', ')', ':', '___EOS___']", "index": 266 }, { "content": "class AppEngineUploadedFile(UploadedFile):\n \"\"\"\n A file uploaded via App Engine's upload mechanism.\n \"\"\"\n\n\n\n", "metadata": "root.AppEngineUploadedFile", "header": "['module', '___EOS___']", "index": 297 }, { "content": " def __init__(self, **kwargs):\n gs_object_name = kwargs.pop('gs_object_name', None)\n blob_key = kwargs.pop('blob_key', None)\n if gs_object_name:\n self.blobstore_info = CloudStorageInfo(gs_object_name)\n elif blob_key:\n self.blobstore_info = BlobInfo(blob_key)\n else:\n raise ValueError('A gs_object_name or blob_key is required.')\n\n super(AppEngineUploadedFile, self).__init__(self.blobstore_info.open(), **kwargs)", "metadata": "root.AppEngineUploadedFile.__init__", "header": "['class', 'AppEngineUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 302 }, { "content": " def open(self, mode=None):\n pass", "metadata": "root.AppEngineUploadedFile.open", "header": "['class', 'AppEngineUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 314 }, { "content": " def chunks(self, chunk_size=1024 * 128):\n self.file.seek(0)\n while True:\n content = self.read(chunk_size)\n if not content:\n break\n yield content", "metadata": "root.AppEngineUploadedFile.chunks", "header": "['class', 'AppEngineUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 317 }, { "content": " def multiple_chunks(self, chunk_size=1024 * 128):\n return True", "metadata": "root.AppEngineUploadedFile.multiple_chunks", "header": "['class', 'AppEngineUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 325 } ]
[ { "span": "from google.appengine.ext.blobstore import BlobInfo, BlobKey, delete, \\\n create_upload_url, BLOB_KEY_HEADER, BLOB_RANGE_HEADER, BlobReader, \\\n create_gs_key, CLOUD_STORAGE_OBJECT_HEADER", "start_line": 28, "start_column": 0, "end_line": 30, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\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_", "c", "String", "IO_", "import_", "String", "IO_", "\\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_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "base_", "import_", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "storage_", "import_", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "uploade", "dfile", "_", "import_", "Upload", "ed", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "upload", "handler_", "import_", "File", "Upload", "Handler_", ",_", "Sto", "p", "Fu", "ture", "Handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "smart", "\\u", "str_", ",_", "force", "\\u", "unicode_", ",_", "filepath", "\\u", "to", "\\u", "uri_", "\\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_", "clouds", "tora", "ge_", "\\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 ", " _", "clouds", "tora", "ge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "._", "images_", "import_", "get", "\\u", "serving", "\\u", "url_", ",_", "Not", "Image", "Error_", ",_", "Transformation", "Error_", ",_", "Blo", "b", "Key", "Requ", "ired", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "._", "blobs", "tore_", "import_", "Blo", "b", "Info_", ",_", "Blo", "b", "Key_", ",_", "delete_", ",_", "create", "\\u", "upload", "\\u", "url_", ",_", "BLOB", "\\u", "KEY", "\\u", "HEADER_", ",_", "BLOB", "\\u", "RANGE", "\\u", "HEADER_", ",_", "Blo", "b", "Reader_", ",_", "create", "\\u", "gs", "\\u", "key_", ",_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "OBJ", "ECT", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "APPEN", "GIN", "E", "\\u", "STOR", "AGE", "\\u", "SERV", "ICE", "\\u", "KEY_", "=_", "'", "APPEN", "GIN", "E", "\\u", "STOR", "AGE", "\\u", "SERV", "ICE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", "\\u", "KEY_", "=_", "'", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BLOB", "STORE", "\\u", "SERVICE_", "=_", "'", "blobs", "tore", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "SERVICE_", "=_", "'", "gs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Backward", "s", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Blo", "bst", "ore", "Storage_", "=_", "App", "Engine", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Dev", "Blo", "bst", "ore", "Storage_", "=_", "App", "Engine", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Blo", "bst", "ore", "File_", "=_", "App", "Engine", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Blo", "bst", "ore", "File", "Upload", "Handler_", "=_", "App", "Engine", "File", "Upload", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Blo", "bst", "ore", "Upload", "ed", "File_", "=_", "App", "Engine", "Upload", "ed", "File_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "upload_", "(_", "request_", ",_", "url_", ",_", "storage", "\\u", "service_", "=_", "None_", ",_", "cloud", "\\u", "storage", "\\u", "bucket_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "storage", "\\u", "service_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage", "\\u", "service_", "=_", "getattr_", "(_", "settings_", ",_", "APPEN", "GIN", "E", "\\u", "STOR", "AGE", "\\u", "SERV", "ICE", "\\u", "KEY_", ",_", "BLOB", "STORE", "\\u", "SERVICE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upload", "\\u", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "storage", "\\u", "service_", "==_", "'", "gs", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "cloud", "\\u", "storage", "\\u", "bucket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cloud", "\\u", "storage", "\\u", "bucket_", "=_", "getattr_", "(_", "settings_", ",_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", "\\u", "KEY_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "cloud", "\\u", "storage", "\\u", "bucket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"'", "cloud", "\\u", "storage", "\\u", "bucket", "'", " ", "keyw", "ord", " ", "argu", "ment", " ", "or", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "settings", ".", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", " ", "must", " ", "be", " ", "set", " ", "whe", "n", " ", "usi", "ng", " ", "Goo", "gle", " ", "Cloud", " ", "Stor", "age", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upload", "\\u", "kwargs_", "[_", "'", "gs", "\\u", "bucket", "\\u", "name", "'_", "]_", "=_", "cloud", "\\u", "storage", "\\u", "bucket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "create", "\\u", "upload", "\\u", "url_", "(_", "url_", ",_", "**_", "upload", "\\u", "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_", "def_", "serve", "\\u", "file_", "(_", "request_", ",_", "file_", ",_", "save", "\\u", "as_", ",_", "content", "\\u", "type_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "file_", ",_", "'", "file", "'_", ")_", "and_", "hasattr_", "(_", "file_", "._", "file_", ",_", "'", "blobs", "tore\\u", "info", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blob", "key_", "=_", "file_", "._", "file_", "._", "blobs", "tore\\u", "info_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "file_", ",_", "'", "blobs", "tore\\u", "info", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blob", "key_", "=_", "file_", "._", "blobs", "tore\\u", "info_", "._", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "provided", " ", "file", " ", "can", "'", "t", " ", "be", " ", "serve", "d", " ", "via", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "App", " ", "Engine", " ", "Blo", "bst", "ore", " ", "or", " ", "Goo", "gle", " ", "Cloud", " ", "Stor", "age", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "BLOB", "\\u", "KEY", "\\u", "HEADER_", "]_", "=_", "str_", "(_", "blob", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Accept", "-", "Range", "s", "'_", "]_", "=_", "'", "bytes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "\\u", "range_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "RANGE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "http", "\\u", "range_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "BLOB", "\\u", "RANGE", "\\u", "HEADER_", "]_", "=_", "http", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "\\u", "as_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "smart", "\\u", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "attach", "ment", ";", " ", "filename", "=", "%", "s", "'_", "%_", "save", "\\u", "as_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file_", "._", "size_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", "=_", "file_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Goo", "gle", " ", "App", " ", "Engine", " ", "storage", " ", "back", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "Supp", "orts", " ", "Blo", "bst", "ore", " ", "and", " ", "Cloud", " ", "Stor", "age", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "storage", "\\u", "service_", "=_", "None_", ",_", "cloud", "\\u", "storage", "\\u", "bucket_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "App", "Engine", "Storage_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "storage", "\\u", "service_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage", "\\u", "service_", "=_", "getattr_", "(_", "settings_", ",_", "APPEN", "GIN", "E", "\\u", "STOR", "AGE", "\\u", "SERV", "ICE", "\\u", "KEY_", ",_", "BLOB", "STORE", "\\u", "SERVICE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "cloud", "\\u", "storage", "\\u", "bucket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cloud", "\\u", "storage", "\\u", "bucket_", "=_", "getattr_", "(_", "settings_", ",_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", "\\u", "KEY_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "storage", "\\u", "service_", "not_", "in_", "(_", "BLOB", "STORE", "\\u", "SERVICE_", ",_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "SERVICE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "APPEN", "GIN", "E", "\\u", "STOR", "AGE", "\\u", "SERV", "ICE", " ", "must", " ", "be", " ", "eit", "her", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "gs", "'", " ", "or", " ", "'", "blobs", "tore", "',", " ", "not", " ", "%", "s", ".\"_", "%_", "storage", "\\u", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "storage", "\\u", "service_", "==_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "SERVICE_", "and_", "not_", "cloud", "\\u", "storage", "\\u", "bucket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "CLOUD", "\\u", "STOR", "AGE", "\\u", "DEF", "AUL", "T", "\\u", "BUCKET", " ", "must", " ", "be", " ", "set", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "whe", "n", " ", "usi", "ng", " ", "Goo", "gle", " ", "Cloud", " ", "Stor", "age", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "storage", "\\u", "service_", "=_", "storage", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cloud", "\\u", "storage", "\\u", "bucket_", "=_", "cloud", "\\u", "storage", "\\u", "bucket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "open_", "(_", "self_", ",_", "name_", ",_", "mode_", "=_", "'", "rb", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "App", "Engine", "File_", "(_", "name_", ",_", "mode_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "save_", "(_", "self_", ",_", "name_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "content_", ",_", "(_", "App", "Engine", "File_", ",_", "App", "Engine", "Upload", "ed", "File_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "content_", "._", "blobs", "tore\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "content_", ",_", "'", "file", "'_", ")_", "and_", "isinstance_", "(_", "content_", "._", "file_", ",_", "(_", "App", "Engine", "File_", ",_", "App", "Engine", "Upload", "ed", "File_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "content_", "._", "file_", "._", "blobs", "tore\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "content_", ",_", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "guessed", "\\u", "type_", "=_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "name_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "storage", "\\u", "service_", "==_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "SERVICE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "clouds", "tora", "ge_", ",_", "'", "clouds", "tora", "ge", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "name_", "=_", "'/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "cloud", "\\u", "storage", "\\u", "bucket_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "clouds", "tora", "ge_", "._", "open_", "(_", "file", "\\u", "name_", ",_", "'", "w", "'_", ",_", "guessed", "\\u", "type_", "or_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "chunk_", "in_", "content_", "._", "chunks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "'/", "gs", "'_", "+_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "deprecated_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "name_", "=_", "files_", "._", "blobs", "tore_", "._", "create_", "(_", "mime", "\\u", "type_", "=_", "guessed", "\\u", "type_", "or_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "blob", "info", "\\u", "uploade", "d\\u", "filename_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "files_", "._", "open_", "(_", "file", "\\u", "name_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "chunk_", "in_", "content_", "._", "chunks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "._", "finalize_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "files_", "._", "blobs", "tore_", "._", "get", "\\u", "blob", "\\u", "key_", "(_", "file", "\\u", "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_", "Value", "Error_", "(_", "\"", "The", " ", "App", " ", "Engine", " ", "storage", " ", "back", "end", " ", "only", " ", "support", "s", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "App", "Engine", "File", " ", "instance", "s", " ", "or", " ", "File", " ", "instance", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "Cloud", "Stor", "age", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'/", "gs", "'_", "+_", "data_", "._", "fullname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "Blo", "b", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "data_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "Blo", "b", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "data_", ",_", "name_", "._", "lstrip_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "type", " ", "return", "ed", " ", "from", " ", "saving", ":", " ", "%", "s", "\"_", "%_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exists_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "info_", "is_", "not_", "None_", "and_", "(_", "not_", "hasattr_", "(_", "info_", ",_", "'", "exist", "s", "'_", ")_", "or_", "info_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "size_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "url_", "(_", "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 ", " _", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Blo", "b", "Key", "Requ", "ired", "Error_", "(_", "'", "No", " ", "blob", " ", "info", " ", "found", " ", "for", " ", "%", "s", ".'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get", "\\u", "serving", "\\u", "url_", "(_", "info_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Not", "Image", "Error_", ",_", "Transformation", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Blo", "b", "Key", "Requ", "ired", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "settings_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "urlparse_", "._", "urljoin_", "(_", "settings_", "._", "MEDIA", "\\u", "URL_", ",_", "filepath", "\\u", "to", "\\u", "uri_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "created", "\\u", "time_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "._", "creation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "valid", "\\u", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "force", "\\u", "unicode_", "(_", "name_", ")_", "._", "strip_", "(_", ")_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "avail", "able", "\\u", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Storage_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "info_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "'/", "gs", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "clouds", "tora", "ge_", ",_", "'", "clouds", "tora", "ge", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Cloud", "Stor", "age", "Info_", "(_", "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 ", " _", "key_", "=_", "Blo", "b", "Key_", "(_", "name_", "._", "split_", "(_", "'/'_", ",_", "1_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Blo", "b", "Info_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fullname_", "=_", "name_", "[_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "self_", "._", "fullname_", "._", "split_", "(_", "'/'_", ",_", "2_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clouds", "tora", "ge_", "._", "delete_", "(_", "self_", "._", "fullname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exists_", "(_", "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 ", " _", "clouds", "tora", "ge_", "._", "stat_", "(_", "self_", "._", "fullname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "clouds", "tora", "ge_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "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_", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "create", "\\u", "gs", "\\u", "key_", "(_", "'/", "gs", "'_", "+_", "self_", "._", "fullname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clouds", "tora", "ge_", "._", "open_", "(_", "self_", "._", "fullname_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "creation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "clouds", "tora", "ge_", "._", "stat_", "(_", "self_", "._", "fullname_", ")_", "._", "st", "\\u", "ctime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Stor", "age", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clouds", "tora", "ge_", "._", "stat_", "(_", "self_", "._", "fullname_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "App", "Engine", "File_", "(_", "File_", ")_", ":_", "\\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_", "App", "Engine", "File_", "(_", "File_", ")_", ":_", "\\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_", ",_", "mode_", ",_", "storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "storage_", "=_", "storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mode_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "blobs", "tore\\u", "info_", "=_", "storage_", "._", "\\u", "get", "\\u", "info_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File_", "(_", "File_", ")_", ":_", "\\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_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "blobs", "tore\\u", "info_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File_", "(_", "File_", ")_", ":_", "\\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_", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "file_", "=_", "self_", "._", "blobs", "tore\\u", "info_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\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_", "App", "Engine", "File", "Upload", "Handler_", "(_", "File", "Upload", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "upload", " ", "handler", " ", "for", " ", "Goo", "gle", " ", "App", " ", "Engine", ".", " ", "Supp", "orts", " ", "bot", "h", "\\", "10", ";", " ", " ", " ", " ", "Blo", "bst", "ore", " ", "and", " ", "Goo", "gle", " ", "Cloud", " ", "Stor", "age", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File", "Upload", "Handler_", "(_", "File", "Upload", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "new", "\\u", "file_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "App", "Engine", "File", "Upload", "Handler_", ",_", "self_", ")_", "._", "new", "\\u", "file_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "key_", "=_", "self_", "._", "content", "\\u", "type", "\\u", "extra_", "._", "get_", "(_", "'", "blob", "-", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "activated_", "=_", "blob", "key_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "activated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "blob", "key_", "=_", "Blo", "b", "Key_", "(_", "blob", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "kwargs_", "._", "get_", "(_", "'", "file", "\\u", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Fu", "ture", "Handlers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File", "Upload", "Handler_", "(_", "File", "Upload", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "\\u", "data\\u", "chunk_", "(_", "self_", ",_", "raw", "\\u", "data_", ",_", "start_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "the", " ", "data", " ", "to", " ", "the", " ", "String", "IO", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "activated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "raw", "\\u", "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 ", " _", "return_", "raw", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "File", "Upload", "Handler_", "(_", "File", "Upload", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "complete_", "(_", "self_", ",_", "file", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "file", " ", "object", " ", "if", " ", "we", "'", "re", " ", "activat", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "activated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "content_", "=_", "email_", "._", "message", "\\u", "from", "\\u", "file_", "(_", "self_", "._", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "dict_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "._", "get_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Missing", " ", "field", " ", "%", "s", ".'_", "%_", "(_", "field", "\\u", "name_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content", "\\u", "type_", "=_", "get", "\\u", "value_", "(_", "upload", "\\u", "content_", ",_", "'", "content", "-", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "get", "\\u", "value_", "(_", "upload", "\\u", "content_", ",_", "'", "content", "-", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gs", "\\u", "object\\u", "name_", "=_", "upload", "\\u", "content_", "._", "get_", "(_", "CLOUD", "\\u", "STOR", "AGE", "\\u", "OBJ", "ECT", "\\u", "HEADER_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blob", "\\u", "key", "'_", ":_", "self_", "._", "blob", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "file", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "int_", "(_", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "charset", "'_", ":_", "self_", "._", "charset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "App", "Engine", "Upload", "ed", "File_", "(_", "**_", "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_", "App", "Engine", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "file", " ", "uploade", "d", " ", "via", " ", "App", " ", "Engine", "'", "s", " ", "upload", " ", "mechanism", ".", "\\", "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_", "App", "Engine", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gs", "\\u", "object\\u", "name_", "=_", "kwargs_", "._", "pop_", "(_", "'", "gs", "\\u", "object\\u", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "\\u", "key_", "=_", "kwargs_", "._", "pop_", "(_", "'", "blob", "\\u", "key", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gs", "\\u", "object\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "blobs", "tore\\u", "info_", "=_", "Cloud", "Stor", "age", "Info_", "(_", "gs", "\\u", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "blob", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "blobs", "tore\\u", "info_", "=_", "Blo", "b", "Info_", "(_", "blob", "\\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 ", " _", "raise_", "Value", "Error_", "(_", "'", "A", " ", "gs", "\\u", "object\\u", "name", " ", "or", " ", "blob", "\\u", "key", " ", "is", " ", "require", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "App", "Engine", "Upload", "ed", "File_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "blobs", "tore\\u", "info_", "._", "open_", "(_", ")_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ",_", "mode_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chunks_", "(_", "self_", ",_", "chunk", "\\u", "size_", "=_", "1024_", "*_", "128_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "self_", "._", "read_", "(_", "chunk", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "content_", ":_", "\\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_", "yield_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Engine", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\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 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
x3omdax/PenBox/Versions/V1.1/penbox.py
[ { "content": " def getWordpress(self) :\n \"\"\"\n get wordpress site using a dork the attacker\n may do a password list attack (i did a tool for that purpose check my pastebin) \n or scan for common vulnerabilities using wpscan for example (i did a simple tool \n for multi scanning using wpscan)\n \"\"\"\n lista = []\n page = 1\n while page <= 101:\n try:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+?page_id=&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n wpnoclean = findwebs[i]\n findwp = re.findall('(.*?)\\?page_id=', wpnoclean)\n lista.extend(findwp)\n page += 50\n except:\n pass\n lista = unique(lista)\n clearScr()\n print '[*] Found ', len(lista), ' Wordpress Website\\n'\n for site in lista :\n print site", "metadata": "root.TNscan.getWordpress", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 534 }, { "content": " def getUsers(self) :\n \"\"\"\n get server users using a method found by \n iranian hackers i think, the attacker may\n do a bruteforce attack on CPanel, ssh, ftp or \n even mysql if it supports remote login\n (you can use medusa or hydra)\n \"\"\"\n clearScr()\n print \"[~] Grabbing Users\"\n userslist = []\n for site1 in self.sites :\n try:\n site = site1\n site = site.replace('http://www.', '')\n site = site.replace('http://', '')\n site = site.replace('.', '')\n if '-' in site:\n site = site.replace('-', '')\n site = site.replace('/', '')\n while len(site) > 2:\n resp = urllib2.urlopen(site1 + '/cgi-sys/guestbook.cgi?user=%s' % site).read()\n if 'invalid username' not in resp.lower():\n print '\\t [*] Found -> ', site\n userslist.append(site)\n break\n else :\n print site\n \n site = site[:-1]\n except:\n pass\n \n clearScr()\n for user in userslist :\n print user", "metadata": "root.TNscan.getUsers", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 644 }, { "content": " def getServerBanner(self) :\n \"\"\"\n simply gets the server banner \n the attacker may benefit from it \n like getting the server side software\n \"\"\"\n clearScr()\n try:\n s = 'http://' + self.serverip\n httpresponse = urllib.urlopen(s)\n print ' [*] Server header -> ', httpresponse.headers.getheader('server')\n except:\n pass", "metadata": "root.TNscan.getServerBanner", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 710 }, { "content": " def grabSqli(self) :\n \"\"\"\n just grabs all websites in server with php?id= dork \n for scanning for error based sql injection\n \"\"\"\n page = 1\n lista = []\n while page <= 101:\n try:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+php?id=&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n x = findwebs[i]\n lista.append(x)\n except:\n pass \n page += 50 \n lista = unique(lista) \n self.checkSqli(lista)", "metadata": "root.TNscan.grabSqli", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 725 }, { "content": " def checkSqli(self, s):\n \"\"\"\n checks for error based sql injection,\n most of the codes here are from webpwn3r \n project the one who has found an lfi in \n yahoo as i remember, you can find a separate \n tool in my blog \n \"\"\"\n clearScr()\n print \"[~] Checking SQL injection\"\n payloads = [\"3'\", \"3%5c\", \"3%27%22%28%29\", \"3'><\", \"3%22%5C%27%5C%22%29%3B%7C%5D%2A%7B%250d%250a%3C%2500%3E%25bf%2527%27\"]\n check = re.compile(\"Incorrect syntax|mysql_fetch|Syntax error|Unclosed.+mark|unterminated.+qoute|SQL.+Server|Microsoft.+Database|Fatal.+error\", re.I)\n for url in s:\n try:\n for param in url.split('?')[1].split('&'):\n for payload in payloads:\n power = url.replace(param, param + payload.strip())\n #print power\n html = urllib2.urlopen(power).readlines()\n for line in html:\n checker = re.findall(check, line)\n if len(checker) != 0 :\n print ' [*] SQLi found -> ', power\n except:\n pass", "metadata": "root.TNscan.checkSqli", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 748 } ]
[ { "span": "except:", "start_line": 554, "start_column": 12, "end_line": 554, "end_column": 19 }, { "span": "except:", "start_line": 674, "start_column": 12, "end_line": 674, "end_column": 19 }, { "span": "except:", "start_line": 721, "start_column": 8, "end_line": 721, "end_column": 15 }, { "span": "except:", "start_line": 741, "start_column": 12, "end_line": 741, "end_column": 19 }, { "span": "except:", "start_line": 771, "start_column": 12, "end_line": 771, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Word", "press_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "wordpress", " ", "site", " ", "usi", "ng", " ", "a", " ", "dor", "k", " ", "the", " ", "attacker", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "do", " ", "a", " ", "password", " ", "list", " ", "attac", "k", " ", "(", "i", " ", "did", " ", "a", " ", "tool", " ", "for", " ", "tha", "t", " ", "purpose", " ", "check", " ", "my", " ", "paste", "bin", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "scan", " ", "for", " ", "common", " ", "vulnerab", "ilities", " ", "usi", "ng", " ", "wps", "can", " ", "for", " ", "example", " ", "(", "i", " ", "did", " ", "a", " ", "simple", " ", "tool", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "multi", " ", "scanning", " ", "usi", "ng", " ", "wps", "can", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "?", "page", "\\u", "id", "=", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "wp", "noc", "lean", "_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "wp_", "=_", "re_", "._", "findall_", "(_", "'(.*", "?)", "\\\\?", "page", "\\u", "id", "='_", ",_", "wp", "noc", "lean", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "._", "extend_", "(_", "find", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "+=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'[", "*]", " ", "Foun", "d", " ", "'_", ",_", "len_", "(_", "lista_", ")_", ",_", "'", " ", "Word", "press", " ", "Webs", "ite", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "lista_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Users_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "server", " ", "users", " ", "usi", "ng", " ", "a", " ", "method", " ", "found", " ", "by", " ", "\\", "10", ";", " ", " ", " ", " ", "ira", "nian", " ", "hacke", "rs", " ", "i", " ", "think", ",", " ", "the", " ", "attacker", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "do", " ", "a", " ", "brute", "force", " ", "attac", "k", " ", "on", " ", "CP", "ane", "l", ",", " ", "ssh", ",", " ", "ftp", " ", "or", " ", "\\", "10", ";", " ", " ", " ", " ", "even", " ", "mysql", " ", "if", " ", "it", " ", "support", "s", " ", "remote", " ", "login", "\\", "10", ";", " ", " ", " ", " ", "(", "you", " ", "can", " ", "use", " ", "med", "usa", " ", "or", " ", "hydra", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Grab", "bing", " ", "User", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site", "1_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "site", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'", "http", "://", "www", ".'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'", "http", "://'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'-'_", "in_", "site_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "site_", "=_", "site_", "._", "replace_", "(_", "'-'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'/'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "site_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "resp_", "=_", "urllib2_", "._", "urlopen_", "(_", "site", "1_", "+_", "'/", "cgi", "-", "sys", "/", "guest", "book", ".", "cgi", "?", "user", "=", "%", "s", "'_", "%_", "site_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "invalid", " ", "user", "name", "'_", "not_", "in_", "resp_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'\\\\", "t", " ", "[*]", " ", "Foun", "d", " ", "->", " ", "'_", ",_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "list_", "._", "append_", "(_", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "site_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "users", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Server", "Banner", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "simp", "ly", " ", "gets", " ", "the", " ", "server", " ", "banner", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "attacker", " ", "may", " ", "benefit", " ", "from", " ", "it", " ", "\\", "10", ";", " ", " ", " ", " ", "like", " ", "getti", "ng", " ", "the", " ", "server", " ", "side", " ", "software", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "http", "://'_", "+_", "self_", "._", "server", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "response_", "=_", "urllib_", "._", "urlopen_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "[*]", " ", "Server", " ", "header", " ", "->", " ", "'_", ",_", "http", "response_", "._", "headers_", "._", "getheader_", "(_", "'", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gra", "b", "Sq", "li_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "gra", "bs", " ", "all", " ", "webs", "ites", " ", "in", " ", "server", " ", "with", " ", "php", "?", "id", "=", " ", "dor", "k", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "scanning", " ", "for", " ", "error", " ", "based", " ", "sql", " ", "injection", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "php", "?", "id", "=", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "+=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Sq", "li_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Sq", "li_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "checks", " ", "for", " ", "error", " ", "based", " ", "sql", " ", "injection", ",", "\\", "10", ";", " ", " ", " ", " ", "most", " ", "of", " ", "the", " ", "codes", " ", "here", " ", "are", " ", "from", " ", "webp", "wn", "3", "r", " ", "\\", "10", ";", " ", " ", " ", " ", "project", " ", "the", " ", "one", " ", "who", " ", "has", " ", "found", " ", "an", " ", "lf", "i", " ", "in", " ", "\\", "10", ";", " ", " ", " ", " ", "ya", "hoo", " ", "as", " ", "i", " ", "remember", ",", " ", "you", " ", "can", " ", "find", " ", "a", " ", "separate", " ", "\\", "10", ";", " ", " ", " ", " ", "tool", " ", "in", " ", "my", " ", "blog", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Check", "ing", " ", "SQL", " ", "injection", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payloads_", "=_", "[_", "\"", "3", "'\"_", ",_", "\"", "3", "%", "5c", "\"_", ",_", "\"", "3", "%", "2", "7", "%", "2", "2", "%", "2", "8", "%", "2", "9", "\"_", ",_", "\"", "3", "'><", "\"_", ",_", "\"", "3", "%", "2", "2", "%", "5", "C", "%", "2", "7", "%", "5", "C", "%", "2", "2", "%", "2", "9", "%", "3", "B", "%", "7", "C", "%", "5", "D", "%", "2", "A", "%", "7", "B", "%", "250", "d", "%", "250", "a", "%", "3", "C", "%", "2500", "%", "3", "E", "%", "25", "bf", "%", "252", "7", "%", "2", "7", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "re_", "._", "compile_", "(_", "\"", "Inco", "rrect", " ", "synta", "x", "|", "mysql", "\\u", "fetch", "|", "Syntax", " ", "error", "|", "Unc", "lose", "d", ".+", "mark", "|", "unter", "minat", "ed", ".+", "qo", "ute", "|", "SQL", ".+", "Server", "|", "Micro", "soft", ".+", "Databa", "se", "|", "Fat", "al", ".+", "error", "\"_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "param_", "in_", "url_", "._", "split_", "(_", "'?'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'&'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "payload_", "in_", "payloads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "power_", "=_", "url_", "._", "replace_", "(_", "param_", ",_", "param_", "+_", "payload_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "power_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "urllib2_", "._", "urlopen_", "(_", "power_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "checker_", "=_", "re_", "._", "findall_", "(_", "check_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "checker_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", " ", "[*]", " ", "SQL", "i", " ", "found", " ", "->", " ", "'_", ",_", "power_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
globocom/database-as-a-service/dbaas/dbaas_services/analyzing/migrations/0002_auto__add_field_analyzerepository_email_sent__add_index_analyzereposit.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'analyzing.analyzerepository': {\n 'Meta': {'unique_together': \"(('analyzed_at', 'instance_name'),)\", 'object_name': 'AnalyzeRepository'},\n 'analyzed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'cpu_alarm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'database_name': ('django.db.models.fields.CharField', [], {'max_length': '60', 'db_index': 'True'}),\n 'email_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'engine_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),\n 'environment_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'db_index': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'instance_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}),\n 'memory_alarm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['analyzing']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding field 'AnalyzeRepository.email_sent'\n db.add_column(u'analyzing_analyzerepository', 'email_sent',\n self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True),\n keep_default=False)\n\n # Adding index on 'AnalyzeRepository', fields ['engine_name']\n db.create_index(u'analyzing_analyzerepository', ['engine_name'])\n\n # Adding index on 'AnalyzeRepository', fields ['environment_name']\n db.create_index(u'analyzing_analyzerepository', ['environment_name'])\n\n # Adding index on 'AnalyzeRepository', fields ['instance_name']\n db.create_index(u'analyzing_analyzerepository', ['instance_name'])\n\n # Adding index on 'AnalyzeRepository', fields ['analyzed_at']\n db.create_index(u'analyzing_analyzerepository', ['analyzed_at'])\n\n # Adding index on 'AnalyzeRepository', fields ['database_name']\n db.create_index(u'analyzing_analyzerepository', ['database_name'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Removing index on 'AnalyzeRepository', fields ['database_name']\n db.delete_index(u'analyzing_analyzerepository', ['database_name'])\n\n # Removing index on 'AnalyzeRepository', fields ['analyzed_at']\n db.delete_index(u'analyzing_analyzerepository', ['analyzed_at'])\n\n # Removing index on 'AnalyzeRepository', fields ['instance_name']\n db.delete_index(u'analyzing_analyzerepository', ['instance_name'])\n\n # Removing index on 'AnalyzeRepository', fields ['environment_name']\n db.delete_index(u'analyzing_analyzerepository', ['environment_name'])\n\n # Removing index on 'AnalyzeRepository', fields ['engine_name']\n db.delete_index(u'analyzing_analyzerepository', ['engine_name'])\n\n # Deleting field 'AnalyzeRepository.email_sent'\n db.delete_column(u'analyzing_analyzerepository', 'email_sent')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 31 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "analy", "zin", "g", ".", "analyze", "repos", "itor", "y", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "analyze", "d\\u", "at", "',", " ", "'", "instance", "\\u", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Analy", "ze", "Repos", "itor", "y", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "analyze", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpu", "\\u", "alarm", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "60", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "sent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eng", "ine", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "environ", "ment", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "memory", "\\u", "alarm", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "analy", "zin", "g", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Analy", "ze", "Repos", "itor", "y", ".", "email", "\\u", "sent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "'", "email", "\\u", "sent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "(_", "default_", "=_", "False_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "eng", "ine", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "eng", "ine", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "environ", "ment", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "environ", "ment", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "instance", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "instance", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "analyze", "d\\u", "at", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "analyze", "d\\u", "at", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "databa", "se", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "databa", "se", "\\u", "name", "'_", "]_", ")_", "\\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_", "#", " ", "Remo", "ving", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "databa", "se", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "databa", "se", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "analyze", "d\\u", "at", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "analyze", "d\\u", "at", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "instance", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "instance", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "environ", "ment", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "environ", "ment", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "index", " ", "on", " ", "'", "Analy", "ze", "Repos", "itor", "y", "',", " ", "fields", " ", "['", "eng", "ine", "\\u", "name", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "index_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "[_", "'", "eng", "ine", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Analy", "ze", "Repos", "itor", "y", ".", "email", "\\u", "sent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "column_", "(_", "u", "'", "analy", "zin", "g", "\\u", "analyze", "repos", "itor", "y", "'_", ",_", "'", "email", "\\u", "sent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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overYas3fsPlugin.py
[ { "content": "\tdef epochseconds_to_iso8601(self, s = None):\n\t\tt = None\n\t\tif s == None:\n\t\t\tdt = datetime.datetime.now()\n\t\telse:\n\t\t\tdt = datetime.datetime.utcfromtimestamp(s)\n\n\t\t# truncates microseconds\n\t\tdt = dt.replace(microsecond=0)\n\n\t\trt = dt.isoformat()\n\t\t\n\t\treturn rt", "metadata": "root.RecoverYas3fsPlugin.epochseconds_to_iso8601", "header": "['class', 'RecoverYas3fsPlugin', '(', 'YAS3FSPlugin', ')', ':', '___EOS___']", "index": 19 }, { "content": "\tdef do_cmd_on_s3_now_w_retries(self, fn):\n\t\t# self, key, pub, action, args, kargs, retries = 1\n\t\tdef wrapper(*args, **kargs):\n\t\t\ttry:\n\t\t\t\treturn fn(*args, **kargs)\n\t\t\texcept Exception as e:\n\t\t\t\tself.logger.error(\"PLUGIN\")\n\t\t\t\tselfless_args = None\n\t\t\t\tif args[1]:\n\t\t\t\t\tselfless_args = args[1:]\n\t\t\t\tself.logger.error(\"PLUGIN do_cmd_on_s3_now_w_retries FAILED\" + \" \" + str(selfless_args))\n\n\t\t\t\ts = args[0]\n\t\t\t\tkey = args[1]\n\t\t\t\tpub = args[2]\n\t\t\t\taction = args[3]\n\t\t\t\targ = args[4]\n\t\t\t\tkargs = args[5]\n\n\n\t\t\t\t### trying to recover\n\t\t\t\tif pub[0] == 'upload':\n\t\t\t\t\ttry:\n\t\t\t\t\t\tpath = pub[1]\n\t\t\t\t\t\tcache_file = s.cache.get_cache_filename(path)\n\t\t\t\t\t\tcache_stat = os.stat(cache_file)\n\t\t\t\t\t\tetag = None\n\t\t\t\t\t\tetag_filename = s.cache.get_cache_etags_filename(path)\n\t\t\t\t\t\tif os.path.isfile(etag_filename):\n\t\t\t\t\t\t\t\twith open(etag_filename, mode='r') as etag_file:\n\t\t\t\t\t\t\t\t\t\tetag = etag_file.read()\n\t\t\t\t\t#\tprint etag_filename\n\t\t\t\t\t#\tprint etag\n\n\n\t\t\t\t\t\tjson_recover = {\n\t\t\t\t\t\t\t\"action\" : action,\n\t\t\t\t\t\t\t\"action_time\" : self.epochseconds_to_iso8601(),\n\t\t\t\t\t\t\t\"pub_action\" : pub[0],\n\t\t\t\t\t\t\t\"file\" : path,\n\t\t\t\t\t\t\t\"cache_file\" : cache_file,\n\t\t\t\t\t\t\t\"cache_stat\" : self.stat_to_dict(cache_stat),\n\t\t\t\t\t\t\t# \"cache_file_size\" : cache_stat.st_size,\n\t\t\t\t\t\t\t# \"cache_file_ctime\" : self.epochseconds_to_iso8601(cache_stat.st_ctime),\n\t\t\t\t\t\t\t# \"cache_file_mtime\" : self.epochseconds_to_iso8601(cache_stat.st_mtime),\n\t\t\t\t\t\t\t\"etag_filename\": etag_filename,\n\t\t\t\t\t\t\t\"etag\": etag,\n\t\t\t\t\t\t\t\"exception\": str(e),\n\t\t\t\t\t\t\t\"s3key\" : dict(filter(self.s3key_json_filter, key.__dict__.iteritems()))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tself.logger.error(\"RecoverYAS3FS PLUGIN UPLOAD FAILED \" + json.dumps(json_recover))\n\n\t\t\t\t\t\tself.make_recovery_copy(cache_file)\n\n\t\t\t\t\texcept Exception, e:\n\t\t\t\t\t\tself.logger.exception(e)\n\n\t\t\treturn args[2] #????\n\t\treturn wrapper", "metadata": "root.RecoverYas3fsPlugin.do_cmd_on_s3_now_w_retries", "header": "['class', 'RecoverYas3fsPlugin', '(', 'YAS3FSPlugin', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "t ", "start_line": 20, "start_column": 2, "end_line": 20, "end_column": 3 }, { "span": "arg ", "start_line": 120, "start_column": 4, "end_line": 120, "end_column": 7 }, { "span": "kargs ", "start_line": 121, "start_column": 4, "end_line": 121, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Recover", "Ya", "s3", "fs", "Plugin_", "(_", "YA", "S", "3", "FS", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "epoch", "second", "s", "\\u", "to", "\\u", "iso8601_", "(_", "self_", ",_", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "t_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "dt_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "dt_", "=_", "datetime_", "._", "datetime_", "._", "utc", "fromtimestamp_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "truncat", "es", " ", "microseconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dt_", "=_", "dt_", "._", "replace_", "(_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rt_", "=_", "dt_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Recover", "Ya", "s3", "fs", "Plugin_", "(_", "YA", "S", "3", "FS", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "cmd", "\\u", "on", "\\u", "s3", "\\u", "now", "\\u", "w", "\\u", "retries_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ",", " ", "key", ",", " ", "pub", ",", " ", "action", ",", " ", "args", ",", " ", "kar", "gs", ",", " ", "retrie", "s", " ", "=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kargs_", ")_", "\\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\t", "\t\t\t_", "self_", "._", "logger_", "._", "error_", "(_", "\"", "PLUGIN", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "less", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "self", "less", "\\u", "args_", "=_", "args_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "error_", "(_", "\"", "PLUGIN", " ", "do", "\\u", "cmd", "\\u", "on", "\\u", "s3", "\\u", "now", "\\u", "w", "\\u", "retrie", "s", " ", "FAIL", "ED", "\"_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "self", "less", "\\u", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub_", "=_", "args_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "args_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg_", "=_", "args_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kargs_", "=_", "args_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "try", "ing", " ", "to", " ", "recover_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pub_", "[_", "0_", "]_", "==_", "'", "upload", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "path_", "=_", "pub_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "file_", "=_", "s_", "._", "cache_", "._", "get", "\\u", "cache", "\\u", "filename_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "stat_", "=_", "os_", "._", "stat_", "(_", "cache", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eta", "g", "\\u", "filename_", "=_", "s_", "._", "cache_", "._", "get", "\\u", "cache", "\\u", "eta", "gs", "\\u", "filename_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "eta", "g", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "with_", "open_", "(_", "eta", "g", "\\u", "filename_", ",_", "mode_", "=_", "'", "r", "'_", ")_", "as_", "eta", "g", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t\t", "_", "etag_", "=_", "eta", "g", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "\t", "print", " ", "eta", "g", "\\u", "filename_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "print", " ", "etag_", "\\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_", "json", "\\u", "recover_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "action", "\"_", ":_", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "action", "\\u", "time", "\"_", ":_", "self_", "._", "epoch", "second", "s", "\\u", "to", "\\u", "iso8601_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pub", "\\u", "action", "\"_", ":_", "pub_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", "\"_", ":_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cache", "\\u", "file", "\"_", ":_", "cache", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cache", "\\u", "stat", "\"_", ":_", "self_", "._", "stat", "\\u", "to", "\\u", "dict_", "(_", "cache", "\\u", "stat_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "cache", "\\u", "file", "\\u", "size", "\"", " ", ":", " ", "cache", "\\u", "stat", ".", "st", "\\u", "size", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "cache", "\\u", "file", "\\u", "ctime", "\"", " ", ":", " ", "self", ".", "epoch", "second", "s", "\\u", "to", "\\u", "iso", "860", "1", "(", "cache", "\\u", "stat", ".", "st", "\\u", "ctime", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "cache", "\\u", "file", "\\u", "mti", "me", "\"", " ", ":", " ", "self", ".", "epoch", "second", "s", "\\u", "to", "\\u", "iso", "860", "1", "(", "cache", "\\u", "stat", ".", "st", "\\u", "mti", "me", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "eta", "g", "\\u", "filename", "\"_", ":_", "eta", "g", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "eta", "g", "\"_", ":_", "etag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "exception", "\"_", ":_", "str_", "(_", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "s3", "key", "\"_", ":_", "dict_", "(_", "filter_", "(_", "self_", "._", "s3", "key", "\\u", "json", "\\u", "filter_", ",_", "key_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Recover", "YA", "S", "3", "FS", " ", "PLUGIN", " ", "UPLOAD", " ", "FAIL", "ED", " ", "\"_", "+_", "json_", "._", "dumps_", "(_", "json", "\\u", "recover_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "recover", "y", "\\u", "copy_", "(_", "cache", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "self_", "._", "logger_", "._", "exception_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args_", "[_", "2_", "]_", "#", "???", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_" ]
[ 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
osrg/ryu/ryu/tests/integrated/test_vrrp_multi.py
[ { "content": "# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.\n# Copyright (C) 2013 Isaku Yamahata <yamahata at valinux co jp>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nUsage:\nPYTHONPATH=. ./bin/ryu-manager --verbose \\\n ryu.topology.switches \\\n ryu.tests.integrated.test_vrrp_multi \\\n ryu.services.protocols.vrrp.dumper\n\nryu.services.protocols.vrrp.dumper is optional.\n\n +---+ ----------------\n /--|OVS|<--veth-->| |\n Ryu +---+ | linux bridge |<--veth--> command to generate packets\n \\--|OVS|<--veth-->| |\n +---+ ----------------\n\nconfigure OVSs to connect ryu\nexample\n# brctl addbr b0\n# ip link add veth0-ovs type veth peer name veth0-br\n# ip link add veth1-ovs type veth peer name veth1-br\n# brctl addif b0 veth0-br\n# brctl addif b0 veth1-br\n# brctl show\nbridge name bridge id STP enabled interfaces\nb0 8000.6642e5822497 no veth0-br\n veth1-br\novs-system 0000.122038293b55 no\n\n# ovs-vsctl add-br s0\n# ovs-vsctl add-port s0 veth0-ovs\n# ovs-vsctl add-br s1\n# ovs-vsctl add-port s1 veth1-ovs\n# ovs-vsctl set-controller s0 tcp:127.0.0.1:6633\n# ovs-vsctl set bridge s0 protocols='[OpenFlow12]'\n# ovs-vsctl set-controller s1 tcp:127.0.0.1:6633\n# ovs-vsctl set bridge s1 protocols='[OpenFlow12]'\n# ovs-vsctl show\n20c2a046-ae7e-4453-a576-11034db24985\n Manager \"ptcp:6634\"\n Bridge \"s0\"\n Controller \"tcp:127.0.0.1:6633\"\n is_connected: true\n Port \"veth0-ovs\"\n Interface \"veth0-ovs\"\n Port \"s0\"\n Interface \"s0\"\n type: internal\n Bridge \"s1\"\n Controller \"tcp:127.0.0.1:6633\"\n is_connected: true\n Port \"veth1-ovs\"\n Interface \"veth1-ovs\"\n Port \"s1\"\n Interface \"s1\"\n type: internal\n ovs_version: \"1.9.90\"\n# ip link veth0-br set up\n# ip link veth0-ovs set up\n# ip link veth1-br set up\n# ip link veth1-ovs set up\n# ip link b0 set up\n\"\"\"\n\nfrom ryu.base import app_manager\nfrom ryu.controller import handler\nfrom ryu.lib import dpid as lib_dpid\nfrom ryu.lib import hub\nfrom ryu.lib.packet import vrrp\nfrom ryu.services.protocols.vrrp import api as vrrp_api\nfrom ryu.services.protocols.vrrp import event as vrrp_event\nfrom ryu.services.protocols.vrrp import monitor_openflow\nfrom ryu.topology import event as topo_event\nfrom ryu.topology import api as topo_api\n\nfrom . import vrrp_common\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class VRRPConfigApp(vrrp_common.VRRPCommon):\n _IFNAME0 = 0\n _IFNAME1 = 1\n\n\n", "metadata": "root.VRRPConfigApp", "header": "['module', '___EOS___']", "index": 93 }, { "content": " def __init__(self, *args, **kwargs):\n super(VRRPConfigApp, self).__init__(*args, **kwargs)\n self.start_main = False", "metadata": "root.VRRPConfigApp.__init__", "header": "['class', 'VRRPConfigApp', '(', 'vrrp_common', '.', 'VRRPCommon', ')', ':', '___EOS___']", "index": 97 }, { "content": " @handler.set_ev_cls(topo_event.EventSwitchEnter)\n def _switch_enter_handler(self, ev):\n if self.start_main:\n return\n\n switches = topo_api.get_switch(self)\n if len(switches) < 2:\n return\n\n self.start_main = True\n app_mgr = app_manager.AppManager.get_instance()\n self.logger.debug('%s', app_mgr.applications)\n self.switches = app_mgr.applications['switches']\n hub.spawn(self._main)", "metadata": "root.VRRPConfigApp._switch_enter_handler", "header": "['class', 'VRRPConfigApp', '(', 'vrrp_common', '.', 'VRRPCommon', ')', ':', '___EOS___']", "index": 101 }, { "content": " def _configure_vrrp_router(self, vrrp_version, priority,\n ip_addr, switch_index, vrid):\n switches = self.switches\n self.logger.debug('%s', switches.dps)\n dpid = sorted(switches.dps.keys())[switch_index]\n self.logger.debug('%s', lib_dpid.dpid_to_str(dpid))\n self.logger.debug('%s', switches.port_state)\n # hack: use the smallest port no to avoid picking OVS local port\n port_no = sorted(switches.port_state[dpid].keys())[0]\n self.logger.debug('%d', port_no)\n port = switches.port_state[dpid][port_no]\n self.logger.debug('%s', port)\n mac = port.hw_addr\n self.logger.debug('%s', mac)\n\n interface = vrrp_event.VRRPInterfaceOpenFlow(\n mac, ip_addr, None, dpid, port_no)\n self.logger.debug('%s', interface)\n\n config = vrrp_event.VRRPConfig(\n version=vrrp_version, vrid=vrid, priority=priority,\n ip_addresses=[ip_addr])\n self.logger.debug('%s', config)\n\n rep = vrrp_api.vrrp_config(self, interface, config)\n self.logger.debug('%s', rep)\n return rep", "metadata": "root.VRRPConfigApp._configure_vrrp_router", "header": "['class', 'VRRPConfigApp', '(', 'vrrp_common', '.', 'VRRPCommon', ')', ':', '___EOS___']", "index": 116 } ]
[ { "span": "from ryu.lib.packet import vrrp", "start_line": 83, "start_column": 0, "end_line": 83, "end_column": 31 }, { "span": "from ryu.services.protocols.vrrp import monitor_openflow", "start_line": 86, "start_column": 0, "end_line": 86, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Ni", "ppo", "n", " ", "Tele", "graph", " ", "and", " ", "Telephone", " ", "Cor", "porat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Is", "ak", "u", " ", "Ya", "mah", "ata", " ", "<", "ya", "mah", "ata", " ", "at", " ", "vali", "nu", "x", " ", "co", " ", "jp", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", "PYTHON", "PATH", "=.", " ", "./", "bin", "/", "ryu", "-", "manage", "r", " ", "--", "verbo", "se", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "ryu", ".", "topo", "log", "y", ".", "switche", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "ryu", ".", "tests", ".", "integrated", ".", "test\\u", "vr", "rp", "\\u", "multi", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "ryu", ".", "service", "s", ".", "protoc", "ols", ".", "vr", "rp", ".", "dumper", "\\", "10", ";", "\\", "10", ";", "ryu", ".", "service", "s", ".", "protoc", "ols", ".", "vr", "rp", ".", "dumper", " ", "is", " ", "option", "al", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "+---", "+", " ", " ", "--------------", "--", "\\", "10", ";", " ", " ", "/--", "|", "OVS", "|<", "--", "vet", "h", "-->", "|", " ", " ", " ", " ", " ", " ", "|", "\\", "10", ";", " ", " ", " ", "Ry", "u", " ", " ", " ", "+---", "+", " ", " ", "|", " ", "linux", " ", "bridge", " ", "|<", "--", "vet", "h", "-->", " ", "command", " ", "to", " ", "generat", "e", " ", "packet", "s", "\\", "10", ";", " ", " ", "\\\\", "--", "|", "OVS", "|<", "--", "vet", "h", "-->", "|", " ", " ", " ", " ", " ", " ", "|", "\\", "10", ";", " ", " ", " ", " ", " ", "+---", "+", " ", " ", "--------------", "--", "\\", "10", ";", "\\", "10", ";", "configur", "e", " ", "OVS", "s", " ", "to", " ", "connect", " ", "ryu", "\\", "10", ";", "example", "\\", "10", ";", "#", " ", "br", "ctl", " ", "add", "br", " ", "b0", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "add", " ", "vet", "h", "0", "-", "ovs", " ", "type", " ", "vet", "h", " ", "peer", " ", "name", " ", "vet", "h", "0", "-", "br", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "add", " ", "vet", "h1", "-", "ovs", " ", "type", " ", "vet", "h", " ", "peer", " ", "name", " ", "vet", "h1", "-", "br", "\\", "10", ";", "#", " ", "br", "ctl", " ", "add", "if", " ", "b0", " ", "vet", "h", "0", "-", "br", "\\", "10", ";", "#", " ", "br", "ctl", " ", "add", "if", " ", "b0", " ", "vet", "h1", "-", "br", "\\", "10", ";", "#", " ", "br", "ctl", " ", "show", "\\", "10", ";", "bridge", " ", "name", " ", "bridge", " ", "id", " ", " ", " ", "ST", "P", " ", "enable", "d", " ", "interface", "s", "\\", "10", ";", "b0", " ", " ", " ", " ", " ", " ", "800", "0.66", "4", "2e", "582", "249", "7", " ", " ", " ", "no", " ", " ", " ", " ", " ", " ", "vet", "h", "0", "-", "br", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", " ", "vet", "h1", "-", "br", "\\", "10", ";", "ovs", "-", "system", " ", " ", " ", " ", " ", " ", "0000", ".12", "203", "829", "3b", "5", "5", " ", " ", " ", "no", "\\", "10", ";", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "add", "-", "br", " ", "s0", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "add", "-", "port", " ", "s0", " ", "vet", "h", "0", "-", "ovs", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "add", "-", "br", " ", "s1", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "add", "-", "port", " ", "s1", " ", "vet", "h1", "-", "ovs", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "set", "-", "controlle", "r", " ", "s0", " ", "tcp", ":", "127", ".0", ".0", ".1", ":", "663", "3", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "set", " ", "bridge", " ", "s0", " ", "protoc", "ols", "='", "[", "Open", "Flow", "1", "2", "]'", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "set", "-", "controlle", "r", " ", "s1", " ", "tcp", ":", "127", ".0", ".0", ".1", ":", "663", "3", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "set", " ", "bridge", " ", "s1", " ", "protoc", "ols", "='", "[", "Open", "Flow", "1", "2", "]'", "\\", "10", ";", "#", " ", "ovs", "-", "vsc", "tl", " ", "show", "\\", "10", ";", "20", "c2", "a0", "4", "6", "-", "ae", "7e", "-", "445", "3", "-", "a5", "7", "6", "-1", "103", "4d", "b2", "498", "5", "\\", "10", ";", " ", " ", " ", " ", "Manager", " ", "\"", "pt", "cp", ":", "663", "4", "\"", "\\", "10", ";", " ", " ", " ", " ", "Bridge", " ", "\"", "s0", "\"", "\\", "10", ";", " ", " ", " ", " ", "Controlle", "r", " ", "\"", "tcp", ":", "127", ".0", ".0", ".1", ":", "663", "3", "\"", "\\", "10", ";", " ", " ", " ", " ", "is", "\\u", "connect", "ed", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "Port", " ", "\"", "vet", "h", "0", "-", "ovs", "\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "\"", "vet", "h", "0", "-", "ovs", "\"", "\\", "10", ";", " ", " ", " ", " ", "Port", " ", "\"", "s0", "\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "\"", "s0", "\"", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "internal", "\\", "10", ";", " ", " ", " ", " ", "Bridge", " ", "\"", "s1", "\"", "\\", "10", ";", " ", " ", " ", " ", "Controlle", "r", " ", "\"", "tcp", ":", "127", ".0", ".0", ".1", ":", "663", "3", "\"", "\\", "10", ";", " ", " ", " ", " ", "is", "\\u", "connect", "ed", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "Port", " ", "\"", "vet", "h1", "-", "ovs", "\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "\"", "vet", "h1", "-", "ovs", "\"", "\\", "10", ";", " ", " ", " ", " ", "Port", " ", "\"", "s1", "\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "\"", "s1", "\"", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "internal", "\\", "10", ";", " ", " ", " ", " ", "ovs", "\\u", "version", ":", " ", "\"", "1.9", ".90", "\"", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "vet", "h", "0", "-", "br", " ", "set", " ", "up", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "vet", "h", "0", "-", "ovs", " ", "set", " ", "up", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "vet", "h1", "-", "br", " ", "set", " ", "up", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "vet", "h1", "-", "ovs", " ", "set", " ", "up", "\\", "10", ";", "#", " ", "ip", " ", "link", " ", "b0", " ", "set", " ", "up", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ryu", "_", "._", "base_", "import_", "app", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "controller_", "import_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "lib_", "import_", "dpid_", "as_", "lib", "\\u", "dpid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "lib_", "import_", "hub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "lib_", "._", "packet_", "import_", "vr", "rp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "services_", "._", "protocols_", "._", "vr", "rp_", "import_", "api_", "as_", "vr", "rp", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "services_", "._", "protocols_", "._", "vr", "rp_", "import_", "event_", "as_", "vr", "rp", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "services_", "._", "protocols_", "._", "vr", "rp_", "import_", "monit", "or", "\\u", "openf", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "topology_", "import_", "event_", "as_", "topo", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "topology_", "import_", "api_", "as_", "topo", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "vr", "rp", "\\u", "common_", "\\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_", "VR", "RP", "Config", "App_", "(_", "vr", "rp", "\\u", "common_", "._", "VR", "RP", "Common_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "IF", "NAME", "0_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IF", "NAME", "1_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "VR", "RP", "Config", "App_", "(_", "vr", "rp", "\\u", "common_", "._", "VR", "RP", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "VR", "RP", "Config", "App_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "main_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VR", "RP", "Config", "App_", "(_", "vr", "rp", "\\u", "common_", "._", "VR", "RP", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handler_", "._", "set\\u", "ev", "\\u", "cls_", "(_", "topo", "\\u", "event_", "._", "Event", "Switch", "Enter", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "switch", "\\u", "enter", "\\u", "handler_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "start", "\\u", "main_", ":_", "\\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_", "switches_", "=_", "topo", "\\u", "api_", "._", "get", "\\u", "switch_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "switches_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "start", "\\u", "main_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "mgr_", "=_", "app", "\\u", "manager_", "._", "App", "Manager_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "app", "\\u", "mgr_", "._", "applications_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "switches_", "=_", "app", "\\u", "mgr_", "._", "applications_", "[_", "'", "switche", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hub_", "._", "spawn_", "(_", "self_", "._", "\\u", "main_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VR", "RP", "Config", "App_", "(_", "vr", "rp", "\\u", "common_", "._", "VR", "RP", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "configur", "e\\u", "vr", "rp", "\\u", "router_", "(_", "self_", ",_", "vr", "rp", "\\u", "version_", ",_", "priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "addr_", ",_", "switch", "\\u", "index_", ",_", "vr", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "switches_", "=_", "self_", "._", "switches_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "switches_", "._", "dps", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dpid_", "=_", "sorted_", "(_", "switches_", "._", "dps", "_", "._", "keys_", "(_", ")_", ")_", "[_", "switch", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "lib", "\\u", "dpid_", "._", "dpid", "\\u", "to", "\\u", "str_", "(_", "dpid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "switches_", "._", "port", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hack", ":", " ", "use", " ", "the", " ", "smallest", " ", "port", " ", "no", " ", "to", " ", "avoid", " ", "pick", "ing", " ", "OVS", " ", "local", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "no_", "=_", "sorted_", "(_", "switches_", "._", "port", "\\u", "state_", "[_", "dpid_", "]_", "._", "keys_", "(_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "d", "'_", ",_", "port", "\\u", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "switches_", "._", "port", "\\u", "state_", "[_", "dpid_", "]_", "[_", "port", "\\u", "no_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mac_", "=_", "port_", "._", "hw", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "mac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "interface_", "=_", "vr", "rp", "\\u", "event_", "._", "VR", "RP", "Interface", "Open", "Flow_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mac_", ",_", "ip", "\\u", "addr_", ",_", "None_", ",_", "dpid_", ",_", "port", "\\u", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "interface_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "vr", "rp", "\\u", "event_", "._", "VR", "RP", "Config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "vr", "rp", "\\u", "version_", ",_", "vr", "id_", "=_", "vr", "id_", ",_", "priority_", "=_", "priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "addresses_", "=_", "[_", "ip", "\\u", "addr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rep_", "=_", "vr", "rp", "\\u", "api_", "._", "vr", "rp", "\\u", "config_", "(_", "self_", ",_", "interface_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'%", "s", "'_", ",_", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rep_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jansel/opentuner/opentuner/__init__.py
[ { "content": "\nimport measurement\nimport resultsdb\nimport search\nimport tuningrunmain\nfrom opentuner.measurement import MeasurementInterface\nfrom opentuner.resultsdb.models import Configuration\nfrom opentuner.resultsdb.models import DesiredResult\nfrom opentuner.resultsdb.models import Result\nfrom opentuner.resultsdb.models import TuningRun\nfrom opentuner.search.manipulator import ConfigurationManipulator\nfrom opentuner.search.manipulator import EnumParameter\nfrom opentuner.search.manipulator import FloatParameter\nfrom opentuner.search.manipulator import IntegerParameter\nfrom opentuner.search.manipulator import LogFloatParameter\nfrom opentuner.search.manipulator import LogIntegerParameter\nfrom opentuner.search.manipulator import PermutationParameter\nfrom opentuner.search.manipulator import ScheduleParameter\nfrom opentuner.search.manipulator import SwitchParameter\nfrom opentuner.tuningrunmain import init_logging\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def argparsers():\n \"\"\"\n return a list of ArguementParser to be used as parents to the user's\n \"\"\"\n return [\n measurement.driver.argparser,\n search.driver.argparser,\n search.plugin.argparser,\n search.technique.argparser,\n #stats.argparser,\n tuningrunmain.argparser,\n ]", "metadata": "root.argparsers", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def default_argparser():\n import argparse\n return argparse.ArgumentParser(parents=argparsers())", "metadata": "root.default_argparser", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "import resultsdb", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 16 }, { "span": "from opentuner.measurement import MeasurementInterface", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 54 }, { "span": "from opentuner.resultsdb.models import Configuration", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 52 }, { "span": "from opentuner.resultsdb.models import DesiredResult", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 52 }, { "span": "from opentuner.resultsdb.models import Result", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 45 }, { "span": "from opentuner.resultsdb.models import TuningRun", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 48 }, { "span": "from opentuner.search.manipulator import ConfigurationManipulator", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 65 }, { "span": "from opentuner.search.manipulator import EnumParameter", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 54 }, { "span": "from opentuner.search.manipulator import FloatParameter", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 55 }, { "span": "from opentuner.search.manipulator import IntegerParameter", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 57 }, { "span": "from opentuner.search.manipulator import LogFloatParameter", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 58 }, { "span": "from opentuner.search.manipulator import LogIntegerParameter", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 60 }, { "span": "from opentuner.search.manipulator import PermutationParameter", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 61 }, { "span": "from opentuner.search.manipulator import ScheduleParameter", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 58 }, { "span": "from opentuner.search.manipulator import SwitchParameter", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 56 }, { "span": "from opentuner.tuningrunmain import init_logging", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "measurement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "results", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tuning", "run", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "measurement_", "import_", "Measurement", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "results", "db_", "._", "models_", "import_", "Configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "results", "db_", "._", "models_", "import_", "Des", "ired", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "results", "db_", "._", "models_", "import_", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "results", "db_", "._", "models_", "import_", "Tuni", "ng", "Run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Configura", "tion", "Manipulat", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Enum", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Float", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Integer", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Log", "Float", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Log", "Integer", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Permut", "ation", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Schedule", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "search_", "._", "manip", "ulator", "_", "import_", "Switch", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opent", "une", "r_", "._", "tuning", "run", "main_", "import_", "init", "\\u", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "argp", "arser", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "return", " ", "a", " ", "list", " ", "of", " ", "Arg", "ue", "ment", "Parser", " ", "to", " ", "be", " ", "used", " ", "as", " ", "parents", " ", "to", " ", "the", " ", "user", "'", "s", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "measurement_", "._", "driver_", "._", "argparser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search_", "._", "driver_", "._", "argparser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search_", "._", "plugin_", "._", "argparser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search_", "._", "technique", "_", "._", "argparser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stats", ".", "argp", "arser", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tuning", "run", "main_", "._", "argparser_", ",_", "\\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_", "default", "\\u", "argparser_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "parents_", "=_", "argp", "arser", "s_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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
OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/datatypes/domain/test/test_plot3d.py
[ { "content": "\"\"\"\nTest Plot3D operations on :class:`DomainObj` objects.\n\"\"\"\n\nimport logging\nimport os.path\nimport tempfile\nimport shutil\nimport unittest\n\nfrom openmdao.lib.datatypes.domain import read_plot3d_q, write_plot3d_q, \\\n read_plot3d_f, write_plot3d_f, \\\n read_plot3d_shape, write_plot3d_grid\n\nfrom openmdao.lib.datatypes.domain.test.wedge import create_wedge_2d, \\\n create_wedge_3d\n\nfrom openmdao.util.testutil import assert_raises\n\n\n\n\nif __name__ == '__main__':\n import nose\n import sys\n sys.argv.append('--cover-package=openmdao.lib.datatypes.domain')\n sys.argv.append('--cover-erase')\n nose.runmodule()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCase(unittest.TestCase):\n \"\"\" Test Plot3D operations on :class:`DomainObj` objects. \"\"\"\n\n\n\n\n\n\n", "metadata": "root.TestCase", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def setUp(self):\n self.startdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp(prefix='test_plot3d-')\n os.chdir(self.tempdir)", "metadata": "root.TestCase.setUp", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def tearDown(self):\n \"\"\" Clean up generated files. \"\"\"\n os.chdir(self.startdir)\n if not os.environ.get('OPENMDAO_KEEPDIRS', False):\n try:\n shutil.rmtree(self.tempdir)\n except OSError:\n pass", "metadata": "root.TestCase.tearDown", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 }, { "content": " def test_q_3d(self):\n logging.debug('')\n logging.debug('test_q_3d')\n\n logger = logging.getLogger()\n wedge = create_wedge_3d((30, 20, 10), 5., 0.5, 2., 30.)\n\n # Big-endian binary.\n write_plot3d_q(wedge, 'be-binary.xyz', 'be-binary.q', logger=logger,\n big_endian=True, unformatted=False)\n domain = read_plot3d_q('be-binary.xyz', 'be-binary.q', logger=logger,\n multiblock=False, big_endian=True,\n unformatted=False)\n self.assertFalse(domain.is_equivalent(wedge, logger=logger))\n domain.rename_zone('xyzzy', domain.zone_1)\n self.assertTrue(domain.is_equivalent(wedge, logger=logger))\n\n # Little-endian unformatted.\n write_plot3d_q(domain, 'unformatted.xyz', 'unformatted.q',\n logger=logger)\n domain = read_plot3d_q('unformatted.xyz', 'unformatted.q',\n logger=logger, multiblock=False)\n self.assertFalse(domain.is_equivalent(wedge, logger=logger))\n domain.rename_zone('xyzzy', domain.zone_1)\n self.assertTrue(domain.is_equivalent(wedge, logger=logger))\n\n # Multiblock.\n wedge2 = create_wedge_3d((29, 19, 9), 5., 2.5, 4., 30.)\n domain.add_domain(wedge2)\n write_plot3d_q(domain, 'unformatted.xyz', 'unformatted.q',\n logger=logger)\n domain = read_plot3d_q('unformatted.xyz', 'unformatted.q',\n logger=logger)\n\n shape = read_plot3d_shape('unformatted.xyz', logger=logger)\n self.assertEqual(shape, [(30, 20, 10), (29, 19, 9)])\n\n # Errors.\n try:\n read_plot3d_q('unformatted.xyz', 'unformatted.q', blanking=True,\n logger=logger, multiblock=False)\n except NotImplementedError as exc:\n self.assertEqual(str(exc), 'blanking not supported yet')\n else:\n self.fail('Expected NotImplementedError')\n\n try:\n read_plot3d_q('unformatted.xyz', 'unformatted.q', planes=True,\n logger=logger, multiblock=False)\n except NotImplementedError as exc:\n self.assertEqual(str(exc), 'planar format not supported yet')\n else:\n self.fail('Expected NotImplementedError')\n\n assert_raises(self, \"write_plot3d_q(logger, 'u.xyz', 'u.q')\",\n globals(), locals(), TypeError,\n \"'domain' argument must be a DomainObj or Zone\")\n\n assert_raises(self, \"write_plot3d_f(logger, 'u.xyz', 'u.f')\",\n globals(), locals(), TypeError,\n \"'domain' argument must be a DomainObj or Zone\")\n\n assert_raises(self, \"write_plot3d_grid(logger, 'u.xyz')\",\n globals(), locals(), TypeError,\n \"'domain' argument must be a DomainObj or Zone\")\n\n wedge = create_wedge_3d((30, 20, 10), 5., 0.5, 2., 30.)\n delattr(wedge.xyzzy.flow_solution, 'mach')\n assert_raises(self, \"write_plot3d_q(wedge, 'u.xyz', 'u.q')\",\n globals(), locals(), AttributeError,\n \"zone xyzzy flow_solution is missing ['mach']\")\n\n assert_raises(self, \"write_plot3d_f(wedge, 'u.xyz', 'u.f', ['froboz'])\",\n globals(), locals(), AttributeError,\n \"zone xyzzy flow_solution is missing ['froboz']\")", "metadata": "root.TestCase.test_q_3d", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_q_2d(self):\n logging.debug('')\n logging.debug('test_q_2d')\n\n logger = logging.getLogger()\n wedge = create_wedge_2d((20, 10), 0.5, 2., 30.)\n\n # Big-endian binary.\n write_plot3d_q(wedge, 'be-binary.xyz', 'be-binary.q', logger=logger,\n big_endian=True, unformatted=False)\n domain = read_plot3d_q('be-binary.xyz', 'be-binary.q', logger=logger,\n dim=2, multiblock=False, big_endian=True,\n unformatted=False)\n self.assertFalse(domain.is_equivalent(wedge, logger=logger))\n domain.rename_zone('xyzzy', domain.zone_1)\n self.assertTrue(domain.is_equivalent(wedge, logger=logger))\n\n # Little-endian unformatted.\n write_plot3d_q(domain, 'unformatted.xyz', 'unformatted.q',\n logger=logger)\n domain = read_plot3d_q('unformatted.xyz', 'unformatted.q',\n logger=logger, dim=2, multiblock=False)\n self.assertFalse(domain.is_equivalent(wedge, logger=logger))\n domain.rename_zone('xyzzy', domain.zone_1)\n self.assertTrue(domain.is_equivalent(wedge, logger=logger))", "metadata": "root.TestCase.test_q_2d", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 113 }, { "content": " def test_f_3d(self):\n logging.debug('')\n logging.debug('test_f_3d')\n\n logger = logging.getLogger()\n wedge = create_wedge_3d((30, 20, 10), 5., 0.5, 2., 30.)\n wedge_flow = wedge.xyzzy.flow_solution\n varnames = ('density', 'momentum', 'energy_stagnation_density')\n\n # Big-endian binary.\n write_plot3d_f(wedge, 'be-binary.xyz', 'be-binary.f', varnames,\n logger=logger, big_endian=True, unformatted=False)\n domain = read_plot3d_f('be-binary.xyz', 'be-binary.f', logger=logger,\n multiblock=False, big_endian=True,\n unformatted=False)\n test_flow = domain.zone_1.flow_solution\n self.assertTrue((test_flow.f_1 == wedge_flow.density).all())\n self.assertTrue((test_flow.f_2 == wedge_flow.momentum.x).all())\n self.assertTrue((test_flow.f_3 == wedge_flow.momentum.y).all())\n self.assertTrue((test_flow.f_4 == wedge_flow.momentum.z).all())\n self.assertTrue((test_flow.f_5 == wedge_flow.energy_stagnation_density).all())\n\n # Little-endian unformatted.\n write_plot3d_f(domain, 'unformatted.xyz', 'unformatted.f',\n logger=logger)\n domain = read_plot3d_f('unformatted.xyz', 'unformatted.f',\n logger=logger, multiblock=False)\n test_flow = domain.zone_1.flow_solution\n self.assertTrue((test_flow.f_1 == wedge_flow.density).all())\n self.assertTrue((test_flow.f_2 == wedge_flow.momentum.x).all())\n self.assertTrue((test_flow.f_3 == wedge_flow.momentum.y).all())\n self.assertTrue((test_flow.f_4 == wedge_flow.momentum.z).all())\n self.assertTrue((test_flow.f_5 == wedge_flow.energy_stagnation_density).all())", "metadata": "root.TestCase.test_f_3d", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": " def test_f_2d(self):\n logging.debug('')\n logging.debug('test_f_2d')\n\n logger = logging.getLogger()\n wedge = create_wedge_2d((20, 10), 0.5, 2., 30.)\n wedge_flow = wedge.xyzzy.flow_solution\n varnames = ('density', 'momentum', 'energy_stagnation_density')\n\n # Big-endian binary.\n write_plot3d_f(wedge, 'be-binary.xyz', 'be-binary.f', varnames,\n logger=logger, big_endian=True, unformatted=False)\n domain = read_plot3d_f('be-binary.xyz', 'be-binary.f', logger=logger,\n dim=2, multiblock=False, big_endian=True,\n unformatted=False)\n test_flow = domain.zone_1.flow_solution\n self.assertTrue((test_flow.f_1 == wedge_flow.density).all())\n self.assertTrue((test_flow.f_2 == wedge_flow.momentum.x).all())\n self.assertTrue((test_flow.f_3 == wedge_flow.momentum.y).all())\n self.assertTrue((test_flow.f_4 == wedge_flow.energy_stagnation_density).all())\n\n # Little-endian unformatted.\n write_plot3d_f(domain, 'unformatted.xyz', 'unformatted.f',\n logger=logger)\n varnames = ('density', 'momentum_x')\n domain = read_plot3d_f('unformatted.xyz', 'unformatted.f', varnames,\n logger=logger, dim=2, multiblock=False)\n test_flow = domain.zone_1.flow_solution\n self.assertTrue((test_flow.density == wedge_flow.density).all())\n self.assertTrue((test_flow.momentum_x == wedge_flow.momentum.x).all())\n self.assertTrue((test_flow.f_3 == wedge_flow.momentum.y).all())\n self.assertTrue((test_flow.f_4 == wedge_flow.energy_stagnation_density).all())", "metadata": "root.TestCase.test_f_2d", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 174 } ]
[ { "span": "from openmdao.lib.datatypes.domain import read_plot3d_q, write_plot3d_q, \\\n read_plot3d_f, write_plot3d_f, \\\n read_plot3d_shape, write_plot3d_grid", "start_line": 10, "start_column": 0, "end_line": 12, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", " ", "Plot", "3", "D", " ", "operati", "ons", " ", "on", " ", ":", "class", ":`", "Doma", "in", "Obj", "`", " ", "object", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "datatypes_", "._", "domain_", "import_", "read", "\\u", "plot", "3d", "\\u", "q_", ",_", "write", "\\u", "plot", "3d", "\\u", "q_", ",_", "read", "\\u", "plot", "3d", "\\u", "f_", ",_", "write", "\\u", "plot", "3d", "\\u", "f_", ",_", "read", "\\u", "plot", "3d", "\\u", "shape_", ",_", "write", "\\u", "plot", "3d", "\\u", "grid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "datatypes_", "._", "domain_", "._", "test_", "._", "wed", "ge_", "import_", "create", "\\u", "wed", "ge", "\\u", "2d_", ",_", "create", "\\u", "wed", "ge", "\\u", "3d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "testu", "til_", "import_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "nose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "._", "append_", "(_", "'--", "cover", "-", "package", "=", "openm", "dao", ".", "lib", ".", "datatype", "s", ".", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "._", "append_", "(_", "'--", "cover", "-", "erase", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nose_", "._", "run", "module_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "Plot", "3", "D", " ", "operati", "ons", " ", "on", " ", ":", "class", ":`", "Doma", "in", "Obj", "`", " ", "object", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tempdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", "=_", "'", "test\\u", "plot", "3d", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Clean", " ", "up", " ", "generat", "ed", " ", "files", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OPEN", "MD", "AO", "\\u", "KEEP", "DIR", "S", "'_", ",_", "False_", ")_", ":_", "\\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_", "._", "rmtree_", "(_", "self_", "._", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "q", "\\u", "3d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "test\\u", "q", "\\u", "3d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge_", "=_", "create", "\\u", "wed", "ge", "\\u", "3d_", "(_", "(_", "30_", ",_", "20_", ",_", "10_", ")_", ",_", "5._", ",_", "0.5_", ",_", "2._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Big", "-", "endian", " ", "binar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "q_", "(_", "wed", "ge_", ",_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "q", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "big", "\\u", "endian_", "=_", "True_", ",_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "q", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi", "block_", "=_", "False_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "._", "rename", "\\u", "zone_", "(_", "'", "xyz", "zy", "'_", ",_", "domain_", "._", "zone", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Litt", "le", "-", "endian", " ", "unfo", "rmat", "ted", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "q_", "(_", "domain_", ",_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "._", "rename", "\\u", "zone_", "(_", "'", "xyz", "zy", "'_", ",_", "domain_", "._", "zone", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multi", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "wed", "ge", "2_", "=_", "create", "\\u", "wed", "ge", "\\u", "3d_", "(_", "(_", "29_", ",_", "19_", ",_", "9_", ")_", ",_", "5._", ",_", "2.5_", ",_", "4._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "._", "add", "\\u", "domain_", "(_", "wed", "ge", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "q_", "(_", "domain_", ",_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "read", "\\u", "plot", "3d", "\\u", "shape_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "shape_", ",_", "[_", "(_", "30_", ",_", "20_", ",_", "10_", ")_", ",_", "(_", "29_", ",_", "19_", ",_", "9_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "blank", "ing_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "exc_", ")_", ",_", "'", "blank", "ing", " ", "not", " ", "support", "ed", " ", "ye", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Not", "Impl", "ement", "ed", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "planes_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "exc_", ")_", ",_", "'", "plan", "ar", " ", "format", " ", "not", " ", "support", "ed", " ", "ye", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Not", "Impl", "ement", "ed", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "self_", ",_", "\"", "write", "\\u", "plot", "3d", "\\u", "q", "(", "logg", "er", ",", " ", "'", "u", ".", "xyz", "',", " ", "'", "u", ".", "q", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "Type", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "domain", "'", " ", "argu", "ment", " ", "must", " ", "be", " ", "a", " ", "Doma", "in", "Obj", " ", "or", " ", "Zon", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "self_", ",_", "\"", "write", "\\u", "plot", "3d", "\\u", "f", "(", "logg", "er", ",", " ", "'", "u", ".", "xyz", "',", " ", "'", "u", ".", "f", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "Type", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "domain", "'", " ", "argu", "ment", " ", "must", " ", "be", " ", "a", " ", "Doma", "in", "Obj", " ", "or", " ", "Zon", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "self_", ",_", "\"", "write", "\\u", "plot", "3d", "\\u", "grid", "(", "logg", "er", ",", " ", "'", "u", ".", "xyz", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "Type", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "domain", "'", " ", "argu", "ment", " ", "must", " ", "be", " ", "a", " ", "Doma", "in", "Obj", " ", "or", " ", "Zon", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wed", "ge_", "=_", "create", "\\u", "wed", "ge", "\\u", "3d_", "(_", "(_", "30_", ",_", "20_", ",_", "10_", ")_", ",_", "5._", ",_", "0.5_", ",_", "2._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delattr", "_", "(_", "wed", "ge_", "._", "xyz", "zy", "_", "._", "flow", "\\u", "solution_", ",_", "'", "mach", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "self_", ",_", "\"", "write", "\\u", "plot", "3d", "\\u", "q", "(", "wed", "ge", ",", " ", "'", "u", ".", "xyz", "',", " ", "'", "u", ".", "q", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "Attribute", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "zone", " ", "xyz", "zy", " ", "flow", "\\u", "solut", "ion", " ", "is", " ", "missi", "ng", " ", "['", "mach", "']\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "self_", ",_", "\"", "write", "\\u", "plot", "3d", "\\u", "f", "(", "wed", "ge", ",", " ", "'", "u", ".", "xyz", "',", " ", "'", "u", ".", "f", "',", " ", "['", "fro", "bo", "z", "'])", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "Attribute", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "zone", " ", "xyz", "zy", " ", "flow", "\\u", "solut", "ion", " ", "is", " ", "missi", "ng", " ", "['", "fro", "bo", "z", "']\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "q", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "test\\u", "q", "\\u", "2d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge_", "=_", "create", "\\u", "wed", "ge", "\\u", "2d_", "(_", "(_", "20_", ",_", "10_", ")_", ",_", "0.5_", ",_", "2._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Big", "-", "endian", " ", "binar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "q_", "(_", "wed", "ge_", ",_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "q", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "big", "\\u", "endian_", "=_", "True_", ",_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "q", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dim_", "=_", "2_", ",_", "multi", "block_", "=_", "False_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "._", "rename", "\\u", "zone_", "(_", "'", "xyz", "zy", "'_", ",_", "domain_", "._", "zone", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Litt", "le", "-", "endian", " ", "unfo", "rmat", "ted", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "q_", "(_", "domain_", ",_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "q_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "dim_", "=_", "2_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "._", "rename", "\\u", "zone_", "(_", "'", "xyz", "zy", "'_", ",_", "domain_", "._", "zone", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "domain_", "._", "is", "\\u", "equivalent", "_", "(_", "wed", "ge_", ",_", "logger_", "=_", "logger_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "f", "\\u", "3d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "test\\u", "f", "\\u", "3d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge_", "=_", "create", "\\u", "wed", "ge", "\\u", "3d_", "(_", "(_", "30_", ",_", "20_", ",_", "10_", ")_", ",_", "5._", ",_", "0.5_", ",_", "2._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge", "\\u", "flow_", "=_", "wed", "ge_", "._", "xyz", "zy", "_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varnames", "_", "=_", "(_", "'", "densit", "y", "'_", ",_", "'", "moment", "um", "'_", ",_", "'", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "densit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Big", "-", "endian", " ", "binar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "f_", "(_", "wed", "ge_", ",_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "f", "'_", ",_", "varnames", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "f_", "(_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "f", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi", "block_", "=_", "False_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "flow_", "=_", "domain_", "._", "zone", "\\u", "1_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "1_", "==_", "wed", "ge", "\\u", "flow_", "._", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "2_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "x_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "3_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "y_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "4_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "z_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "5_", "==_", "wed", "ge", "\\u", "flow_", "._", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Litt", "le", "-", "endian", " ", "unfo", "rmat", "ted", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "f_", "(_", "domain_", ",_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "f_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "flow_", "=_", "domain_", "._", "zone", "\\u", "1_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "1_", "==_", "wed", "ge", "\\u", "flow_", "._", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "2_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "x_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "3_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "y_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "4_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "z_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "5_", "==_", "wed", "ge", "\\u", "flow_", "._", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "f", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "test\\u", "f", "\\u", "2d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge_", "=_", "create", "\\u", "wed", "ge", "\\u", "2d_", "(_", "(_", "20_", ",_", "10_", ")_", ",_", "0.5_", ",_", "2._", ",_", "30.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wed", "ge", "\\u", "flow_", "=_", "wed", "ge_", "._", "xyz", "zy", "_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varnames", "_", "=_", "(_", "'", "densit", "y", "'_", ",_", "'", "moment", "um", "'_", ",_", "'", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "densit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Big", "-", "endian", " ", "binar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "f_", "(_", "wed", "ge_", ",_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "f", "'_", ",_", "varnames", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "f_", "(_", "'", "be", "-", "binar", "y", ".", "xyz", "'_", ",_", "'", "be", "-", "binar", "y", ".", "f", "'_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dim_", "=_", "2_", ",_", "multi", "block_", "=_", "False_", ",_", "big", "\\u", "endian_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unfo", "rmat", "ted_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "flow_", "=_", "domain_", "._", "zone", "\\u", "1_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "1_", "==_", "wed", "ge", "\\u", "flow_", "._", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "2_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "x_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "3_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "y_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "4_", "==_", "wed", "ge", "\\u", "flow_", "._", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Litt", "le", "-", "endian", " ", "unfo", "rmat", "ted", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "plot", "3d", "\\u", "f_", "(_", "domain_", ",_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varnames", "_", "=_", "(_", "'", "densit", "y", "'_", ",_", "'", "moment", "um", "\\u", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "read", "\\u", "plot", "3d", "\\u", "f_", "(_", "'", "unfo", "rmat", "ted", ".", "xyz", "'_", ",_", "'", "unfo", "rmat", "ted", ".", "f", "'_", ",_", "varnames", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "dim_", "=_", "2_", ",_", "multi", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "flow_", "=_", "domain_", "._", "zone", "\\u", "1_", "._", "flow", "\\u", "solution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "density_", "==_", "wed", "ge", "\\u", "flow_", "._", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "moment", "um", "\\u", "x_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "x_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "3_", "==_", "wed", "ge", "\\u", "flow_", "._", "momentum_", "._", "y_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "test\\u", "flow_", "._", "f", "\\u", "4_", "==_", "wed", "ge", "\\u", "flow_", "._", "energ", "y", "\\u", "stag", "nati", "on", "\\u", "density_", ")_", "._", "all_", "(_", ")_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CGATOxford/cgat/obsolete/pipeline_prdm9.py
[ { "content": "################################################################################\n#\n# MRC FGU Computational Genomics Group\n#\n# $Id: pipeline_snps.py 2870 2010-03-03 10:20:29Z andreas $\n#\n# Copyright (C) 2009 Andreas Heger\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n#################################################################################\n\"\"\"\npipeline_prdm9.py\n=================\n\n:Author: Andreas Heger\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nPurpose\n-------\n\nAnalysis of prdm9 in 17 mouse strains.\n\nUsage\n-----\n\nType::\n\n python <script_name>.py --help\n\nfor command line help.\n\nCode\n----\n\n\"\"\"\nfrom ruffus import *\nimport sys\nimport glob\nimport gzip\nimport os\nimport itertools\nimport CGAT.CSV as CSV\nimport re\nimport math\nimport types\nimport optparse\nimport shutil\nimport sqlite3\nimport CGAT.GFF as GFF\nimport CGAT.GTF as GTF\nimport CGAT.Experiment as E\nimport CGAT.Pipeline as P\nimport CGAT.IOTools as IOTools\nimport CGAT.Genomics as Genomics\nimport CGAT.Database as Database\nimport CGAT.FastaIterator as FastaIterator\nimport PipelineGeneset as PGeneset\nimport PipelineGO as PGO\nimport scipy.stats\nimport CGAT.Stats as Stats\nimport alignlib\nimport CGAT.Mali as Mali\n\nPARAMS = P.getParameters()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__== \"__main__\":\n sys.exit( P.main(sys.argv) )\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@files( ((\"../data/znf.data\", \"profile.fasta\" ) , ))\ndef createProfile( infile, outfile ):\n '''convert mali to profile\n '''\n outfile = open(outfile, \"w\")\n for line in open(infile):\n if line.startswith(\"#\"): continue\n data = re.split(\"\\s+\", line[:-1],1)\n print data\n pid, sequence = data\n outfile.write(\">%s\\n%s\\n\" % (pid, sequence ))\n outfile.close()", "metadata": "root.createProfile", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def getParts( src ):\n '''split a wrap-around alignment'''\n\n result = None\n r = []\n last_s = src.getColTo()\n for p in range( src.getRowFrom(), \n src.getRowTo() ):\n s = src.mapRowToCol(p)\n if s < 0: continue\n if last_s >= s:\n if result:\n r.append( result )\n result = alignlib.makeAlignmentVector()\n last_s = s\n result.addPair( s, p, 0 )\n\n if result:\n r.append( result )\n return r", "metadata": "root.getParts", "header": "['module', '___EOS___']", "index": 92 }, { "content": "def alignIndels( all_alleles, colcounts, extend_by = 0 ):\n '''align all indel-regions.'''\n\n aa = alignlib.makeAlignatorDPFull( alignlib.ALIGNMENT_LOCAL, 0, 0 ) \n alignator = alignlib.makeMultipleAlignatorSimple( aa)\n\n ids = all_alleles.keys()\n\n for x,c in enumerate(colcounts):\n if c <= 1: continue\n sequences = alignlib.StringVector()\n for sid in ids:\n for allele in all_alleles[sid]:\n sequences.append( allele[x] )\n\n mali = alignlib.makeMultAlignment()\n alignator.align( mali, sequences )\n realigned = []\n for line in str(alignlib.MultAlignmentFormatPlain( mali, sequences )).split(\"\\n\")[:-1]:\n data = line[:-1].split(\"\\t\")\n realigned.append( data[1] )\n assert len(realigned) == len(sequences)\n\n l = max( [len(r) for r in realigned] )\n i = 0\n for sid in ids:\n for allele in all_alleles[sid]:\n if realigned[i]: allele[x] = realigned[i] \n else: allele[x] = \"-\" * l \n i += 1\n \n colcounts[x] = l", "metadata": "root.alignIndels", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def _alignToProfile( infile, outfile, \n min_score = 0 ):\n '''align sequences in *infile* against mali\n\n Only alignments with a score higher than *min_score* are accepted.\n\n Output multiple alignment in fasta format to *outfile* and a table\n in :file:`outfile.log`.\n '''\n\n mali = Mali.Mali()\n mali.readFromFile( open(\"../data/mouse.fasta\") )\n src_mali = Mali.convertMali2Alignlib( mali )\n \n E.debug( \"read mali: %i sequences x %i columns\" % (mali.getNumSequences(), mali.getNumColumns() ))\n\n # add pseudocounts\n profile_mali = mali.getClone()\n n = profile_mali.getNumColumns() \n for x in \"ACGT\": \n for y in range(0,2):\n profile_mali.addSequence( \"%s%i\" % (x,y), 0, n, x * n )\n\n\n profile_mali = Mali.convertMali2Alignlib( profile_mali )\n alignlib.setDefaultEncoder( alignlib.getEncoder( alignlib.DNA4 ) )\n alignlib.setDefaultLogOddor( alignlib.makeLogOddorUniform() )\n\n # bg = alignlib.FrequencyVector()\n # bg.extend( ( 0.3, 0.1, 0.2, 0.2, 0.2) )\n # alignlib.setDefaultRegularizor( alignlib.makeRegularizorTatusov(\n # alignlib.makeSubstitutionMatrixDNA4(),\n # bg,\n # \"ACGTN\",\n # 10.0, 1.0) )\n\n profile = alignlib.makeProfile( profile_mali )\n \n alignment_mode = alignlib.ALIGNMENT_WRAP\n\n alignator = alignlib.makeAlignatorDPFull( alignment_mode,\n -5.0,\n -0.5 )\n \n map_seq2profile = alignlib.makeAlignmentVector()\n map_rseq2profile = alignlib.makeAlignmentVector()\n profile.prepare()\n\n # print profile\n\n build_mali = alignlib.makeMultAlignment()\n m = alignlib.makeAlignmentVector()\n m.addDiagonal( 0, n, 0 )\n build_mali.add( src_mali, m )\n\n outf = open( outfile, \"w\" )\n outf_log = open( outfile + \".info\", \"w\" )\n outf_log.write( \"read_id\\tlength\\tstart\\tend\\tparts\\tcovered\\tpcovered\\tscore\\tmali_start\\tmali_end\\tmali_covered\\tmali_pcovered\\n\" )\n\n sequences, aa = alignlib.StringVector(), alignlib.AlignandumVector()\n ids = []\n\n for pid in mali.getIdentifiers():\n sequences.append( re.sub( \"-\", \"\", mali[pid] ) )\n ids.append( pid )\n\n # print str(alignlib.MultAlignmentFormatPlain( build_mali, sequences ))\n\n c = E.Counter()\n\n for s in FastaIterator.FastaIterator( open(infile)):\n\n E.debug(\"adding %s\" % s.title )\n c.input += 1\n rsequence = Genomics.complement(s.sequence)\n seq = alignlib.makeSequence( s.sequence )\n rseq = alignlib.makeSequence( rsequence )\n\n alignator.align( map_seq2profile, seq, profile )\n alignator.align( map_rseq2profile, rseq, profile )\n\n if map_seq2profile.getScore() > map_rseq2profile.getScore():\n m, seq, sequence = map_seq2profile, seq, s.sequence\n else:\n m, seq, sequence = map_rseq2profile, rseq, rsequence\n\n if m.getLength() == 0:\n c.skipped += 1\n continue\n\n if m.getScore() < min_score: \n c.skipped += 1\n continue\n\n r = getParts( m )\n\n covered = 0\n for mm in r:\n build_mali.add( mm )\n sequences.append( sequence )\n ids.append( s.title )\n covered += mm.getLength() - mm.getNumGaps()\n\n mali_covered = m.getColTo() - m.getColFrom()\n\n outf_log.write( \"\\t\".join( map(str, (\n s.title,\n len(s.sequence),\n m.getRowFrom(),\n m.getRowTo(),\n len(r),\n covered,\n \"%5.2f\" % (100.0 * covered / len(s.sequence) ),\n m.getScore(),\n m.getColFrom(),\n m.getColTo(),\n mali_covered,\n \"%5.2f\" % ((100.0 * mali_covered) / mali.getNumColumns())\n ) ) ) + \"\\n\" )\n\n c.output += 1\n\n #build_mali.expand( aa )\n result = str(alignlib.MultAlignmentFormatPlain( build_mali, \n sequences, \n alignlib.UnalignedStacked ))\n\n for pid, data in zip(ids, result.split(\"\\n\") ):\n start, sequence, end = data.split(\"\\t\")\n outf.write(\">%s/%i-%i\\n%s\\n\" % (pid, int(start)+1, int(end), sequence) )\n\n\n outf.close()\n outf_log.close()\n\n E.info( \"%s\\n\" % str(c) )", "metadata": "root._alignToProfile", "header": "['module', '___EOS___']", "index": 146 }, { "content": "@follows(createProfile)\n@files( [ (x, \"%s_%03i_na.mali\" % (x[:-3],f), f) \n for x,f in itertools.product( glob.glob(\"*.fa\"), (0, 80 ) ) ] )\ndef alignToProfile( infile, outfile, threshold ):\n _alignToProfile( infile, outfile, min_score = threshold )", "metadata": "root.alignToProfile", "header": "['module', '___EOS___']", "index": 283 }, { "content": "@transform( alignToProfile\n , suffix( \".mali\")\n , \".import\" )\ndef importMaliStats( infile, outfile ):\n '''import stats.'''\n \n table = P.toTable( outfile ) + \"_info\" \n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s\n --index=read_id \n --table=%(table)s \n < %(infile)s.info\n > %(outfile)s\n '''\n P.run()", "metadata": "root.importMaliStats", "header": "['module', '___EOS___']", "index": 289 }, { "content": "@transform( alignToProfile\n , suffix( \"_na.mali\")\n , \"_aa.mali\" )\ndef buildMalisCodon( infile, outfile ):\n '''build codon alignments\n\n The frame is given by the master multiple alignment.\n\n Sequences with indels that are not multiples of three\n are removed.\n\n Sequences with stop codons are removed.\n TODO\n '''\n \n statement = '''\n cat %(infile)s\n | python %(scriptsdir)s/fasta2fasta.py --method=translate \n | perl -p -e \"s/[a-z]/-/g unless (/^>/)\"\n | python %(scriptsdir)s/mali2mali.py --method=remove-all-gaps --log=%(outfile)s.log --allow-duplicates\n\n > %(outfile)s\n '''\n \n P.run()", "metadata": "root.buildMalisCodon", "header": "['module', '___EOS___']", "index": 305 }, { "content": "@transform( alignToProfile\n , suffix( \"_na.mali\")\n , \"_aa.mali\" )\ndef buildMalisAA( infile, outfile ):\n '''translate multiple alignments.\n\n The frame is given by the master multiple alignment.\n\n Indels in other sequences are ignored.\n '''\n \n statement = '''\n cat %(infile)s\n | perl -p -e \"s/[a-z]/-/g unless (/^>/)\"\n | python %(scriptsdir)s/mali2mali.py --method=remove-all-gaps --log=%(outfile)s.log --allow-duplicates\n | python %(scriptsdir)s/fasta2fasta.py --method=translate \n > %(outfile)s\n '''\n \n P.run()", "metadata": "root.buildMalisAA", "header": "['module', '___EOS___']", "index": 332 }, { "content": "@transform( alignToProfile\n , suffix( \"_na.mali\")\n , \"_na.columns\" )\ndef computeColumnStatsNA( infile, outfile ):\n '''compute stats per column.\n\n Only columns are counted that are non-insert with respect to\n the master alignment. The master alignment columns are\n later removed in order to count only sequences within \n a strain.\n '''\n \n statement = '''\n cat %(infile)s\n | perl -p -e \"s/[a-z]/-/g unless (/^>/)\"\n | python %(scriptsdir)s/mali2mali.py --method=remove-all-gaps --log=%(outfile)s.log --allow-duplicates\n | python %(scriptsdir)s/fasta2fasta.py --exclude=\"(^mouse)\" --log=%(outfile)s.log\n | python %(scriptsdir)s/mali2table.py --section=all --log=%(outfile)s.log --allow-duplicates\n > %(outfile)s\n '''\n \n P.run()", "metadata": "root.computeColumnStatsNA", "header": "['module', '___EOS___']", "index": 353 }, { "content": "@transform( buildMalisAA\n , suffix( \"_aa.mali\")\n , \"_aa.columns\" )\ndef computeColumnStatsAA( infile, outfile ):\n '''compute stats per column.\n\n Only columns are counted that are non-insert with respect to\n the master alignment. The master alignment columns are\n later removed.\n '''\n \n statement = '''\n cat %(infile)s\n | perl -p -e \"s/[X?]/-/g unless (/^>/)\"\n | python %(scriptsdir)s/fasta2fasta.py --exclude=\"(^mouse)\" --log=%(outfile)s.log\n | python %(scriptsdir)s/mali2table.py --section=all --log=%(outfile)s.log --allow-duplicates --alphabet=aa\n > %(outfile)s\n '''\n \n P.run()", "metadata": "root.computeColumnStatsAA", "header": "['module', '___EOS___']", "index": 376 }, { "content": "@transform( (computeColumnStatsNA, computeColumnStatsAA)\n , suffix( \".columns\")\n , \"_columns.import\" )\ndef importColumnStats( infile, outfile ):\n '''import stats.'''\n \n table = P.toTable( outfile ) \n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s\n --index=column \n --table=%(table)s \n < %(infile)s\n > %(outfile)s\n '''\n P.run()", "metadata": "root.importColumnStats", "header": "['module', '___EOS___']", "index": 397 }, { "content": "@follows( alignToProfile\n , importMaliStats\n , computeColumnStatsNA\n , buildMalisAA\n , computeColumnStatsAA\n , importColumnStats\n )\ndef full(): pass", "metadata": "root.full", "header": "['module', '___EOS___']", "index": 414 } ]
[ { "span": "import gzip", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 11 }, { "span": "import os", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 9 }, { "span": "import CGAT.CSV as CSV", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 22 }, { "span": "import math", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 11 }, { "span": "import types", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 12 }, { "span": "import optparse", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 15 }, { "span": "import shutil", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 13 }, { "span": "import sqlite3", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 14 }, { "span": "import CGAT.GFF as GFF", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 22 }, { "span": "import CGAT.GTF as GTF", "start_line": 63, "start_column": 0, "end_line": 63, "end_column": 22 }, { "span": "import CGAT.IOTools as IOTools", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 30 }, { "span": "import CGAT.Database as Database", "start_line": 68, "start_column": 0, "end_line": 68, "end_column": 32 }, { "span": "import PipelineGeneset as PGeneset", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 34 }, { "span": "import PipelineGO as PGO", "start_line": 71, "start_column": 0, "end_line": 71, "end_column": 24 }, { "span": "import scipy.stats", "start_line": 72, "start_column": 0, "end_line": 72, "end_column": 18 }, { "span": "import CGAT.Stats as Stats", "start_line": 73, "start_column": 0, "end_line": 73, "end_column": 26 } ]
[]
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_", "#", " ", " ", " ", "MR", "C", " ", "FG", "U", " ", "Computation", "al", " ", "Geno", "mic", "s", " ", "Group_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "$", "Id", ":", " ", "pipeline", "\\u", "snp", "s", ".", "py", " ", "287", "0", " ", "2010", "-0", "3", "-0", "3", " ", "10", ":", "20", ":", "2", "9", "Z", " ", "andr", "eas", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Andre", "as", " ", "He", "ger_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "modif", "y", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "of", " ", "the", " ", "License", ",", " ", "or", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "along", " ", "with", " ", "this", " ", "program", ";", " ", "if", " ", "not", ",", " ", "write", " ", "to", " ", "the", " ", "Free", " ", "Sof", "twa", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Foun", "dati", "on", ",", " ", "Inc", ".,", " ", "5", "9", " ", "Temp", "le", " ", "Place", " ", "-", " ", "Suit", "e", " ", "330", ",", " ", "Bo", "ston", ",", " ", "MA", " ", " ", "0211", "1", "-1", "307", ",", " ", "USA", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "pipeline", "\\u", "prd", "m", "9", ".", "py", "\\", "10", ";", "==============", "===", "\\", "10", ";", "\\", "10", ";", ":", "Author", ":", " ", "Andre", "as", " ", "He", "ger", "\\", "10", ";", ":", "Release", ":", " ", "$", "Id", "$", "\\", "10", ";", ":", "Date", ":", " ", "|", "toda", "y", "|", "\\", "10", ";", ":", "Ta", "gs", ":", " ", "Pyth", "on", "\\", "10", ";", "\\", "10", ";", "Pur", "pose", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "Analy", "sis", " ", "of", " ", "prd", "m", "9", " ", "in", " ", "1", "7", " ", "mouse", " ", "strain", "s", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", "\\", "10", ";", "-----", "\\", "10", ";", "\\", "10", ";", "Type", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "<", "script", "\\u", "name", ">.", "py", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", "for", " ", "command", " ", "line", " ", "help", ".", "\\", "10", ";", "\\", "10", ";", "Code", "\\", "10", ";", "----", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ru", "ff", "us_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "CSV_", "as_", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "GF", "F_", "as_", "GF", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "GT", "F_", "as_", "GT", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Experiment_", "as_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Pipeline_", "as_", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "IO", "Tools_", "as_", "IO", "Tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Geno", "mic", "s_", "as_", "Geno", "mic", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Database_", "as_", "Database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Fast", "a", "Iterator_", "as_", "Fast", "a", "Iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Pipe", "line", "Genes", "et_", "as_", "PG", "ene", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Pipe", "line", "GO", "_", "as_", "PG", "O_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Stats_", "as_", "Stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "align", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Mal", "i_", "as_", "Mal", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PARAMS_", "=_", "P_", "._", "get", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "(_", "P_", "._", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "files_", "(_", "(_", "(_", "\"..", "/", "data", "/", "zn", "f", ".", "data", "\"_", ",_", "\"", "profile", ".", "fasta", "\"_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "Profile_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "convert", " ", "mali", " ", "to", " ", "profile", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "\"#\"_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "re_", "._", "split_", "(_", "\"\\\\", "s", "+\"_", ",_", "line_", "[_", ":_", "-_", "1_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", ",_", "sequence_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "._", "write_", "(_", "\">", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "pid_", ",_", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "._", "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_", "get", "Parts_", "(_", "src_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "split", " ", "a", " ", "wrap", "-", "aro", "und", " ", "alignme", "nt", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "s_", "=_", "src_", "._", "get", "Col", "To_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "range_", "(_", "src_", "._", "get", "Row", "From_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "._", "get", "Row", "To_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "src_", "._", "map", "Row", "To", "Col_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "<_", "0_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "s_", ">=_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "align", "lib_", "._", "make", "Align", "ment", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "s_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Pair_", "(_", "s_", ",_", "p_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "align", "Inde", "ls_", "(_", "all", "\\u", "alleles", "_", ",_", "col", "counts_", ",_", "extend", "\\u", "by_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "align", " ", "all", " ", "indel", "-", "regions", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aa_", "=_", "align", "lib_", "._", "make", "Align", "ator", "DP", "Full_", "(_", "align", "lib_", "._", "ALIGN", "MENT", "\\u", "LOCAL_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "ator_", "=_", "align", "lib_", "._", "make", "Multipl", "e", "Align", "ator", "Simple_", "(_", "aa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ids_", "=_", "all", "\\u", "alleles", "_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "c_", "in_", "enumerate_", "(_", "col", "counts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "<=_", "1_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sequences_", "=_", "align", "lib_", "._", "String", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sid_", "in_", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "allele_", "in_", "all", "\\u", "alleles", "_", "[_", "sid_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sequences_", "._", "append_", "(_", "allele_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mali", "_", "=_", "align", "lib_", "._", "make", "Mult", "Alignment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "ator_", "._", "align_", "(_", "mali", "_", ",_", "sequences_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reali", "gned", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "str_", "(_", "align", "lib_", "._", "Mult", "Align", "ment", "Format", "Plai", "n_", "(_", "mali", "_", ",_", "sequences_", ")_", ")_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reali", "gned", "_", "._", "append_", "(_", "data_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "reali", "gned", "_", ")_", "==_", "len_", "(_", "sequences_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "=_", "max_", "(_", "[_", "len_", "(_", "r_", ")_", "for_", "r_", "in_", "reali", "gned", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sid_", "in_", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "allele_", "in_", "all", "\\u", "alleles", "_", "[_", "sid_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reali", "gned", "_", "[_", "i_", "]_", ":_", "allele_", "[_", "x_", "]_", "=_", "reali", "gned", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "allele_", "[_", "x_", "]_", "=_", "\"-\"_", "*_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "col", "counts_", "[_", "x_", "]_", "=_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "align", "To", "Profile_", "(_", "infile_", ",_", "outfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "score_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "align", " ", "sequence", "s", " ", "in", " ", "*", "infile", "*", " ", "against", " ", "mali", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "alignme", "nts", " ", "with", " ", "a", " ", "score", " ", "higher", " ", "than", " ", "*", "min", "\\u", "score", "*", " ", "are", " ", "accept", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "multiple", " ", "alignme", "nt", " ", "in", " ", "fasta", " ", "format", " ", "to", " ", "*", "outfile", "*", " ", "and", " ", "a", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "in", " ", ":", "file", ":`", "outfile", ".", "log", "`.", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mali", "_", "=_", "Mal", "i_", "._", "Mal", "i_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mali", "_", "._", "read", "Fro", "m", "File_", "(_", "open_", "(_", "\"..", "/", "data", "/", "mouse", ".", "fasta", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "\\u", "mali", "_", "=_", "Mal", "i_", "._", "convert", "Mal", "i2", "Align", "lib_", "(_", "mali", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "debug_", "(_", "\"", "read", " ", "mali", ":", " ", "%", "i", " ", "sequence", "s", " ", "x", " ", "%", "i", " ", "column", "s", "\"_", "%_", "(_", "mali", "_", "._", "get", "Num", "Sequences", "_", "(_", ")_", ",_", "mali", "_", "._", "get", "Num", "Columns_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "pseudo", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "profile", "\\u", "mali", "_", "=_", "mali", "_", "._", "get", "Clone", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "profile", "\\u", "mali", "_", "._", "get", "Num", "Columns_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "\"", "ACGT", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile", "\\u", "mali", "_", "._", "add", "Sequence_", "(_", "\"%", "s", "%", "i", "\"_", "%_", "(_", "x_", ",_", "y_", ")_", ",_", "0_", ",_", "n_", ",_", "x_", "*_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "profile", "\\u", "mali", "_", "=_", "Mal", "i_", "._", "convert", "Mal", "i2", "Align", "lib_", "(_", "profile", "\\u", "mali", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "lib_", "._", "set", "Default", "Encoder_", "(_", "align", "lib_", "._", "get", "Encoder_", "(_", "align", "lib_", "._", "DNA", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "lib_", "._", "set", "Default", "Log", "Od", "dor_", "(_", "align", "lib_", "._", "make", "Log", "Od", "dor", "Uniform", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bg", " ", "=", " ", "align", "lib", ".", "Freq", "uenc", "y", "Vector", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bg", ".", "extend", "(", " ", "(", " ", "0.", "3", ",", " ", "0.", "1", ",", " ", "0.", "2", ",", " ", "0.", "2", ",", " ", "0.", "2", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "align", "lib", ".", "set", "Default", "Regula", "riz", "or", "(", " ", "align", "lib", ".", "make", "Regula", "riz", "or", "Ta", "tus", "ov", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "align", "lib", ".", "make", "Substituti", "on", "Matrix", "DNA", "4", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "bg", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "\"", "ACGT", "N", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "10.", "0", ",", " ", "1.0", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "profile_", "=_", "align", "lib_", "._", "make", "Profile_", "(_", "profile", "\\u", "mali", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alignme", "nt", "\\u", "mode_", "=_", "align", "lib_", "._", "ALIGN", "MENT", "\\u", "WRAP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "align", "ator_", "=_", "align", "lib_", "._", "make", "Align", "ator", "DP", "Full_", "(_", "alignme", "nt", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "5.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "map", "\\u", "seq", "2p", "rofile", "_", "=_", "align", "lib_", "._", "make", "Align", "ment", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "rse", "q2", "profile_", "=_", "align", "lib_", "._", "make", "Align", "ment", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "build", "\\u", "mali", "_", "=_", "align", "lib_", "._", "make", "Mult", "Alignment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "align", "lib_", "._", "make", "Align", "ment", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "Diag", "onal", "_", "(_", "0_", ",_", "n_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "mali", "_", "._", "add_", "(_", "src", "\\u", "mali", "_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outf_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf", "\\u", "log_", "=_", "open_", "(_", "outfile_", "+_", "\".", "info", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf", "\\u", "log_", "._", "write_", "(_", "\"", "read", "\\u", "id", "\\\\", "tle", "ngt", "h", "\\\\", "tstart", "\\\\", "tend", "\\\\", "tpa", "rts", "\\\\", "tco", "vere", "d", "\\\\", "tpc", "over", "ed", "\\\\", "tsc", "ore", "\\\\", "tma", "li", "\\u", "start", "\\\\", "tma", "li", "\\u", "end", "\\\\", "tma", "li", "\\u", "covered", "\\\\", "tma", "li", "\\u", "pco", "vere", "d", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", ",_", "aa_", "=_", "align", "lib_", "._", "String", "Vector_", "(_", ")_", ",_", "align", "lib_", "._", "Align", "and", "um", "Vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pid_", "in_", "mali", "_", "._", "get", "Identifiers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sequences_", "._", "append_", "(_", "re_", "._", "sub_", "(_", "\"-\"_", ",_", "\"\"_", ",_", "mali", "_", "[_", "pid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "append_", "(_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "str", "(", "align", "lib", ".", "Mult", "Align", "ment", "Format", "Plai", "n", "(", " ", "build", "\\u", "mali", ",", " ", "sequence", "s", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "E_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "Fast", "a", "Iterator_", "._", "Fast", "a", "Iterator_", "(_", "open_", "(_", "infile_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "debug_", "(_", "\"", "addin", "g", " ", "%", "s", "\"_", "%_", "s_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "input_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rse", "quenc", "e_", "=_", "Geno", "mic", "s_", "._", "complement_", "(_", "s_", "._", "sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "align", "lib_", "._", "make", "Sequence_", "(_", "s_", "._", "sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rse", "q_", "=_", "align", "lib_", "._", "make", "Sequence_", "(_", "rse", "quenc", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "align", "ator_", "._", "align_", "(_", "map", "\\u", "seq", "2p", "rofile", "_", ",_", "seq_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "align", "ator_", "._", "align_", "(_", "map", "\\u", "rse", "q2", "profile_", ",_", "rse", "q_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "map", "\\u", "seq", "2p", "rofile", "_", "._", "get", "Score_", "(_", ")_", ">_", "map", "\\u", "rse", "q2", "profile_", "._", "get", "Score_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "seq_", ",_", "sequence_", "=_", "map", "\\u", "seq", "2p", "rofile", "_", ",_", "seq_", ",_", "s_", "._", "sequence_", "\\u\\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_", ",_", "seq_", ",_", "sequence_", "=_", "map", "\\u", "rse", "q2", "profile_", ",_", "rse", "q_", ",_", "rse", "quenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "._", "get", "Length_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "skipped_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "._", "get", "Score_", "(_", ")_", "<_", "min", "\\u", "score_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "skipped_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "get", "Parts_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "covered", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mm_", "in_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "\\u", "mali", "_", "._", "add_", "(_", "mm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sequences_", "._", "append_", "(_", "sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "append_", "(_", "s_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covered", "_", "+=_", "mm_", "._", "get", "Length_", "(_", ")_", "-_", "mm_", "._", "get", "Num", "Gap", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mali", "\\u", "covered", "_", "=_", "m_", "._", "get", "Col", "To_", "(_", ")_", "-_", "m_", "._", "get", "Col", "From_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outf", "\\u", "log_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "s_", "._", "sequence_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "get", "Row", "From_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "get", "Row", "To_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "r_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "covered", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "5.2", "f", "\"_", "%_", "(_", "100.0_", "*_", "covered", "_", "/_", "len_", "(_", "s_", "._", "sequence_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "get", "Score_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "get", "Col", "From_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "get", "Col", "To_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mali", "\\u", "covered", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "5.2", "f", "\"_", "%_", "(_", "(_", "100.0_", "*_", "mali", "\\u", "covered", "_", ")_", "/_", "mali", "_", "._", "get", "Num", "Columns_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "output_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "build", "\\u", "mali", ".", "expand", "(", " ", "aa", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "str_", "(_", "align", "lib_", "._", "Mult", "Align", "ment", "Format", "Plai", "n_", "(_", "build", "\\u", "mali", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "align", "lib_", "._", "Una", "ligne", "d", "Stack", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pid_", ",_", "data_", "in_", "zip_", "(_", "ids_", ",_", "result_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "sequence_", ",_", "end_", "=_", "data_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf_", "._", "write_", "(_", "\">", "%", "s", "/", "%", "i", "-%", "i", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "pid_", ",_", "int_", "(_", "start_", ")_", "+_", "1_", ",_", "int_", "(_", "end_", ")_", ",_", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outf_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf", "\\u", "log_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "info_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "str_", "(_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "follow", "s_", "(_", "create", "Profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "files_", "(_", "[_", "(_", "x_", ",_", "\"%", "s", "\\u", "%", "03", "i", "\\u", "na", ".", "mali", "\"_", "%_", "(_", "x_", "[_", ":_", "-_", "3_", "]_", ",_", "f_", ")_", ",_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "f_", "in_", "itertools_", "._", "product_", "(_", "glob_", "._", "glob_", "(_", "\"*", ".", "fa", "\"_", ")_", ",_", "(_", "0_", ",_", "80_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "align", "To", "Profile_", "(_", "infile_", ",_", "outfile_", ",_", "threshold_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "align", "To", "Profile_", "(_", "infile_", ",_", "outfile_", ",_", "min", "\\u", "score_", "=_", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "align", "To", "Profile_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\".", "mali", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Mal", "i", "Stats_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "stats", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "P_", "._", "to", "Table_", "(_", "outfile_", ")_", "+_", "\"\\u", "info", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "read", "\\u", "id", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", ".", "info", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "align", "To", "Profile_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\"\\u", "na", ".", "mali", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\"\\u", "aa", ".", "mali", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Mal", "is", "Cod", "on_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "build", " ", "codon", " ", "alignme", "nts", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "frame", " ", "is", " ", "give", "n", " ", "by", " ", "the", " ", "master", " ", "multiple", " ", "alignme", "nt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sequences", " ", "with", " ", "indel", "s", " ", "tha", "t", " ", "are", " ", "not", " ", "multiple", "s", " ", "of", " ", "three", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "remove", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sequences", " ", "with", " ", "stop", " ", "codon", "s", " ", "are", " ", "remove", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "fasta", "2f", "asta", ".", "py", " ", "--", "method", "=", "translat", "e", " ", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "perl", " ", "-", "p", " ", "-", "e", " ", "\"", "s", "/", "[", "a", "-", "z", "]/", "-", "/", "g", " ", "unl", "ess", " ", "(/", "^", ">/", ")\"", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "mali", "2ma", "li", ".", "py", " ", "--", "method", "=", "remove", "-", "all", "-", "gap", "s", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "--", "allow", "-", "duplicat", "es", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "align", "To", "Profile_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\"\\u", "na", ".", "mali", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\"\\u", "aa", ".", "mali", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Mal", "is", "AA_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "translat", "e", " ", "multiple", " ", "alignme", "nts", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "frame", " ", "is", " ", "give", "n", " ", "by", " ", "the", " ", "master", " ", "multiple", " ", "alignme", "nt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Inde", "ls", " ", "in", " ", "other", " ", "sequence", "s", " ", "are", " ", "ignore", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "perl", " ", "-", "p", " ", "-", "e", " ", "\"", "s", "/", "[", "a", "-", "z", "]/", "-", "/", "g", " ", "unl", "ess", " ", "(/", "^", ">/", ")\"", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "mali", "2ma", "li", ".", "py", " ", "--", "method", "=", "remove", "-", "all", "-", "gap", "s", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "--", "allow", "-", "duplicat", "es", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "fasta", "2f", "asta", ".", "py", " ", "--", "method", "=", "translat", "e", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "align", "To", "Profile_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\"\\u", "na", ".", "mali", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\"\\u", "na", ".", "column", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute", "Colum", "n", "Stat", "s", "NA_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "stats", " ", "per", " ", "column", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "column", "s", " ", "are", " ", "counted", " ", "tha", "t", " ", "are", " ", "non", "-", "insert", " ", "with", " ", "respec", "t", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "master", " ", "alignme", "nt", ".", " ", "The", " ", "master", " ", "alignme", "nt", " ", "column", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "late", "r", " ", "remove", "d", " ", "in", " ", "order", " ", "to", " ", "count", " ", "only", " ", "sequence", "s", " ", "within", " ", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "strain", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "perl", " ", "-", "p", " ", "-", "e", " ", "\"", "s", "/", "[", "a", "-", "z", "]/", "-", "/", "g", " ", "unl", "ess", " ", "(/", "^", ">/", ")\"", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "mali", "2ma", "li", ".", "py", " ", "--", "method", "=", "remove", "-", "all", "-", "gap", "s", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "--", "allow", "-", "duplicat", "es", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "fasta", "2f", "asta", ".", "py", " ", "--", "exclu", "de", "=\"(", "^", "mouse", ")\"", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "mali", "2t", "able", ".", "py", " ", "--", "section", "=", "all", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "--", "allow", "-", "duplicat", "es", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "build", "Mal", "is", "AA_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\"\\u", "aa", ".", "mali", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\"\\u", "aa", ".", "column", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute", "Colum", "n", "Stat", "s", "AA_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "stats", " ", "per", " ", "column", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "column", "s", " ", "are", " ", "counted", " ", "tha", "t", " ", "are", " ", "non", "-", "insert", " ", "with", " ", "respec", "t", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "master", " ", "alignme", "nt", ".", " ", "The", " ", "master", " ", "alignme", "nt", " ", "column", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "late", "r", " ", "remove", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "perl", " ", "-", "p", " ", "-", "e", " ", "\"", "s", "/", "[", "X", "?]", "/-", "/", "g", " ", "unl", "ess", " ", "(/", "^", ">/", ")\"", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "fasta", "2f", "asta", ".", "py", " ", "--", "exclu", "de", "=\"(", "^", "mouse", ")\"", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "mali", "2t", "able", ".", "py", " ", "--", "section", "=", "all", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "--", "allow", "-", "duplicat", "es", " ", "--", "alpha", "bet", "=", "aa", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transform_", "(_", "(_", "compute", "Colum", "n", "Stat", "s", "NA_", ",_", "compute", "Colum", "n", "Stat", "s", "AA_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "suffix_", "(_", "\".", "column", "s", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "\"\\u", "column", "s", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Colum", "n", "Stats_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "stats", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "P_", "._", "to", "Table_", "(_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "column", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "follow", "s_", "(_", "align", "To", "Profile_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "import", "Mal", "i", "Stats_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "compute", "Colum", "n", "Stat", "s", "NA_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "build", "Mal", "is", "AA_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "compute", "Colum", "n", "Stat", "s", "AA_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "import", "Colum", "n", "Stats_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "full_", "(_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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id and a security authority.\n\n :param sid: a PySID\n :param system_name: optional name of a security authority\n :returns: a :class:`Principal` object for `sid`\n \"\"\"\n try:\n name, domain, type = wrapped(\n win32security.LookupAccountSid,\n None if system is None else unicode(system),\n sid\n )\n except exc.x_not_found:\n name = domain = type = core.UNSET\n cls = cls.SID_NAME_USE_MAP.get(type, cls)\n return cls(sid, None if system is None else unicode(system))", "metadata": "root.Principal.from_sid", "header": "['class', 'Principal', '(', 'core', '.', '_WinSysObject', ')', ':', '___EOS___']", "index": 250 }, { "content": " def runas(self, command_line, password=core.UNSET, load_profile=False):\n \"\"\"Run a command logged on as this user\n\n :param command_line: command line to run, quoted as necessary\n :param password: password; if not supplied, standard Windows prompt\n :param with_profile: if True, HKEY_CURRENT_USER is loaded [False]\n \"\"\"\n #~ if not password:\n #~ password = dialogs.get_password(self.name, self.domain)\n logon_flags = 0\n if load_profile: logon_flags |= _advapi32.LOGON_FLAGS.WITH_PROFILE\n process_info = _advapi32.CreateProcessWithLogonW(\n username=self.name,\n domain=self.domain,\n password=password,\n command_line=command_line,\n logon_flags=logon_flags\n )\n #\n # Wait for up to 20 secs\n #\n #~ if wrapped(win32event.WaitForInputIdle, process_info.hProcess, 10000) == win32event.WAIT_TIMEOUT:\n #~ raise x_accounts(errctx=\"runas\", errmsg=\"runas process not created with 10 secs\")", "metadata": "root.User.runas", "header": "['class', 'User', '(', 'Principal', ')', ':', '___EOS___']", "index": 373 } ]
[ { "span": "name ", "start_line": 265, "start_column": 12, "end_line": 265, "end_column": 16 }, { "span": "domain ", "start_line": 265, "start_column": 19, "end_line": 265, "end_column": 25 }, { "span": "process_info ", "start_line": 384, "start_column": 8, "end_line": 384, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Princip", "al_", "(_", "core_", "._", "\\u", "Win", "Sys", "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_", "from", "\\u", "sid_", "(_", "cls_", ",_", "sid_", ",_", "system_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", ":", "class", ":`", "Princip", "al", "`", " ", "based", " ", "on", " ", "a", " ", "sid", " ", "and", " ", "a", " ", "security", " ", "authori", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "sid", ":", " ", "a", " ", "Py", "SID", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "system", "\\u", "name", ":", " ", "option", "al", " ", "name", " ", "of", " ", "a", " ", "security", " ", "authori", "ty", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", ":", "class", ":`", "Princip", "al", "`", " ", "object", " ", "for", " ", "`", "sid", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "domain_", ",_", "type_", "=_", "wrapped_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "win32", "security_", "._", "Look", "up", "Account", "Si", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", "if_", "system_", "is_", "None_", "else_", "unicode_", "(_", "system_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sid_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "x", "\\u", "not", "\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "domain_", "=_", "type_", "=_", "core_", "._", "UNS", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "=_", "cls_", "._", "SID", "\\u", "NAME", "\\u", "USE", "\\u", "MAP_", "._", "get_", "(_", "type_", ",_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "sid_", ",_", "None_", "if_", "system_", "is_", "None_", "else_", "unicode_", "(_", "system_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "Princip", "al_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "runa", "s_", "(_", "self_", ",_", "command", "\\u", "line_", ",_", "password_", "=_", "core_", "._", "UNS", "ET_", ",_", "load", "\\u", "profile_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "a", " ", "command", " ", "logged", " ", "on", " ", "as", " ", "this", " ", "user", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "command", "\\u", "line", ":", " ", "command", " ", "line", " ", "to", " ", "run", ",", " ", "quoted", " ", "as", " ", "necessar", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "password", ":", " ", "password", ";", " ", "if", " ", "not", " ", "supplie", "d", ",", " ", "standard", " ", "Window", "s", " ", "prompt", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "with", "\\u", "profile", ":", " ", "if", " ", "Tru", "e", ",", " ", "HKEY", "\\u", "CURREN", "T", "\\u", "USER", " ", "is", " ", "load", "ed", " ", "[", "Fal", "se", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "if", " ", "not", " ", "password", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "password", " ", "=", " ", "dialog", "s", ".", "get", "\\u", "password", "(", "self", ".", "name", ",", " ", "self", ".", "domain", ")_", "\\u\\u\\uNL\\u\\u\\u_", "logo", "n", "\\u", "flags_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "load", "\\u", "profile_", ":_", "logo", "n", "\\u", "flags_", "|=_", "\\u", "adv", "api", "32_", "._", "LOGO", "N", "\\u", "FLAGS_", "._", "WITH", "\\u", "PROFILE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "info_", "=_", "\\u", "adv", "api", "32_", "._", "Creat", "e", "Process", "With", "Logo", "n", "W_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "self_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "line_", "=_", "command", "\\u", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logo", "n", "\\u", "flags_", "=_", "logo", "n", "\\u", "flags_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "for", " ", "up", " ", "to", " ", "20", " ", "secs_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "if", " ", "wrapp", "ed", "(", "win32", "event", ".", "Wait", "For", "Inp", "ut", "Id", "le", ",", " ", "process", "\\u", "info", ".", "h", "Process", ",", " ", "10000", ")", " ", "==", " ", "win32", "event", ".", "WAIT", "\\u", "TIME", "OUT", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "raise", " ", "x", "\\u", "account", "s", "(", "errc", "tx", "=\"", "runa", "s", "\",", " ", "err", "msg", "=\"", "runa", "s",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\n Show the upcoming contests\n \"\"\"\n\n today = datetime.datetime.today()\n today = datetime.datetime.strptime(str(today)[:-7],\n \"%Y-%m-%d %H:%M:%S\")\n\n start_date = today.date()\n end_date = start_date + datetime.timedelta(90)\n url = \"https://contesttrackerapi.herokuapp.com/\"\n response = requests.get(url)\n if response.status_code == 200:\n response = response.json()[\"result\"]\n else:\n # @todo: something better\n return dict()\n\n ongoing = response[\"ongoing\"]\n upcoming = response[\"upcoming\"]\n contests = []\n cal = pdt.Calendar()\n\n table = TABLE(_class=\"centered striped\")\n thead = THEAD(TR(TH(\"Contest Name\"),\n TH(\"Site\"),\n TH(\"Start\"),\n TH(\"Duration/Ending\"),\n TH(\"Link\"),\n TH(\"Add Reminder\")))\n table.append(thead)\n tbody = TBODY()\n\n for i in ongoing:\n\n if i[\"Platform\"] in (\"TOPCODER\", \"OTHER\"):\n continue\n\n try:\n endtime = datetime.datetime.strptime(i[\"EndTime\"],\n \"%a, %d %b %Y %H:%M\")\n except ValueError:\n continue\n tr = TR()\n span = SPAN(_class=\"green tooltipped\",\n data={\"position\": \"right\",\n \"delay\": \"50\",\n \"tooltip\": \"Live Contest\"},\n _style=\"cursor: pointer; \" + \\\n \"float:right; \" + \\\n \"height:10px; \" + \\\n \"width:10px; \" + \\\n \"border-radius: 50%;\")\n tr.append(TD(i[\"Name\"], span))\n tr.append(TD(i[\"Platform\"].capitalize()))\n tr.append(TD(\"-\"))\n tr.append(TD(str(endtime).replace(\"-\", \"/\"),\n _class=\"contest-end-time\"))\n tr.append(TD(A(I(_class=\"fa fa-external-link-square fa-lg\"),\n _class=\"btn-floating btn-small green accent-4 tooltipped\",\n _href=i[\"url\"],\n data={\"position\": \"left\",\n \"tooltip\": \"Contest Link\",\n \"delay\": \"50\"},\n _target=\"_blank\")))\n tr.append(TD(BUTTON(I(_class=\"fa fa-calendar-plus-o\"),\n _class=\"btn-floating btn-small orange accent-4 tooltipped disabled\",\n data={\"position\": \"left\",\n \"tooltip\": \"Already started!\",\n \"delay\": \"50\"})))\n tbody.append(tr)\n\n # This id is used for uniquely identifying\n # a particular contest in js\n button_id = 1\n for i in upcoming:\n\n if i[\"Platform\"] in (\"TOPCODER\", \"OTHER\"):\n continue\n\n start_time = datetime.datetime.strptime(i[\"StartTime\"],\n \"%a, %d %b %Y %H:%M\")\n tr = TR(_id=\"contest-\" + str(button_id))\n tr.append(TD(i[\"Name\"]))\n tr.append(TD(i[\"Platform\"].capitalize()))\n tr.append(TD(str(start_time)))\n\n duration = i[\"Duration\"]\n duration = duration.replace(\" days\", \"d\")\n duration = duration.replace(\" day\", \"d\")\n tr.append(TD(duration))\n tr.append(TD(A(I(_class=\"fa fa-external-link-square fa-lg\"),\n _class=\"btn-floating btn-small green accent-4 tooltipped\",\n _href=i[\"url\"],\n data={\"position\": \"left\",\n \"tooltip\": \"Contest Link\",\n \"delay\": \"50\"},\n _target=\"_blank\")))\n tr.append(TD(BUTTON(I(_class=\"fa fa-calendar-plus-o\"),\n _class=\"btn-floating btn-small orange accent-4 tooltipped\",\n data={\"position\": \"left\",\n \"tooltip\": \"Set Reminder to Google Calendar\",\n \"delay\": \"50\"},\n _id=\"set-reminder-\" + str(button_id))))\n tbody.append(tr)\n button_id += 1\n\n table.append(tbody)\n return dict(table=table, upcoming=upcoming)", "metadata": "root.contests", "header": "['module', '___EOS___']", "index": 318 }, { "content": "@auth.requires_login()\ndef submissions():\n \"\"\"\n Retrieve submissions of the logged-in user\n \"\"\"\n\n if len(request.args) == 0:\n active = \"1\"\n else:\n active = request.args[0]\n\n cftable = db.custom_friend\n ftable = db.friends\n stable = db.submission\n atable = db.auth_user\n\n # Get all the friends/custom friends of the logged-in user\n friends, cusfriends = utilities.get_friends(session[\"user_id\"])\n\n # The Original IDs of duplicate custom_friends\n custom_friends = []\n for cus_id in cusfriends:\n if cus_id[1] == None:\n custom_friends.append(cus_id[0])\n else:\n custom_friends.append(cus_id[1])\n\n query = (stable.user_id.belongs(friends)) | \\\n (stable.custom_user_id.belongs(custom_friends))\n total_count = db(query).count()\n\n PER_PAGE = current.PER_PAGE\n count = total_count / PER_PAGE\n if total_count % PER_PAGE:\n count += 1\n\n if request.extension == \"json\":\n return dict(count=count,\n total_rows=1)\n\n offset = PER_PAGE * (int(active) - 1)\n # Retrieve only some number of submissions from the offset\n rows = db(query).select(orderby=~db.submission.time_stamp,\n limitby=(offset, offset + PER_PAGE))\n\n table = utilities.render_table(rows, cusfriends)\n return dict(table=table,\n friends=friends,\n cusfriends=cusfriends,\n total_rows=len(rows))", "metadata": "root.submissions", "header": "['module', '___EOS___']", "index": 1077 } ]
[ { "span": "end_date ", "start_line": 328, "start_column": 4, "end_line": 328, "end_column": 12 }, { "span": "contests ", "start_line": 339, "start_column": 4, "end_line": 339, "end_column": 12 }, { "span": "cal ", "start_line": 340, "start_column": 4, "end_line": 340, "end_column": 7 }, { "span": "cftable ", "start_line": 1088, "start_column": 4, "end_line": 1088, "end_column": 11 }, { "span": "ftable ", "start_line": 1089, "start_column": 4, "end_line": 1089, "end_column": 10 }, { "span": "atable ", "start_line": 1091, "start_column": 4, "end_line": 1091, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contest", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "the", " ", "upcom", "ing", " ", "contest", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "datetime_", "._", "datetime_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "today_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "str_", "(_", "today_", ")_", "[_", ":_", "-_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "today_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "date_", "=_", "start", "\\u", "date_", "+_", "datetime_", "._", "timedelta_", "(_", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"", "https", "://", "contest", "track", "era", "pi", ".", "hero", "ku", "app", ".", "com", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "response_", "._", "json_", "(_", ")_", "[_", "\"", "result", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "todo", ":", " ", "somet", "hing", " ", "bett", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ong", "oin", "g_", "=_", "response_", "[_", "\"", "ong", "oin", "g", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upcom", "ing_", "=_", "response_", "[_", "\"", "upcom", "ing", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cal_", "=_", "pd", "t_", "._", "Calendar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "TABLE_", "(_", "\\u", "class_", "=_", "\"", "centered", " ", "strip", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thea", "d_", "=_", "THE", "AD_", "(_", "TR_", "(_", "TH_", "(_", "\"", "Contest", " ", "Name", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Start", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Dur", "ation", "/", "Endi", "ng", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Link", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Add", " ", "Remi", "nder", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "append_", "(_", "thea", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbo", "dy_", "=_", "TB", "OD", "Y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "ong", "oin", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "\"", "Plat", "form", "\"_", "]_", "in_", "(_", "\"", "TOP", "CODE", "R", "\"_", ",_", "\"", "OTHER", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endtime_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "i_", "[_", "\"", "End", "Time", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "a", ",", " ", "%", "d", " ", "%", "b", " ", "%", "Y", " ", "%", "H", ":", "%", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tr_", "=_", "TR_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "span_", "=_", "SPAN", "_", "(_", "\\u", "class_", "=_", "\"", "green", " ", "toolt", "ipp", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "position", "\"_", ":_", "\"", "right", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dela", "y", "\"_", ":_", "\"", "50", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolt", "ip", "\"_", ":_", "\"", "Live", " ", "Contest", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "style_", "=_", "\"", "cursor", ":", " ", "point", "er", ";", " ", "\"_", "+_", "\"", "float", ":", "right", ";", " ", "\"_", "+_", "\"", "height", ":", "10", "px", ";", " ", "\"_", "+_", "\"", "widt", "h", ":", "10", "px", ";", " ", "\"_", "+_", "\"", "border", "-", "radi", "us", ":", " ", "50", "%;", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "\"", "Name", "\"_", "]_", ",_", "span_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "\"", "Plat", "form", "\"_", "]_", "._", "capitalize_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "\"-\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "str_", "(_", "endtime_", ")_", "._", "replace_", "(_", "\"-\"_", ",_", "\"/\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "contest", "-", "end", "-", "time", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "A_", "(_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "external", "-", "link", "-", "square", " ", "fa", "-", "lg", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", "-", "float", "ing", " ", "btn", "-", "small", " ", "green", " ", "accent", "-", "4", " ", "toolt", "ipp", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "i_", "[_", "\"", "url", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "position", "\"_", ":_", "\"", "left", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolt", "ip", "\"_", ":_", "\"", "Contest", " ", "Link", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dela", "y", "\"_", ":_", "\"", "50", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "target_", "=_", "\"\\u", "blank", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "BUTTON_", "(_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "calendar", "-", "plus", "-", "o", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", "-", "float", "ing", " ", "btn", "-", "small", " ", "orange", " ", "accent", "-", "4", " ", "toolt", "ipp", "ed", " ", "disable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "position", "\"_", ":_", "\"", "left", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolt", "ip", "\"_", ":_", "\"", "Al", "read", "y", " ", "start", "ed", "!\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dela", "y", "\"_", ":_", "\"", "50", "\"_", "}_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbo", "dy_", "._", "append_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "id", " ", "is", " ", "used", " ", "for", " ", "unique", "ly", " ", "identify", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "partic", "ular", " ", "contest", " ", "in", " ", "js_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "button", "\\u", "id_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "upcom", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "\"", "Plat", "form", "\"_", "]_", "in_", "(_", "\"", "TOP", "CODE", "R", "\"_", ",_", "\"", "OTHER", "\"_", ")_", ":_", "\\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_", "start", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "i_", "[_", "\"", "Start", "Time", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "a", ",", " ", "%", "d", " ", "%", "b", " ", "%", "Y", " ", "%", "H", ":", "%", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "=_", "TR_", "(_", "\\u", "id_", "=_", "\"", "contest", "-\"_", "+_", "str_", "(_", "button", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "\"", "Name", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "\"", "Plat", "form", "\"_", "]_", "._", "capitalize_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "str_", "(_", "start", "\\u", "time_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", "=_", "i_", "[_", "\"", "Dur", "ation", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "duration_", "._", "replace_", "(_", "\"", " ", "day", "s", "\"_", ",_", "\"", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "duration_", "._", "replace_", "(_", "\"", " ", "day", "\"_", ",_", "\"", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "duration_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "A_", "(_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "external", "-", "link", "-", "square", " ", "fa", "-", "lg", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", "-", "float", "ing", " ", "btn", "-", "small", " ", "green", " ", "accent", "-", "4", " ", "toolt", "ipp", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "i_", "[_", "\"", "url", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "position", "\"_", ":_", "\"", "left", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolt", "ip", "\"_", ":_", "\"", "Contest", " ", "Link", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dela", "y", "\"_", ":_", "\"", "50", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "target_", "=_", "\"\\u", "blank", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "BUTTON_", "(_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "calendar", "-", "plus", "-", "o", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", "-", "float", "ing", " ", "btn", "-", "small", " ", "orange", " ", "accent", "-", "4", " ", "toolt", "ipp", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "position", "\"_", ":_", "\"", "left", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolt", "ip", "\"_", ":_", "\"", "Set", " ", "Remi", "nder", " ", "to", " ", "Goo", "gle", " ", "Cal", "enda", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dela", "y", "\"_", ":_", "\"", "50", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "\"", "set", "-", "reminder", "-\"_", "+_", "str_", "(_", "button", "\\u", "id_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbo", "dy_", "._", "append_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "append_", "(_", "tbo", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "table_", "=_", "table_", ",_", "upcom", "ing_", "=_", "upcom", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "._", "require", "s", "\\u", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submissions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "subm", "ission", "s", " ", "of", " ", "the", " ", "logged", "-", "in", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active_", "=_", "\"", "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 ", " _", "active_", "=_", "request_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cf", "table_", "=_", "db_", "._", "custom", "\\u", "friend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fta", "ble_", "=_", "db_", "._", "friends_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stable_", "=_", "db_", "._", "submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atab", "le_", "=_", "db_", "._", "auth", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "the", " ", "friends", "/", "custom", " ", "friends", " ", "of", " ", "the", " ", "logged", "-", "in", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "friends_", ",_", "cus", "friends_", "=_", "utilities_", "._", "get", "\\u", "friends_", "(_", "session_", "[_", "\"", "user", "\\u", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Origina", "l", " ", "ID", "s", " ", "of", " ", "duplicat", "e", " ", "custom", "\\u", "friends_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "friends_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cus", "\\u", "id_", "in_", "cus", "friends_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cus", "\\u", "id_", "[_", "1_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "custom", "\\u", "friends_", "._", "append_", "(_", "cus", "\\u", "id_", "[_", "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 ", " _", "custom", "\\u", "friends_", "._", "append_", "(_", "cus", "\\u", "id_", "[_", "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_", "query_", "=_", "(_", "stable_", "._", "user", "\\u", "id_", "._", "belo", "ngs_", "(_", "friends_", ")_", ")_", "|_", "(_", "stable_", "._", "custom", "\\u", "user", "\\u", "id_", "._", "belo", "ngs_", "(_", "custom", "\\u", "friends_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "count_", "=_", "db_", "(_", "query_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PER", "\\u", "PAGE_", "=_", "current_", "._", "PER", "\\u", "PAGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "total", "\\u", "count_", "/_", "PER", "\\u", "PAGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "\\u", "count_", "%_", "PER", "\\u", "PAGE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "extension_", "==_", "\"", "json", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", "count_", "=_", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "rows_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "PER", "\\u", "PAGE_", "*_", "(_", "int_", "(_", "active_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Retrieve", " ", "only", " ", "some", " ", "number", " ", "of", " ", "subm", "ission", "s", " ", "from", " ", "the", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "orderby_", "=_", "~_", "db_", "._", "submission_", "._", "time", "\\u", "stamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "offset_", ",_", "offset_", "+_", "PER", "\\u", "PAGE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "utilities_", "._", "render", "\\u", "table_", "(_", "rows_", ",_", "cus", "friends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "table_", "=_", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "friends_", "=_", "friends_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cus", "friends_", "=_", "cus", "friends_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "rows_", "=_", "len_", "(_", "rows_", ")_", ")_", "\\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,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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 ]
Unused import
SOM-Research/Gitana/init_dbschema.py
[ { "content": "__author__ = 'atlanmod'\n\nimport mysql.connector\nfrom mysql.connector import errorcode\nfrom datetime import datetime\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class InitDbSchema():\n\n\n\n\n\n\n\n\n", "metadata": "root.InitDbSchema", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def __init__(self, db_name, logger):\n self.logger = logger\n self.DB_NAME = db_name\n\n CONFIG = {\n 'user': 'root',\n 'password': 'root',\n 'host': 'localhost',\n 'port': '3306',\n 'raise_on_warnings': False,\n 'charset': 'utf8',\n 'buffered': True\n }\n\n self.cnx = mysql.connector.connect(**CONFIG)", "metadata": "root.InitDbSchema.__init__", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 11 }, { "content": " def init_database(self):\n self.init_tables()\n self.init_views()\n self.init_functions()\n self.init_stored_procedures()", "metadata": "root.InitDbSchema.init_database", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 27 }, { "content": " def init_views(self):\n cursor = self.cnx.cursor()\n\n num_files_deleted = \"\"\"\n CREATE VIEW num_files_deleted AS\n SELECT COUNT(DISTINCT fm.file_id) AS value FROM file_modification fm WHERE fm.status = \"deleted\";\n \"\"\"\n\n num_files_present = \"\"\"\n CREATE VIEW num_files_present AS\n SELECT (COUNT(*) - value) AS value\n FROM file f JOIN num_files_deleted nfd;\n \"\"\"\n\n num_branches = \"\"\"\n CREATE VIEW num_branches AS\n SELECT COUNT(*) as value\n FROM reference r;\n \"\"\"\n\n number_file_modification_per_commit = \"\"\"\n CREATE VIEW number_file_modification_per_commit AS\n SELECT COUNT(DISTINCT fm.file_id) as value\n FROM file_modification fm\n GROUP BY fm.commit_id;\n \"\"\"\n\n avg_number_file_modification_per_commit = \"\"\"\n CREATE VIEW avg_number_file_modification_per_commit AS\n SELECT AVG(value) AS value\n FROM number_file_modification_per_commit;\n \"\"\"\n\n num_empty_lines_deleted_files = \"\"\"\n CREATE VIEW num_empty_lines_deleted_files AS\n SELECT COUNT(*) AS value\n FROM line_detail ld, file_modification fm\n WHERE ld.file_modification_id = fm.id AND fm.status = \"deleted\" AND ld.is_empty = 1;\n \"\"\"\n\n num_empty_lines_present_files = \"\"\"\n CREATE VIEW num_empty_lines_present_files AS\n SELECT (COUNT(*) - value) AS value\n FROM line_detail ld, file_modification fm\n JOIN num_empty_lines_deleted_files neldf\n WHERE ld.file_modification_id = fm.id AND ld.is_empty = 1;\n \"\"\"\n\n num_commented_lines_deleted_files = \"\"\"\n CREATE VIEW num_commented_lines_deleted_files AS\n SELECT COUNT(*) AS value\n FROM line_detail ld, file_modification fm\n WHERE ld.file_modification_id = fm.id AND fm.status = \"deleted\" AND (ld.is_commented = 1 OR ld.is_partially_commented = 1);\n \"\"\"\n\n num_commented_lines_present_files = \"\"\"\n CREATE VIEW num_commented_lines_present_files AS\n SELECT (COUNT(*) - value) as value\n FROM line_detail ld, file_modification fm\n JOIN num_commented_lines_deleted_files ncldf\n WHERE ld.file_modification_id = fm.id AND (ld.is_commented = 1 OR ld.is_partially_commented = 1);\n \"\"\"\n\n num_lines_deleted_files = \"\"\"\n CREATE VIEW num_lines_deleted_files AS\n SELECT COUNT(*) AS value\n FROM line_detail ld, file_modification fm\n WHERE ld.file_modification_id = fm.id AND fm.status = \"deleted\";\n \"\"\"\n\n num_lines_present_files = \"\"\"\n CREATE VIEW num_lines_present_files AS\n SELECT (COUNT(*) - value) as value\n FROM line_detail ld, file_modification fm\n JOIN num_lines_deleted_files nldf\n WHERE ld.file_modification_id = fm.id;\n \"\"\"\n\n num_distinct_commits = \"\"\"\n CREATE VIEW num_distinct_commits AS\n SELECT COUNT(*) as value FROM commit c;\n \"\"\"\n\n num_commits_in_references = \"\"\"\n CREATE VIEW num_commits_in_references AS\n SELECT COUNT(*) as value FROM commit_in_reference cin;\n \"\"\"\n\n num_developers = \"\"\"\n CREATE VIEW num_developers AS\n SELECT COUNT(*) as value FROM developer d;\n \"\"\"\n\n repo_metrics = \"\"\"\n CREATE VIEW repo_metrics AS\n SELECT\n a.value as num_files_deleted,\n b.value as num_files_present,\n c.value as num_branches,\n d.value as avg_number_file_modification_per_commit,\n e.value as num_empty_lines_deleted_files,\n f.value as num_empty_lines_present_files,\n g.value as num_commented_lines_deleted_files,\n h.value as num_commented_lines_present_files,\n i.value as num_lines_deleted_files,\n l.value as num_lines_present_files,\n m.value as num_distinct_commits,\n n.value as num_commits_in_references,\n o.value as num_developers\n FROM num_files_deleted a\n JOIN num_files_present b\n JOIN num_branches c\n JOIN avg_number_file_modification_per_commit d\n JOIN num_empty_lines_deleted_files e\n JOIN num_empty_lines_present_files f\n JOIN num_commented_lines_deleted_files g\n JOIN num_commented_lines_present_files h\n JOIN num_lines_deleted_files i\n JOIN num_lines_present_files l\n JOIN num_distinct_commits m\n JOIN num_commits_in_references n\n JOIN num_developers o;\n \"\"\"\n\n developer_weekly_activity_metrics = \"\"\"\n CREATE VIEW developer_activity_metrics AS\n SELECT\n YEAR(c.authored_date) as year,\n WEEK(c.authored_date) as week,\n d.name as author,\n SUM(fm.additions) as insertions,\n SUM(fm.deletions) as deletions\n FROM\n developer d,\n commit c,\n file_modification fm\n WHERE\n c.author_id = d.id AND c.id = fm.commit_id\n GROUP BY\n WEEK(c.authored_date), YEAR(c.authored_date), d.id;\n \"\"\"\n\n totalChanges = \"\"\"\n CREATE VIEW totalChanges AS\n SELECT COUNT(DISTINCT fm.id) AS value FROM file_modification fm;\n \"\"\"\n\n num_commented_lines_per_author = \"\"\"\n CREATE VIEW num_commented_lines_per_author AS\n SELECT c.author_id, COUNT(*) as value\n FROM line_detail ld, file_modification fm, commit c\n WHERE ld.file_modification_id = fm.id AND c.id = fm.commit_id AND type = 'addition' AND (ld.is_commented = 1 OR ld.is_partially_commented = 1)\n GROUP BY c.author_id;\n \"\"\"\n\n num_total_commented_lines = \"\"\"\n CREATE VIEW num_total_commented_lines AS\n SELECT COUNT(*) as value\n FROM line_detail ld, file_modification fm, commit c\n WHERE ld.file_modification_id = fm.id AND c.id = fm.commit_id AND type = 'addition' AND (ld.is_commented = 1 OR ld.is_partially_commented = 1);\n \"\"\"\n\n developer_project_activity_metrics = \"\"\"\n CREATE VIEW developer_project_activity_metrics AS\n SELECT\n d.name as author,\n COUNT(DISTINCT c.id) as commits,\n SUM(fm.additions) as insertions,\n SUM(fm.deletions) as deletions,\n ROUND((COUNT(DISTINCT fm.id)/total.value)*100, 2) as perc_changes,\n nclpa.value AS num_commented_lines_per_author,\n ROUND((nclpa.value/ntcl.value)*100, 2) AS perc_commented_lines\n FROM\n developer d,\n commit c,\n file_modification fm\n JOIN\n totalChanges as total\n JOIN\n num_commented_lines_per_author as nclpa\n JOIN\n num_total_commented_lines as ntcl\n WHERE\n c.author_id = d.id AND c.id = fm.commit_id AND nclpa.author_id = d.id\n GROUP BY\n d.id;\n \"\"\"\n\n cursor.execute(num_files_deleted)\n cursor.execute(num_files_present)\n cursor.execute(num_branches)\n cursor.execute(number_file_modification_per_commit)\n cursor.execute(avg_number_file_modification_per_commit)\n cursor.execute(num_empty_lines_deleted_files)\n cursor.execute(num_empty_lines_present_files)\n cursor.execute(num_commented_lines_deleted_files)\n cursor.execute(num_commented_lines_present_files)\n cursor.execute(num_lines_deleted_files)\n cursor.execute(num_lines_present_files)\n cursor.execute(num_distinct_commits)\n cursor.execute(num_commits_in_references)\n cursor.execute(num_developers)\n cursor.execute(repo_metrics)\n\n cursor.execute(developer_weekly_activity_metrics)\n\n cursor.execute(totalChanges)\n cursor.execute(num_commented_lines_per_author)\n cursor.execute(num_total_commented_lines)\n cursor.execute(developer_project_activity_metrics)\n\n cursor.close()", "metadata": "root.InitDbSchema.init_views", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 33 }, { "content": " def init_functions(self):\n cursor = self.cnx.cursor()\n\n get_file_history = \"\"\"\n CREATE DEFINER=`root`@`localhost` FUNCTION `get_file_history`(_file_id INT) RETURNS text CHARSET utf8\n BEGIN\n DECLARE _file_ids TEXT DEFAULT _file_id;\n DECLARE _prev INT;\n DECLARE _aux INT;\n\n SELECT previous_file_id INTO _prev\n FROM file_renamed\n WHERE current_file_id = _file_id;\n\n /* execute the loop until a previous version is found */\n WHILE _prev IS NOT NULL DO\n /* add the previous version file id to the _file_ids variable */\n SET _file_ids = CONCAT(_file_ids, ',' , _prev);\n\n SET _aux = _prev;\n SET _prev = NULL;\n\n SELECT previous_file_id INTO _prev\n FROM file_renamed\n WHERE current_file_id = _aux;\n\n END WHILE;\n RETURN _file_ids;\n END\"\"\"\n\n levenshtein_distance = \"\"\"\n CREATE DEFINER=`root`@`localhost` FUNCTION `levenshtein_distance`(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8) RETURNS int(11)\n DETERMINISTIC\n BEGIN\n DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT;\n DECLARE s1_char CHAR CHARACTER SET utf8;\n -- max strlen=255 for this function\n DECLARE cv0, cv1 VARBINARY(256);\n\n SET s1_len = CHAR_LENGTH(s1),\n s2_len = CHAR_LENGTH(s2),\n cv1 = 0x00,\n j = 1,\n i = 1,\n c = 0;\n\n IF (s1 = s2) THEN\n RETURN (0);\n ELSEIF (s1_len = 0) THEN\n RETURN (s2_len);\n ELSEIF (s2_len = 0) THEN\n RETURN (s1_len);\n END IF;\n\n WHILE (j <= s2_len) DO\n SET cv1 = CONCAT(cv1, CHAR(j)),\n j = j + 1;\n END WHILE;\n\n WHILE (i <= s1_len) DO\n SET s1_char = SUBSTRING(s1, i, 1),\n c = i,\n cv0 = CHAR(i),\n j = 1;\n\n WHILE (j <= s2_len) DO\n SET c = c + 1,\n cost = IF(s1_char = SUBSTRING(s2, j, 1), 0, 1);\n\n SET c_temp = ORD(SUBSTRING(cv1, j, 1)) + cost;\n IF (c > c_temp) THEN\n SET c = c_temp;\n END IF;\n\n SET c_temp = ORD(SUBSTRING(cv1, j+1, 1)) + 1;\n IF (c > c_temp) THEN\n SET c = c_temp;\n END IF;\n\n SET cv0 = CONCAT(cv0, CHAR(c)),\n j = j + 1;\n END WHILE;\n\n SET cv1 = cv0,\n i = i + 1;\n END WHILE;\n\n RETURN (c);\n END\"\"\"\n\n soundex_match = \"\"\"\n CREATE DEFINER=`root`@`localhost` FUNCTION `soundex_match`(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8) RETURNS int(1)\n DETERMINISTIC\n BEGIN\n DECLARE _result INT DEFAULT 0;\n IF SOUNDEX(s1) = SOUNDEX(s2) THEN\n SET _result = 1;\n END IF;\n RETURN _result;\n END\"\"\"\n\n cursor.execute(get_file_history)\n cursor.execute(levenshtein_distance)\n cursor.execute(soundex_match)\n cursor.close()", "metadata": "root.InitDbSchema.init_functions", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 246 }, { "content": " def init_stored_procedures(self):\n cursor = self.cnx.cursor()\n\n get_file_version = \"\"\"\n CREATE DEFINER=`root`@`localhost` PROCEDURE `get_file_version`(IN _file_id INTEGER, _date TEXT, by_line BOOL)\n BEGIN\n DECLARE invar INTEGER;\n DECLARE _file_ids TEXT;\n\n /* retrieve the previous version of the file */\n SET @invar = _file_id;\n PREPARE stmt FROM 'SELECT get_file_history(id) INTO @_file_ids FROM file WHERE id = ?';\n EXECUTE stmt using @invar;\n\n /* returns either the content per line or the compacted version */\n IF by_line THEN\n CALL get_file_history_by_line(@_file_ids, _date);\n ELSE\n CALL get_file_history_compact(@_file_ids, _date);\n END IF;\n END\"\"\"\n\n get_file_version_by_line = \"\"\"\n CREATE DEFINER=`root`@`localhost` PROCEDURE `get_file_version_by_line`(IN _file_ids TEXT, IN _date TEXT)\n BEGIN\n DECLARE _query TEXT DEFAULT\n CONCAT('SELECT SUBSTRING(add_cont, 2) as line_content\n FROM (\n SELECT ld.line_number, max(c.committed_date) AS last_committed_date\n FROM file_modification fm\n JOIN line_detail ld\n ON fm.id = ld.file_modification_id\n JOIN commit c\n ON fm.commit_id = c.id\n WHERE fm.file_id IN (', _file_ids, ') AND committed_date <= \\\\'', _date , '\\\\'\n group by ld.line_number) as last_mod\n left join\n (\n SELECT ld.line_number AS line, ld.content AS add_cont, c.committed_date as date\n FROM file_modification fm\n JOIN line_detail ld\n ON fm.id = ld.file_modification_id\n JOIN commit c\n ON fm.commit_id = c.id\n WHERE fm.file_id IN (', _file_ids, ') AND ld.type = \"addition\" AND committed_date <= \\\\'', _date, '\\\\'\n ) AS _add\n ON last_mod.line_number = _add.line AND last_mod.last_committed_date = _add.date\n WHERE add_cont IS NOT NULL\n ORDER BY last_mod.line_number;');\n DECLARE sql_query TEXT;\n SET @sql_query = _query;\n PREPARE stmt FROM @sql_query;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\n\n END\"\"\"\n\n get_file_version_compact = \"\"\"\n CREATE DEFINER=`root`@`localhost` PROCEDURE `get_file_version_compact`(IN _file_ids TEXT, IN _date TEXT)\n BEGIN\n DECLARE _query TEXT DEFAULT\n CONCAT('CREATE TEMPORARY TABLE _tmp AS\n SELECT SUBSTRING(add_cont, 2) as line_content\n FROM (\n SELECT ld.line_number, max(c.committed_date) AS last_committed_date\n FROM file_modification fm\n JOIN line_detail ld\n ON fm.id = ld.file_modification_id\n JOIN commit c\n ON fm.commit_id = c.id\n WHERE fm.file_id IN (', _file_ids, ') AND committed_date <= \\\\'', _date , '\\\\'\n group by ld.line_number) as last_mod\n left join\n (\n SELECT ld.line_number AS line, ld.content AS add_cont, c.committed_date as date\n FROM file_modification fm\n JOIN line_detail ld\n ON fm.id = ld.file_modification_id\n JOIN commit c\n ON fm.commit_id = c.id\n WHERE fm.file_id IN (', _file_ids, ') AND ld.type = \"addition\" AND committed_date <= \\\\'', _date, '\\\\'\n ) AS _add\n ON last_mod.line_number = _add.line AND last_mod.last_committed_date = _add.date\n WHERE add_cont IS NOT NULL\n ORDER BY last_mod.line_number;');\n DECLARE sql_query TEXT;\n DECLARE content LONGBLOB;\n DECLARE _txt BLOB;\n DECLARE done INT DEFAULT FALSE;\n DECLARE cur CURSOR FOR SELECT * FROM _tmp;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;\n\n /* drop _tmp table if exists */\n DROP TABLE IF EXISTS _tmp;\n\n /* create _tmp table */\n SET @sql_query = _query;\n PREPARE stmt FROM @sql_query;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\n\n /* iterate over the lines and fill the variable content */\n OPEN cur;\n FETCH cur INTO _txt;\n\n SET content = _txt;\n\n read_loop: LOOP\n FETCH cur into _txt;\n IF done THEN\n LEAVE read_loop;\n END IF;\n /* concat the line content to the variable content */\n SET content = CONCAT(content, '\\\\n', COALESCE(_txt, ''));\n END LOOP;\n\n CLOSE cur;\n\n /* drop _tmp table if exists */\n DROP TABLE IF EXISTS _tmp;\n /* return the conent variable */\n SELECT content;\n\n END\n \"\"\"\n\n cursor.execute(get_file_version)\n cursor.execute(get_file_version_by_line)\n cursor.execute(get_file_version_compact)\n\n cursor.close()", "metadata": "root.InitDbSchema.init_stored_procedures", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 352 }, { "content": " def init_tables(self):\n cursor = self.cnx.cursor()\n\n drop_database_if_exists = \"DROP DATABASE IF EXISTS \" + self.DB_NAME\n cursor.execute(drop_database_if_exists)\n\n create_database = \"CREATE DATABASE \" + self.DB_NAME\n cursor.execute(create_database)\n\n cursor.execute(\"set global innodb_file_format = BARRACUDA\")\n cursor.execute(\"set global innodb_file_format_max = BARRACUDA\")\n cursor.execute(\"set global innodb_large_prefix = ON\")\n cursor.execute(\"set global character_set_server = utf8\")\n\n create_table_repositories = \"CREATE TABLE \" + self.DB_NAME + \".repository( \" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"name varchar(255), \" \\\n \"INDEX n (name), \" \\\n \"CONSTRAINT name UNIQUE (name)\" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_references = \"CREATE TABLE \" + self.DB_NAME + \".reference( \" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"repo_id int(20), \" \\\n \"name varchar(255), \" \\\n \"type varchar(255), \" \\\n \"INDEX n (name), \" \\\n \"CONSTRAINT name UNIQUE (name) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_developers = \"CREATE TABLE \" + self.DB_NAME + \".developer( \" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"name varchar(256), \" \\\n \"email varchar(256), \" \\\n \"INDEX ne (name, email), \" \\\n \"CONSTRAINT naem UNIQUE (name, email) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_commits = \"CREATE TABLE \" + self.DB_NAME + \".commit(\" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"repo_id int(20), \" \\\n \"sha varchar(512), \" \\\n \"message varchar(512), \" \\\n \"author_id int(20), \" \\\n \"committer_id int(20), \" \\\n \"authored_date timestamp, \" \\\n \"committed_date timestamp, \" \\\n \"size int(20), \" \\\n \"INDEX sha (sha), \" \\\n \"CONSTRAINT s UNIQUE (sha) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_commit_parent = \"CREATE TABLE \" + self.DB_NAME + \".commit_parent(\" \\\n \"repo_id int(20), \" \\\n \"commit_id int(20), \" \\\n \"commit_sha varchar(512), \" \\\n \"parent_id int(20), \" \\\n \"parent_sha varchar(512), \" \\\n \"PRIMARY KEY copa (repo_id, commit_id, parent_id), \" \\\n \"INDEX csha (commit_sha), \" \\\n \"INDEX psha (parent_sha), \" \\\n \"CONSTRAINT cshapsha UNIQUE (repo_id, commit_id, parent_sha) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_commits2reference = \"CREATE TABLE \" + self.DB_NAME + \".commit_in_reference(\" \\\n \"repo_id int(20), \" \\\n \"commit_id int(20), \" \\\n \"ref_id int(20), \" \\\n \"PRIMARY KEY core (commit_id, ref_id) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_files = \"CREATE TABLE \" + self.DB_NAME + \".file( \" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"repo_id int(20), \" \\\n \"name varchar(255), \" \\\n \"ext varchar(255), \" \\\n \"ref_id int(20), \" \\\n \"INDEX rrn (repo_id, ref_id, name), \" \\\n \"CONSTRAINT rerena UNIQUE (repo_id, ref_id, name) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_file_renamed = \"CREATE TABLE \" + self.DB_NAME + \".file_renamed ( \" \\\n \"repo_id int(20), \" \\\n \"current_file_id int(20), \" \\\n \"previous_file_id int(20), \" \\\n \"PRIMARY KEY rena (current_file_id, previous_file_id), \" \\\n \"INDEX current (current_file_id), \" \\\n \"INDEX previous (previous_file_id) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_file_modifications = \"CREATE TABLE \" + self.DB_NAME + \".file_modification( \" \\\n \"id int(20) AUTO_INCREMENT PRIMARY KEY, \" \\\n \"commit_id int(20), \" \\\n \"file_id int(20), \" \\\n \"status varchar(10), \" \\\n \"additions numeric(10), \" \\\n \"deletions numeric(10), \" \\\n \"changes numeric(10), \" \\\n \"patch longblob, \" \\\n \"INDEX c (commit_id), \" \\\n \"INDEX f (file_id) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n create_table_lines = \"CREATE TABLE \" + self.DB_NAME + \".line_detail( \" \\\n \"file_modification_id int(11),\" \\\n \"type varchar(25), \" \\\n \"line_number numeric(20), \" \\\n \"is_commented numeric(1), \" \\\n \"is_partially_commented numeric(1), \" \\\n \"is_empty numeric(1), \" \\\n \"content longblob, \" \\\n \"PRIMARY KEY fityli (file_modification_id, type, line_number), \" \\\n \"INDEX fi (file_modification_id) \" \\\n \") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\"\n\n use_database = \"USE \" + self.DB_NAME\n\n cursor.execute(create_table_repositories)\n cursor.execute(create_table_references)\n cursor.execute(create_table_developers)\n cursor.execute(create_table_commits)\n cursor.execute(create_table_commit_parent)\n cursor.execute(create_table_commits2reference)\n cursor.execute(create_table_files)\n cursor.execute(create_table_file_renamed)\n cursor.execute(create_table_file_modifications)\n cursor.execute(create_table_lines)\n cursor.execute(use_database)\n cursor.close()\n return", "metadata": "root.InitDbSchema.init_tables", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 484 }, { "content": " def execute(self):\n\n start_time = datetime.now()\n self.init_database()\n self.cnx.close()\n end_time = datetime.now()\n\n minutes_and_seconds = divmod((end_time-start_time).total_seconds(), 60)\n self.logger.info(\"InitDbSchema: process finished after \" + str(minutes_and_seconds[0])\n + \" minutes and \" + str(round(minutes_and_seconds[1], 1)) + \" secs\")\n return", "metadata": "root.InitDbSchema.execute", "header": "['class', 'InitDbSchema', '(', ')', ':', '___EOS___']", "index": 615 } ]
[ { "span": "from mysql.connector import errorcode", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "atl", "an", "mod", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mysql_", "._", "connector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mysql_", "._", "connector_", "import_", "errorcode", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "db", "\\u", "name_", ",_", "logger_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "=_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "DB", "\\u", "NAME_", "=_", "db", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "'", "root", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "root", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "'", "3306", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "raise", "\\u", "on", "\\u", "warn", "ings", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "charset", "'_", ":_", "'", "utf", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "buffered", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cnx_", "=_", "mysql_", "._", "connector_", "._", "connect_", "(_", "**_", "CONFIG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "database_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "views_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "functions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "store", "d\\u", "procedure", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "views_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "cnx_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "files", "\\u", "deleted_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "files", "\\u", "delete", "d", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(", "DIST", "INC", "T", " ", "fm", ".", "file", "\\u", "id", ")", " ", "AS", " ", "value", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", " ", "WHE", "RE", " ", "fm", ".", "status", " ", "=", " ", "\"", "delete", "d", "\";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "files", "\\u", "present_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "files", "\\u", "presen", "t", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "(", "COUNT", "(*", ")", " ", "-", " ", "value", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "file", " ", "f", " ", "JOIN", " ", "num", "\\u", "files", "\\u", "delete", "d", " ", "nf", "d", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "branches_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "branch", "es", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "reference", " ", "r", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(", "DIST", "INC", "T", " ", "fm", ".", "file", "\\u", "id", ")", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "GROU", "P", " ", "BY", " ", "fm", ".", "commit", "\\u", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avg", "\\u", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "avg", "\\u", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "AVG", "(", "value", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "fm", ".", "status", " ", "=", " ", "\"", "delete", "d", "\"", " ", "AND", " ", "ld", ".", "is", "\\u", "empty", " ", "=", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "empty", "\\u", "lines", "\\u", "presen", "t", "\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "(", "COUNT", "(*", ")", " ", "-", " ", "value", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "nel", "df", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "ld", ".", "is", "\\u", "empty", " ", "=", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "fm", ".", "status", " ", "=", " ", "\"", "delete", "d", "\"", " ", "AND", " ", "(", "ld", ".", "is", "\\u", "commente", "d", " ", "=", " ", "1", " ", "OR", " ", "ld", ".", "is", "\\u", "partial", "ly", "\\u", "commente", "d", " ", "=", " ", "1", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "presen", "t", "\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "(", "COUNT", "(*", ")", " ", "-", " ", "value", ")", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "ncl", "df", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "(", "ld", ".", "is", "\\u", "commente", "d", " ", "=", " ", "1", " ", "OR", " ", "ld", ".", "is", "\\u", "partial", "ly", "\\u", "commente", "d", " ", "=", " ", "1", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "AS", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "fm", ".", "status", " ", "=", " ", "\"", "delete", "d", "\";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "lines", "\\u", "presen", "t", "\\u", "files_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "(", "COUNT", "(*", ")", " ", "-", " ", "value", ")", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "nl", "df", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "distinct", "\\u", "commits_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "distinct", "\\u", "commit", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "as", " ", "value", " ", "FROM", " ", "commit", " ", "c", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "commit", "s", "\\u", "in", "\\u", "references_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "commit", "s", "\\u", "in", "\\u", "reference", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "as", " ", "value", " ", "FROM", " ", "commit", "\\u", "in", "\\u", "reference", " ", "cin", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "developer", "s_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "developer", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "as", " ", "value", " ", "FROM", " ", "developer", " ", "d", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "metrics_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "repo", "\\u", "metric", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", "\\", "10", ";", " ", " ", " ", " ", "a", ".", "value", " ", "as", " ", "num", "\\u", "files", "\\u", "delete", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "b", ".", "value", " ", "as", " ", "num", "\\u", "files", "\\u", "presen", "t", ",", "\\", "10", ";", " ", " ", " ", " ", "c", ".", "value", " ", "as", " ", "num", "\\u", "branch", "es", ",", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "value", " ", "as", " ", "avg", "\\u", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit", ",", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "value", " ", "as", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "f", ".", "value", " ", "as", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "g", ".", "value", " ", "as", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "h", ".", "value", " ", "as", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "presen", "t", "\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "i", ".", "value", " ", "as", " ", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "l", ".", "value", " ", "as", " ", "num", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", ",", "\\", "10", ";", " ", " ", " ", " ", "m", ".", "value", " ", "as", " ", "num", "\\u", "distinct", "\\u", "commit", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "n", ".", "value", " ", "as", " ", "num", "\\u", "commit", "s", "\\u", "in", "\\u", "reference", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "o", ".", "value", " ", "as", " ", "num", "\\u", "developer", "s", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "num", "\\u", "files", "\\u", "delete", "d", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "files", "\\u", "presen", "t", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "branch", "es", " ", "c", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "avg", "\\u", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit", " ", "d", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "e", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "empty", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "g", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "h", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files", " ", "i", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "lines", "\\u", "presen", "t", "\\u", "files", " ", "l", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "distinct", "\\u", "commit", "s", " ", "m", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "commit", "s", "\\u", "in", "\\u", "reference", "s", " ", "n", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "num", "\\u", "developer", "s", " ", "o", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "developer", "\\u", "week", "ly", "\\u", "activit", "y", "\\u", "metrics_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "developer", "\\u", "activit", "y", "\\u", "metric", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", "\\", "10", ";", " ", " ", " ", " ", "YEA", "R", "(", "c", ".", "author", "ed", "\\u", "date", ")", " ", "as", " ", "year", ",", "\\", "10", ";", " ", " ", " ", " ", "WEEK", "(", "c", ".", "author", "ed", "\\u", "date", ")", " ", "as", " ", "week", ",", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "name", " ", "as", " ", "author", ",", "\\", "10", ";", " ", " ", " ", " ", "SUM", "(", "fm", ".", "additions", ")", " ", "as", " ", "insertion", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "SUM", "(", "fm", ".", "deletion", "s", ")", " ", "as", " ", "deletion", "s", "\\", "10", ";", " ", " ", " ", " ", "FROM", "\\", "10", ";", " ", " ", " ", " ", "developer", " ", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "commit", " ", "c", ",", "\\", "10", ";", " ", " ", " ", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", "\\", "10", ";", " ", " ", " ", " ", "c", ".", "author", "\\u", "id", " ", "=", " ", "d", ".", "id", " ", "AND", " ", "c", ".", "id", " ", "=", " ", "fm", ".", "commit", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "GROU", "P", " ", "BY", "\\", "10", ";", " ", " ", " ", " ", "WEEK", "(", "c", ".", "author", "ed", "\\u", "date", "),", " ", "YEA", "R", "(", "c", ".", "author", "ed", "\\u", "date", "),", " ", "d", ".", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "Changes_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "total", "Change", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(", "DIST", "INC", "T", " ", "fm", ".", "id", ")", " ", "AS", " ", "value", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "per", "\\u", "author_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "per", "\\u", "author", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "c", ".", "author", "\\u", "id", ",", " ", "COUNT", "(*", ")", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", ",", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "c", ".", "id", " ", "=", " ", "fm", ".", "commit", "\\u", "id", " ", "AND", " ", "type", " ", "=", " ", "'", "addition", "'", " ", "AND", " ", "(", "ld", ".", "is", "\\u", "commente", "d", " ", "=", " ", "1", " ", "OR", " ", "ld", ".", "is", "\\u", "partial", "ly", "\\u", "commente", "d", " ", "=", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "GROU", "P", " ", "BY", " ", "c", ".", "author", "\\u", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "total", "\\u", "commente", "d\\u", "lines_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "num", "\\u", "total", "\\u", "commente", "d\\u", "lines", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", " ", "as", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "line", "\\u", "deta", "il", " ", "ld", ",", " ", "file", "\\u", "modification", " ", "fm", ",", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", " ", "=", " ", "fm", ".", "id", " ", "AND", " ", "c", ".", "id", " ", "=", " ", "fm", ".", "commit", "\\u", "id", " ", "AND", " ", "type", " ", "=", " ", "'", "addition", "'", " ", "AND", " ", "(", "ld", ".", "is", "\\u", "commente", "d", " ", "=", " ", "1", " ", "OR", " ", "ld", ".", "is", "\\u", "partial", "ly", "\\u", "commente", "d", " ", "=", " ", "1", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "developer", "\\u", "project", "\\u", "activit", "y", "\\u", "metrics_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "VIEW", " ", "developer", "\\u", "project", "\\u", "activit", "y", "\\u", "metric", "s", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "name", " ", "as", " ", "author", ",", "\\", "10", ";", " ", " ", " ", " ", "COUNT", "(", "DIST", "INC", "T", " ", "c", ".", "id", ")", " ", "as", " ", "commit", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "SUM", "(", "fm", ".", "additions", ")", " ", "as", " ", "insertion", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "SUM", "(", "fm", ".", "deletion", "s", ")", " ", "as", " ", "deletion", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "ROUND", "((", "COUNT", "(", "DIST", "INC", "T", " ", "fm", ".", "id", ")/", "total", ".", "value", ")*", "100", ",", " ", "2", ")", " ", "as", " ", "perc", "\\u", "change", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "ncl", "pa", ".", "value", " ", "AS", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "per", "\\u", "author", ",", "\\", "10", ";", " ", " ", " ", " ", "ROUND", "((", "ncl", "pa", ".", "value", "/", "nt", "cl", ".", "value", ")*", "100", ",", " ", "2", ")", " ", "AS", " ", "perc", "\\u", "commente", "d\\u", "lines", "\\", "10", ";", " ", " ", " ", " ", "FROM", "\\", "10", ";", " ", " ", " ", " ", "developer", " ", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "commit", " ", "c", ",", "\\", "10", ";", " ", " ", " ", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", "JOIN", "\\", "10", ";", " ", " ", " ", " ", "total", "Change", "s", " ", "as", " ", "total", "\\", "10", ";", " ", " ", " ", " ", "JOIN", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "commente", "d\\u", "lines", "\\u", "per", "\\u", "author", " ", "as", " ", "ncl", "pa", "\\", "10", ";", " ", " ", " ", " ", "JOIN", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "total", "\\u", "commente", "d\\u", "lines", " ", "as", " ", "nt", "cl", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", "\\", "10", ";", " ", " ", " ", " ", "c", ".", "author", "\\u", "id", " ", "=", " ", "d", ".", "id", " ", "AND", " ", "c", ".", "id", " ", "=", " ", "fm", ".", "commit", "\\u", "id", " ", "AND", " ", "ncl", "pa", ".", "author", "\\u", "id", " ", "=", " ", "d", ".", "id", "\\", "10", ";", " ", " ", " ", " ", "GROU", "P", " ", "BY", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "files", "\\u", "deleted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "files", "\\u", "present_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "branches_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "avg", "\\u", "number", "\\u", "file", "\\u", "modification", "\\u", "per", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "empty", "\\u", "lines", "\\u", "delete", "d\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "empty", "\\u", "lines", "\\u", "presen", "t", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "delete", "d\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "presen", "t", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "lines", "\\u", "delete", "d\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "lines", "\\u", "presen", "t", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "distinct", "\\u", "commits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "commit", "s", "\\u", "in", "\\u", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "developer", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "repo", "\\u", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "developer", "\\u", "week", "ly", "\\u", "activit", "y", "\\u", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "total", "Changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "commente", "d\\u", "lines", "\\u", "per", "\\u", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "num", "\\u", "total", "\\u", "commente", "d\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "developer", "\\u", "project", "\\u", "activit", "y", "\\u", "metrics_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "functions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "cnx_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "file", "\\u", "history_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "FUNC", "TIO", "N", " ", "`", "get", "\\u", "file", "\\u", "histo", "ry", "`", "(\\u", "file", "\\u", "id", " ", "INT", ")", " ", "RETURN", "S", " ", "text", " ", "CHARS", "ET", " ", "utf", "8", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "file", "\\u", "ids", " ", "TEXT", " ", "DEF", "AUL", "T", " ", "\\u", "file", "\\u", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "prev", " ", "INT", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "aux", " ", "INT", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "previ", "ous", "\\u", "file", "\\u", "id", " ", "INT", "O", " ", "\\u", "prev", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "renamed", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "current", "\\u", "file", "\\u", "id", " ", "=", " ", "\\u", "file", "\\u", "id", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "execute", " ", "the", " ", "loop", " ", "unti", "l", " ", "a", " ", "previ", "ous", " ", "version", " ", "is", " ", "found", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "WH", "ILE", " ", "\\u", "prev", " ", "IS", " ", "NOT", " ", "NULL", " ", "DO", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "add", " ", "the", " ", "previ", "ous", " ", "version", " ", "file", " ", "id", " ", "to", " ", "the", " ", "\\u", "file", "\\u", "ids", " ", "variab", "le", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "\\u", "file", "\\u", "ids", " ", "=", " ", "CONC", "AT", "(\\u", "file", "\\u", "ids", ",", " ", "','", " ", ",", " ", "\\u", "prev", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "\\u", "aux", " ", "=", " ", "\\u", "prev", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "\\u", "prev", " ", "=", " ", "NULL", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "previ", "ous", "\\u", "file", "\\u", "id", " ", "INT", "O", " ", "\\u", "prev", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "renamed", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "current", "\\u", "file", "\\u", "id", " ", "=", " ", "\\u", "aux", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "WH", "ILE", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", " ", "\\u", "file", "\\u", "ids", ";", "\\", "10", ";", " ", " ", " ", " ", "END", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "leve", "nsh", "tein", "\\u", "distance_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "FUNC", "TIO", "N", " ", "`", "leve", "nsh", "tein", "\\u", "distance", "`", "(", "s1", " ", "VARCHA", "R", "(", "255", ")", " ", "CHARACTER", " ", "SET", " ", "utf", "8", ",", " ", "s2", " ", "VARCHA", "R", "(", "255", ")", " ", "CHARACTER", " ", "SET", " ", "utf", "8", ")", " ", "RETURN", "S", " ", "int", "(", "11", ")", "\\", "10", ";", " ", " ", " ", " ", "DET", "ERM", "INI", "STIC", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "s1", "\\u", "len", ",", " ", "s2", "\\u", "len", ",", " ", "i", ",", " ", "j", ",", " ", "c", ",", " ", "c\\u", "temp", ",", " ", "cost", " ", "INT", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "s1", "\\u", "char", " ", "CHAR", " ", "CHARACTER", " ", "SET", " ", "utf", "8", ";", "\\", "10", ";", " ", " ", " ", " ", "--", " ", "max", " ", "strl", "en", "=", "255", " ", "for", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "cv", "0", ",", " ", "cv", "1", " ", "VAR", "BIN", "ARY", "(", "256", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "s1", "\\u", "len", " ", "=", " ", "CHAR", "\\u", "LENGTH", "(", "s1", "),", "\\", "10", ";", " ", " ", " ", " ", "s2", "\\u", "len", " ", "=", " ", "CHAR", "\\u", "LENGTH", "(", "s2", "),", "\\", "10", ";", " ", " ", " ", " ", "cv", "1", " ", "=", " ", "0x00", ",", "\\", "10", ";", " ", " ", " ", " ", "j", " ", "=", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "i", " ", "=", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "c", " ", "=", " ", "0", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "(", "s1", " ", "=", " ", "s2", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "RETURN", " ", "(", "0", ");", "\\", "10", ";", " ", " ", " ", " ", "ELS", "EI", "F", " ", "(", "s1", "\\u", "len", " ", "=", " ", "0", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "RETURN", " ", "(", "s2", "\\u", "len", ");", "\\", "10", ";", " ", " ", " ", " ", "ELS", "EI", "F", " ", "(", "s2", "\\u", "len", " ", "=", " ", "0", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "RETURN", " ", "(", "s1", "\\u", "len", ");", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WH", "ILE", " ", "(", "j", " ", "<=", " ", "s2", "\\u", "len", ")", " ", "DO", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SET", " ", "cv", "1", " ", "=", " ", "CONC", "AT", "(", "cv", "1", ",", " ", "CHAR", "(", "j", "))", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "j", " ", "=", " ", "j", " ", "+", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "WH", "ILE", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WH", "ILE", " ", "(", "i", " ", "<=", " ", "s1", "\\u", "len", ")", " ", "DO", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SET", " ", "s1", "\\u", "char", " ", "=", " ", "SUBST", "RING", "(", "s1", ",", " ", "i", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "c", " ", "=", " ", "i", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cv", "0", " ", "=", " ", "CHAR", "(", "i", "),", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "j", " ", "=", " ", "1", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WH", "ILE", " ", "(", "j", " ", "<=", " ", "s2", "\\u", "len", ")", " ", "DO", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "c", " ", "=", " ", "c", " ", "+", " ", "1", ",", "\\", "10", ";", " ", " ", "cost", " ", "=", " ", "IF", "(", "s1", "\\u", "char", " ", "=", " ", "SUBST", "RING", "(", "s2", ",", " ", "j", ",", " ", "1", "),", " ", "0", ",", " ", "1", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "c\\u", "temp", " ", "=", " ", "ORD", "(", "SUBST", "RING", "(", "cv", "1", ",", " ", "j", ",", " ", "1", "))", " ", "+", " ", "cost", ";", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "(", "c", " ", ">", " ", "c\\u", "temp", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SET", " ", "c", " ", "=", " ", "c\\u", "temp", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "c\\u", "temp", " ", "=", " ", "ORD", "(", "SUBST", "RING", "(", "cv", "1", ",", " ", "j", "+", "1", ",", " ", "1", "))", " ", "+", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "(", "c", " ", ">", " ", "c\\u", "temp", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SET", " ", "c", " ", "=", " ", "c\\u", "temp", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "cv", "0", " ", "=", " ", "CONC", "AT", "(", "cv", "0", ",", " ", "CHAR", "(", "c", "))", ",", "\\", "10", ";", " ", " ", "j", " ", "=", " ", "j", " ", "+", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "END", " ", "WH", "ILE", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SET", " ", "cv", "1", " ", "=", " ", "cv", "0", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "i", " ", "=", " ", "i", " ", "+", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "WH", "ILE", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", " ", "(", "c", ");", "\\", "10", ";", " ", " ", " ", " ", "END", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sound", "ex", "\\u", "match_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "FUNC", "TIO", "N", " ", "`", "sound", "ex", "\\u", "match", "`", "(", "s1", " ", "VARCHA", "R", "(", "255", ")", " ", "CHARACTER", " ", "SET", " ", "utf", "8", ",", " ", "s2", " ", "VARCHA", "R", "(", "255", ")", " ", "CHARACTER", " ", "SET", " ", "utf", "8", ")", " ", "RETURN", "S", " ", "int", "(", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "DET", "ERM", "INI", "STIC", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "result", " ", "INT", " ", "DEF", "AUL", "T", " ", "0", ";", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "SOUND", "EX", "(", "s1", ")", " ", "=", " ", "SOUND", "EX", "(", "s2", ")", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "\\u", "result", " ", "=", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", " ", "\\u", "result", ";", "\\", "10", ";", " ", " ", " ", " ", "END", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "get", "\\u", "file", "\\u", "history_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "leve", "nsh", "tein", "\\u", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "sound", "ex", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "store", "d\\u", "procedure", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "cnx_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "file", "\\u", "version_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "PROC", "EDU", "RE", " ", "`", "get", "\\u", "file", "\\u", "version", "`", "(", "IN", " ", "\\u", "file", "\\u", "id", " ", "INTEG", "ER", ",", " ", "\\u", "date", " ", "TEXT", ",", " ", "by", "\\u", "line", " ", "BOO", "L", ")", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "inva", "r", " ", "INTEG", "ER", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "file", "\\u", "ids", " ", "TEXT", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "retrieve", " ", "the", " ", "previ", "ous", " ", "version", " ", "of", " ", "the", " ", "file", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "@", "inva", "r", " ", "=", " ", "\\u", "file", "\\u", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "PREP", "ARE", " ", "stmt", " ", "FROM", " ", "'", "SELECT", " ", "get", "\\u", "file", "\\u", "histo", "ry", "(", "id", ")", " ", "INT", "O", " ", "@\\u", "file", "\\u", "ids", " ", "FROM", " ", "file", " ", "WHE", "RE", " ", "id", " ", "=", " ", "?'", ";", "\\", "10", ";", " ", " ", " ", " ", "EXECUTE", " ", "stmt", " ", "usi", "ng", " ", "@", "inva", "r", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "return", "s", " ", "eit", "her", " ", "the", " ", "content", " ", "per", " ", "line", " ", "or", " ", "the", " ", "compact", "ed", " ", "version", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "by", "\\u", "line", " ", "THE", "N", "\\", "10", ";", " ", " ", " ", " ", "CALL", " ", "get", "\\u", "file", "\\u", "histo", "ry", "\\u", "by", "\\u", "line", "(", "@\\u", "file", "\\u", "ids", ",", " ", "\\u", "date", ");", "\\", "10", ";", " ", " ", " ", " ", "ELS", "E", "\\", "10", ";", " ", " ", " ", " ", "CALL", " ", "get", "\\u", "file", "\\u", "histo", "ry", "\\u", "compact", "(", "@\\u", "file", "\\u", "ids", ",", " ", "\\u", "date", ");", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", " ", " ", " ", " ", "END", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "file", "\\u", "version", "\\u", "by", "\\u", "line_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "PROC", "EDU", "RE", " ", "`", "get", "\\u", "file", "\\u", "version", "\\u", "by", "\\u", "line", "`", "(", "IN", " ", "\\u", "file", "\\u", "ids", " ", "TEXT", ",", " ", "IN", " ", "\\u", "date", " ", "TEXT", ")", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "query", " ", "TEXT", " ", "DEF", "AUL", "T", "\\", "10", ";", " ", " ", " ", " ", "CONC", "AT", "('", "SELECT", " ", "SUBST", "RING", "(", "add", "\\u", "cont", ",", " ", "2", ")", " ", "as", " ", "line", "\\u", "content", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "(", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SELECT", " ", "ld", ".", "line", "\\u", "number", ",", " ", "max", "(", "c", ".", "committ", "ed", "\\u", "date", ")", " ", "AS", " ", "last", "\\u", "committ", "ed", "\\u", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "line", "\\u", "deta", "il", " ", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "id", " ", "=", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "commit", "\\u", "id", " ", "=", " ", "c", ".", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "fm", ".", "file", "\\u", "id", " ", "IN", " ", "('", ",", " ", "\\u", "file", "\\u", "ids", ",", " ", "')", " ", "AND", " ", "committ", "ed", "\\u", "date", " ", "<=", " ", "\\\\\\\\", "''", ",", " ", "\\u", "date", " ", ",", " ", "'\\\\\\\\", "'", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "group", " ", "by", " ", "ld", ".", "line", "\\u", "number", ")", " ", "as", " ", "last", "\\u", "mod", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "left", " ", "join", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SELECT", " ", "ld", ".", "line", "\\u", "number", " ", "AS", " ", "line", ",", " ", "ld", ".", "content", " ", "AS", " ", "add", "\\u", "cont", ",", " ", "c", ".", "committ", "ed", "\\u", "date", " ", "as", " ", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "line", "\\u", "deta", "il", " ", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "id", " ", "=", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "commit", "\\u", "id", " ", "=", " ", "c", ".", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "fm", ".", "file", "\\u", "id", " ", "IN", " ", "('", ",", " ", "\\u", "file", "\\u", "ids", ",", " ", "')", " ", "AND", " ", "ld", ".", "type", " ", "=", " ", "\"", "addition", "\"", " ", "AND", " ", "committ", "ed", "\\u", "date", " ", "<=", " ", "\\\\\\\\", "''", ",", " ", "\\u", "date", ",", " ", "'\\\\\\\\", "'", "\\", "10", ";", " ", " ", " ", " ", " ", " ", ")", " ", "AS", " ", "\\u", "add", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "last", "\\u", "mod", ".", "line", "\\u", "number", " ", "=", " ", "\\u", "add", ".", "line", " ", "AND", " ", "last", "\\u", "mod", ".", "last", "\\u", "committ", "ed", "\\u", "date", " ", "=", " ", "\\u", "add", ".", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "add", "\\u", "cont", " ", "IS", " ", "NOT", " ", "NULL", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ORDE", "R", " ", "BY", " ", "last", "\\u", "mod", ".", "line", "\\u", "number", ";'", ");", "\\", "10", ";", " ", " ", " ", " ", " ", "DECL", "ARE", " ", "sql", "\\u", "query", " ", "TEXT", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "SET", " ", "@", "sql", "\\u", "query", " ", "=", " ", "\\u", "query", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "PREP", "ARE", " ", "stmt", " ", "FROM", " ", "@", "sql", "\\u", "query", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "EXECUTE", " ", "stmt", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "DEA", "LLO", "CATE", " ", "PREP", "ARE", " ", "stmt", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "END", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "file", "\\u", "version", "\\u", "compact_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "DEFINE", "R", "=", "`", "root", "`", "@", "`", "local", "host", "`", " ", "PROC", "EDU", "RE", " ", "`", "get", "\\u", "file", "\\u", "version", "\\u", "compact", "`", "(", "IN", " ", "\\u", "file", "\\u", "ids", " ", "TEXT", ",", " ", "IN", " ", "\\u", "date", " ", "TEXT", ")", "\\", "10", ";", " ", " ", " ", " ", "BEGIN", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "query", " ", "TEXT", " ", "DEF", "AUL", "T", "\\", "10", ";", " ", " ", " ", " ", "CONC", "AT", "('", "CREATE", " ", "TEMP", "ORA", "RY", " ", "TAB", "LE", " ", "\\u", "tmp", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SELECT", " ", "SUBST", "RING", "(", "add", "\\u", "cont", ",", " ", "2", ")", " ", "as", " ", "line", "\\u", "content", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "(", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SELECT", " ", "ld", ".", "line", "\\u", "number", ",", " ", "max", "(", "c", ".", "committ", "ed", "\\u", "date", ")", " ", "AS", " ", "last", "\\u", "committ", "ed", "\\u", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "line", "\\u", "deta", "il", " ", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "id", " ", "=", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "commit", "\\u", "id", " ", "=", " ", "c", ".", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "fm", ".", "file", "\\u", "id", " ", "IN", " ", "('", ",", " ", "\\u", "file", "\\u", "ids", ",", " ", "')", " ", "AND", " ", "committ", "ed", "\\u", "date", " ", "<=", " ", "\\\\\\\\", "''", ",", " ", "\\u", "date", " ", ",", " ", "'\\\\\\\\", "'", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "group", " ", "by", " ", "ld", ".", "line", "\\u", "number", ")", " ", "as", " ", "last", "\\u", "mod", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "left", " ", "join", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "SELECT", " ", "ld", ".", "line", "\\u", "number", " ", "AS", " ", "line", ",", " ", "ld", ".", "content", " ", "AS", " ", "add", "\\u", "cont", ",", " ", "c", ".", "committ", "ed", "\\u", "date", " ", "as", " ", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "FROM", " ", "file", "\\u", "modification", " ", "fm", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "line", "\\u", "deta", "il", " ", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "id", " ", "=", " ", "ld", ".", "file", "\\u", "modification", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "JOIN", " ", "commit", " ", "c", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "fm", ".", "commit", "\\u", "id", " ", "=", " ", "c", ".", "id", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "fm", ".", "file", "\\u", "id", " ", "IN", " ", "('", ",", " ", "\\u", "file", "\\u", "ids", ",", " ", "')", " ", "AND", " ", "ld", ".", "type", " ", "=", " ", "\"", "addition", "\"", " ", "AND", " ", "committ", "ed", "\\u", "date", " ", "<=", " ", "\\\\\\\\", "''", ",", " ", "\\u", "date", ",", " ", "'\\\\\\\\", "'", "\\", "10", ";", " ", " ", " ", " ", " ", " ", ")", " ", "AS", " ", "\\u", "add", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ON", " ", "last", "\\u", "mod", ".", "line", "\\u", "number", " ", "=", " ", "\\u", "add", ".", "line", " ", "AND", " ", "last", "\\u", "mod", ".", "last", "\\u", "committ", "ed", "\\u", "date", " ", "=", " ", "\\u", "add", ".", "date", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "add", "\\u", "cont", " ", "IS", " ", "NOT", " ", "NULL", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ORDE", "R", " ", "BY", " ", "last", "\\u", "mod", ".", "line", "\\u", "number", ";'", ");", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "sql", "\\u", "query", " ", "TEXT", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "content", " ", "LONG", "BLOB", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "\\u", "txt", " ", "BLOB", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "don", "e", " ", "INT", " ", "DEF", "AUL", "T", " ", "FAL", "SE", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "cur", " ", "CURSOR", " ", "FOR", " ", "SELECT", " ", "*", " ", "FROM", " ", "\\u", "tmp", ";", "\\", "10", ";", " ", " ", " ", " ", "DECL", "ARE", " ", "CONTINUE", " ", "HANDLER", " ", "FOR", " ", "NOT", " ", "FO", "UND", " ", "SET", " ", "don", "e", " ", "=", " ", "1", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "drop", " ", "\\u", "tmp", " ", "table", " ", "if", " ", "exist", "s", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "\\u", "tmp", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "create", " ", "\\u", "tmp", " ", "table", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "@", "sql", "\\u", "query", " ", "=", " ", "\\u", "query", ";", "\\", "10", ";", " ", " ", " ", " ", "PREP", "ARE", " ", "stmt", " ", "FROM", " ", "@", "sql", "\\u", "query", ";", "\\", "10", ";", " ", " ", " ", " ", "EXECUTE", " ", "stmt", ";", "\\", "10", ";", " ", " ", " ", " ", "DEA", "LLO", "CATE", " ", "PREP", "ARE", " ", "stmt", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "iterate", " ", "over", " ", "the", " ", "lines", " ", "and", " ", "fill", " ", "the", " ", "variab", "le", " ", "content", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "OPEN", " ", "cur", ";", "\\", "10", ";", " ", " ", " ", " ", "FETCH", " ", "cur", " ", "INT", "O", " ", "\\u", "txt", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "content", " ", "=", " ", "\\u", "txt", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "read", "\\u", "loop", ":", " ", "LOOP", "\\", "10", ";", " ", " ", " ", " ", "FETCH", " ", "cur", " ", "int", "o", " ", "\\u", "txt", ";", "\\", "10", ";", " ", " ", " ", " ", "IF", " ", "don", "e", " ", "THE", "N", "\\", "10", ";", " ", " ", "LEA", "VE", " ", "read", "\\u", "loop", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "IF", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "conc", "at", " ", "the", " ", "line", " ", "content", " ", "to", " ", "the", " ", "variab", "le", " ", "content", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "SET", " ", "content", " ", "=", " ", "CONC", "AT", "(", "content", ",", " ", "'\\\\\\\\", "n", "',", " ", "COA", "LES", "CE", "(\\u", "txt", ",", " ", "''", "))", ";", "\\", "10", ";", " ", " ", " ", " ", "END", " ", "LOOP", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLOSE", " ", "cur", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "drop", " ", "\\u", "tmp", " ", "table", " ", "if", " ", "exist", "s", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "\\u", "tmp", ";", "\\", "10", ";", " ", " ", " ", " ", "/*", " ", "return", " ", "the", " ", "cone", "nt", " ", "variab", "le", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "content", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "END", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "get", "\\u", "file", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "get", "\\u", "file", "\\u", "version", "\\u", "by", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "get", "\\u", "file", "\\u", "version", "\\u", "compact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "tables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "cnx_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drop", "\\u", "databa", "se", "\\u", "if", "\\u", "exists_", "=_", "\"", "DROP", " ", "DATA", "BASE", " ", "IF", " ", "EXIST", "S", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "drop", "\\u", "databa", "se", "\\u", "if", "\\u", "exists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "database_", "=_", "\"", "CREATE", " ", "DATA", "BASE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "set", " ", "global", " ", "inno", "db", "\\u", "file", "\\u", "format", " ", "=", " ", "BAR", "RAC", "UD", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "set", " ", "global", " ", "inno", "db", "\\u", "file", "\\u", "format\\u", "max", " ", "=", " ", "BAR", "RAC", "UD", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "set", " ", "global", " ", "inno", "db", "\\u", "large", "\\u", "prefix", " ", "=", " ", "ON", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "set", " ", "global", " ", "character", "\\u", "set\\u", "server", " ", "=", " ", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "repositories_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "repos", "itor", "y", "(", " ", "\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "name", " ", "var", "char", "(", "255", "),", " ", "\"_", "\"", "INDE", "X", " ", "n", " ", "(", "name", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "name", " ", "UNI", "QUE", " ", "(", "name", ")\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "references_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "reference", "(", " ", "\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "name", " ", "var", "char", "(", "255", "),", " ", "\"_", "\"", "type", " ", "var", "char", "(", "255", "),", " ", "\"_", "\"", "INDE", "X", " ", "n", " ", "(", "name", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "name", " ", "UNI", "QUE", " ", "(", "name", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "developer", "s_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "developer", "(", " ", "\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "name", " ", "var", "char", "(", "256", "),", " ", "\"_", "\"", "email", " ", "var", "char", "(", "256", "),", " ", "\"_", "\"", "INDE", "X", " ", "ne", " ", "(", "name", ",", " ", "email", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "na", "em", " ", "UNI", "QUE", " ", "(", "name", ",", " ", "email", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "commits_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "commit", "(\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "sha", " ", "var", "char", "(", "512", "),", " ", "\"_", "\"", "message", " ", "var", "char", "(", "512", "),", " ", "\"_", "\"", "author", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "committer", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "author", "ed", "\\u", "date", " ", "timestamp", ",", " ", "\"_", "\"", "committ", "ed", "\\u", "date", " ", "timestamp", ",", " ", "\"_", "\"", "size", " ", "int", "(", "20", "),", " ", "\"_", "\"", "INDE", "X", " ", "sha", " ", "(", "sha", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "s", " ", "UNI", "QUE", " ", "(", "sha", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "commit", "\\u", "parent_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "commit", "\\u", "parent", "(\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "commit", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "commit", "\\u", "sha", " ", "var", "char", "(", "512", "),", " ", "\"_", "\"", "parent", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "parent", "\\u", "sha", " ", "var", "char", "(", "512", "),", " ", "\"_", "\"", "PRIMA", "RY", " ", "KEY", " ", "cop", "a", " ", "(", "repo", "\\u", "id", ",", " ", "commit", "\\u", "id", ",", " ", "parent", "\\u", "id", "),", " ", "\"_", "\"", "INDE", "X", " ", "csh", "a", " ", "(", "commit", "\\u", "sha", "),", " ", "\"_", "\"", "INDE", "X", " ", "ps", "ha", " ", "(", "parent", "\\u", "sha", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "csh", "aps", "ha", " ", "UNI", "QUE", " ", "(", "repo", "\\u", "id", ",", " ", "commit", "\\u", "id", ",", " ", "parent", "\\u", "sha", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "commit", "s2", "reference_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "commit", "\\u", "in", "\\u", "reference", "(\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "commit", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "ref", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "PRIMA", "RY", " ", "KEY", " ", "core", " ", "(", "commit", "\\u", "id", ",", " ", "ref", "\\u", "id", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "files_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "file", "(", " ", "\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "name", " ", "var", "char", "(", "255", "),", " ", "\"_", "\"", "ext", " ", "var", "char", "(", "255", "),", " ", "\"_", "\"", "ref", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "INDE", "X", " ", "rr", "n", " ", "(", "repo", "\\u", "id", ",", " ", "ref", "\\u", "id", ",", " ", "name", "),", " ", "\"_", "\"", "CONSTR", "AIN", "T", " ", "rer", "ena", " ", "UNI", "QUE", " ", "(", "repo", "\\u", "id", ",", " ", "ref", "\\u", "id", ",", " ", "name", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "file", "\\u", "renamed", "_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "file", "\\u", "renamed", " ", "(", " ", "\"_", "\"", "repo", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "current", "\\u", "file", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "previ", "ous", "\\u", "file", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "PRIMA", "RY", " ", "KEY", " ", "rena", " ", "(", "current", "\\u", "file", "\\u", "id", ",", " ", "previ", "ous", "\\u", "file", "\\u", "id", "),", " ", "\"_", "\"", "INDE", "X", " ", "current", " ", "(", "current", "\\u", "file", "\\u", "id", "),", " ", "\"_", "\"", "INDE", "X", " ", "previ", "ous", " ", "(", "previ", "ous", "\\u", "file", "\\u", "id", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "file", "\\u", "modification", "s_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "file", "\\u", "modification", "(", " ", "\"_", "\"", "id", " ", "int", "(", "20", ")", " ", "AUTO", "\\u", "INCREMENT", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\"", "commit", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "file", "\\u", "id", " ", "int", "(", "20", "),", " ", "\"_", "\"", "status", " ", "var", "char", "(", "10", "),", " ", "\"_", "\"", "additions", " ", "numeri", "c", "(", "10", "),", " ", "\"_", "\"", "deletion", "s", " ", "numeri", "c", "(", "10", "),", " ", "\"_", "\"", "change", "s", " ", "numeri", "c", "(", "10", "),", " ", "\"_", "\"", "patch", " ", "long", "blob", ",", " ", "\"_", "\"", "INDE", "X", " ", "c", " ", "(", "commit", "\\u", "id", "),", " ", "\"_", "\"", "INDE", "X", " ", "f", " ", "(", "file", "\\u", "id", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "table", "\\u", "lines_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "+_", "\".", "line", "\\u", "deta", "il", "(", " ", "\"_", "\"", "file", "\\u", "modification", "\\u", "id", " ", "int", "(", "11", "),", "\"_", "\"", "type", " ", "var", "char", "(", "25", "),", " ", "\"_", "\"", "line", "\\u", "number", " ", "numeri", "c", "(", "20", "),", " ", "\"_", "\"", "is", "\\u", "commente", "d", " ", "numeri", "c", "(", "1", "),", " ", "\"_", "\"", "is", "\\u", "partial", "ly", "\\u", "commente", "d", " ", "numeri", "c", "(", "1", "),", " ", "\"_", "\"", "is", "\\u", "empty", " ", "numeri", "c", "(", "1", "),", " ", "\"_", "\"", "content", " ", "long", "blob", ",", " ", "\"_", "\"", "PRIMA", "RY", " ", "KEY", " ", "fit", "yli", " ", "(", "file", "\\u", "modification", "\\u", "id", ",", " ", "type", ",", " ", "line", "\\u", "number", "),", " ", "\"_", "\"", "INDE", "X", " ", "fi", " ", "(", "file", "\\u", "modification", "\\u", "id", ")", " ", "\"_", "\")", " ", "ENGINE", "=", "Inno", "DB", " ", "DEF", "AUL", "T", " ", "CHARS", "ET", "=", "utf", "8", " ", "ROW", "\\u", "FORMAT", "=", "DYNAMIC", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "database_", "=_", "\"", "USE", " ", "\"_", "+_", "self_", "._", "DB", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "repositories_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "developer", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "commits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "commit", "\\u", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "commit", "s2", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "file", "\\u", "renamed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "file", "\\u", "modification", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "create", "\\u", "table", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "use", "\\u", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ini", "t", "Db", "Schema_", "(_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cnx_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "minute", "s", "\\u", "and", "\\u", "seconds_", "=_", "divmod_", "(_", "(_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "\"", "Ini", "t", "Db", "Schema", ":", " ", "process", " ", "finish", "ed", " ", "after", " ", "\"_", "+_", "str_", "(_", "minute", "s", "\\u", "and", "\\u", "seconds_", "[_", "0_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "\"", " ", "minute", "s", " ", "and", " ", "\"_", "+_", "str_", "(_", "round_", "(_", "minute", "s", "\\u", "and", "\\u", "seconds_", "[_", "1_", "]_", ",_", "1_", ")_", ")_", "+_", "\"", " ", "secs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/lib/virt/config_capabilities.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui Core.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\n\"\"\" \n<comment-ja>\n</comment-ja>\n<comment-en>\nRead xml of libvirt's capabilities and load to object.\n!!! Notice: this is read-only parser. !!!\n</comment-en>\n\n@file: config_capabilities.py\n\n@author: Taizo ITO <taizo@karesansui-project.info>\n\nxml sample:\n-----------------------------------------------------------\n<capabilities>\n <host>\n <cpu>\n <arch>x86_64</arch>\n <model>pentium3</model>\n <topology sockets='1' cores='1' threads='1'/>\n <feature name='syscall'/>\n <feature name='hypervisor'/>\n <feature name='acpi'/>\n <feature name='apic'/>\n </cpu>\n <migration_features>\n <live/>\n <uri_transports>\n <uri_transport>tcp</uri_transport>\n </uri_transports>\n </migration_features>\n </host>\n <guest>\n <os_type>hvm</os_type>\n <arch name='i686'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu</emulator>\n <machine>pc-0.12</machine>\n <machine canonical='pc-0.12'>pc</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n <features>\n <cpuselection/>\n <pae/>\n <nonpae/>\n <acpi default='on' toggle='yes'/>\n <apic default='on' toggle='no'/>\n </features>\n </guest>\n <guest>\n <os_type>hvm</os_type>\n <arch name='x86_64'>\n <wordsize>64</wordsize>\n <emulator>/usr/bin/qemu-system-x86_64</emulator>\n <machine>pc-0.12</machine>\n <machine canonical='pc-0.12'>pc</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n <features>\n <cpuselection/>\n <acpi default='on' toggle='yes'/>\n <apic default='on' toggle='no'/>\n </features>\n </guest>\n</capabilities>\n-----------------------------------------------------------\n\n\"\"\"\n\nimport os\nimport time\n\nfrom StringIO import StringIO\nimport errno\n\nimport karesansui\n\nfrom karesansui.lib.utils import get_xml_xpath as XMLXpath, \\\n get_nums_xml_xpath as XMLXpathNum, \\\n get_xml_parse as XMLParse, \\\n r_chgrp, r_chmod, preprint_r\n\n\n\nif __name__ == '__main__':\n string = \"\"\"<capabilities>\n\n <host>\n <cpu>\n <arch>x86_64</arch>\n <model>pentium3</model>\n <topology sockets='1' cores='1' threads='1'/>\n <feature name='lahf_lm'/>\n <feature name='lm'/>\n <feature name='nx'/>\n <feature name='syscall'/>\n <feature name='hypervisor'/>\n <feature name='sse4.1'/>\n <feature name='cx16'/>\n <feature name='ssse3'/>\n <feature name='pni'/>\n <feature name='ss'/>\n <feature name='sse2'/>\n <feature name='acpi'/>\n <feature name='ds'/>\n <feature name='clflush'/>\n <feature name='apic'/>\n </cpu>\n <migration_features>\n <live/>\n <uri_transports>\n <uri_transport>tcp</uri_transport>\n </uri_transports>\n </migration_features>\n </host>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='i686'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu</emulator>\n <machine>pc-0.12</machine>\n <machine canonical='pc-0.12'>pc</machine>\n <machine>pc-0.11</machine>\n <machine>pc-0.10</machine>\n <machine>isapc</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n <features>\n <cpuselection/>\n <pae/>\n <nonpae/>\n <acpi default='on' toggle='yes'/>\n <apic default='on' toggle='no'/>\n </features>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='x86_64'>\n <wordsize>64</wordsize>\n <emulator>/usr/bin/qemu-system-x86_64</emulator>\n <machine>pc-0.12</machine>\n <machine canonical='pc-0.12'>pc</machine>\n <machine>pc-0.11</machine>\n <machine>pc-0.10</machine>\n <machine>isapc</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n <features>\n <cpuselection/>\n <acpi default='on' toggle='yes'/>\n <apic default='on' toggle='no'/>\n </features>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='arm'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu-system-arm</emulator>\n <machine>integratorcp</machine>\n <machine>syborg</machine>\n <machine>musicpal</machine>\n <machine>mainstone</machine>\n <machine>n800</machine>\n <machine>n810</machine>\n <machine>cheetah</machine>\n <machine>sx1</machine>\n <machine>sx1-v1</machine>\n <machine>tosa</machine>\n <machine>akita</machine>\n <machine>spitz</machine>\n <machine>borzoi</machine>\n <machine>terrier</machine>\n <machine>connex</machine>\n <machine>verdex</machine>\n <machine>lm3s811evb</machine>\n <machine>lm3s6965evb</machine>\n <machine>realview-eb</machine>\n <machine>realview-eb-mpcore</machine>\n <machine>realview-pb-a8</machine>\n <machine>realview-pbx-a9</machine>\n <machine>versatilepb</machine>\n <machine>versatileab</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='mips'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu-system-mips</emulator>\n <machine>malta</machine>\n <machine>mipssim</machine>\n <machine>magnum</machine>\n <machine>pica61</machine>\n <machine>mips</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='mipsel'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu-system-mipsel</emulator>\n <machine>malta</machine>\n <machine>mipssim</machine>\n <machine>magnum</machine>\n <machine>pica61</machine>\n <machine>mips</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='sparc'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu-system-sparc</emulator>\n <machine>SS-5</machine>\n <machine>SS-10</machine>\n <machine>SS-600MP</machine>\n <machine>SS-20</machine>\n <machine>Voyager</machine>\n <machine>LX</machine>\n <machine>SS-4</machine>\n <machine>SPARCClassic</machine>\n <machine>SPARCbook</machine>\n <machine>SS-1000</machine>\n <machine>SS-2000</machine>\n <machine>SS-2</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n </guest>\n\n <guest>\n <os_type>hvm</os_type>\n <arch name='ppc'>\n <wordsize>32</wordsize>\n <emulator>/usr/bin/qemu-system-ppc</emulator>\n <machine>g3beige</machine>\n <machine>mpc8544ds</machine>\n <machine>bamboo</machine>\n <machine>ref405ep</machine>\n <machine>taihu</machine>\n <machine>mac99</machine>\n <machine>prep</machine>\n <machine>xenpv</machine>\n <domain type='qemu'>\n </domain>\n </arch>\n </guest>\n\n</capabilities>\n\"\"\"\n\n param = CapabilitiesConfigParam()\n param.load_xml_config(string)\n\n preprint_r(param.host)\n preprint_r(param.guest) \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class KaresasnuiCapabilitiesConfigParamException(karesansui.KaresansuiLibException):\n pass", "metadata": "root.KaresasnuiCapabilitiesConfigParamException", "header": "['module', '___EOS___']", "index": 112 }, { "content": "class CapabilitiesConfigParam:\n\n\n\n\n", "metadata": "root.CapabilitiesConfigParam", "header": "['module', '___EOS___']", "index": 115 }, { "content": " def __init__(self):\n self.host = {}\n self.guest = []", "metadata": "root.CapabilitiesConfigParam.__init__", "header": "['class', 'CapabilitiesConfigParam', ':', '___EOS___']", "index": 117 }, { "content": " def get_host_cpu_arch(self):\n try:\n return self.host['cpu']['arch']\n except:\n return None", "metadata": "root.CapabilitiesConfigParam.get_host_cpu_arch", "header": "['class', 'CapabilitiesConfigParam', ':', '___EOS___']", "index": 121 }, { "content": " def load_xml_config(self,string):\n\n doc = XMLParse(string)\n xpath_prefix = \"/capabilities\"\n\n ###################\n # host section\n host_xpath = \"%s/host\" % xpath_prefix\n host = {}\n\n # host - cpu section\n host_cpu_xpath = \"%s/cpu\" % host_xpath\n cpu = {}\n cpu['arch'] = XMLXpath(doc, '%s/arch/text()' % host_cpu_xpath)\n cpu['model'] = XMLXpath(doc, '%s/model/text()' % host_cpu_xpath)\n topology = {}\n topology['sockets'] = XMLXpath(doc, '%s/topology/@sockets' % host_cpu_xpath)\n topology['cores'] = XMLXpath(doc, '%s/topology/@cores' % host_cpu_xpath)\n topology['threads'] = XMLXpath(doc, '%s/topology/@threads' % host_cpu_xpath)\n cpu['topology'] = topology\n\n features = {}\n feature = []\n feature_num = XMLXpathNum(doc, '%s/feature' % host_cpu_xpath)\n for n in range(1, feature_num + 1):\n name = XMLXpath(doc, '%s/feature[%i]/@name' % (host_cpu_xpath, n,))\n feature.append(name)\n vmx = XMLXpath(doc, '%s/features/vmx' % host_cpu_xpath)\n features['feature'] = feature\n features['vmx'] = vmx\n cpu['feature'] = features\n\n host['cpu'] = cpu\n\n # host - migration_features section\n host_migration_features_xpath = \"%s/migration_features\" % host_xpath\n migration_features = {}\n\n uri_transports = []\n uri_transport_num = XMLXpathNum(doc,'%s/uri_transports/uri_transport' % host_migration_features_xpath)\n for n in range(1, uri_transport_num + 1):\n uri_transport = XMLXpath(doc,'%s/uri_transports/uri_transport/text()' % host_migration_features_xpath)\n uri_transports.append(uri_transport)\n live = XMLXpath(doc, '%s/live' % host_migration_features_xpath)\n migration_features['uri_transports'] = uri_transports\n migration_features['live'] = live\n\n host['migration_features'] = migration_features\n\n ###################\n # guest section\n guest_xpath = \"%s/guest\" % xpath_prefix\n guests = []\n\n guest_num = XMLXpathNum(doc,'%s' % guest_xpath)\n for n in range(1, guest_num + 1):\n guest = {}\n\n os_type = XMLXpath(doc, '%s[%i]/os_type/text()' % (guest_xpath,n,))\n\n arch = {}\n name = XMLXpath(doc, '%s[%i]/arch/@name' % (guest_xpath,n,))\n wordsize = XMLXpath(doc, '%s[%i]/arch/wordsize/text()' % (guest_xpath,n,))\n emulator = XMLXpath(doc, '%s[%i]/arch/emulator/text()' % (guest_xpath,n,))\n machines = []\n machine_num = XMLXpathNum(doc, '%s[%i]/arch/machine' % (guest_xpath,n,))\n for m in range(1, machine_num + 1):\n machine = XMLXpath(doc, '%s[%i]/arch/machine[%i]/text()' % (guest_xpath,n,m,))\n machines.append(machine)\n domain = {}\n type = XMLXpath(doc, '%s[%i]/arch/domain/@type' % (guest_xpath,n,))\n domain['type'] = type\n arch['name'] = name\n arch['wordsize'] = wordsize\n arch['emulator'] = emulator\n arch['machine'] = machines\n arch['domain'] = domain\n\n features = {}\n cpuselection = XMLXpath(doc, '%s[%i]/features/cpuselection' % (guest_xpath,n,))\n pae = XMLXpath(doc, '%s[%i]/features/pae' % (guest_xpath,n,))\n nonpae = XMLXpath(doc, '%s[%i]/features/nonpae' % (guest_xpath,n,))\n acpi = {}\n default = XMLXpath(doc, '%s[%i]/features/acpi/@default' % (guest_xpath,n,))\n toggle = XMLXpath(doc, '%s[%i]/features/acpi/@toggle' % (guest_xpath,n,))\n acpi['default'] = default\n acpi['toggle'] = toggle\n apic = {}\n default = XMLXpath(doc, '%s[%i]/features/apic/@default' % (guest_xpath,n,))\n toggle = XMLXpath(doc, '%s[%i]/features/apic/@toggle' % (guest_xpath,n,))\n apic['default'] = default\n apic['toggle'] = toggle\n features['acpi'] = acpi\n features['apic'] = apic\n\n guest['os_type'] = os_type\n guest['arch'] = arch\n guest['features'] = features\n guests.append(guest)\n\n self.host = host\n self.guest = guests\n\n return { \"host\" :self.host, \"guest\":self.guest }", "metadata": "root.CapabilitiesConfigParam.load_xml_config", "header": "['class', 'CapabilitiesConfigParam', ':', '___EOS___']", "index": 127 }, { "content": " def validate(self):\n pass", "metadata": "root.CapabilitiesConfigParam.validate", "header": "['class', 'CapabilitiesConfigParam', ':', '___EOS___']", "index": 233 } ]
[ { "span": "import os", "start_line": 99, "start_column": 0, "end_line": 99, "end_column": 9 }, { "span": "import time", "start_line": 100, "start_column": 0, "end_line": 100, "end_column": 11 }, { "span": "from StringIO import StringIO", "start_line": 102, "start_column": 0, "end_line": 102, "end_column": 29 }, { "span": "import errno", "start_line": 103, "start_column": 0, "end_line": 103, "end_column": 12 }, { "span": "from karesansui.lib.utils import get_xml_xpath as XMLXpath, \\\n get_nums_xml_xpath as XMLXpathNum, \\\n get_xml_parse as XMLParse, \\\n r_chgrp, r_chmod, preprint_r", "start_line": 107, "start_column": 0, "end_line": 110, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", " ", "Core", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "\\", "10", ";<", "comment", "-", "ja", ">", "\\", "10", ";<", "/", "comment", "-", "ja", ">", "\\", "10", ";<", "comment", "-", "en", ">", "\\", "10", ";", "Read", " ", "xml", " ", "of", " ", "libvi", "rt", "'", "s", " ", "capab", "ilities", " ", "and", " ", "load", " ", "to", " ", "object", ".", "\\", "10", ";", "!!!", " ", "Noti", "ce", ":", " ", "this", " ", "is", " ", "read", "-", "only", " ", "parser", ".", " ", "!!!", "\\", "10", ";<", "/", "comment", "-", "en", ">", "\\", "10", ";", "\\", "10", ";", "@", "file", ":", " ", " ", " ", "config", "\\u", "capab", "ilities", ".", "py", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Tai", "zo", " ", "IT", "O", " ", "<", "tai", "zo", "@", "kar", "esa", "nsu", "i", "-", "project", ".", "info", ">", "\\", "10", ";", "\\", "10", ";", "xml", " ", "sample", ":", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "---", "\\", "10", ";<", "capab", "ilities", ">", "\\", "10", ";", " ", " ", "<", "host", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "cpu", ">", "\\", "10", ";", " ", " ", "<", "arch", ">", "x8", "6", "\\u", "64", "</", "arch", ">", "\\", "10", ";", " ", " ", "<", "model", ">", "pent", "ium", "3", "</", "model", ">", "\\", "10", ";", " ", " ", "<", "topo", "log", "y", " ", "socket", "s", "='", "1", "'", " ", "cores", "='", "1", "'", " ", "thread", "s", "='", "1", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "syscall", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "hypervisor", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "ac", "pi", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "apic", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "cpu", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "migrati", "on", "\\u", "features", ">", "\\", "10", ";", " ", " ", "<", "live", "/>", "\\", "10", ";", " ", " ", "<", "uri", "\\u", "transport", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "uri", "\\u", "transport", ">", "tcp", "</", "uri", "\\u", "transport", ">", "\\", "10", ";", " ", " ", "</", "uri", "\\u", "transport", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "migrati", "on", "\\u", "features", ">", "\\", "10", ";", " ", " ", "</", "host", ">", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "i", "686", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".12", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", " ", "canonical", "='", "pc", "-0", ".12", "'>", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "features", ">", "\\", "10", ";", " ", " ", "<", "cpus", "election", "/>", "\\", "10", ";", " ", " ", "<", "pa", "e", "/>", "\\", "10", ";", " ", " ", "<", "nonp", "ae", "/>", "\\", "10", ";", " ", " ", "<", "ac", "pi", " ", "default", "='", "on", "'", " ", "toggle", "='", "ye", "s", "'/>", "\\", "10", ";", " ", " ", "<", "apic", " ", "default", "='", "on", "'", " ", "toggle", "='", "no", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "features", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "x8", "6", "\\u", "64", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "64", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "x8", "6", "\\u", "64", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".12", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", " ", "canonical", "='", "pc", "-0", ".12", "'>", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "features", ">", "\\", "10", ";", " ", " ", "<", "cpus", "election", "/>", "\\", "10", ";", " ", " ", "<", "ac", "pi", " ", "default", "='", "on", "'", " ", "toggle", "='", "ye", "s", "'/>", "\\", "10", ";", " ", " ", "<", "apic", " ", "default", "='", "on", "'", " ", "toggle", "='", "no", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "features", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";<", "/", "capab", "ilities", ">", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "---", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath_", ",_", "get", "\\u", "nums", "\\u", "xml", "\\u", "xpath_", "as_", "XML", "Xp", "ath", "Num_", ",_", "get", "\\u", "xml", "\\u", "parse_", "as_", "XML", "Parse_", ",_", "r", "\\u", "chg", "rp_", ",_", "r", "\\u", "chmod_", ",_", "prep", "rint", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "string_", "=_", "\"\"\"", "<", "capab", "ilities", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "host", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "cpu", ">", "\\", "10", ";", " ", " ", "<", "arch", ">", "x8", "6", "\\u", "64", "</", "arch", ">", "\\", "10", ";", " ", " ", "<", "model", ">", "pent", "ium", "3", "</", "model", ">", "\\", "10", ";", " ", " ", "<", "topo", "log", "y", " ", "socket", "s", "='", "1", "'", " ", "cores", "='", "1", "'", " ", "thread", "s", "='", "1", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "lah", "f", "\\u", "lm", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "lm", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "nx", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "syscall", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "hypervisor", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "sse", "4.1", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "cx", "16", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "sss", "e3", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "pn", "i", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "ss", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "sse", "2", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "ac", "pi", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "ds", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "clf", "lus", "h", "'/>", "\\", "10", ";", " ", " ", "<", "feature", " ", "name", "='", "apic", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "cpu", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "migrati", "on", "\\u", "features", ">", "\\", "10", ";", " ", " ", "<", "live", "/>", "\\", "10", ";", " ", " ", "<", "uri", "\\u", "transport", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "uri", "\\u", "transport", ">", "tcp", "</", "uri", "\\u", "transport", ">", "\\", "10", ";", " ", " ", "</", "uri", "\\u", "transport", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "migrati", "on", "\\u", "features", ">", "\\", "10", ";", " ", " ", "</", "host", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "i", "686", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".12", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", " ", "canonical", "='", "pc", "-0", ".12", "'>", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".1", "1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".1", "0", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "isa", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "features", ">", "\\", "10", ";", " ", " ", "<", "cpus", "election", "/>", "\\", "10", ";", " ", " ", "<", "pa", "e", "/>", "\\", "10", ";", " ", " ", "<", "nonp", "ae", "/>", "\\", "10", ";", " ", " ", "<", "ac", "pi", " ", "default", "='", "on", "'", " ", "toggle", "='", "ye", "s", "'/>", "\\", "10", ";", " ", " ", "<", "apic", " ", "default", "='", "on", "'", " ", "toggle", "='", "no", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "features", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "x8", "6", "\\u", "64", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "64", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "x8", "6", "\\u", "64", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".12", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", " ", "canonical", "='", "pc", "-0", ".12", "'>", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".1", "1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pc", "-0", ".1", "0", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "isa", "pc", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "features", ">", "\\", "10", ";", " ", " ", "<", "cpus", "election", "/>", "\\", "10", ";", " ", " ", "<", "ac", "pi", " ", "default", "='", "on", "'", " ", "toggle", "='", "ye", "s", "'/>", "\\", "10", ";", " ", " ", "<", "apic", " ", "default", "='", "on", "'", " ", "toggle", "='", "no", "'/>", "\\", "10", ";", " ", " ", " ", " ", "</", "features", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "arm", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "arm", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "integra", "tor", "cp", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "sy", "bor", "g", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "music", "pal", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "main", "stone", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "n", "800", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "n", "810", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "che", "eta", "h", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "sx", "1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "sx", "1", "-", "v1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "tos", "a", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "aki", "ta", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "spi", "tz", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "bor", "zo", "i", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "terr", "ier", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "conne", "x", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "verd", "ex", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "lm", "3", "s", "811", "ev", "b", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "lm", "3", "s", "696", "5e", "vb", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "real", "view", "-", "eb", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "real", "view", "-", "eb", "-", "mpc", "ore", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "real", "view", "-", "pb", "-", "a8", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "real", "view", "-", "pb", "x", "-", "a9", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "versa", "tile", "pb", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "versa", "tile", "ab", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "mips", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "mips", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mal", "ta", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mips", "sim", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "magn", "um", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pica", "6", "1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mips", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "mips", "el", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "mips", "el", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mal", "ta", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mips", "sim", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "magn", "um", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "pica", "6", "1", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mips", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "spar", "c", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "spar", "c", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "5", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-1", "0", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "600", "MP", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "20", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "Vo", "ya", "ger", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "LX", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "4", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SPAR", "CC", "lass", "ic", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SPAR", "Cb", "ook", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-1", "000", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "2000", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "SS", "-", "2", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "guest", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "os", "\\u", "type", ">", "hv", "m", "</", "os", "\\u", "type", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "arch", " ", "name", "='", "pp", "c", "'>", "\\", "10", ";", " ", " ", "<", "words", "ize", ">", "32", "</", "words", "ize", ">", "\\", "10", ";", " ", " ", "<", "emulator", ">/", "usr", "/", "bin", "/", "qe", "mu", "-", "system", "-", "pp", "c", "</", "emulator", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "g3", "bei", "ge", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mpc", "854", "4d", "s", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "bam", "boo", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "ref", "405", "ep", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "tai", "hu", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "mac", "9", "9", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "prep", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "machine", ">", "xen", "pv", "</", "machine", ">", "\\", "10", ";", " ", " ", "<", "domain", " ", "type", "='", "qe", "mu", "'>", "\\", "10", ";", " ", " ", "</", "domain", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "arch", ">", "\\", "10", ";", " ", " ", "</", "guest", ">", "\\", "10", ";", "\\", "10", ";<", "/", "capab", "ilities", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "=_", "Capabilities", "Config", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prep", "rint", "\\u", "r_", "(_", "param_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prep", "rint", "\\u", "r_", "(_", "param_", "._", "guest_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Kar", "esa", "sn", "ui", "Capabilities", "Config", "Param", "Exception_", "(_", "kar", "esa", "nsu", "i_", "._", "Kar", "esa", "nsu", "i", "Lib", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "guest_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "host", "\\u", "cpu", "\\u", "arch_", "(_", "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_", "._", "host_", "[_", "'", "cpu", "'_", "]_", "[_", "'", "arch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "xml", "\\u", "config_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "XML", "Parse_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "\\u", "prefix_", "=_", "\"/", "capab", "ilities", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "xpath_", "=_", "\"%", "s", "/", "host", "\"_", "%_", "xpa", "th", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "-", " ", "cpu", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "cpu", "\\u", "xpath_", "=_", "\"%", "s", "/", "cpu", "\"_", "%_", "host", "\\u", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "arch", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "arch", "/", "text", "()'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "model", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "model", "/", "text", "()'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "socket", "s", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "socket", "s", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "cores", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "cores", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "thread", "s", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "thread", "s", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "topo", "log", "y", "'_", "]_", "=_", "topology_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "/", "feature", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "feature", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "feature", "[", "%", "i", "]/", "@", "name", "'_", "%_", "(_", "host", "\\u", "cpu", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vmx", "_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "features", "/", "vmx", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "feature", "'_", "]_", "=_", "feature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "vmx", "'_", "]_", "=_", "vmx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "feature", "'_", "]_", "=_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "[_", "'", "cpu", "'_", "]_", "=_", "cpu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "-", " ", "migrati", "on", "\\u", "features", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", "=_", "\"%", "s", "/", "migrati", "on", "\\u", "features", "\"_", "%_", "host", "\\u", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uri", "\\u", "transports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "transport", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "/", "uri", "\\u", "transport", "s", "/", "uri", "\\u", "transport", "'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "uri", "\\u", "transport", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "transport_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "uri", "\\u", "transport", "s", "/", "uri", "\\u", "transport", "/", "text", "()'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "transports_", "._", "append_", "(_", "uri", "\\u", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "live_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "live", "'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "[_", "'", "uri", "\\u", "transport", "s", "'_", "]_", "=_", "uri", "\\u", "transports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "[_", "'", "live", "'_", "]_", "=_", "live_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "[_", "'", "migrati", "on", "\\u", "features", "'_", "]_", "=_", "migrati", "on", "\\u", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "guest", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "\\u", "xpath_", "=_", "\"%", "s", "/", "guest", "\"_", "%_", "xpa", "th", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "'_", "%_", "guest", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "guest", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "guest_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os", "\\u", "type_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "os", "\\u", "type", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arch_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "@", "name", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words", "ize_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "words", "ize", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "emulator", "_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "emulator", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machine", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "machine", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "range_", "(_", "1_", ",_", "machine", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "machine", "[", "%", "i", "]/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", "m_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machines_", "._", "append_", "(_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "domain", "/", "@", "type", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "[_", "'", "type", "'_", "]_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "words", "ize", "'_", "]_", "=_", "words", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "emulator", "'_", "]_", "=_", "emulator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "machine", "'_", "]_", "=_", "machines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "domain", "'_", "]_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpus", "election_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "cpus", "election", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pa", "e_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "pa", "e", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nonp", "ae_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "nonp", "ae", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "ac", "pi", "/", "@", "default", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toggle_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "ac", "pi", "/", "@", "toggle", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "[_", "'", "default", "'_", "]_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "[_", "'", "toggle", "'_", "]_", "=_", "toggle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "apic", "/", "@", "default", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toggle_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "apic", "/", "@", "toggle", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "[_", "'", "default", "'_", "]_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "[_", "'", "toggle", "'_", "]_", "=_", "toggle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "ac", "pi", "'_", "]_", "=_", "ac", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "apic", "'_", "]_", "=_", "apic", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest_", "[_", "'", "os", "\\u", "type", "'_", "]_", "=_", "os", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest_", "[_", "'", "arch", "'_", "]_", "=_", "arch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest_", "[_", "'", "features", "'_", "]_", "=_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "._", "append_", "(_", "guest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "guest_", "=_", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "host", "\"_", ":_", "self_", "._", "host_", ",_", "\"", "guest", "\"_", ":_", "self_", "._", "guest_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rtucker-mozilla/mozilla_inventory/core/interface/static_intr/views.py
[ { "content": "def combine_a_ptr_to_interface(request, addr_pk, ptr_pk):\n \"\"\"\n When a PTR/AddressRecord have the same ip/name it's likely that they could\n become an interface attached to a system. This view (function) takes an\n AddressRecord (addr) and PTR (ptr) and using their data creates an\n StaticInterface. Finally, addr and ptr are deleted.\n \"\"\"\n addr = get_object_or_404(AddressRecord, pk=addr_pk)\n ptr = get_object_or_404(PTR, pk=ptr_pk)\n is_ajax = request.POST.get('is_ajax')\n system_hostname = request.POST.get('system_hostname')\n if is_ajax and system_hostname:\n system = None\n try:\n system = System.objects.get(hostname=system_hostname)\n except:\n try:\n system_hostname = re.sub('mozilla\\.[com|net|org]', '',\n system_hostname)\n system = System.objects.get(hostname=system_hostname)\n except:\n system = None\n if system:\n try:\n x = do_combine_a_ptr_to_interface(\n addr, ptr, system, mac_address=\"00:00:00:00:00:00\")\n (intr, addr_deleted, ptr_deleted) = x\n except ValidationError, e:\n return HttpResponse(json.dumps({'success': False, 'error':\n e.messages[0]}))\n ret_dict = {}\n ret_dict['success'] = True\n ret_dict['hostname'] = system.hostname\n ret_dict['id'] = system.id\n return HttpResponse(json.dumps(ret_dict))\n else:\n return HttpResponse(json.dumps({'success': False, 'error':\n 'Unable to find system'}))\n\n if request.method == \"POST\":\n form = CombineForm(request.POST)\n if form.is_valid():\n system = form.cleaned_data['system']\n try:\n x = do_combine_a_ptr_to_interface(addr, ptr, system)\n intr, addr_deleted, ptr_deleted = x\n return redirect(intr)\n except ValidationError, e:\n form.errors['__all__'] = ErrorList(e.messages)\n return render(request, 'static_intr/combine.html', {\n 'addr': addr,\n 'ptr': ptr,\n 'form': form\n })\n else:\n form = CombineForm()\n return render(request, 'static_intr/combine.html', {\n 'form': form,\n 'addr': addr,\n 'ptr': ptr,\n })", "metadata": "root.combine_a_ptr_to_interface", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def create_static_interface(request, system_pk):\n # TODO, make sure the user has access to this system\n system = get_object_or_404(System, pk=system_pk)\n if request.method == 'POST':\n interface_form = StaticInterfaceForm(request.POST)\n interface_form.instance.system = system\n\n a, ptr, r = None, None, None\n if interface_form.is_valid():\n try:\n intr = interface_form.instance\n intr.system = system\n intr.full_clean()\n intr.save()\n except ValidationError, e:\n interface_form._errors['__all__'] = ErrorList(e.messages)\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': 'New Interface for System {0}'.format(\n system)\n })\n else:\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': 'New Interface for System {0}'.format(system)\n })\n\n messages.success(request, \"Success! Interface Created.\")\n return redirect(system)\n\n else:\n interface_form = StaticInterfaceForm()\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': 'New Interface for System {0}'.format(system)\n })", "metadata": "root.create_static_interface", "header": "['module', '___EOS___']", "index": 272 }, { "content": "def quick_create(request, system_pk):\n # TODO, make sure the user has access to this system\n system = get_object_or_404(System, pk=system_pk)\n if request.method == 'POST':\n interface_form = StaticInterfaceQuickForm(request.POST)\n\n a, ptr, r = None, None, None\n if interface_form.is_valid():\n try:\n # mac = interface_form.cleaned_data['mac']\n if 'label' in interface_form.cleaned_data:\n label = interface_form.cleaned_data['label']\n else:\n label = \"\"\n mrange_pk = interface_form.cleaned_data['range']\n mrange = get_object_or_404(Range, pk=mrange_pk)\n network = mrange.network\n ip_type = network.ip_type\n vlan = network.vlan\n site = network.site\n\n networks = []\n for network in vlan.network_set.all():\n if not network.site:\n continue\n if network.site.get_site_path() == site.get_site_path():\n networks.append(network)\n if not networks:\n raise ValidationError(\n \"No appropriate networks found. Consider adding this \"\n \"interface manually.\")\n\n ip = mrange.get_next_ip()\n if ip is None:\n raise ValidationError(\n \"No appropriate IP found in {0} Vlan {1} Range {2} - \"\n \"{3}. Consider adding this interface \"\n \"manually.\".format(site.name, vlan.name,\n mrange.start_str, mrange.end_str))\n\n expected_name = \"{0}.{1}.mozilla.com\".format(\n vlan.name, site.get_site_path())\n print \"Expected name {0}\".format(expected_name)\n try:\n domain = Domain.objects.get(name=expected_name)\n except ObjectDoesNotExist, e:\n raise ValidationError(\n \"The domain '{0}' doesn't seem to exist. Consider \"\n \"creating this interface manually.\".\n format(expected_name))\n\n intr = StaticInterface(label=label, domain=domain,\n ip_str=str(ip),\n # ip_type=ip_type, mac=mac,\n # system=system)\n ip_type=ip_type, system=system)\n intr.full_clean()\n intr.save()\n except ValidationError, e:\n interface_form._errors['__all__'] = ErrorList(e.messages)\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': \"Quick Interface Create for System \"\n \"{0}\".format(system)\n })\n else:\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': 'Quick Interface Create for System {0}'.format(\n system)\n })\n\n messages.success(request, \"Success! Interface Created.\")\n return redirect(system)\n\n else:\n interface_form = StaticInterfaceQuickForm()\n return render(request, 'static_intr/static_intr_form.html', {\n 'form': interface_form,\n 'form_title': 'Quick Interface Create for System {0}'.format(\n system)\n })", "metadata": "root.quick_create", "header": "['module', '___EOS___']", "index": 310 } ]
[ { "span": "intr,", "start_line": 101, "start_column": 17, "end_line": 101, "end_column": 21 }, { "span": "addr_deleted,", "start_line": 101, "start_column": 23, "end_line": 101, "end_column": 35 }, { "span": "ptr_deleted)", "start_line": 101, "start_column": 37, "end_line": 101, "end_column": 48 }, { "span": "a,", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 9 }, { "span": "ptr,", "start_line": 279, "start_column": 11, "end_line": 279, "end_column": 14 }, { "span": "r ", "start_line": 279, "start_column": 16, "end_line": 279, "end_column": 17 }, { "span": "a,", "start_line": 316, "start_column": 8, "end_line": 316, "end_column": 9 }, { "span": "ptr,", "start_line": 316, "start_column": 11, "end_line": 316, "end_column": 14 }, { "span": "r ", "start_line": 316, "start_column": 16, "end_line": 316, "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_", "def_", "combin", "e\\u", "a", "\\u", "ptr", "\\u", "to", "\\u", "interface_", "(_", "request_", ",_", "addr", "\\u", "pk_", ",_", "ptr", "\\u", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "PTR", "/", "Address", "Record", " ", "have", " ", "the", " ", "same", " ", "ip", "/", "name", " ", "it", "'", "s", " ", "like", "ly", " ", "tha", "t", " ", "the", "y", " ", "coul", "d", "\\", "10", ";", " ", " ", " ", " ", "bec", "ome", " ", "an", " ", "interface", " ", "attache", "d", " ", "to", " ", "a", " ", "system", ".", " ", "Thi", "s", " ", "view", " ", "(", "function", ")", " ", "take", "s", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "Address", "Record", " ", "(", "addr", ")", " ", "and", " ", "PTR", " ", "(", "ptr", ")", " ", "and", " ", "usi", "ng", " ", "thei", "r", " ", "data", " ", "create", "s", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "Static", "Interface", ".", " ", "Final", "ly", ",", " ", "addr", " ", "and", " ", "ptr", " ", "are", " ", "delete", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Address", "Record_", ",_", "pk_", "=_", "addr", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptr_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "PTR", "_", ",_", "pk_", "=_", "ptr", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "ajax_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "is", "\\u", "aja", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "hostname_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "system", "\\u", "host", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "ajax_", "and_", "system", "\\u", "hostname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "System_", "._", "objects_", "._", "get_", "(_", "hostname_", "=_", "system", "\\u", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system", "\\u", "hostname_", "=_", "re_", "._", "sub_", "(_", "'", "moz", "illa", "\\\\.", "[", "com", "|", "net", "|", "org", "]'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system", "\\u", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "=_", "System_", "._", "objects_", "._", "get_", "(_", "hostname_", "=_", "system", "\\u", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "system_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "do", "\\u", "combin", "e\\u", "a", "\\u", "ptr", "\\u", "to", "\\u", "interface_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "addr_", ",_", "ptr_", ",_", "system_", ",_", "mac", "\\u", "address_", "=_", "\"", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "intr", "_", ",_", "addr", "\\u", "deleted_", ",_", "ptr", "\\u", "deleted_", ")_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "'", "success", "'_", ":_", "False_", ",_", "'", "error", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "._", "messages_", "[_", "0_", "]_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "host", "name", "'_", "]_", "=_", "system_", "._", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "id", "'_", "]_", "=_", "system_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "ret", "\\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 ", " _", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "'", "success", "'_", ":_", "False_", ",_", "'", "error", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Una", "ble", " ", "to", " ", "find", " ", "system", "'_", "}_", ")_", ")_", "\\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_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Combine", "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 ", " _", "system_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "system", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "do", "\\u", "combin", "e\\u", "a", "\\u", "ptr", "\\u", "to", "\\u", "interface_", "(_", "addr_", ",_", "ptr_", ",_", "system_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", ",_", "addr", "\\u", "deleted_", ",_", "ptr", "\\u", "deleted_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "intr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "errors_", "[_", "'\\u", "\\u", "all", "\\u\\u'_", "]_", "=_", "Error", "List_", "(_", "e_", "._", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "combin", "e", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addr", "'_", ":_", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ptr", "'_", ":_", "ptr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Combine", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "combin", "e", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addr", "'_", ":_", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ptr", "'_", ":_", "ptr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "static", "\\u", "interface_", "(_", "request_", ",_", "system", "\\u", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ",", " ", "make", " ", "sure", " ", "the", " ", "user", " ", "has", " ", "access", " ", "to", " ", "this", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "System_", ",_", "pk_", "=_", "system", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "form_", "=_", "Static", "Interface", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface", "\\u", "form_", "._", "instance_", "._", "system_", "=_", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", ",_", "ptr_", ",_", "r_", "=_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intr", "_", "=_", "interface", "\\u", "form_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", "._", "system_", "=_", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", "._", "full", "\\u", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "form_", "._", "\\u", "errors_", "[_", "'\\u", "\\u", "all", "\\u\\u'_", "]_", "=_", "Error", "List_", "(_", "e_", "._", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "'", "New", " ", "Interface", " ", "for", " ", "System", " ", "{", "0", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "system_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "'", "New", " ", "Interface", " ", "for", " ", "System", " ", "{", "0", "}'_", "._", "format_", "(_", "system_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\"", "Success", "!", " ", "Interface", " ", "Creat", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "system_", ")_", "\\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 ", " _", "interface", "\\u", "form_", "=_", "Static", "Interface", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "'", "New", " ", "Interface", " ", "for", " ", "System", " ", "{", "0", "}'_", "._", "format_", "(_", "system_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "quick", "\\u", "create_", "(_", "request_", ",_", "system", "\\u", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ",", " ", "make", " ", "sure", " ", "the", " ", "user", " ", "has", " ", "access", " ", "to", " ", "this", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "System_", ",_", "pk_", "=_", "system", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "form_", "=_", "Static", "Interface", "Qui", "ck", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", ",_", "ptr_", ",_", "r_", "=_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mac", " ", "=", " ", "interface", "\\u", "form", ".", "clean", "ed", "\\u", "data", "['", "mac", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "label", "'_", "in_", "interface", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "label_", "=_", "interface", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "label_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mr", "ange", "\\u", "pk_", "=_", "interface", "\\u", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "range", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "ange_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Range_", ",_", "pk_", "=_", "mr", "ange", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "=_", "mr", "ange_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip", "\\u", "type_", "=_", "network_", "._", "ip", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlan_", "=_", "network_", "._", "vlan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "network_", "._", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "networks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "network_", "in_", "vlan_", "._", "network", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "network_", "._", "site_", ":_", "\\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_", "network_", "._", "site_", "._", "get", "\\u", "site", "\\u", "path_", "(_", ")_", "==_", "site_", "._", "get", "\\u", "site", "\\u", "path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "networks_", "._", "append_", "(_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "networks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "appropr", "iate", " ", "network", "s", " ", "found", ".", " ", "Consider", " ", "addin", "g", " ", "this", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interface", " ", "manu", "ally", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ip_", "=_", "mr", "ange_", "._", "get", "\\u", "next", "\\u", "ip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "appropr", "iate", " ", "IP", " ", "found", " ", "in", " ", "{", "0", "}", " ", "Vla", "n", " ", "{", "1", "}", " ", "Range", " ", "{", "2", "}", " ", "-", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "3", "}.", " ", "Consider", " ", "addin", "g", " ", "this", " ", "interface", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "manu", "ally", ".\"_", "._", "format_", "(_", "site_", "._", "name_", ",_", "vlan_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "ange_", "._", "start", "\\u", "str_", ",_", "mr", "ange_", "._", "end", "\\u", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected", "\\u", "name_", "=_", "\"{", "0", "}.", "{", "1", "}.", "moz", "illa", ".", "com", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vlan_", "._", "name_", ",_", "site_", "._", "get", "\\u", "site", "\\u", "path_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Expect", "ed", " ", "name", " ", "{", "0", "}\"_", "._", "format_", "(_", "expected", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "domain_", "=_", "Domain_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "expected", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "domain", " ", "'{", "0", "}'", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "exist", ".", " ", "Consider", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "ng", " ", "this", " ", "interface", " ", "manu", "ally", ".\"_", "._", "\\u\\u\\uNL\\u\\u\\u_", "format_", "(_", "expected", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "intr", "_", "=_", "Static", "Interface_", "(_", "label_", "=_", "label_", ",_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "str_", "=_", "str_", "(_", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ip", "\\u", "type", "=", "ip", "\\u", "type", ",", " ", "mac", "=", "mac", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", "=", "system", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "type_", "=_", "ip", "\\u", "type_", ",_", "system_", "=_", "system_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", "._", "full", "\\u", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intr", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "form_", "._", "\\u", "errors_", "[_", "'\\u", "\\u", "all", "\\u\\u'_", "]_", "=_", "Error", "List_", "(_", "e_", "._", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "\"", "Qui", "ck", " ", "Interface", " ", "Creat", "e", " ", "for", " ", "System", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}\"_", "._", "format_", "(_", "system_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "'", "Qui", "ck", " ", "Interface", " ", "Creat", "e", " ", "for", " ", "System", " ", "{", "0", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "system_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\"", "Success", "!", " ", "Interface", " ", "Creat", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "system_", ")_", "\\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 ", " _", "interface", "\\u", "form_", "=_", "Static", "Interface", "Qui", "ck", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "static", "\\u", "intr", "/", "static", "\\u", "intr", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "interface", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "title", "'_", ":_", "'", "Qui", "ck", " ", "Interface", " ", "Creat", "e", " ", "for", " ", "System", " ", "{", "0", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "system_", ")_", "\\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, 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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 ]
Unused import
ml-slac/deep-jets/training/visualize-conv.py
[ { "content": "from scipy.ndimage import convolve\n\nfrom keras.layers import containers\nfrom keras.models import Sequential, model_from_yaml\nfrom keras.layers.core import Dense, Dropout, AutoEncoder, MaxoutDense, Activation, Merge\nfrom keras.layers.advanced_activations import PReLU\nfrom keras.layers.embeddings import Embedding\nfrom keras.layers.noise import GaussianNoise\nfrom keras.optimizers import SGD, RMSprop, Adagrad, Adam\nfrom keras import regularizers\nfrom keras.callbacks import EarlyStopping, ModelCheckpoint\nimport numpy as np\n\n# %run ../viz/visualize.py\n# %run ../viz/performance.py\nfrom viz import *\nfrom likelihood import *\n\n\n\n\n\n\n\nPLOT_DIR = './plots/arxiv/%s'\n\ndata = np.load('../FINAL_SAMPLE.npy')\n\nprint '{} jets before preselection'.format(data.shape[0])\n\nsignal, pt, mass, tau_21 = data['signal'], data['jet_pt'], data['jet_mass'], data['tau_21']\n\nimport deepdish.io as io\n\nnet = io.load('./SLACNetConv-final-logloss.h5')\n\nimport matplotlib.cm as cm\n\nfg = filter_grid(net['layer_0']['param_0'].reshape(64, 11, 11), normalize=False, cmap=cm.YlGnBu, symmetric=False)\n\nfg.savefig(PLOT_DIR % 'conv-filts.pdf')\n\n\nsignal = (signal == 1)\nbackground = (signal == False)\n\n# -- calculate the weights\nweights = np.ones(data.shape[0])\n\n# reference_distribution = np.random.uniform(250, 300, signal.sum())\nreference_distribution = pt[background]\n\nweights[signal] = get_weights(reference_distribution, pt[signal], \n\tbins=np.linspace(250, 300, 200))\n\nweights[background] = get_weights(reference_distribution, pt[background], \n\tbins=np.linspace(250, 300, 200))\n# weights[signal] = get_weights(pt[signal != 1], pt[signal], \n# \tbins=np.concatenate((\n# \t\tnp.linspace(200, 300, 1000), np.linspace(300, 1005, 500)))\n# \t)\n\n\n\nsig_jets = data['image'][signal == True]\nbkg_jets = data['image'][signal == False]\n\nsig_mean = np.average(sig_jets, axis=0)#, weights=weights[signal == True])\nbkg_mean = np.average(bkg_jets, axis=0)#, weights=weights[signal == False])\n\nsig_mean_ben = np.average(ben['image'][ben['signal'] == 1], axis=0)\nbkg_mean_ben = np.average(ben['image'][ben['signal'] == 0], axis=0)\n\n\n\n\nfg = filter_grid([_filt_diff(sig_mean, bkg_mean, np.sign(w) * np.sqrt(np.abs(w))) for w in net['layer_0']['param_0'].reshape(64, 11, 11)], normalize=False, symmetric=True)\n\nfg.savefig(PLOT_DIR % 'conv-diffs-global.pdf')\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def filter_grid(filters, labels=None, nfilters='all', shape=None, normalize=True, cmap=None, symmetric=True):\n '''\n A tool for visualizing filters on a grid.\n\n Args:\n filters (iterable): each element should be an \n image with len(image.shape) == 2\n\n nfilters: (str or int): out of the total filters, \n how many to plot? If a str, must be 'all'\n\n shape (tuple): What shape of grid do we want?\n\n normalize (bool): do we normalize all filters to have \n magnitude 1?\n\n Returns: \n plt.figure\n '''\n \n NUMERICAL_NOISE_THRESH = 1e-3\n\n if nfilters == 'all':\n side_length = int(np.round(np.sqrt(len(filters))))\n else:\n side_length = int(np.round(np.sqrt(nfilters)))\n\n if cmap is None:\n cma = custom_div_cmap(50)\n else:\n cma = cmap\n fig = plt.figure(figsize=(15, 15), dpi=140)\n\n if shape is None:\n grid_layout = gridspec.GridSpec(side_length, side_length)\n nplots = side_length ** 2\n else:\n grid_layout = gridspec.GridSpec(shape[0], shape[1])\n nplots = shape[0] * shape[1]\n # GmtoT1osfCpLCw6lzpnXh79y\n plt.title('plots')\n grid_layout.update(wspace=0.0, hspace=0.0) # set the spacing between axes. \n\n for i, filt in enumerate(filters):\n \tfilt = filt.copy()\n ax = plt.subplot(grid_layout[i])\n if normalize:\n filt /= np.s\n um(filt ** 2)\n\n # -- trim off absurd values.\n # abs_max = np.percentile(np.abs(filt), 98)\n abs_max = np.max(np.abs(filt))\n\n # -- trim out numerical zero noise\n # filt[np.abs(filt) < NUMERICAL_NOISE_THRESH] = 0.0\n if symmetric:\n image = ax.imshow(filt, interpolation='nearest', \n cmap=cma, vmin=-abs_max, vmax=abs_max)\n else:\n image = plt.imshow(filt, interpolation='nearest', cmap=cma)\n if i % 10 == 0:\n logger.info('{} of {} completed.'.format(i, nplots))\n plt.axis('off')\n if labels is not None:\n plt.title(labels[i])\n plt.subplots_adjust(hspace = 0, wspace=0)\n\n return fig", "metadata": "root.filter_grid", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def _filt_diff(s, b, w, border='constant'):\n\treturn convolve(s, w, mode=border, cval=0.0) - convolve(b, w, mode=border, cval=0.0)", "metadata": "root._filt_diff", "header": "['module', '___EOS___']", "index": 143 } ]
[ { "span": "from keras.layers import containers", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 35 }, { "span": "from keras.models import Sequential, model_from_yaml", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 52 }, { "span": "from keras.layers.core import Dense, Dropout, AutoEncoder, MaxoutDense, Activation, Merge", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 89 }, { "span": "from keras.layers.advanced_activations import PReLU", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 51 }, { "span": "from keras.layers.embeddings import Embedding", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 45 }, { "span": "from keras.layers.noise import GaussianNoise", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 44 }, { "span": "from keras.optimizers import SGD, RMSprop, Adagrad, Adam", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 56 }, { "span": "from keras import regularizers", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 30 }, { "span": "from keras.callbacks import EarlyStopping, ModelCheckpoint", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 58 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "scipy_", "._", "ndimage_", "import_", "convolve", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "keras_", "._", "layers_", "import_", "containers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "models_", "import_", "Sequential_", ",_", "model", "\\u", "from", "\\u", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "core_", "import_", "Dense_", ",_", "Dropout_", ",_", "Auto", "Encoder_", ",_", "Max", "out", "Dense_", ",_", "Activation_", ",_", "Merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "advanced", "\\u", "activations_", "import_", "PR", "e", "LU_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "embeddings_", "import_", "Embedding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "noise_", "import_", "Gaussian", "Noise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "optimizers_", "import_", "SGD", "_", ",_", "RMS", "prop_", ",_", "Ada", "grad_", ",_", "Adam", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "import_", "regularizer", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "callbacks_", "import_", "Earl", "y", "Stopp", "ing_", ",_", "Model", "Checkpoint", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "%", "run", " ", "..", "/", "viz", "/", "visualize", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "%", "run", " ", "..", "/", "viz", "/", "perform", "anc", "e", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "viz_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "likelihood_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PLOT", "\\u", "DIR_", "=_", "'./", "plots", "/", "arx", "iv", "/", "%", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "np_", "._", "load_", "(_", "'../", "FINAL", "\\u", "SAMPLE", ".", "npy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'{}", " ", "jet", "s", " ", "bef", "ore", " ", "prese", "lection", "'_", "._", "format_", "(_", "data_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", ",_", "pt_", ",_", "mass_", ",_", "tau", "\\u", "21_", "=_", "data_", "[_", "'", "signal", "'_", "]_", ",_", "data_", "[_", "'", "jet", "\\u", "pt", "'_", "]_", ",_", "data_", "[_", "'", "jet", "\\u", "mass", "'_", "]_", ",_", "data_", "[_", "'", "tau", "\\u", "21", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "deep", "dis", "h_", "._", "io_", "as_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "net_", "=_", "io_", "._", "load_", "(_", "'./", "SLA", "CN", "et", "Conv", "-", "final", "-", "loglo", "ss", ".", "h5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "._", "cm_", "as_", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fg_", "=_", "filter", "\\u", "grid_", "(_", "net_", "[_", "'", "layer", "\\u", "0", "'_", "]_", "[_", "'", "param", "\\u", "0", "'_", "]_", "._", "reshape_", "(_", "64_", ",_", "11_", ",_", "11_", ")_", ",_", "normalize_", "=_", "False_", ",_", "cmap_", "=_", "cm_", "._", "Yl", "Gn", "Bu", "_", ",_", "symmetric", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fg_", "._", "savefig_", "(_", "PLOT", "\\u", "DIR_", "%_", "'", "conv", "-", "filt", "s", ".", "pdf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "=_", "(_", "signal_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "background_", "=_", "(_", "signal_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "calcul", "ate", " ", "the", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "=_", "np_", "._", "ones_", "(_", "data_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", "\\u", "distribu", "tion", " ", "=", " ", "np", ".", "random", ".", "uniform", "(", "250", ",", " ", "300", ",", " ", "signal", ".", "sum", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "\\u", "distribution_", "=_", "pt_", "[_", "background_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "[_", "signal_", "]_", "=_", "get", "\\u", "weights_", "(_", "reference", "\\u", "distribution_", ",_", "pt_", "[_", "signal_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bins_", "=_", "np_", "._", "linspace_", "(_", "250_", ",_", "300_", ",_", "200_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "[_", "background_", "]_", "=_", "get", "\\u", "weights_", "(_", "reference", "\\u", "distribution_", ",_", "pt_", "[_", "background_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bins_", "=_", "np_", "._", "linspace_", "(_", "250_", ",_", "300_", ",_", "200_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "weight", "s", "[", "signal", "]", " ", "=", " ", "get", "\\u", "weight", "s", "(", "pt", "[", "signal", " ", "!=", " ", "1", "],", " ", "pt", "[", "signal", "],", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "bins", "=", "np", ".", "concatenate", "((", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "np", ".", "lins", "pace", "(", "200", ",", " ", "300", ",", " ", "1000", "),", " ", "np", ".", "lins", "pace", "(", "300", ",", " ", "1005", ",", " ", "500", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "\\u", "jet", "s_", "=_", "data_", "[_", "'", "image", "'_", "]_", "[_", "signal_", "==_", "True_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bkg", "\\u", "jet", "s_", "=_", "data_", "[_", "'", "image", "'_", "]_", "[_", "signal_", "==_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "\\u", "mean_", "=_", "np_", "._", "average_", "(_", "sig", "\\u", "jet", "s_", ",_", "axis_", "=_", "0_", ")_", "#", ",", " ", "weight", "s", "=", "weight", "s", "[", "signal", " ", "==", " ", "Tru", "e", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bkg", "\\u", "mean_", "=_", "np_", "._", "average_", "(_", "bkg", "\\u", "jet", "s_", ",_", "axis_", "=_", "0_", ")_", "#", ",", " ", "weight", "s", "=", "weight", "s", "[", "signal", " ", "==", " ", "Fal", "se", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "\\u", "mean", "\\u", "ben", "_", "=_", "np_", "._", "average_", "(_", "ben", "_", "[_", "'", "image", "'_", "]_", "[_", "ben", "_", "[_", "'", "signal", "'_", "]_", "==_", "1_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bkg", "\\u", "mean", "\\u", "ben", "_", "=_", "np_", "._", "average_", "(_", "ben", "_", "[_", "'", "image", "'_", "]_", "[_", "ben", "_", "[_", "'", "signal", "'_", "]_", "==_", "0_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fg_", "=_", "filter", "\\u", "grid_", "(_", "[_", "\\u", "filt", "\\u", "diff_", "(_", "sig", "\\u", "mean_", ",_", "bkg", "\\u", "mean_", ",_", "np_", "._", "sign_", "(_", "w_", ")_", "*_", "np_", "._", "sqrt_", "(_", "np_", "._", "abs_", "(_", "w_", ")_", ")_", ")_", "for_", "w_", "in_", "net_", "[_", "'", "layer", "\\u", "0", "'_", "]_", "[_", "'", "param", "\\u", "0", "'_", "]_", "._", "reshape_", "(_", "64_", ",_", "11_", ",_", "11_", ")_", "]_", ",_", "normalize_", "=_", "False_", ",_", "symmetric", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fg_", "._", "savefig_", "(_", "PLOT", "\\u", "DIR_", "%_", "'", "conv", "-", "diffs", "-", "global", ".", "pdf", "'_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter", "\\u", "grid_", "(_", "filters_", ",_", "labels_", "=_", "None_", ",_", "nfi", "lter", "s_", "=_", "'", "all", "'_", ",_", "shape_", "=_", "None_", ",_", "normalize_", "=_", "True_", ",_", "cmap_", "=_", "None_", ",_", "symmetric", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "tool", " ", "for", " ", "visuali", "zin", "g", " ", "filter", "s", " ", "on", " ", "a", " ", "grid", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "filter", "s", " ", "(", "iterable", "):", " ", "each", " ", "element", " ", "shou", "ld", " ", "be", " ", "an", " ", "\\", "10", ";", " ", " ", " ", " ", "image", " ", "with", " ", "len", "(", "image", ".", "shape", ")", " ", "==", " ", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nfi", "lter", "s", ":", " ", "(", "str", " ", "or", " ", "int", "):", " ", "out", " ", "of", " ", "the", " ", "total", " ", "filter", "s", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "how", " ", "many", " ", "to", " ", "plot", "?", " ", "If", " ", "a", " ", "str", ",", " ", "must", " ", "be", " ", "'", "all", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "shape", " ", "(", "tuple", "):", " ", "What", " ", "shape", " ", "of", " ", "grid", " ", "do", " ", "we", " ", "want", "?", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "normali", "ze", " ", "(", "bool", "):", " ", "do", " ", "we", " ", "normali", "ze", " ", "all", " ", "filter", "s", " ", "to", " ", "have", " ", "\\", "10", ";", " ", " ", " ", " ", "magnitude", " ", "1", "?", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", " ", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "figure", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NUMERIC", "AL", "\\u", "NO", "ISE", "\\u", "THRESH", "_", "=_", "1e-3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nfi", "lter", "s_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "side", "\\u", "length_", "=_", "int_", "(_", "np_", "._", "round_", "(_", "np_", "._", "sqrt_", "(_", "len_", "(_", "filters_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "side", "\\u", "length_", "=_", "int_", "(_", "np_", "._", "round_", "(_", "np_", "._", "sqrt_", "(_", "nfi", "lter", "s_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmap_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cma", "_", "=_", "custom", "\\u", "div", "\\u", "cmap_", "(_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cma", "_", "=_", "cmap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "15_", ",_", "15_", ")_", ",_", "dpi_", "=_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shape_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "layout_", "=_", "grids", "pec_", "._", "Grid", "Spec_", "(_", "side", "\\u", "length_", ",_", "side", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npl", "ots_", "=_", "side", "\\u", "length_", "**_", "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 ", " _", "grid", "\\u", "layout_", "=_", "grids", "pec_", "._", "Grid", "Spec_", "(_", "shape_", "[_", "0_", "]_", ",_", "shape_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npl", "ots_", "=_", "shape_", "[_", "0_", "]_", "*_", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Gm", "to", "T1", "os", "f", "Cp", "LC", "w", "6", "lz", "pn", "Xh", "7", "9", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "'", "plots", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid", "\\u", "layout_", "._", "update_", "(_", "wsp", "ace_", "=_", "0.0_", ",_", "hspace", "_", "=_", "0.0_", ")_", "#", " ", "set", " ", "the", " ", "spaci", "ng", " ", "bet", "ween", " ", "axes", ".", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "filt_", "in_", "enumerate_", "(_", "filters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t_", "filt_", "=_", "filt_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "plt_", "._", "subplot_", "(_", "grid", "\\u", "layout_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normalize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "/=_", "np_", "._", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "um_", "(_", "filt_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "trim", " ", "off", " ", "abs", "ur", "d", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abs", "\\u", "max", " ", "=", " ", "np", ".", "percentile", "(", "np", ".", "abs", "(", "filt", "),", " ", "98", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abs", "\\u", "max_", "=_", "np_", "._", "max_", "(_", "np_", "._", "abs_", "(_", "filt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "trim", " ", "out", " ", "numerical", " ", "zero", " ", "noise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filt", "[", "np", ".", "abs", "(", "filt", ")", " ", "<", " ", "NUMERIC", "AL", "\\u", "NO", "ISE", "\\u", "THRESH", "]", " ", "=", " ", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "symmetric", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "ax_", "._", "imshow_", "(_", "filt_", ",_", "interpolation_", "=_", "'", "near", "est", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmap_", "=_", "cma", "_", ",_", "vmin_", "=_", "-_", "abs", "\\u", "max_", ",_", "vmax_", "=_", "abs", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "plt_", "._", "imshow_", "(_", "filt_", ",_", "interpolation_", "=_", "'", "near", "est", "'_", ",_", "cmap_", "=_", "cma", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'{}", " ", "of", " ", "{}", " ", "complete", "d", ".'_", "._", "format_", "(_", "i_", ",_", "npl", "ots_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "axis_", "(_", "'", "off", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "labels_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "title_", "(_", "labels_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "subplot", "s", "\\u", "adjust_", "(_", "hspace", "_", "=_", "0_", ",_", "wsp", "ace_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "filt", "\\u", "diff_", "(_", "s_", ",_", "b_", ",_", "w_", ",_", "border_", "=_", "'", "constant", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "convolve", "_", "(_", "s_", ",_", "w_", ",_", "mode_", "=_", "border_", ",_", "cval", "_", "=_", "0.0_", ")_", "-_", "convolve", "_", "(_", "b_", ",_", "w_", ",_", "mode_", "=_", "border_", ",_", "cval", "_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
statsmodels/statsmodels/statsmodels/iolib/foreign.py
[ { "content": " def __init__(self, fname, missing_values=False, encoding=None):\n if encoding == None:\n import locale\n self._encoding = locale.getpreferredencoding()\n else:\n self._encoding = encoding\n self._missing_values = missing_values\n self._parse_header(fname)", "metadata": "root.StataReader.__init__", "header": "['class', 'StataReader', '(', 'object', ')', ':', '___EOS___']", "index": 293 }, { "content": " def _col_size(self, k = None):\n \"\"\"Calculate size of a data record.\"\"\"\n if len(self._col_sizes) == 0:\n self._col_sizes = lmap(lambda x: self._calcsize(x),\n self._header['typlist'])\n if k == None:\n return self._col_sizes\n else:\n return self._col_sizes[k]", "metadata": "root.StataReader._col_size", "header": "['class', 'StataReader', '(', 'object', ')', ':', '___EOS___']", "index": 503 } ]
[ { "span": "encoding == None:", "start_line": 294, "start_column": 11, "end_line": 294, "end_column": 27 }, { "span": "k == None:", "start_line": 508, "start_column": 11, "end_line": 508, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Stat", "a", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fname_", ",_", "missi", "ng", "\\u", "values_", "=_", "False_", ",_", "encoding_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "encoding_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "encoding_", "=_", "locale_", "._", "getpr", "efer", "rede", "nco", "ding_", "(_", ")_", "\\u\\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", "encoding_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "missi", "ng", "\\u", "values_", "=_", "missi", "ng", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "header_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stat", "a", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "col", "\\u", "size_", "(_", "self_", ",_", "k_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "e", " ", "size", " ", "of", " ", "a", " ", "data", " ", "record", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "col", "\\u", "sizes_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "col", "\\u", "sizes_", "=_", "lma", "p_", "(_", "lambda_", "x_", ":_", "self_", "._", "\\u", "calcsize_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "header_", "[_", "'", "typ", "list", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "k_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "col", "\\u", "sizes_", "\\u\\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_", "._", "\\u", "col", "\\u", "sizes_", "[_", "k_", "]_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
kayhayen/Nuitka/tests/benchmarks/micro/UnpackPerformance.py
[ { "content": "def unpacker():\n for i in range(10000):\n a, b, c = giveUnpackResult()", "metadata": "root.unpacker", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "a,", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 9 }, { "span": "b,", "start_line": 28, "start_column": 11, "end_line": 28, "end_column": 12 }, { "span": "c ", "start_line": 28, "start_column": 14, "end_line": 28, "end_column": 15 } ]
[]
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_", "unpack", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "10000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "b_", ",_", "c_", "=_", "give", "Unpack", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
Calysto/metakernel/metakernel/tests/test_magic.py
[ { "content": "def test_option():\n kernel = get_kernel()\n d = Dummy(kernel)\n assert 'Options:' in d.line_dummy.__doc__\n assert '--size' in d.line_dummy.__doc__\n\n ret = d.call_magic('line', 'dummy', '', 'hey -s400,200')\n assert ret == d\n assert d.foo == 'hey', d.foo\n assert d.size == (400, 200)\n\n ret = d.call_magic('line', 'dummy', '', 'hey there')\n assert d.foo == 'hey there'\n\n ret = d.call_magic('line', 'dummy', '', 'range(1, 10)')\n assert d.foo == range(1, 10)\n\n ret = d.call_magic('line', 'dummy', '', '[1, 2, 3]')\n assert d.foo == [1, 2, 3]\n\n ret = d.call_magic('line', 'dummy', '', 'hey -l -s400,200')\n assert d.size == (400, 200)\n assert d.foo == \"hey -l\"\n\n ret = d.call_magic('line', 'dummy', '', 'hey -s -- -s400,200')\n assert d.size == (400, 200)\n assert d.foo == \"hey -s\"", "metadata": "root.test_option", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "ret ", "start_line": 77, "start_column": 4, "end_line": 77, "end_column": 7 }, { "span": "ret ", "start_line": 80, "start_column": 4, "end_line": 80, "end_column": 7 }, { "span": "ret ", "start_line": 83, "start_column": 4, "end_line": 83, "end_column": 7 }, { "span": "ret ", "start_line": 86, "start_column": 4, "end_line": 86, "end_column": 7 } ]
[ { "span": "ret ", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 7 } ]
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", "option_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kernel_", "=_", "get", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Dummy_", "(_", "kernel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "Optio", "ns", ":'_", "in_", "d_", "._", "line", "\\u", "dummy_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'--", "size", "'_", "in_", "d_", "._", "line", "\\u", "dummy_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ret_", "==_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "'", "hey", "'_", ",_", "d_", "._", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "size_", "==_", "(_", "400_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "there", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "'", "hey", " ", "there", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "range", "(", "1", ",", " ", "10", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "range_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'[", "1", ",", " ", "2", ",", " ", "3", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "l", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "size_", "==_", "(_", "400_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "\"", "hey", " ", "-", "l", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "s", " ", "--", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u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2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
cloudera/hue/desktop/core/ext-py/kazoo-2.0/kazoo/protocol/connection.py
[ { "content": " def _next_server(self, delay):\n jitter = random.randint(0, 100) / 100.0\n while time.time() < self.last_attempt + delay + jitter:\n # Skip rw ping checks if its too soon\n return False\n for host, port in self.hosts:\n log.debug(\"Pinging server for r/w: %s:%s\", host, port)\n self.last_attempt = time.time()\n try:\n with self.socket_handling():\n sock = self.connection((host, port))\n sock.sendall(b\"isro\")\n result = sock.recv(8192)\n sock.close()\n if result == b'rw':\n return (host, port)\n else:\n return False\n except ConnectionDropped:\n return False\n\n # Add some jitter between host pings\n while time.time() < self.last_attempt + jitter:\n return False\n delay *= 2", "metadata": "root.RWPinger._next_server", "header": "['class', 'RWPinger', '(', 'object', ')', ':', '___EOS___']", "index": 105 } ]
[ { "span": "while time.time() < self.last_attempt + jitter:", "start_line": 127, "start_column": 12, "end_line": 127, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "RW", "Ping", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "next", "\\u", "server_", "(_", "self_", ",_", "delay_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jitter_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "time_", "._", "time_", "(_", ")_", "<_", "self_", "._", "last", "\\u", "attempt_", "+_", "delay_", "+_", "jitter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "rw", " ", "ping", " ", "checks", " ", "if", " ", "its", " ", "too", " ", "soo", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "host_", ",_", "port_", "in_", "self_", "._", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "Ping", "ing", " ", "server", " ", "for", " ", "r", "/", "w", ":", " ", "%", "s", ":", "%", "s", "\"_", ",_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "attempt_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "socket", "\\u", "handling", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sock_", "=_", "self_", "._", "connection_", "(_", "(_", "host_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "sendall_", "(_", "b", "\"", "isr", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "sock_", "._", "recv_", "(_", "8192_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "==_", "b", "'", "rw", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Connect", "ion", "Dropp", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "some", " ", "jitter", " ", "bet", "ween", " ", "host", " ", "ping", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "time_", "._", "time_", "(_", ")_", "<_", "self_", "._", "last", "\\u", "attempt_", "+_", "jitter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delay_", "*=_", "2_", "\\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, 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 ]
Testing equality to None
Esri/solutions-geoprocessing-toolbox/utils/test/UnitTestUtilities.py
[ { "content": "def initializeLogger(name):\n ''' get and return named logger '''\n if Configuration.DEBUG == True:\n print(\"UnitTestUtilities - initializeLogger\")\n\n # Check if the path to the log files exists, and create if not\n if not os.path.exists(Configuration.logPath):\n dummy = makeFolderFromPath(Configuration.logPath)\n\n # get a unique log file name if we don't have a name already\n if name == None or name == \"\":\n name = getLoggerName()\n\n logFile = os.path.join(Configuration.logPath, name)\n\n # if the log file does NOT exist, create it\n if not os.path.exists(logFile):\n logFile = makeFileFromPath(logFile)\n\n logging.basicConfig(format='%(levelname)s: %(asctime)s %(message)s', filename=logFile, level=logging.DEBUG)\n logger = logging.getLogger(name)\n return logger", "metadata": "root.initializeLogger", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def checkGeoObjects(objects):\n ''' check geospatial stuff exists '''\n if Configuration.DEBUG == True: print(\"UnitTestUtilities - checkGeoObjects\")\n for object2Check in objects:\n #TODO: Shouldn't we be using arcpy.Exists()?\n desc = arcpy.Describe(object2Check)\n if desc == None:\n print(\"--> Invalid Object: \" + str(object2Check))\n arcpy.AddError(\"Bad Input\")\n raise Exception('Bad Input')\n else:\n if Configuration.DEBUG == True: print(\"Valid Object: \" + desc.Name)", "metadata": "root.checkGeoObjects", "header": "['module', '___EOS___']", "index": 169 } ]
[ { "span": "name == None ", "start_line": 100, "start_column": 7, "end_line": 100, "end_column": 19 }, { "span": "desc == None:", "start_line": 175, "start_column": 11, "end_line": 175, "end_column": 23 } ]
[]
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_", "initialize", "Logger_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "get", " ", "and", " ", "return", " ", "named", " ", "logg", "er", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Configuration_", "._", "DEBUG_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Unit", "Test", "Utili", "ties", " ", "-", " ", "initialize", "Log", "ger", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "path", " ", "to", " ", "the", " ", "log", " ", "files", " ", "exist", "s", ",", " ", "and", " ", "create", " ", "if", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "Configuration_", "._", "log", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dummy_", "=_", "make", "Fold", "er", "Fro", "m", "Path_", "(_", "Configuration_", "._", "log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "a", " ", "unique", " ", "log", " ", "file", " ", "name", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "name", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "==_", "None_", "or_", "name_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "get", "Log", "ger", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "Configuration_", "._", "log", "Path_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "log", " ", "file", " ", "doe", "s", " ", "NOT", " ", "exist", ",", " ", "create", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "log", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "File_", "=_", "make", "File", "Fro", "m", "Path_", "(_", "log", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "format_", "=_", "'%", "(", "level", "name", ")", "s", ":", " ", "%", "(", "asc", "time", ")", "s", " ", "%", "(", "message", ")", "s", "'_", ",_", "filename_", "=_", "log", "File_", ",_", "level_", "=_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "check", "Geo", "Objects_", "(_", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "geos", "pati", "al", " ", "stu", "ff", " ", "exist", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Configuration_", "._", "DEBUG_", "==_", "True_", ":_", "print_", "(_", "\"", "Unit", "Test", "Utili", "ties", " ", "-", " ", "check", "Geo", "Object", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "object", "2", "Check_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Sho", "ul", "dn", "'", "t", " ", "we", " ", "be", " ", "usi", "ng", " ", "arc", "py", ".", "Exist", "s", "()", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "object", "2", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"--", ">", " ", "Inva", "lid", " ", "Object", ":", " ", "\"_", "+_", "str_", "(_", "object", "2", "Check_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "\"", "Ba", "d", " ", "Inp", "ut", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "Ba", "d", " ", "Inp", "ut", "'_", ")_", "\\u\\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_", "Configuration_", "._", "DEBUG_", "==_", "True_", ":_", "print_", "(_", "\"", "Valid", " ", "Object", ":", " ", "\"_", "+_", "desc_", "._", "Name_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
petrvanblokland/Xierpa3/xierpa3/contributions/filibuster/blurbwriter.py
[ { "content": " def replacecode(self, text):\n m = 1\n pend= 0\n while m<>None:\n m = self.pstatement.search(text, pend)\n if m == None:\n return 0, text\n tag = m.group('tagname')\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n try:\n result = eval(tag)\n except:\n result = '__error('+tag+')__'\n if not isinstance(result, basestring):\n result = str(result)\n parts = string.split(text, '<-' + tag + '->')\n text = parts[0] + result + string.join(parts[1:], '<-' + tag + '->')\n return 1, text", "metadata": "root.BlurbWriter.replacecode", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def replacetag(self, level, text):\n level = level + 1\n if level > 100:\n raise 'recursion error? too many nested instructions!', self.lasttag\n #pend = 0\n m = 1\n while m<>None:\n start, stop = self.findtag(text)\n if start == None:\n return 0, text\n tag = text[start:stop]\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n\n # do the meta-recursive tag-tagging thing here\n metatext = text\n metatag = tag\n while string.find(tag, opentag) <> -1:\n _, metatag = self.replacetag(level, tag) # ok, metalog\n parts = string.split(metatext, tag)\n if len(parts) > 1:\n tag = string.join(parts, metatag)\n else:\n tag = metatag\n return self.replacetag(level, tag)\n \n tagname, cmd, variable, hard = self.parsetag(tag)\n # process in-tag commands, if any\n cachethis = 0 # whether results should be cached\n setarticle = 0 # prepare an article ( 'a' or 'an' )\n uppered = 0 # make first character uppercase\n formatcmds = []\n for i in cmd:\n si = string.strip(i)\n if not si:\n continue\n if si=='article':\n setarticle = 1\n elif si[0] == '!': # it's a format command!\n formatcmds.append(si[1:])\n elif si[0] == '^': # make first character uppercase\n uppered = 1\n\n parts = string.split(text, opentag + tag + closetag)\n if self.has_key(tagname):\n _, selection = self.choice(variable, tagname) # ci, selection\n _, c = self.replacetag(level, selection) # ok, c\n else:\n _, c = self.replacetag(level, '__' + tagname + '__') # ok, c \n self.lasttag = c\n\n # take care of the article command\n art = ''\n if setarticle:\n if c[0] in vowels:\n art = 'an '\n else:\n art = 'a '\n if uppered and c:\n c = string.upper(c[0])+c[1:]\n\n # format the line if necessary\n if len(formatcmds) > 0 and self.formatfunc:\n for fc in formatcmds:\n if DEBUG:\n print 'writerformatting before:', fc, c\n if not self.formatdict.has_key(fc):\n continue\n c = self.formatfunc(c, self.formatdict[fc])\n if DEBUG:\n print 'writerformatting after:', fc, c\n\n # build the new line\n vardef = c\n if variable:\n c = ''\n try:\n text = parts[0] + art + c + string.join(parts[1:], opentag + tag + closetag)\n except:\n print '13213312312321231'\n pass\n # store the result in the cache\n # note: it is storing the stylised version\n if variable or cachethis:\n if variable:\n tg = variable\n else:\n tg = tagname\n if hard:\n self.define(tg, vardef)\n else:\n self.softdefine(tg, vardef)\n return 0, text", "metadata": "root.BlurbWriter.replacetag", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 318 } ]
[ { "span": "m == None:", "start_line": 263, "start_column": 15, "end_line": 263, "end_column": 24 }, { "span": "start == None:", "start_line": 326, "start_column": 15, "end_line": 326, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "code_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "pstat", "ement_", "._", "search_", "(_", "text_", ",_", "pend", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "m_", "._", "group_", "(_", "'", "tagname", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\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 ", " _", "result_", "=_", "eval_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "'\\u", "\\u", "error", "('_", "+_", "tag_", "+_", "')", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "result_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "str_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "result_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "tag_", "(_", "self_", ",_", "level_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "level_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", ">_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "recursion", " ", "error", "?", " ", "too", " ", "many", " ", "nest", "ed", " ", "instruct", "ion", "s", "!'_", ",_", "self_", "._", "last", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pend", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "stop_", "=_", "self_", "._", "find", "tag_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "text_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "meta", "-", "recurs", "ive", " ", "tag", "-", "tagging", " ", "thing", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "tag_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "string_", "._", "find_", "(_", "tag_", ",_", "opent", "ag_", ")_", "<_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "meta", "tag_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "#", " ", "ok", ",", " ", "metal", "og_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "meta", "text_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "string_", "._", "join_", "(_", "parts_", ",_", "meta", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "meta", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tagname_", ",_", "cmd_", ",_", "variable_", ",_", "hard", "_", "=_", "self_", "._", "parset", "ag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "in", "-", "tag", " ", "command", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "this_", "=_", "0_", "#", " ", "whe", "ther", " ", "results", " ", "shou", "ld", " ", "be", " ", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seta", "rti", "cle_", "=_", "0_", "#", " ", "prepar", "e", " ", "an", " ", "article", " ", "(", " ", "'", "a", "'", " ", "or", " ", "'", "an", "'", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper", "ed_", "=_", "0_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format", "cmds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "si_", "=_", "string_", "._", "strip_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "si_", ":_", "\\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_", "si_", "==_", "'", "article", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seta", "rti", "cle_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'!'_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "format", " ", "command", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "format", "cmds_", "._", "append_", "(_", "si_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'", "^", "'_", ":_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upper", "ed_", "=_", "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_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key_", "(_", "tagname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "selection_", "=_", "self_", "._", "choice_", "(_", "variable_", ",_", "tagname_", ")_", "#", " ", "ci", ",", " ", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "selection_", ")_", "#", " ", "ok", ",", " ", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "'\\u\\u'_", "+_", "tagname_", "+_", "'\\u\\u'_", ")_", "#", " ", "ok", ",", " ", "c", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "tag_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "care", " ", "of", " ", "the", " ", "article", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "art_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seta", "rti", "cle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "[_", "0_", "]_", "in_", "vowels", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "art_", "=_", "'", "an", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "art_", "=_", "'", "a", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upper", "ed_", "and_", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "string_", "._", "upper_", "(_", "c_", "[_", "0_", "]_", ")_", "+_", "c_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "the", " ", "line", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "format", "cmds_", ")_", ">_", "0_", "and_", "self_", "._", "format", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fc_", "in_", "format", "cmds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "bef", "ore", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "format", "dict_", "._", "has", "\\u", "key_", "(_", "fc_", ")_", ":_", "\\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_", "c_", "=_", "self_", "._", "format", "func_", "(_", "c_", ",_", "self_", "._", "format", "dict_", "[_", "fc_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "after", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "new", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vard", "ef_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "art_", "+_", "c_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\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_", "'", "132", "133", "1231", "232", "1231", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "result", " ", "in", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", ":", " ", "it", " ", "is", " ", "stor", "ing", " ", "the", " ", "sty", "lis", "ed", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "variable_", "or_", "cache", "this_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tg_", "=_", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tg_", "=_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hard", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\u\\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_", "._", "soft", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", ",_", "text_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
rapp-project/rapp-platform/rapp_speech_detection_sphinx4/src/rapp_speech_detection_sphinx4/speech_recognition_sphinx4.py
[ { "content": "#!/usr/bin/env python\n# -*- encode: utf-8 -*-\n\n#Copyright 2015 RAPP\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# Authors: Athanassios Kintsakis, Aris Thallas, Manos Tsardoulias\n# contact: akintsakis@issel.ee.auth.gr, aris.thallas@{iti.gr, gmail.com}, etsardou@iti.gr\n\nimport rospy\nimport sys\nimport subprocess\nimport time\n\nfrom greek_support import *\nfrom english_support import *\nfrom sphinx4_wrapper import *\nfrom rapp_tools import *\nfrom sphinx4_configuration_params import *\n\nfrom global_parameters import GlobalParams\n\nfrom rapp_platform_ros_communications.srv import (\n SpeechRecognitionSphinx4Srv,\n SpeechRecognitionSphinx4SrvResponse,\n SpeechRecognitionSphinx4SrvRequest,\n SpeechRecognitionSphinx4ConfigureSrv,\n SpeechRecognitionSphinx4ConfigureSrvResponse,\n SpeechRecognitionSphinx4ConfigureSrvRequest,\n SpeechRecognitionSphinx4TotalSrv,\n SpeechRecognitionSphinx4TotalSrvResponse\n )\n\nfrom rapp_platform_ros_communications.srv import (\n fetchDataSrv,\n fetchDataSrvRequest\n )\n\nfrom rapp_platform_ros_communications.msg import (\n StringArrayMsg\n )\n\nfrom std_msgs.msg import (\n String\n )\n\n## @class SpeechRecognitionSphinx4\n# @brief Provides a complete Rapp Sphinx Entity.\n#\n# Maintains a complete Rapp Sphinx Entity for the\n# speech_recognition_sphinx4_handler_node.SpeechRecognitionSphinx4HandlerNode\n# to perform the speech recognition.\n\n# Main function\nif __name__ == \"__main__\":\n rospy.init_node('SpeechRecognitionSphinx4')\n SpeechRecognitionSphinx4Node = SpeechRecognitionSphinx4()\n rospy.spin()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SpeechRecognitionSphinx4(GlobalParams):\n\n ## Constructor performing initializations\n\n ## Performs Sphinx4 configuration and speech recognition\n #\n # @param req [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4TotalSrvRequest] The speech recognition request\n # @return res [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4TotalSrvResponse] The speech recognition response\n\n ## Performs Sphinx4 speech recognition\n #\n # @param req [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4SrvRequest] The speech recognition request\n # @return res [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4SrvResponse] The speech recognition response\n\n ## Performs Sphinx4 configuration\n #\n # @param req [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4ConfigureSrvRequest] The sphinx configuration request\n # @return res [rapp_platform_ros_communications::SpeechDetectionSphinx4Wrapper::SpeechRecognitionSphinx4ConfigureSrvRequest] The sphinx configuration response", "metadata": "root.SpeechRecognitionSphinx4", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self):\n GlobalParams.__init__(self)\n\n ## The sphinx wrapper communicates with the actual Sphinx.java process\n #\n # (see sphinx4_wrapper.Sphinx4Wrapper)\n self._sphinx4 = Sphinx4Wrapper()\n ## Greek_support creates necessary files for Greek speech recognition\n #\n # (see greek_support.GreekSupport)\n self._greek_support = GreekSupport()\n ## English creates necessary files for english speech recognition\n #\n # (see english_support.EnglishSupport)\n self._english_support = EnglishSupport()\n ## The Sphinx configuration parameters\n #\n # (see sphinx4_configuration_params.SphinxConfigurationParams)\n self._configuration_params = SphinxConfigurationParams()\n\n ## A dictionary to transform the englified greek words to actual greek words\n self._word_mapping = {}\n\n ## Defines whether database authentication should be used\n self._use_db_authentication = rospy.get_param(\\\n \"rapp_speech_detection_sphinx4_use_db_authentication\")\n\n #---------------------------Check db authentication------------------------#\n if self._use_db_authentication == True:\n serv_db_topic = \\\n rospy.get_param(\"rapp_mysql_wrapper_user_fetch_data_topic\")\n ## The database authentication service client\n #\n # Used to identify user performed the speech recognition request.\n # (see mysql_wrapper.MySQLdbWrapper.fetchData)\n self._authentication_service = rospy.ServiceProxy(\\\n serv_db_topic, fetchDataSrv)\n\n if(not self._use_db_authentication):\n rospy.logerror(\"Sphinx4 Seech Detection use authentication param not found\")\n\n\n total_path = \".:\" + self._sphinx_jar_files_url + \\\n \"/\" + self._sphinx_jar_file + \":\" \\\n + self._sphinx_package_url + \"/src\"\n\n sphinx_configuration = { \\\n 'jar_path' : total_path, \\\n 'configuration_path' : self._language_models_url + \"/greekPack/default.config.xml\", \\\n 'acoustic_model' : self._acoustic_models_url , \\\n 'grammar_name' : 'hello', \\\n 'grammar_folder' : self._language_models_url + \"/greekPack/\", \\\n 'dictionary' : self._language_models_url + \"/greekPack/custom.dict\", \\\n 'language_model' : self._language_models_url + \"/greekPack/sentences.lm.bin\", \\\n 'grammar_disabled' : True\n }\n self._sphinx4.initializeSphinx(sphinx_configuration)", "metadata": "root.SpeechRecognitionSphinx4.__init__", "header": "['class', 'SpeechRecognitionSphinx4', '(', 'GlobalParams', ')', ':', '___NEWLINE___', '___NL___', '## Constructor performing initializations', '___NL___', '___EOS___']", "index": 66 }, { "content": " def speechRecognitionBatch(self, req):\n\n total_res = SpeechRecognitionSphinx4TotalSrvResponse()\n\n #-------------------------Check with database-------------------------#\n if self._use_db_authentication == True:\n req_db = fetchDataSrv()\n req_db.req_cols=[\"username\"]\n entry1=[\"username\", req.user]\n req_db.where_data=[StringArrayMsg(s=entry1)]\n\n resp = self._authentication_service(req_db.req_cols, req_db.where_data)\n if resp.success.data != True or len(resp.res_data) == 0:\n total_res.error = \"Non authenticated user\"\n return total_res\n\n conf_req = SpeechRecognitionSphinx4ConfigureSrvRequest()\n spee_req = SpeechRecognitionSphinx4SrvRequest()\n\n conf_req.language = req.language\n conf_req.words = req.words\n conf_req.grammar = req.grammar\n conf_req.sentences = req.sentences\n\n conf_res = SpeechRecognitionSphinx4ConfigureSrvResponse()\n conf_res = self._configureSpeechRecognition(conf_req)\n total_res.error = conf_res.error\n if conf_res.error != '':\n total_res.error = total_res.error + '\\n' + conf_res.error\n return total_res\n\n spee_req.path = req.path\n spee_req.audio_source = req.audio_source\n spee_req.user = req.user\n spee_res = self._speechRecognition(spee_req)\n total_res.words = spee_res.words\n total_res.error = spee_res.error\n return total_res", "metadata": "root.SpeechRecognitionSphinx4.speechRecognitionBatch", "header": "['class', 'SpeechRecognitionSphinx4', '(', 'GlobalParams', ')', ':', '___NEWLINE___', '___NL___', '## Constructor performing initializations', '___NL___', '___EOS___']", "index": 128 }, { "content": " def _speechRecognition(self, req):\n res = SpeechRecognitionSphinx4SrvResponse()\n words = self._sphinx4.performSpeechRecognition(req.path, req.audio_source, req.user)\n rapp_print (words)\n # Error handling - Must be implemented with exceptions\n if len(words) == 1 and \"Error:\" in words[0]:\n res.error = words[0]\n res.words = []\n return res\n\n for word in words:\n if self._configuration_params._language != \"en\":\n rapp_print (\"Word: #\" + word + \"#\")\n if word == \"\" or word == '<unk>':\n continue\n res.words.append(self._word_mapping[word])\n else:\n res.words.append(word.replace(\"'\",\" \"))\n\n return res;", "metadata": "root.SpeechRecognitionSphinx4._speechRecognition", "header": "['class', 'SpeechRecognitionSphinx4', '(', 'GlobalParams', ')', ':', '___NEWLINE___', '___NL___', '## Constructor performing initializations', '___NL___', '___EOS___']", "index": 171 }, { "content": " def _configureSpeechRecognition(self, req):\n res = SpeechRecognitionSphinx4ConfigureSrvResponse()\n res.error = ''\n conf = {} # Dummy initialization\n reconfigure = False\n\n if self._configuration_params._language != req.language:\n reconfigure = True\n elif self._configuration_params._words != req.words:\n reconfigure = True\n elif self._configuration_params._grammar != req.grammar:\n reconfigure = True\n elif self._configuration_params._sentences != req.sentences:\n reconfigure = True\n self._configuration_params._language = req.language\n self._configuration_params._words = req.words\n self._configuration_params._grammar = req.grammar\n self._configuration_params._sentences = req.sentences\n\n if reconfigure == False:\n return res\n\n # English language\n if self._configuration_params._language == 'en':\n rapp_print (\"Language set to English\")\n # Whole dictionary utilization\n if len(self._configuration_params._words) == 0:\n rapp_print (\"Generic model used\")\n # success is either True (bool) or error (string)\n try:\n conf = self._english_support.getGenericConfiguration()\n except RappError as e:\n res.error = e.value\n return res\n # Limited dictionary utilization\n else:\n rapp_print (\"Limited model used\")\n # success is either True (bool) or error (string)\n try:\n conf = self._english_support.getLimitedVocebularyConfiguration(\\\n self._configuration_params._words, \\\n self._configuration_params._grammar, \\\n self._configuration_params._sentences)\n except RappError as e:\n res.error = e.value\n return res\n\n # Greek language\n elif self._configuration_params._language == \"el\":\n rapp_print (\"Language set to Greek\")\n # Whole dictionary utilization\n if len(self._configuration_params._words) == 0:\n rapp_print (\"Generic model used\")\n # TODO\n # Limited dictionary utilization\n else:\n rapp_print (\"Words to be recognized (\" + \\\n str(len(self._configuration_params._words)) + \"):\")\n # success is either True (bool) or error (string)\n try:\n [conf, eng_w] = self._greek_support.getLimitedVocebularyConfiguration(\\\n self._configuration_params._words, \\\n self._configuration_params._grammar, \\\n self._configuration_params._sentences)\n except RappError as e:\n res.error = e.value\n return res\n\n self._word_mapping = {}\n for ew in eng_w:\n self._word_mapping[ew] = eng_w[ew]\n rapp_print (self._word_mapping)\n\n else:\n res.error = \"Wrong language\"\n return res\n\n # Actual sphinx4 configuration\n rapp_print (\"Configuration: \\n\")\n rapp_print (conf)\n self._sphinx4.configureSphinx(conf)\n return res", "metadata": "root.SpeechRecognitionSphinx4._configureSpeechRecognition", "header": "['class', 'SpeechRecognitionSphinx4', '(', 'GlobalParams', ')', ':', '___NEWLINE___', '___NL___', '## Constructor performing initializations', '___NL___', '___EOS___']", "index": 196 } ]
[ { "span": "import sys", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 10 }, { "span": "import subprocess", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 17 }, { "span": "import time", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 11 }, { "span": "from rapp_platform_ros_communications.srv import (\n SpeechRecognitionSphinx4Srv,\n SpeechRecognitionSphinx4SrvResponse,\n SpeechRecognitionSphinx4SrvRequest,\n SpeechRecognitionSphinx4ConfigureSrv,\n SpeechRecognitionSphinx4ConfigureSrvResponse,\n SpeechRecognitionSphinx4ConfigureSrvRequest,\n SpeechRecognitionSphinx4TotalSrv,\n SpeechRecognitionSphinx4TotalSrvResponse\n )", "start_line": 33, "start_column": 0, "end_line": 42, "end_column": 3 }, { "span": "from rapp_platform_ros_communications.srv import (\n fetchDataSrv,\n fetchDataSrvRequest\n )", "start_line": 44, "start_column": 0, "end_line": 47, "end_column": 3 }, { "span": "from std_msgs.msg import (\n String\n )", "start_line": 53, "start_column": 0, "end_line": 55, "end_column": 3 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "encode", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Copy", "right", " ", "201", "5", " ", "RA", "PP", "_", "\\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_", "#", " ", "Author", "s", ":", " ", "Ath", "ana", "ssi", "os", " ", "Kin", "tsa", "kis", ",", " ", "Ari", "s", " ", "Tha", "lla", "s", ",", " ", "Man", "os", " ", "Ts", "ard", "oul", "ias", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contact", ":", " ", "aki", "nts", "aki", "s", "@", "isse", "l", ".", "ee", ".", "auth", ".", "gr", ",", " ", "aris", ".", "tha", "lla", "s", "@{", "iti", ".", "gr", ",", " ", "gma", "il", ".", "com", "},", " ", "ets", "ard", "ou", "@", "iti", ".", "gr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "rospy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "greek", "\\u", "support_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "english", "\\u", "support_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sphinx", "4", "\\u", "wrapper_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rapp", "\\u", "tools_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sphinx", "4", "\\u", "configura", "tion", "\\u", "params_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "global", "\\u", "parameters_", "import_", "Global", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s_", "._", "srv_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Total", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Total", "Sr", "v", "Response_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s_", "._", "srv_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "Data", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Request_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s_", "._", "msg_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "String", "Array", "Msg_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "std", "\\u", "msgs_", "._", "msg_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "String_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "class", " ", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "brief", " ", "Prov", "ides", " ", "a", " ", "complete", " ", "Ra", "pp", " ", "Sph", "inx", " ", "Entit", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Maint", "ain", "s", " ", "a", " ", "complete", " ", "Ra", "pp", " ", "Sph", "inx", " ", "Entit", "y", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "spe", "ech", "\\u", "recognition", "\\u", "sphinx", "4", "\\u", "handler", "\\u", "node", ".", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Handle", "r", "Node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "perform", " ", "the", " ", "spe", "ech", " ", "recognition", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "function_", "\\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 ", " _", "rospy_", "._", "init", "\\u", "node_", "(_", "'", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Node_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rospy_", "._", "spin_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", "Global", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Constructor", " ", "perform", "ing", " ", "initialization", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Perform", "s", " ", "Sph", "inx", "4", " ", "configura", "tion", " ", "and", " ", "spe", "ech", " ", "recognition", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "req", " ", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Total", "Sr", "v", "Request", "]", " ", "The", " ", "spe", "ech", " ", "recognition", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Total", "Sr", "v", "Respons", "e", "]", " ", "The", " ", "spe", "ech", " ", "recognition", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Perform", "s", " ", "Sph", "inx", "4", " ", "spe", "ech", " ", "recognition", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "req", " ", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Request", "]", " ", "The", " ", "spe", "ech", " ", "recognition", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Respons", "e", "]", " ", "The", " ", "spe", "ech", " ", "recognition", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Perform", "s", " ", "Sph", "inx", "4", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "req", " ", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Request", "]", " ", "The", " ", "sphinx", " ", "configura", "tion", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "Spee", "ch", "Detect", "ion", "Sph", "inx", "4", "Wrapper", "::", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Request", "]", " ", "The", " ", "sphinx", " ", "configura", "tion", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", "Global", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Constructor", " ", "perform", "ing", " ", "initialization", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Global", "Params_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "The", " ", "sphinx", " ", "wrapp", "er", " ", "communi", "cate", "s", " ", "with", " ", "the", " ", "actual", " ", "Sph", "inx", ".", "java", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "sphinx", "4", "\\u", "wrapp", "er", ".", "Sph", "inx", "4", "Wrapper", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "sphinx", "4_", "=_", "Sph", "inx", "4", "Wrapper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Gree", "k", "\\u", "support", " ", "create", "s", " ", "necessar", "y", " ", "files", " ", "for", " ", "Gree", "k", " ", "spe", "ech", " ", "recognition", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "greek", "\\u", "support", ".", "Gree", "k", "Supp", "ort", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "greek", "\\u", "support_", "=_", "Gree", "k", "Support_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Eng", "lish", " ", "create", "s", " ", "necessar", "y", " ", "files", " ", "for", " ", "english", " ", "spe", "ech", " ", "recognition", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "english", "\\u", "support", ".", "Eng", "lish", "Supp", "ort", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "english", "\\u", "support_", "=_", "Eng", "lish", "Support_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "The", " ", "Sph", "inx", " ", "configura", "tion", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "sphinx", "4", "\\u", "configura", "tion", "\\u", "params", ".", "Sph", "inx", "Configura", "tion", "Param", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "=_", "Sph", "inx", "Configura", "tion", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "A", " ", "dictionar", "y", " ", "to", " ", "transform", " ", "the", " ", "eng", "lif", "ied", " ", "greek", " ", "words", " ", "to", " ", "actual", " ", "greek", " ", "words_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "word", "\\u", "mapping_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Define", "s", " ", "whe", "ther", " ", "databa", "se", " ", "authenticat", "ion", " ", "shou", "ld", " ", "be", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "use", "\\u", "db", "\\u", "authentication_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "\"", "rapp", "\\u", "spe", "ech", "\\u", "detect", "ion", "\\u", "sphinx", "4", "\\u", "use", "\\u", "db", "\\u", "authenticat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "------------", "Check", " ", "db", " ", "authenticat", "ion", "--------------", "----------", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "use", "\\u", "db", "\\u", "authentication_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "db", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "\"", "rapp", "\\u", "mysql", "\\u", "wrapp", "er", "\\u", "user", "\\u", "fetch", "\\u", "data\\u", "topic", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "The", " ", "databa", "se", " ", "authenticat", "ion", " ", "service", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "to", " ", "identify", " ", "user", " ", "perform", "ed", " ", "the", " ", "spe", "ech", " ", "recognition", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "mysql", "\\u", "wrapp", "er", ".", "My", "SQL", "db", "Wrapper", ".", "fetch", "Data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "authenticat", "ion", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "db", "\\u", "topic_", ",_", "fetch", "Data", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "\\u", "use", "\\u", "db", "\\u", "authentication_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rospy_", "._", "loge", "rror_", "(_", "\"", "Sph", "inx", "4", " ", "See", "ch", " ", "Detect", "ion", " ", "use", " ", "authenticat", "ion", " ", "param", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "\\u", "path_", "=_", "\".", ":\"_", "+_", "self_", "._", "\\u", "sphinx", "\\u", "jar", "\\u", "files", "\\u", "url_", "+_", "\"/\"_", "+_", "self_", "._", "\\u", "sphinx", "\\u", "jar", "\\u", "file_", "+_", "\":\"_", "+_", "self_", "._", "\\u", "sphinx", "\\u", "package", "\\u", "url_", "+_", "\"/", "src", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sphinx", "\\u", "configuration_", "=_", "{_", "'", "jar", "\\u", "path", "'_", ":_", "total", "\\u", "path_", ",_", "'", "configura", "tion", "\\u", "path", "'_", ":_", "self_", "._", "\\u", "language", "\\u", "model", "s", "\\u", "url_", "+_", "\"/", "greek", "Pack", "/", "default", ".", "config", ".", "xml", "\"_", ",_", "'", "aco", "usti", "c\\u", "model", "'_", ":_", "self_", "._", "\\u", "aco", "usti", "c\\u", "model", "s", "\\u", "url_", ",_", "'", "grammar", "\\u", "name", "'_", ":_", "'", "hell", "o", "'_", ",_", "'", "grammar", "\\u", "folder", "'_", ":_", "self_", "._", "\\u", "language", "\\u", "model", "s", "\\u", "url_", "+_", "\"/", "greek", "Pack", "/\"_", ",_", "'", "dictionar", "y", "'_", ":_", "self_", "._", "\\u", "language", "\\u", "model", "s", "\\u", "url_", "+_", "\"/", "greek", "Pack", "/", "custom", ".", "dict", "\"_", ",_", "'", "language", "\\u", "model", "'_", ":_", "self_", "._", "\\u", "language", "\\u", "model", "s", "\\u", "url_", "+_", "\"/", "greek", "Pack", "/", "sentence", "s", ".", "lm", ".", "bin", "\"_", ",_", "'", "grammar", "\\u", "disable", "d", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sphinx", "4_", "._", "initialize", "Sph", "inx", "_", "(_", "sphinx", "\\u", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", "Global", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Constructor", " ", "perform", "ing", " ", "initialization", "s_", "\\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_", "spe", "ech", "Reco", "gni", "tion", "Batch_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "res_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Total", "Sr", "v", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "----------", "Check", " ", "with", " ", "databa", "se", "--------------", "-----------", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "use", "\\u", "db", "\\u", "authentication_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req", "\\u", "db_", "=_", "fetch", "Data", "Sr", "v_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "db_", "._", "req", "\\u", "cols_", "=_", "[_", "\"", "user", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry", "1_", "=_", "[_", "\"", "user", "name", "\"_", ",_", "req_", "._", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "db_", "._", "where", "\\u", "data_", "=_", "[_", "String", "Array", "Msg_", "(_", "s_", "=_", "entry", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "\\u", "authenticat", "ion", "\\u", "service_", "(_", "req", "\\u", "db_", "._", "req", "\\u", "cols_", ",_", "req", "\\u", "db_", "._", "where", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resp_", "._", "success_", "._", "data_", "!=_", "True_", "or_", "len_", "(_", "resp_", "._", "res", "\\u", "data_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "res_", "._", "error_", "=_", "\"", "Non", " ", "authenticat", "ed", " ", "user", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "total", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conf", "\\u", "req_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "e\\u", "req_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf", "\\u", "req_", "._", "language_", "=_", "req_", "._", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "req_", "._", "words_", "=_", "req_", "._", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "req_", "._", "grammar_", "=_", "req_", "._", "grammar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "req_", "._", "sentences_", "=_", "req_", "._", "sentences_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf", "\\u", "res_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "res_", "=_", "self_", "._", "\\u", "configur", "e", "Spee", "ch", "Reco", "gni", "tion_", "(_", "conf", "\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "res_", "._", "error_", "=_", "conf", "\\u", "res_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conf", "\\u", "res_", "._", "error_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "res_", "._", "error_", "=_", "total", "\\u", "res_", "._", "error_", "+_", "'\\\\", "n", "'_", "+_", "conf", "\\u", "res_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "total", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spe", "e\\u", "req_", "._", "path_", "=_", "req_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "e\\u", "req_", "._", "audio", "\\u", "source_", "=_", "req_", "._", "audio", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "e\\u", "req_", "._", "user_", "=_", "req_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "e\\u", "res_", "=_", "self_", "._", "\\u", "spe", "ech", "Reco", "gni", "tion_", "(_", "spe", "e\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "res_", "._", "words_", "=_", "spe", "e\\u", "res_", "._", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "res_", "._", "error_", "=_", "spe", "e\\u", "res_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "total", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", "Global", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Constructor", " ", "perform", "ing", " ", "initialization", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "spe", "ech", "Reco", "gni", "tion_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Sr", "v", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "self_", "._", "\\u", "sphinx", "4_", "._", "perform", "Spee", "ch", "Reco", "gni", "tion_", "(_", "req_", "._", "path_", ",_", "req_", "._", "audio", "\\u", "source_", ",_", "req_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rapp", "\\u", "print_", "(_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Error", " ", "handling", " ", "-", " ", "Mus", "t", " ", "be", " ", "implemented", " ", "with", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "words_", ")_", "==_", "1_", "and_", "\"", "Error", ":\"_", "in_", "words_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "error_", "=_", "words_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "words_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "word_", "in_", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "language_", "!=_", "\"", "en", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rapp", "\\u", "print_", "(_", "\"", "Word", ":", " ", "#\"_", "+_", "word_", "+_", "\"#\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "word_", "==_", "\"\"_", "or_", "word_", "==_", "'<", "unk", ">'_", ":_", "\\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_", "res_", "._", "words_", "._", "append_", "(_", "self_", "._", "\\u", "word", "\\u", "mapping_", "[_", "word_", "]_", ")_", "\\u\\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_", "._", "words_", "._", "append_", "(_", "word_", "._", "replace_", "(_", "\"'\"_", ",_", "\"", " ", "\"_", ")_", ")_", "\\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_", "res_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4_", "(_", "Global", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Constructor", " ", "perform", "ing", " ", "initialization", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "configur", "e", "Spee", "ch", "Reco", "gni", "tion_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "Spee", "ch", "Reco", "gni", "tion", "Sph", "inx", "4", "Configure", "Sr", "v", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "{_", "}_", "#", " ", "Du", "mm", "y", " ", "initialization", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reconfigur", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "language_", "!=_", "req_", "._", "language_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reconfigur", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", "!=_", "req_", "._", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reconfigur", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "grammar_", "!=_", "req_", "._", "grammar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reconfigur", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "sentences_", "!=_", "req_", "._", "sentences_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reconfigur", "e_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "language_", "=_", "req_", "._", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", "=_", "req_", "._", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "grammar_", "=_", "req_", "._", "grammar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "sentences_", "=_", "req_", "._", "sentences_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "reconfigur", "e_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Eng", "lish", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "language_", "==_", "'", "en", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rapp", "\\u", "print_", "(_", "\"", "Lang", "ua", "ge", " ", "set", " ", "to", " ", "Eng", "lish", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Who", "le", " ", "dictionar", "y", " ", "utilization", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rapp", "\\u", "print_", "(_", "\"", "Gene", "ric", " ", "model", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "success", " ", "is", " ", "eit", "her", " ", "Tru", "e", " ", "(", "bool", ")", " ", "or", " ", "error", " ", "(", "string", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "self_", "._", "\\u", "english", "\\u", "support_", "._", "get", "Gene", "ric", "Configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ra", "pp", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "error_", "=_", "e_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Limit", "ed", " ", "dictionar", "y", " ", "utilization", "_", "\\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 ", " _", "rapp", "\\u", "print_", "(_", "\"", "Limit", "ed", " ", "model", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "success", " ", "is", " ", "eit", "her", " ", "Tru", "e", " ", "(", "bool", ")", " ", "or", " ", "error", " ", "(", "string", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "self_", "._", "\\u", "english", "\\u", "support_", "._", "get", "Limit", "ed", "Vo", "ce", "bul", "ary", "Configuration_", "(_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", ",_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "grammar_", ",_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "sentences_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ra", "pp", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "error_", "=_", "e_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gree", "k", " ", "language_", "\\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_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "language_", "==_", "\"", "el", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rapp", "\\u", "print_", "(_", "\"", "Lang", "ua", "ge", " ", "set", " ", "to", " ", "Gree", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Who", "le", " ", "dictionar", "y", " ", "utilization", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rapp", "\\u", "print_", "(_", "\"", "Gene", "ric", " ", "model", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Limit", "ed", " ", "dictionar", "y", " ", "utilization", "_", "\\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 ", " _", "rapp", "\\u", "print_", "(_", "\"", "Word", "s", " ", "to", " ", "be", " ", "recognize", "d", " ", "(\"_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", ")_", ")_", "+_", "\"):", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "success", " ", "is", " ", "eit", "her", " ", "Tru", "e", " ", "(", "bool", ")", " ", "or", " ", "error", " ", "(", "string", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "conf_", ",_", "eng", "\\u", "w_", "]_", "=_", "self_", "._", "\\u", "greek", "\\u", "support_", "._", "get", "Limit", "ed", "Vo", "ce", "bul", "ary", "Configuration_", "(_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "words_", ",_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "grammar_", ",_", "self_", "._", "\\u", "configura", "tion", "\\u", "params_", "._", "\\u", "sentences_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ra", "pp", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "error_", "=_", "e_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "word", "\\u", "mapping_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ew_", "in_", "eng", "\\u", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "word", "\\u", "mapping_", "[_", "ew_", "]_", "=_", "eng", "\\u", "w_", "[_", "ew_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rapp", "\\u", "print_", "(_", "self_", "._", "\\u", "word", "\\u", "mapping_", ")_", "\\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 ", " _", "res_", "._", "error_", "=_", "\"", "Wro", "ng", " ", "language", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", " ", "sphinx", "4", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rapp", "\\u", "print_", "(_", "\"", "Configura", "tion", ":", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rapp", "\\u", "print_", "(_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sphinx", "4_", "._", "configur", "e", "Sph", "inx", "_", "(_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
kayhayen/Nuitka/tests/basics/BuiltinsTest.py
[ { "content": "# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com\n#\n# Python tests originally created or extracted from other peoples work. The\n# parts were too small to be protected.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nfrom __future__ import print_function\n\n\n\nprint(\"Testing locals():\")\nprint(someFunctionWritingLocals())\nprint(someFunctionWritingLocalsContainingExec())\n\n\nprint(\"Vars on module level\", displayDict(vars()))\n\nmodule_locals = locals()\n\n# Patch away \"__file__\" path in a hard to detect way. This will make sure,\n# repeated calls to locals really get the same dictionary.\nimport os\nmodule_locals[\"__file__\"] = os.path.basename(module_locals[ \"__file__\" ])\ndel module_locals\n\nprint(\"Use of locals on the module level\", displayDict(locals()))\n\n\n\nprint(\"Testing globals():\")\nsomeFunctionUsingGlobals()\n\nprint(\"Testing dir():\")\n\nprint(\"Module dir\", end = ' ')\n\n\nsomeFunctionUsingDir()\n\nprint(\"Making a new type, with type() and 3 args:\", end = ' ')\nnew_class = type(\"Name\", (object,), {})\nprint(new_class, new_class())\n\nprint(\"None has type\", type(None))\n\nprint(\"Constant ranges\", range(2), range(1, 6), range(3, 0, -1), range(3, 8, 2), range(5, -5, -3))\nprint(\"Border cases\", range(0), range(-1), range(-1, 1))\n\nprint(\"Corner case large negative value\", range(-2**100))\nprint(\"Corner case with large start/end values in small range\", range(2**100,2**100+2))\n\ntry:\n print(\"Range with 0 step gives:\", end = ' ')\n print(range(3, 8, 0))\nexcept ValueError as e:\n print(repr(e))\n\ntry:\n print(\"Range with float:\", end = ' ')\n print(range(1.0))\nexcept TypeError as e:\n print(\"Gives exception:\", repr(e))\n\ntry:\n print(\"Empty range call\", end = ' ')\n print(range())\nexcept TypeError as e:\n print(\"Gives exception:\", e)\n\nprint(\"List from iterable\", list(\"abc\"), list())\nprint(\"List from sequence\", list(sequence = (0, 1, 2)))\nprint(\"Tuple from iterable\", tuple(\"cda\"), tuple())\nprint(\"Tuple from sequence\", tuple(sequence = (0, 1, 2)))\n\nprint(\"Dictionary from iterable and keywords\", dict((\"ab\", (1, 2)), f = 1, g = 1))\nprint(\"More constant dictionaries\", {\"two\": 2, \"one\": 1}, {}, dict())\ng = {\"two\": 2, \"one\": 1}\nprint(\"Variable dictionary\", dict(g))\nprint(\"Found during optimization\", dict(dict({\"le\": 2, \"la\": 1}), fu = 3), dict(named = dict({\"le\": 2, \"la\": 1})))\n\nprint(\"Floats from constants\", float(\"3.0\"), float(x = 9.0), float())\nprint(\"Found during optimization\", float(float(\"3.2\")), float(x = float(11.0)))\n\nprint(\"Complex from constants\", complex(\"3.0j\"), complex(real = 9.0), complex(imag = 9.0), complex(1,2), complex())\nprint(\"Found during optimization\", complex(float(\"3.2\")), complex(real = float(11.0)), complex(imag = float(11.0)))\n\nprint(\"Strs from constants\", str(\"3.3\"), str(object = 9.1), str())\nprint(\"Found during optimization\", str(float(\"3.3\")), str(object = float(12.0)))\n\nprint(\"Bools from constants\", bool(\"3.3\"), bool(x = 9.1), bool(0), bool())\nprint(\"Found during optimization\", bool(float(\"3.3\")), bool(x = float(0.0)))\n\nprint(\"Ints from constants\", int('3'), int(x = '9'), int('f', 16), int(x = 'e', base = 16), int(\"0101\", base = 2), int(0), int())\nprint(\"Found ints during optimization\", int(int('3')), int(x = int(0.0)))\n\ntry:\n print(\"Longs from constants\", long('3'), long(x = '9'), long('f', 16), long(x = 'e', base = 16), long(\"0101\", base = 2), long(0), long())\n print(\"Found longs during optimization\", long(long('3')), long(x = long(0.0)))\nexcept NameError:\n print(\"Python3 has no long type.\")\n pass\n\n\ntry:\n print(\"Int with only base\", int(base = 2), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\ntry:\n print(\"Int with large base\", int(2, 37), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\ntry:\n print(\"Long with only base\", int(base = 2), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\n\nprint(\"Oct from constants\", oct(467), oct(0))\nprint(\"Found during optimization\", oct(int('3')))\n\nprint(\"Hex from constants\", hex(467), hex(0))\nprint(\"Found during optimization\", hex(int('3')))\n\n\nprint(\"Bin from constants\", bin(467), bin(0))\nprint(\"Found during optimization\", bin(int('3')))\n\ntry:\n int(1,2,3)\nexcept Exception as e:\n print(\"Too many args gave\", repr(e))\n\ntry:\n int(y = 1)\nexcept Exception as e:\n print(\"Wrong arg\", repr(e))\n\nf = 3\nprint(\"Unoptimized call of int\", int('0' * f, base = 16))\n\nd = { 'x' : \"12\", \"base\" : 8 }\nprint(\"Dict star argument call of int\", int(**d))\n\n\nbase = 16\n\ntry:\n value = unicode(\"20\")\nexcept NameError:\n print(\"Python3: Has unicode by default.\")\n value = \"20\"\n\nprint(\"Unoptimized calls of int with unicode args\", int(value, base), int(value))\n\nbase = 37\ntry:\n print(\"Int with large base\", int(2, base), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\n\ntry:\n print(chr())\nexcept Exception as e:\n print(\"Disallowed without args\", repr(e))\n\ntry:\n print(ord())\nexcept Exception as e:\n print(\"Disallowed without args\", repr(e))\n\ntry:\n print(ord(s = 1))\nexcept Exception as e:\n print(\"Disallowed keyword args\", repr(e))\n\ntry:\n print(ord(1, 2))\nexcept Exception as e:\n print(\"Too many plain args\", repr(e))\n\ntry:\n print(ord(1, s = 2))\nexcept Exception as e:\n print(\"Too many args, some keywords\", repr(e))\n\ntry:\n print(str('1', offer = 2))\nexcept Exception as e:\n print(\"Too many args, some keywords\", repr(e))\n\n# TODO: This is calls, not really builtins.\na = 2\n\nprint(\"Can optimize the star list argness away\", int(*(a,)), end = ' ')\nprint(\"Can optimize the empty star list arg away\", int(*tuple()), end = ' ')\nprint(\"Can optimize the empty star dict arg away\", int(**dict()))\n\nprint(\"Dict building with keyword arguments\", dict(), dict(a = f))\nprint(\n \"Dictionary entirely from constant args\",\n displayDict(\n dict(q = \"Guido\", w = \"van\", e = \"Rossum\", r = \"invented\", t = \"Python\", y = \"\")\n )\n)\n\na = 5\nprint(\"Instance check recognises\", isinstance(a, int))\n\ntry:\n print(\"Instance check with too many arguments\", isinstance(a, long, int))\nexcept Exception as e:\n print(\"Too many args\", repr(e))\n\ntry:\n print(\"Instance check with too many arguments\", isinstance(a))\nexcept Exception as e:\n print(\"Too few args\", repr(e))\n\n\nusingIterToCheckIterable(1)\n\nprint(\"Nested constant, dict inside a list, referencing a built-in compile time constant\", end = ' ')\nprint([dict(type = int)])\n\nprint(\"nan and -nan sign checks:\")\nfrom math import copysign\nprint(copysign(1.0, float(\"nan\")))\nprint(copysign(1.0, float(\"-nan\")))\n\nprint(\"Using != to detect nan floats:\")\na = float(\"nan\")\nif a != a:\n print(\"is nan\")\nelse:\n print(\"isn't nan\")\n\n\nvalues = [\n b'100',\n b'',\n bytearray(b'100'),\n CustomStr(\"100\"),\n CustomBytes(b'100'),\n CustomByteArray(b'100')\n]\n\nfor x in values:\n try:\n print(\"int\", repr(x), int(x), int(x,2))\n except (TypeError, ValueError) as e:\n print(\"caught\", repr(e))\n\n try:\n print(\"long\", repr(x), long(x), long(x,2))\n except (TypeError, ValueError) as e:\n print(\"caught\", repr(e))\n except NameError:\n print(\"Python3 has no long\")\n\n\nz = range(5)\ntry:\n next(z)\nexcept TypeError as e:\n print(\"caught\", repr(e))\n\ntry:\n open()\nexcept TypeError as e:\n print(\"Open without arguments gives\", repr(e))\n\nprint(\"Type of id values:\", type(id(id)))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "pass", "start_line": 172, "start_column": 4, "end_line": 172, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "tests", " ", "original", "ly", " ", "created", " ", "or", " ", "extracted", " ", "from", " ", "other", " ", "people", "s", " ", "work", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "s", " ", "wer", "e", " ", "too", " ", "small", " ", "to", " ", "be", " ", "protect", "ed", "._", "\\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "print_", "(_", "\"", "Test", "ing", " ", "locals", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "some", "Function", "Writ", "ing", "Local", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "some", "Function", "Writ", "ing", "Local", "s", "Contain", "ing", "Exec_", "(_", ")_", ")_", "\\u\\u\\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_", "print_", "(_", "\"", "Var", "s", " ", "on", " ", "module", " ", "level", "\"_", ",_", "display", "Dict_", "(_", "vars_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "locals_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pat", "ch", " ", "awa", "y", " ", "\"\\u\\u", "file", "\\u\\u\"", " ", "path", " ", "in", " ", "a", " ", "hard", " ", "to", " ", "detect", " ", "way", ".", " ", "Thi", "s", " ", "will", " ", "make", " ", "sure", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "repeated", " ", "calls", " ", "to", " ", "locals", " ", "reall", "y", " ", "get", " ", "the", " ", "same", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "locals_", "[_", "\"\\u\\u", "file", "\\u\\u\"_", "]_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "module", "\\u", "locals_", "[_", "\"\\u\\u", "file", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module", "\\u", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Us", "e", " ", "of", " ", "locals", " ", "on", " ", "the", " ", "module", " ", "level", "\"_", ",_", "display", "Dict_", "(_", "locals_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Test", "ing", " ", "globals", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "some", "Function", "Us", "ing", "Globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Test", "ing", " ", "dir", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Modul", "e", " ", "dir", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\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_", "some", "Function", "Us", "ing", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Maki", "ng", " ", "a", " ", "new", " ", "type", ",", " ", "with", " ", "type", "()", " ", "and", " ", "3", " ", "args", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "class_", "=_", "type_", "(_", "\"", "Name", "\"_", ",_", "(_", "object_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "new", "\\u", "class_", ",_", "new", "\\u", "class_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Non", "e", " ", "has", " ", "type", "\"_", ",_", "type_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Const", "ant", " ", "ranges", "\"_", ",_", "range_", "(_", "2_", ")_", ",_", "range_", "(_", "1_", ",_", "6_", ")_", ",_", "range_", "(_", "3_", ",_", "0_", ",_", "-_", "1_", ")_", ",_", "range_", "(_", "3_", ",_", "8_", ",_", "2_", ")_", ",_", "range_", "(_", "5_", ",_", "-_", "5_", ",_", "-_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Border", " ", "case", "s", "\"_", ",_", "range_", "(_", "0_", ")_", ",_", "range_", "(_", "-_", "1_", ")_", ",_", "range_", "(_", "-_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Corner", " ", "case", " ", "large", " ", "negati", "ve", " ", "value", "\"_", ",_", "range_", "(_", "-_", "2_", "**_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Corner", " ", "case", " ", "with", " ", "large", " ", "start", "/", "end", " ", "values", " ", "in", " ", "small", " ", "range", "\"_", ",_", "range_", "(_", "2_", "**_", "100_", ",_", "2_", "**_", "100_", "+_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Range", " ", "with", " ", "0", " ", "step", " ", "give", "s", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", "3_", ",_", "8_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Range", " ", "with", " ", "float", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Give", "s", " ", "exception", ":\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Emp", "ty", " ", "range", " ", "call", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Give", "s", " ", "exception", ":\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "List", " ", "from", " ", "iterable", "\"_", ",_", "list_", "(_", "\"", "abc", "\"_", ")_", ",_", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "List", " ", "from", " ", "sequence", "\"_", ",_", "list_", "(_", "sequence_", "=_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Tup", "le", " ", "from", " ", "iterable", "\"_", ",_", "tuple_", "(_", "\"", "cda", "\"_", ")_", ",_", "tuple_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Tup", "le", " ", "from", " ", "sequence", "\"_", ",_", "tuple_", "(_", "sequence_", "=_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Dict", "ionar", "y", " ", "from", " ", "iterable", " ", "and", " ", "keywords", "\"_", ",_", "dict_", "(_", "(_", "\"", "ab", "\"_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", ",_", "f_", "=_", "1_", ",_", "g_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Mor", "e", " ", "constant", " ", "dictionar", "ies", "\"_", ",_", "{_", "\"", "two", "\"_", ":_", "2_", ",_", "\"", "one", "\"_", ":_", "1_", "}_", ",_", "{_", "}_", ",_", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "{_", "\"", "two", "\"_", ":_", "2_", ",_", "\"", "one", "\"_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Varia", "ble", " ", "dictionar", "y", "\"_", ",_", "dict_", "(_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "dict_", "(_", "dict_", "(_", "{_", "\"", "le", "\"_", ":_", "2_", ",_", "\"", "la", "\"_", ":_", "1_", "}_", ")_", ",_", "fu", "_", "=_", "3_", ")_", ",_", "dict_", "(_", "named_", "=_", "dict_", "(_", "{_", "\"", "le", "\"_", ":_", "2_", ",_", "\"", "la", "\"_", ":_", "1_", "}_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Float", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "float_", "(_", "\"", "3.0", "\"_", ")_", ",_", "float_", "(_", "x_", "=_", "9.0_", ")_", ",_", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "float_", "(_", "float_", "(_", "\"", "3.2", "\"_", ")_", ")_", ",_", "float_", "(_", "x_", "=_", "float_", "(_", "11.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Comple", "x", " ", "from", " ", "constant", "s", "\"_", ",_", "complex_", "(_", "\"", "3.0", "j", "\"_", ")_", ",_", "complex_", "(_", "real_", "=_", "9.0_", ")_", ",_", "complex_", "(_", "imag_", "=_", "9.0_", ")_", ",_", "complex_", "(_", "1_", ",_", "2_", ")_", ",_", "complex_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "complex_", "(_", "float_", "(_", "\"", "3.2", "\"_", ")_", ")_", ",_", "complex_", "(_", "real_", "=_", "float_", "(_", "11.0_", ")_", ")_", ",_", "complex_", "(_", "imag_", "=_", "float_", "(_", "11.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Str", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "str_", "(_", "\"", "3.3", "\"_", ")_", ",_", "str_", "(_", "object_", "=_", "9.1", "_", ")_", ",_", "str_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "str_", "(_", "float_", "(_", "\"", "3.3", "\"_", ")_", ")_", ",_", "str_", "(_", "object_", "=_", "float_", "(_", "12.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Boo", "ls", " ", "from", " ", "constant", "s", "\"_", ",_", "bool_", "(_", "\"", "3.3", "\"_", ")_", ",_", "bool_", "(_", "x_", "=_", "9.1", "_", ")_", ",_", "bool_", "(_", "0_", ")_", ",_", "bool_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "bool_", "(_", "float_", "(_", "\"", "3.3", "\"_", ")_", ")_", ",_", "bool_", "(_", "x_", "=_", "float_", "(_", "0.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Int", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "int_", "(_", "'", "3", "'_", ")_", ",_", "int_", "(_", "x_", "=_", "'", "9", "'_", ")_", ",_", "int_", "(_", "'", "f", "'_", ",_", "16_", ")_", ",_", "int_", "(_", "x_", "=_", "'", "e", "'_", ",_", "base_", "=_", "16_", ")_", ",_", "int_", "(_", "\"", "0101", "\"_", ",_", "base_", "=_", "2_", ")_", ",_", "int_", "(_", "0_", ")_", ",_", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "ints", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "int_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ",_", "int_", "(_", "x_", "=_", "int_", "(_", "0.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 ", " _", "print_", "(_", "\"", "Long", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "long_", "(_", "'", "3", "'_", ")_", ",_", "long_", "(_", "x_", "=_", "'", "9", "'_", ")_", ",_", "long_", "(_", "'", "f", "'_", ",_", "16_", ")_", ",_", "long_", "(_", "x_", "=_", "'", "e", "'_", ",_", "base_", "=_", "16_", ")_", ",_", "long_", "(_", "\"", "0101", "\"_", ",_", "base_", "=_", "2_", ")_", ",_", "long_", "(_", "0_", ")_", ",_", "long_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "long", "s", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "long_", "(_", "long_", "(_", "'", "3", "'_", ")_", ")_", ",_", "long_", "(_", "x_", "=_", "long_", "(_", "0.0_", ")_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Pyth", "on", "3", " ", "has", " ", "no", " ", "long", " ", "type", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "only", " ", "base", "\"_", ",_", "int_", "(_", "base_", "=_", "2_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "large", " ", "base", "\"_", ",_", "int_", "(_", "2_", ",_", "37_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Long", " ", "with", " ", "only", " ", "base", "\"_", ",_", "int_", "(_", "base_", "=_", "2_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Oct", " ", "from", " ", "constant", "s", "\"_", ",_", "oct", "_", "(_", "467", "_", ")_", ",_", "oct", "_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "oct", "_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Hex", " ", "from", " ", "constant", "s", "\"_", ",_", "hex_", "(_", "467", "_", ")_", ",_", "hex_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "hex_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Bin", " ", "from", " ", "constant", "s", "\"_", ",_", "bin_", "(_", "467", "_", ")_", ",_", "bin_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "bin_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", " ", "ga", "ve", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "int_", "(_", "y_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Wro", "ng", " ", "arg", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Uno", "pti", "mi", "zed", " ", "call", " ", "of", " ", "int", "\"_", ",_", "int_", "(_", "'", "0", "'_", "*_", "f_", ",_", "base_", "=_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "{_", "'", "x", "'_", ":_", "\"", "1", "2", "\"_", ",_", "\"", "base", "\"_", ":_", "8_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Dict", " ", "star", " ", "argu", "ment", " ", "call", " ", "of", " ", "int", "\"_", ",_", "int_", "(_", "**_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "16_", "\\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 ", " _", "value_", "=_", "unicode_", "(_", "\"", "20", "\"_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Pyth", "on", "3", ":", " ", "Has", " ", "unicode", " ", "by", " ", "default", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "\"", "20", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Uno", "pti", "mi", "zed", " ", "calls", " ", "of", " ", "int", " ", "with", " ", "unicode", " ", "args", "\"_", ",_", "int_", "(_", "value_", ",_", "base_", ")_", ",_", "int_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "37_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "large", " ", "base", "\"_", ",_", "int_", "(_", "2_", ",_", "base_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "chr_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "with", "out", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "ord_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "with", "out", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "ord_", "(_", "s_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "keyw", "ord", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "ord_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "plain", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "ord_", "(_", "1_", ",_", "s_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", ",", " ", "some", " ", "keywords", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "str_", "(_", "'", "1", "'_", ",_", "offer_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", ",", " ", "some", " ", "keywords", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Thi", "s", " ", "is", " ", "calls", ",", " ", "not", " ", "reall", "y", " ", "bui", "lti", "ns", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "star", " ", "list", " ", "arg", "ness", " ", "awa", "y", "\"_", ",_", "int_", "(_", "*_", "(_", "a_", ",_", ")_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "empty", " ", "star", " ", "list", " ", "arg", " ", "awa", "y", "\"_", ",_", "int_", "(_", "*_", "tuple_", "(_", ")_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "empty", " ", "star", " ", "dict", " ", "arg", " ", "awa", "y", "\"_", ",_", "int_", "(_", "**_", "dict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Dict", " ", "buildi", "ng", " ", "with", " ", "keyw", "ord", " ", "argu", "ment", "s", "\"_", ",_", "dict_", "(_", ")_", ",_", "dict_", "(_", "a_", "=_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dict", "ionar", "y", " ", "entire", "ly", " ", "from", " ", "constant", " ", "args", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "Dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "q_", "=_", "\"", "Guid", "o", "\"_", ",_", "w_", "=_", "\"", "van", "\"_", ",_", "e_", "=_", "\"", "Ros", "sum", "\"_", ",_", "r_", "=_", "\"", "inven", "ted", "\"_", ",_", "t_", "=_", "\"", "Pyth", "on", "\"_", ",_", "y_", "=_", "\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "recog", "nis", "es", "\"_", ",_", "isinstance_", "(_", "a_", ",_", "int_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "with", " ", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "isinstance_", "(_", "a_", ",_", "long_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "with", " ", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "isinstance_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "few", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "usi", "ng", "It", "er", "To", "Check", "Iterable_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Nest", "ed", " ", "constant", ",", " ", "dict", " ", "insi", "de", " ", "a", " ", "list", ",", " ", "referenci", "ng", " ", "a", " ", "bui", "lt", "-", "in", " ", "compile", " ", "time", " ", "constant", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "[_", "dict_", "(_", "type_", "=_", "int_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "nan", " ", "and", " ", "-", "nan", " ", "sign", " ", "checks", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "copy", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "copy", "sign_", "(_", "1.0_", ",_", "float_", "(_", "\"", "nan", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "copy", "sign_", "(_", "1.0_", ",_", "float_", "(_", "\"-", "nan", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Us", "ing", " ", "!=", " ", "to", " ", "detect", " ", "nan", " ", "float", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "float_", "(_", "\"", "nan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "!=_", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "is", " ", "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 ", " _", "print_", "(_", "\"", "isn", "'", "t", " ", "nan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "100", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'", "100", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Str_", "(_", "\"", "100", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Bytes_", "(_", "b", "'", "100", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Byte", "Array_", "(_", "b", "'", "100", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "int", "\"_", ",_", "repr_", "(_", "x_", ")_", ",_", "int_", "(_", "x_", ")_", ",_", "int_", "(_", "x_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "long", "\"_", ",_", "repr_", "(_", "x_", ")_", ",_", "long_", "(_", "x_", ")_", ",_", "long_", "(_", "x_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Pyth", "on", "3", " ", "has", " ", "no", " ", "long", "\"_", ")_", "\\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_", "z_", "=_", "range_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "(_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Open", " ", "with", "out", " ", "argu", "ment", "s", " ", "give", "s", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Type", " ", "of", " ", "id", " ", "values", ":\"_", ",_", "type_", "(_", "id_", "(_", "id_", ")_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
rvanlaar/easy-transifex/src/transifex/transifex/resources/tests/lib/qt/__init__.py
[ { "content": " def test_unfinished_entries(self):\n \"\"\"Test that unfinished entries are not added in the database\"\"\"\n # Empty our resource\n SourceEntity.objects.filter(resource=self.resource).delete()\n\n # Make sure that we have no translations to begin with\n self.assertEqual(Translation.objects.filter(source_entity__in=\n SourceEntity.objects.filter(resource=self.resource).values('id')).count(), 0)\n\n # Import file with two senteces\n handler = LinguistHandler('%s/general/unfinished.ts' %\n os.path.split(__file__)[0])\n handler.bind_resource(self.resource)\n handler.set_language(self.resource.source_language)\n handler.parse_file(is_source=True)\n handler.save2db(is_source=True)\n\n # Make sure that we have all sources in the db\n self.assertEqual(SourceEntity.objects.filter(\n resource=self.resource).values('id').count(), 2)\n\n # Make sure that we have all translations in the db\n self.assertEqual(Translation.objects.filter(source_entity__in=\n SourceEntity.objects.filter(resource=self.resource).values('id')).count(), 2)\n\n # Import the same file as a translation file in pt_BR.\n handler = LinguistHandler('%s/general/unfinished.ts' %\n os.path.split(__file__)[0])\n handler.bind_resource(self.resource)\n handler.set_language(self.language)\n handler.parse_file()\n handler.save2db()\n\n # Make sure that we have all sources in the db\n self.assertEqual(SourceEntity.objects.filter(\n resource=self.resource).values('id').count(), 2)\n\n # Make sure that we have all translations in the db\n # One is marked as unfinished so it shouldn't be saved\n self.assertEqual(Translation.objects.filter(source_entity__in=\n SourceEntity.objects.filter(resource=self.resource).values('id')).count(), 3)\n\n # The unfinished translation should be added as a translation\n self.assertEqual(Suggestion.objects.filter(source_entity__in=\n SourceEntity.objects.filter(resource=self.resource).values('id')).count(), 1)", "metadata": "root.TestQtFile.test_unfinished_entries", "header": "['class', 'TestQtFile', '(', 'FormatsBaseTestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def test_unfinished_entries(self):\n testfile = os.path.join(\n os.path.dirname(__file__),\n 'en-untranslated.ts'\n )\n handler = LinguistHandler(testfile)\n handler.bind_resource(self.resource)\n handler.set_language(self.language)\n handler.parse_file(is_source=True)\n handler.save2db(is_source=True)\n lang = Language.objects.by_code_or_alias('el')\n testfile = os.path.join(\n os.path.dirname(__file__),\n 'gr-untranslated.ts'\n )\n handler = LinguistHandler(testfile)\n handler.bind_resource(self.resource)\n handler.set_language(lang)\n handler.parse_file()\n handler.save2db()\n handler.compile()\n self.assertEqual(handler.compiled_template.count('unfinished'), 2)", "metadata": "root.TestQtFile.test_unfinished_entries", "header": "['class', 'TestQtFile', '(', 'FormatsBaseTestCase', ')', ':', '___EOS___']", "index": 316 } ]
[ { "span": "test_unfinished_entries(", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 31 } ]
[ { "span": "test_unfinished_entries(", "start_line": 316, "start_column": 8, "end_line": 316, "end_column": 31 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Qt", "File_", "(_", "Format", "s", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unfi", "nish", "ed", "\\u", "entries_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "unfi", "nish", "ed", " ", "entri", "es", " ", "are", " ", "not", " ", "adde", "d", " ", "in", " ", "the", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Emp", "ty", " ", "our", " ", "resource_", "\\u\\u\\uNL\\u\\u\\u_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "we", " ", "have", " ", "no", " ", "translatio", "ns", " ", "to", " ", "begin", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "in_", "=_", "\\u\\u\\uNL\\u\\u\\u_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", ")_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "file", " ", "with", " ", "two", " ", "sent", "ece", "s_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Lin", "gui", "st", "Handler_", "(_", "'%", "s", "/", "genera", "l", "/", "unfi", "nish", "ed", ".", "ts", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "bind", "\\u", "resource_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set\\u", "language_", "(_", "self_", "._", "resource_", "._", "source", "\\u", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "parse", "\\u", "file_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "save", "2d", "b_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "we", " ", "have", " ", "all", " ", "source", "s", " ", "in", " ", "the", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "we", " ", "have", " ", "all", " ", "translatio", "ns", " ", "in", " ", "the", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "in_", "=_", "\\u\\u\\uNL\\u\\u\\u_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "same", " ", "file", " ", "as", " ", "a", " ", "translatio", "n", " ", "file", " ", "in", " ", "pt", "\\u", "BR", "._", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Lin", "gui", "st", "Handler_", "(_", "'%", "s", "/", "genera", "l", "/", "unfi", "nish", "ed", ".", "ts", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "bind", "\\u", "resource_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set\\u", "language_", "(_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "parse", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "save", "2d", "b_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "we", " ", "have", " ", "all", " ", "source", "s", " ", "in", " ", "the", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "we", " ", "have", " ", "all", " ", "translatio", "ns", " ", "in", " ", "the", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "is", " ", "marked", " ", "as", " ", "unfi", "nish", "ed", " ", "so", " ", "it", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "saved_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "in_", "=_", "\\u\\u\\uNL\\u\\u\\u_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", ")_", "._", "count_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "unfi", "nish", "ed", " ", "translatio", "n", " ", "shou", "ld", " ", "be", " ", "adde", "d", " ", "as", " ", "a", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Suggestion", "_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "in_", "=_", "\\u\\u\\uNL\\u\\u\\u_", "Sou", "rce", "Entity_", "._", "objects_", "._", "filter_", "(_", "resource_", "=_", "self_", "._", "resource_", ")_", "._", "values_", "(_", "'", "id", "'_", ")_", ")_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Qt", "File_", "(_", "Format", "s", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unfi", "nish", "ed", "\\u", "entries_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "-", "untr", "ans", "late", "d", ".", "ts", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Lin", "gui", "st", "Handler_", "(_", "testfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "bind", "\\u", "resource_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set\\u", "language_", "(_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "parse", "\\u", "file_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "save", "2d", "b_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", "=_", "Language_", "._", "objects_", "._", "by", "\\u", "code", "\\u", "or", "\\u", "alias_", "(_", "'", "el", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gr", "-", "untr", "ans", "late", "d", ".", "ts", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Lin", "gui", "st", "Handler_", "(_", "testfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "bind", "\\u", "resource_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set\\u", "language_", "(_", "lang_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "parse", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "save", "2d", "b_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "handler_", "._", "compile", "d\\u", "template_", "._", "count_", "(_", "'", "unfi", "nish", "ed", "'_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
AcademicsToday/py-academicstoday/academicstoday_project/teacher/tests/test_syllabus.py
[ { "content": " def test_syllabus_page_with_pdf_file(self):\n kwargs = {'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}\n client = self.get_logged_in_client()\n file_path = settings.MEDIA_ROOT + '/sample.pdf'\n with open(file_path, 'rb') as fp:\n self.assertTrue(fp is not None)\n response = client.post('/teacher/course/1/save_syllabus',{\n 'file': fp,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n response = client.post('/teacher/course/1/syllabus')\n self.assertEqual(response.status_code, 200)\n self.assertIn(b'Comics Book Course',response.content)\n self.assertIn(b'ajax_delete_syllabus',response.content)\n self.assertIn(b'PDF RESULT',response.content)", "metadata": "root.SyllabusTestCase.test_syllabus_page_with_pdf_file", "header": "['class', 'SyllabusTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_save_syllabus(self):\n kwargs = {'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}\n client = self.get_logged_in_client()\n file_path = settings.MEDIA_ROOT + '/sample.pdf'\n with open(file_path, 'rb') as fp:\n self.assertTrue(fp is not None)\n response = client.post('/teacher/course/1/save_syllabus',{\n 'file': fp,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n json_string = response.content.decode(encoding='UTF-8')\n array = json.loads(json_string)\n self.assertEqual(array['message'], 'saved')\n self.assertEqual(array['status'], 'success')", "metadata": "root.SyllabusTestCase.test_save_syllabus", "header": "['class', 'SyllabusTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_delete_syllabus_with_correct_user(self):\n kwargs = {'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}\n client = self.get_logged_in_client()\n file_path = settings.MEDIA_ROOT + '/sample.pdf'\n with open(file_path, 'rb') as fp:\n self.assertTrue(fp is not None)\n response = client.post('/teacher/course/1/save_syllabus',{\n 'file': fp,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n json_string = response.content.decode(encoding='UTF-8')\n array = json.loads(json_string)\n self.assertEqual(array['message'], 'saved')\n self.assertEqual(array['status'], 'success')\n \n response = client.post('/teacher/course/1/delete_syllabus',{\n 'syllabus_id': 1,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n json_string = response.content.decode(encoding='UTF-8')\n array = json.loads(json_string)\n self.assertEqual(array['message'], 'deleted')\n self.assertEqual(array['status'], 'success')", "metadata": "root.SyllabusTestCase.test_delete_syllabus_with_correct_user", "header": "['class', 'SyllabusTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 126 }, { "content": " def test_delete_syllabus_with_correct_user(self):\n kwargs = {'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}\n client = self.get_logged_in_client()\n file_path = settings.MEDIA_ROOT + '/sample.pdf'\n with open(file_path, 'rb') as fp:\n self.assertTrue(fp is not None)\n response = client.post('/teacher/course/1/save_syllabus',{\n 'file': fp,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n json_string = response.content.decode(encoding='UTF-8')\n array = json.loads(json_string)\n self.assertEqual(array['message'], 'saved')\n self.assertEqual(array['status'], 'success')\n client.logout()\n client = self.get_logged_in_trudy_client()\n response = client.post('/teacher/course/1/delete_syllabus',{\n 'syllabus_id': 1,\n }, **kwargs)\n self.assertEqual(response.status_code, 200)\n json_string = response.content.decode(encoding='UTF-8')\n array = json.loads(json_string)\n self.assertEqual(array['message'], 'unauthorized deletion')\n self.assertEqual(array['status'], 'failed')", "metadata": "root.SyllabusTestCase.test_delete_syllabus_with_correct_user", "header": "['class', 'SyllabusTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 150 } ]
[ { "span": "self.assertTrue(fp is not None)", "start_line": 100, "start_column": 12, "end_line": 100, "end_column": 43 }, { "span": "self.assertTrue(fp is not None)", "start_line": 116, "start_column": 12, "end_line": 116, "end_column": 43 }, { "span": "self.assertTrue(fp is not None)", "start_line": 131, "start_column": 12, "end_line": 131, "end_column": 43 }, { "span": "self.assertTrue(fp is not None)", "start_line": 155, "start_column": 12, "end_line": 155, "end_column": 43 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Sy", "lla", "bus", "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", "syl", "lab", "us", "\\u", "page", "\\u", "with", "\\u", "pdf", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "'", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "get", "\\u", "logged", "\\u", "in", "\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "settings_", "._", "MEDIA", "\\u", "ROOT_", "+_", "'/", "sample", ".", "pdf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "fp_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "save", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "fp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "syl", "lab", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "'", "Com", "ics", " ", "Boo", "k", " ", "Cour", "se", "'_", ",_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "'", "aja", "x", "\\u", "delete", "\\u", "syl", "lab", "us", "'_", ",_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "'", "PD", "F", " ", "RESU", "LT", "'_", ",_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sy", "lla", "bus", "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", "save", "\\u", "syl", "lab", "us_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "'", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "get", "\\u", "logged", "\\u", "in", "\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "settings_", "._", "MEDIA", "\\u", "ROOT_", "+_", "'/", "sample", ".", "pdf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "fp_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "save", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "fp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "string_", "=_", "response_", "._", "content_", "._", "decode_", "(_", "encoding_", "=_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "message", "'_", "]_", ",_", "'", "saved", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "status", "'_", "]_", ",_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sy", "lla", "bus", "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", "delete", "\\u", "syl", "lab", "us", "\\u", "with", "\\u", "correct", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "'", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "get", "\\u", "logged", "\\u", "in", "\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "settings_", "._", "MEDIA", "\\u", "ROOT_", "+_", "'/", "sample", ".", "pdf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "fp_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "save", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "fp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "string_", "=_", "response_", "._", "content_", "._", "decode_", "(_", "encoding_", "=_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "message", "'_", "]_", ",_", "'", "saved", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "status", "'_", "]_", ",_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "delete", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "syl", "lab", "us", "\\u", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "string_", "=_", "response_", "._", "content_", "._", "decode_", "(_", "encoding_", "=_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "message", "'_", "]_", ",_", "'", "delete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "status", "'_", "]_", ",_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sy", "lla", "bus", "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", "delete", "\\u", "syl", "lab", "us", "\\u", "with", "\\u", "correct", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "'", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "get", "\\u", "logged", "\\u", "in", "\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "settings_", "._", "MEDIA", "\\u", "ROOT_", "+_", "'/", "sample", ".", "pdf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "rb", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "fp_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "save", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "fp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "string_", "=_", "response_", "._", "content_", "._", "decode_", "(_", "encoding_", "=_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "message", "'_", "]_", ",_", "'", "saved", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "status", "'_", "]_", ",_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "get", "\\u", "logged", "\\u", "in", "\\u", "tru", "dy", "\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "post_", "(_", "'/", "teacher", "/", "course", "/", "1", "/", "delete", "\\u", "syl", "lab", "us", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "syl", "lab", "us", "\\u", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "string_", "=_", "response_", "._", "content_", "._", "decode_", "(_", "encoding_", "=_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "message", "'_", "]_", ",_", "'", "unauthorized", " ", "deletion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "array_", "[_", "'", "status", "'_", "]_", ",_", "'", "fail", "ed", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
BD2KGenomics/toil/src/toil/test/batchSystems/batchSystemTest.py
[ { "content": "class hidden:\n \"\"\"\n Hide abstract base class from unittest's test case loader\n\n http://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class#answer-25695512\n \"\"\"\n\n class AbstractBatchSystemTest(ToilTest):\n \"\"\"\n A base test case with generic tests that every batch system should pass\n \"\"\"\n __metaclass__ = ABCMeta\n\n @abstractmethod\n def createBatchSystem(self):\n \"\"\"\n :rtype: AbstractBatchSystem\n \"\"\"\n raise NotImplementedError\n\n def supportsWallTime(self):\n return False\n\n def _createDummyConfig(self):\n return Config()\n\n @classmethod\n def setUpClass(cls):\n super(hidden.AbstractBatchSystemTest, cls).setUpClass()\n logging.basicConfig(level=logging.DEBUG)\n\n def setUp(self):\n super(hidden.AbstractBatchSystemTest, self).setUp()\n self.config = self._createDummyConfig()\n self.batchSystem = self.createBatchSystem()\n self.tempDir = self._createTempDir('testFiles')\n\n def tearDown(self):\n self.batchSystem.shutdown()\n super(hidden.AbstractBatchSystemTest, self).tearDown()\n\n def testAvailableCores(self):\n self.assertTrue(multiprocessing.cpu_count() >= numCores)\n\n def testRunJobs(self):\n testPath = os.path.join(self.tempDir, \"test.txt\")\n\n job1 = self.batchSystem.issueBatchJob(\"sleep 1000\", **defaultRequirements)\n job2 = self.batchSystem.issueBatchJob(\"sleep 1000\", **defaultRequirements)\n\n issuedIDs = self._waitForJobsToIssue(2)\n self.assertEqual(set(issuedIDs), {job1, job2})\n\n runningJobIDs = self._waitForJobsToStart(2)\n self.assertEqual(set(runningJobIDs), {job1, job2})\n\n # Killing the jobs instead of allowing them to complete means this test can run very\n # quickly if the batch system issues and starts the jobs quickly.\n self.batchSystem.killBatchJobs([job1, job2])\n self.assertEqual({}, self.batchSystem.getRunningBatchJobIDs())\n\n # Issue a job and then allow it to finish by itself, causing it to be added to the\n # updated jobs queue.\n self.assertFalse(os.path.exists(testPath))\n job3 = self.batchSystem.issueBatchJob(\"touch %s\" % testPath, **defaultRequirements)\n\n updatedID, exitStatus, wallTime = self.batchSystem.getUpdatedBatchJob(maxWait=1000)\n\n # Since the first two jobs were killed, the only job in the updated jobs queue should\n # be job 3. If the first two jobs were (incorrectly) added to the queue, this will\n # fail with updatedID being equal to job1 or job2.\n self.assertEqual(exitStatus, 0)\n self.assertEqual(updatedID, job3)\n if self.supportsWallTime():\n self.assertTrue(wallTime > 0)\n else:\n self.assertIsNone(wallTime)\n self.assertTrue(os.path.exists(testPath))\n self.assertFalse(self.batchSystem.getUpdatedBatchJob(0))\n\n # Make sure killBatchJobs can handle jobs that don't exist\n self.batchSystem.killBatchJobs([10])\n\n def testSetEnv(self):\n # Parasol disobeys shell rules and stupidly splits the command at the space character\n # before exec'ing it, whether the space is quoted, escaped or not. This means that we\n # can't have escaped or quotes spaces in the command line. So we can't use bash -c\n # '...' or python -c '...'. The safest thing to do here is to script the test and\n # invoke that script rather than inline the test via -c.\n def assertEnv():\n import os, sys\n sys.exit(0 if os.getenv('FOO') == 'bar' else 42)\n\n script_body = dedent('\\n'.join(getsource(assertEnv).split('\\n')[1:]))\n with tempFileContaining(script_body) as script_path:\n # First, ensure that the test fails if the variable is *not* set\n command = sys.executable + ' ' + script_path\n job4 = self.batchSystem.issueBatchJob(command, **defaultRequirements)\n updatedID, exitStatus, wallTime = self.batchSystem.getUpdatedBatchJob(maxWait=1000)\n self.assertEqual(exitStatus, 42)\n self.assertEqual(updatedID, job4)\n # Now set the variable and ensure that it is present\n self.batchSystem.setEnv('FOO', 'bar')\n job5 = self.batchSystem.issueBatchJob(command, **defaultRequirements)\n updatedID, exitStatus, wallTime = self.batchSystem.getUpdatedBatchJob(maxWait=1000)\n self.assertEqual(exitStatus, 0)\n self.assertEqual(updatedID, job5)\n\n def testCheckResourceRequest(self):\n if isinstance(self.batchSystem, BatchSystemSupport):\n checkResourceRequest = self.batchSystem.checkResourceRequest\n self.assertRaises(InsufficientSystemResources, checkResourceRequest,\n memory=1000, cores=200, disk=1e9)\n self.assertRaises(InsufficientSystemResources, checkResourceRequest,\n memory=5, cores=200, disk=1e9)\n self.assertRaises(InsufficientSystemResources, checkResourceRequest,\n memory=1001e9, cores=1, disk=1e9)\n self.assertRaises(InsufficientSystemResources, checkResourceRequest,\n memory=5, cores=1, disk=2e9)\n self.assertRaises(AssertionError, checkResourceRequest,\n memory=None, cores=1, disk=1000)\n self.assertRaises(AssertionError, checkResourceRequest,\n memory=10, cores=None, disk=1000)\n checkResourceRequest(memory=10, cores=1, disk=100)\n\n def testGetRescueJobFrequency(self):\n self.assertTrue(self.batchSystem.getRescueBatchJobFrequency() > 0)\n\n def testScalableBatchSystem(self):\n # If instance of scalable batch system\n pass\n\n def _waitForJobsToIssue(self, numJobs):\n issuedIDs = []\n while not len(issuedIDs) == numJobs:\n issuedIDs = self.batchSystem.getIssuedBatchJobIDs()\n return issuedIDs\n\n def _waitForJobsToStart(self, numJobs):\n runningIDs = []\n while not len(runningIDs) == numJobs:\n time.sleep(0.1)\n runningIDs = self.batchSystem.getRunningBatchJobIDs().keys()\n return runningIDs", "metadata": "root.hidden", "header": "['module', '___EOS___']", "index": 52 }, { "content": " @skipIf(SingleMachineBatchSystem.numCores < 3, 'Need at least three cores to run this test')\n def testServices(self):\n options = Job.Runner.getDefaultOptions(self._getTestJobStorePath())\n options.logDebug = True\n options.maxCores = 3\n self.assertTrue(options.maxCores <= SingleMachineBatchSystem.numCores)\n Job.Runner.startToil(Job.wrapJobFn(parentJob, self.scriptCommand()), options)\n with open(self.counterPath, 'r+') as f:\n s = f.read()\n log.info('Counter is %s', s)\n self.assertEqual(self.getCounters(), (0, 3))", "metadata": "root.MaxCoresSingleMachineBatchSystemTest.testServices", "header": "['class', 'MaxCoresSingleMachineBatchSystemTest', '(', 'ToilTest', ')', ':', '___EOS___']", "index": 364 } ]
[ { "span": "self.assertTrue(multiprocessing.cpu_count() >= numCores)", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 68 }, { "span": "self.assertTrue(wallTime > 0)", "start_line": 126, "start_column": 16, "end_line": 126, "end_column": 45 }, { "span": "self.assertTrue(self.batchSystem.getRescueBatchJobFrequency() > 0)", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 78 }, { "span": "self.assertTrue(options.maxCores <= SingleMachineBatchSystem.numCores)", "start_line": 369, "start_column": 8, "end_line": 369, "end_column": 78 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hi", "de", " ", "abstract", " ", "base", " ", "class", " ", "from", " ", "unittest", "'", "s", " ", "test", " ", "case", " ", "load", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "132", "345", "5", "/", "python", "-", "unit", "-", "test", "-", "with", "-", "base", "-", "and", "-", "sub", "-", "class", "#", "answer", "-", "256", "955", "1", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Abstract", "Bat", "ch", "System", "Test_", "(_", "To", "il", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "base", " ", "test", " ", "case", " ", "with", " ", "gener", "ic", " ", "tests", " ", "tha", "t", " ", "every", " ", "batch", " ", "system", " ", "shou", "ld", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "ABC", "Meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "Bat", "ch", "System_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Abstract", "Bat", "ch", "System", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "support", "s", "Wall", "Time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "Du", "mm", "y", "Config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "hidden_", "._", "Abstract", "Bat", "ch", "System", "Test_", ",_", "cls_", ")_", "._", "set", "Up", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "hidden_", "._", "Abstract", "Bat", "ch", "System", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "self_", "._", "\\u", "create", "Du", "mm", "y", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch", "System_", "=_", "self_", "._", "create", "Bat", "ch", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temp", "Dir_", "=_", "self_", "._", "\\u", "create", "Temp", "Dir_", "(_", "'", "test", "Files", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "batch", "System_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "hidden_", "._", "Abstract", "Bat", "ch", "System", "Test_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Avail", "able", "Core", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", ">=_", "num", "Core", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Run", "Jobs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "temp", "Dir_", ",_", "\"", "test", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "1_", "=_", "self_", "._", "batch", "System_", "._", "issue", "Bat", "ch", "Job_", "(_", "\"", "sleep", " ", "1000", "\"_", ",_", "**_", "default", "Requirements", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "2_", "=_", "self_", "._", "batch", "System_", "._", "issue", "Bat", "ch", "Job_", "(_", "\"", "sleep", " ", "1000", "\"_", ",_", "**_", "default", "Requirements", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "issue", "d", "ID", "s_", "=_", "self_", "._", "\\u", "wait", "For", "Jo", "bs", "To", "Issue_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "issue", "d", "ID", "s_", ")_", ",_", "{_", "job", "1_", ",_", "job", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runn", "ing", "Jo", "b", "ID", "s_", "=_", "self_", "._", "\\u", "wait", "For", "Jo", "bs", "To", "Start_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "runn", "ing", "Jo", "b", "ID", "s_", ")_", ",_", "{_", "job", "1_", ",_", "job", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Kill", "ing", " ", "the", " ", "jobs", " ", "inst", "ead", " ", "of", " ", "allow", "ing", " ", "them", " ", "to", " ", "complete", " ", "means", " ", "this", " ", "test", " ", "can", " ", "run", " ", "very", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "quickl", "y", " ", "if", " ", "the", " ", "batch", " ", "system", " ", "issue", "s", " ", "and", " ", "starts", " ", "the", " ", "jobs", " ", "quickl", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "batch", "System_", "._", "kill", "Bat", "ch", "Jobs_", "(_", "[_", "job", "1_", ",_", "job", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "{_", "}_", ",_", "self_", "._", "batch", "System_", "._", "get", "Run", "ning", "Bat", "ch", "Jo", "b", "ID", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "job", " ", "and", " ", "then", " ", "allow", " ", "it", " ", "to", " ", "finish", " ", "by", " ", "its", "elf", ",", " ", "caus", "ing", " ", "it", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", " ", "jobs", " ", "queue", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "test", "Path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "3_", "=_", "self_", "._", "batch", "System_", "._", "issue", "Bat", "ch", "Job_", "(_", "\"", "touch", " ", "%", "s", "\"_", "%_", "test", "Path_", ",_", "**_", "default", "Requirements", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "d", "ID_", ",_", "exit", "Status_", ",_", "wall", "Time_", "=_", "self_", "._", "batch", "System_", "._", "get", "Update", "d", "Bat", "ch", "Job_", "(_", "max", "Wait_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "the", " ", "first", " ", "two", " ", "jobs", " ", "wer", "e", " ", "kille", "d", ",", " ", "the", " ", "only", " ", "job", " ", "in", " ", "the", " ", "update", "d", " ", "jobs", " ", "queue", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "job", " ", "3", ".", " ", "If", " ", "the", " ", "first", " ", "two", " ", "jobs", " ", "wer", "e", " ", "(", "incorrect", "ly", ")", " ", "adde", "d", " ", "to", " ", "the", " ", "queue", ",", " ", "this", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", " ", "with", " ", "update", "d", "ID", " ", "bei", "ng", " ", "equal", " ", "to", " ", "job", "1", " ", "or", " ", "job", "2._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exit", "Status_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "update", "d", "ID_", ",_", "job", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "support", "s", "Wall", "Time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "wall", "Time_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "None_", "(_", "wall", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "test", "Path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "batch", "System_", "._", "get", "Update", "d", "Bat", "ch", "Job_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "kill", "Bat", "ch", "Jo", "bs", " ", "can", " ", "handle", " ", "jobs", " ", "tha", "t", " ", "don", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "batch", "System_", "._", "kill", "Bat", "ch", "Jobs_", "(_", "[_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Set", "Env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Para", "sol", " ", "dis", "obe", "ys", " ", "shell", " ", "rule", "s", " ", "and", " ", "stu", "pid", "ly", " ", "split", "s", " ", "the", " ", "command", " ", "at", " ", "the", " ", "space", " ", "character_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "exec", "'", "ing", " ", "it", ",", " ", "whe", "ther", " ", "the", " ", "space", " ", "is", " ", "quoted", ",", " ", "escaped", " ", "or", " ", "not", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "have", " ", "escaped", " ", "or", " ", "quote", "s", " ", "space", "s", " ", "in", " ", "the", " ", "command", " ", "line", ".", " ", "So", " ", "we", " ", "can", "'", "t", " ", "use", " ", "bash", " ", "-", "c_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'...", "'", " ", "or", " ", "python", " ", "-", "c", " ", "'...", "'.", " ", "The", " ", "safe", "st", " ", "thing", " ", "to", " ", "do", " ", "here", " ", "is", " ", "to", " ", "script", " ", "the", " ", "test", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invoke", " ", "tha", "t", " ", "script", " ", "rat", "her", " ", "than", " ", "inline", " ", "the", " ", "test", " ", "via", " ", "-", "c", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "Env_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", "if_", "os_", "._", "getenv_", "(_", "'", "FOO", "'_", ")_", "==_", "'", "bar", "'_", "else_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script", "\\u", "body_", "=_", "dedent_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "gets", "ource_", "(_", "assert", "Env_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "temp", "File", "Contain", "ing_", "(_", "script", "\\u", "body_", ")_", "as_", "script", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "ensure", " ", "tha", "t", " ", "the", " ", "test", " ", "fail", "s", " ", "if", " ", "the", " ", "variab", "le", " ", "is", " ", "*", "not", "*", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "sys_", "._", "executable_", "+_", "'", " ", "'_", "+_", "script", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "4_", "=_", "self_", "._", "batch", "System_", "._", "issue", "Bat", "ch", "Job_", "(_", "command_", ",_", "**_", "default", "Requirements", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "ID_", ",_", "exit", "Status_", ",_", "wall", "Time_", "=_", "self_", "._", "batch", "System_", "._", "get", "Update", "d", "Bat", "ch", "Job_", "(_", "max", "Wait_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exit", "Status_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "update", "d", "ID_", ",_", "job", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "set", " ", "the", " ", "variab", "le", " ", "and", " ", "ensure", " ", "tha", "t", " ", "it", " ", "is", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "batch", "System_", "._", "set", "Env_", "(_", "'", "FOO", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "5_", "=_", "self_", "._", "batch", "System_", "._", "issue", "Bat", "ch", "Job_", "(_", "command_", ",_", "**_", "default", "Requirements", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "ID_", ",_", "exit", "Status_", ",_", "wall", "Time_", "=_", "self_", "._", "batch", "System_", "._", "get", "Update", "d", "Bat", "ch", "Job_", "(_", "max", "Wait_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exit", "Status_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "update", "d", "ID_", ",_", "job", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Check", "Reso", "urc", "e", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "batch", "System_", ",_", "Bat", "ch", "System", "Support_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Reso", "urc", "e", "Request_", "=_", "self_", "._", "batch", "System_", "._", "check", "Reso", "urc", "e", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ins", "uff", "icient", "System", "Resources_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "1000_", ",_", "cores_", "=_", "200_", ",_", "disk_", "=_", "1e9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ins", "uff", "icient", "System", "Resources_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "5_", ",_", "cores_", "=_", "200_", ",_", "disk_", "=_", "1e9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ins", "uff", "icient", "System", "Resources_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "100", "1e9_", ",_", "cores_", "=_", "1_", ",_", "disk_", "=_", "1e9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ins", "uff", "icient", "System", "Resources_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "5_", ",_", "cores_", "=_", "1_", ",_", "disk_", "=_", "2e", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "None_", ",_", "cores_", "=_", "1_", ",_", "disk_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "check", "Reso", "urc", "e", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "10_", ",_", "cores_", "=_", "None_", ",_", "disk_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "Reso", "urc", "e", "Request_", "(_", "memory_", "=_", "10_", ",_", "cores_", "=_", "1_", ",_", "disk_", "=_", "100_", ")_", "\\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_", "test", "Get", "Resc", "ue", "Jo", "b", "Frequency_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "batch", "System_", "._", "get", "Resc", "ue", "Bat", "ch", "Jo", "b", "Frequency_", "(_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Scala", "ble", "Bat", "ch", "System_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "instance", " ", "of", " ", "scala", "ble", " ", "batch", " ", "system_", "\\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_", "def_", "\\u", "wait", "For", "Jo", "bs", "To", "Issue_", "(_", "self_", ",_", "num", "Jobs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issue", "d", "ID", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "len_", "(_", "issue", "d", "ID", "s_", ")_", "==_", "num", "Jobs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issue", "d", "ID", "s_", "=_", "self_", "._", "batch", "System_", "._", "get", "Issue", "d", "Bat", "ch", "Jo", "b", "ID", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "issue", "d", "ID", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "wait", "For", "Jo", "bs", "To", "Start_", "(_", "self_", ",_", "num", "Jobs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "runn", "ing", "ID", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "len_", "(_", "runn", "ing", "ID", "s_", ")_", "==_", "num", "Jobs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runn", "ing", "ID", "s_", "=_", "self_", "._", "batch", "System_", "._", "get", "Run", "ning", "Bat", "ch", "Jo", "b", "ID", "s_", "(_", ")_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "runn", "ing", "ID", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Max", "Core", "s", "Sing", "le", "Machine", "Bat", "ch", "System", "Test_", "(_", "To", "il", "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_", "@_", "skip", "If_", "(_", "Sing", "le", "Machine", "Bat", "ch", "System_", "._", "num", "Core", "s_", "<_", "3_", ",_", "'", "Ne", "ed", " ", "at", " ", "leas", "t", " ", "three", " ", "cores", " ", "to", " ", "run", " ", "this", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Services_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "Job_", "._", "Runner_", "._", "get", "Default", "Options_", "(_", "self_", "._", "\\u", "get", "Test", "Jo", "b", "Stor", "e", "Path_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "log", "Debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "max", "Core", "s_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "options_", "._", "max", "Core", "s_", "<=_", "Sing", "le", "Machine", "Bat", "ch", "System_", "._", "num", "Core", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Job_", "._", "Runner_", "._", "start", "To", "il_", "(_", "Job_", "._", "wrap", "Jo", "b", "Fn_", "(_", "parent", "Job_", ",_", "self_", "._", "script", "Command_", "(_", ")_", ")_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "counter", "Path_", ",_", "'", "r", "+'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Counter", " ", "is", " ", "%", "s", "'_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "get", "Counter", "s_", "(_", ")_", ",_", "(_", "0_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
sahana/eden/modules/s3/s3crud.py
[ { "content": "# -*- coding: utf-8 -*-\n\n\"\"\" S3 RESTful CRUD Methods\n\n @see: U{B{I{S3XRC}} <http://eden.sahanafoundation.org/wiki/S3XRC>}\n\n @requires: U{B{I{gluon}} <http://web2py.com>}\n @requires: U{B{I{lxml}} <http://codespeak.net/lxml>}\n\n @copyright: 2009-2016 (c) Sahana Software Foundation\n @license: MIT\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\n\n__all__ = (\"S3CRUD\",)\n\ntry:\n import json # try stdlib (Python 2.6)\nexcept ImportError:\n try:\n import simplejson as json # try external module\n except:\n import gluon.contrib.simplejson as json # fallback to pure-Python module\n\ntry:\n from lxml import etree\nexcept ImportError:\n import sys\n print >> sys.stderr, \"ERROR: lxml module needed for XML handling\"\n raise\n\nfrom gluon import *\nfrom gluon.languages import lazyT\nfrom gluon.storage import Storage\nfrom gluon.tools import callback\n\nfrom s3datetime import S3DateTime\nfrom s3export import S3Exporter\nfrom s3forms import S3SQLDefaultForm\nfrom s3rest import S3Method\nfrom s3utils import s3_unicode, s3_validate, s3_represent_value, s3_set_extension\nfrom s3widgets import S3EmbeddedComponentWidget, S3Selector, ICON\n\n# Compact JSON encoding\nSEPARATORS = (\",\", \":\")\n\n# =============================================================================\n\n# END =========================================================================\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def create(self, r, **attr):\n \"\"\"\n Create new records\n\n @param r: the S3Request\n @param attr: dictionary of parameters for the method handler\n \"\"\"\n\n session = current.session\n request = self.request\n response = current.response\n\n resource = self.resource\n table = resource.table\n tablename = resource.tablename\n\n representation = r.representation\n\n output = dict()\n\n native = r.method == \"create\"\n\n # Get table configuration\n _config = self._config\n insertable = _config(\"insertable\", True)\n if not insertable:\n if native:\n r.error(405, current.ERROR.METHOD_DISABLED)\n else:\n return dict(form=None)\n\n authorised = self._permitted(method=\"create\")\n if not authorised:\n if native:\n r.unauthorised()\n else:\n return dict(form=None)\n\n # Get callbacks\n onvalidation = _config(\"create_onvalidation\") or \\\n _config(\"onvalidation\")\n onaccept = _config(\"create_onaccept\") or \\\n _config(\"onaccept\")\n\n if r.interactive:\n\n crud_string = self.crud_string\n\n # Page details\n if native:\n\n # Set view\n if representation in (\"popup\", \"iframe\"):\n response.view = self._view(r, \"popup.html\")\n output[\"caller\"] = request.vars.caller\n else:\n response.view = self._view(r, \"create.html\")\n\n # Title\n if r.component:\n title = crud_string(r.tablename, \"title_display\")\n output[\"title\"] = title\n else:\n title = crud_string(tablename, \"label_create\")\n output[\"title\"] = title\n output[\"title_list\"] = crud_string(tablename, \"title_list\")\n\n # Buttons\n buttons = self.render_buttons(r, [\"list\"], **attr)\n if buttons:\n output[\"buttons\"] = buttons\n\n # Component join\n link = None\n if r.component:\n if resource.link is None:\n # No link table - direct component\n link = self._embed_component(resource, record=r.id)\n pkey = resource.pkey\n fkey = resource.fkey\n field = table[fkey]\n value = r.record[pkey]\n field.comment = None\n field.default = value\n field.update = value\n if r.http == \"POST\":\n r.post_vars.update({fkey: value})\n field.readable = False\n field.writable = False\n else:\n link = Storage(resource=resource.link, master=r.record)\n\n get_vars = r.get_vars\n\n # Hierarchy parent\n hierarchy = None\n link_to_parent = get_vars.get(\"link_to_parent\")\n if link_to_parent:\n try:\n parent = long(link_to_parent)\n except ValueError:\n r.error(400, \"Invalid parent record ID: %s\" % link_to_parent)\n else:\n from s3hierarchy import S3Hierarchy\n h = S3Hierarchy(tablename)\n if h.config:\n try:\n hierarchy = h.preprocess_create_node(r, parent)\n except KeyError:\n import sys\n r.error(404, sys.exc_info()[1])\n\n # Copy record\n from_table = None\n from_record = get_vars.get(\"from_record\")\n map_fields = get_vars.get(\"from_fields\")\n\n if from_record:\n del get_vars[\"from_record\"] # forget it\n if from_record.find(\".\") != -1:\n from_table, from_record = from_record.split(\".\", 1)\n from_table = current.db.get(from_table, None)\n if not from_table:\n r.error(404, current.ERROR.BAD_RESOURCE)\n else:\n from_table = table\n try:\n from_record = long(from_record)\n except:\n r.error(404, current.ERROR.BAD_RECORD)\n authorised = current.auth.s3_has_permission(\"read\",\n from_table._tablename,\n from_record)\n if not authorised:\n r.unauthorised()\n if map_fields:\n del r.get_vars[\"from_fields\"]\n if map_fields.find(\"$\") != -1:\n mf = map_fields.split(\",\")\n mf = [f.find(\"$\") != -1 and f.split(\"$\") or \\\n [f, f] for f in mf]\n map_fields = Storage(mf)\n else:\n map_fields = map_fields.split(\",\")\n\n # Success message\n message = crud_string(self.tablename, \"msg_record_created\")\n\n # Copy formkey if un-deleting a duplicate\n if \"id\" in request.post_vars:\n post_vars = request.post_vars\n original = str(post_vars.id)\n formkey = session.get(\"_formkey[%s/None]\" % tablename)\n formname = \"%s/%s\" % (tablename, original)\n session[\"_formkey[%s]\" % formname] = formkey\n if \"deleted\" in table:\n table.deleted.writable = True\n post_vars[\"deleted\"] = False\n if \"created_on\" in table:\n table.created_on.writable = True\n post_vars[\"created_on\"] = request.utcnow\n if \"created_by\" in table:\n table.created_by.writable = True\n if current.auth.user:\n post_vars[\"created_by\"] = current.auth.user.id\n else:\n post_vars[\"created_by\"] = None\n post_vars[\"_undelete\"] = True\n post_vars[\"_formname\"] = formname\n post_vars[\"id\"] = original\n request.vars.update(**post_vars)\n else:\n original = None\n\n subheadings = _config(\"subheadings\")\n\n # Interim save button\n self._interim_save_button()\n\n # Default Cancel Button\n if r.representation == \"html\" and r.method == \"create\":\n self._default_cancel_button(r)\n\n # Get the form\n output[\"form\"] = self.sqlform(request=request,\n resource=resource,\n data=self.data,\n record_id=original,\n from_table=from_table,\n from_record=from_record,\n map_fields=map_fields,\n onvalidation=onvalidation,\n onaccept=onaccept,\n link=link,\n hierarchy=hierarchy,\n message=message,\n subheadings=subheadings,\n format=representation,\n )\n\n # Navigate-away confirmation\n if self.settings.navigate_away_confirm:\n response.s3.jquery_ready.append(\"S3EnableNavigateAwayConfirm()\")\n\n # Redirection\n if representation in (\"popup\", \"iframe\", \"plain\", \"dl\"):\n self.next = None\n else:\n if r.http == \"POST\" and \"interim_save\" in r.post_vars:\n next_vars = self._remove_filters(r.get_vars)\n create_next = r.url(target=\"[id]\", method=\"update\",\n vars=next_vars)\n elif r.http == \"POST\" and \"save_close\" in r.post_vars:\n create_next = _config(\"create_next_close\")\n elif session.s3.rapid_data_entry and not r.component:\n create_next = r.url()\n else:\n create_next = _config(\"create_next\")\n\n if not create_next:\n next_vars = self._remove_filters(r.get_vars)\n if r.component:\n self.next = r.url(method=\"\",\n vars=next_vars)\n else:\n self.next = r.url(id=\"[id]\",\n method=\"read\",\n vars=next_vars)\n elif callable(create_next):\n self.next = create_next(r)\n else:\n self.next = create_next\n\n elif representation == \"plain\":\n # NB formstyle will be \"table3cols\" so widgets need to support that\n # or else we need to be able to override this\n response.view = self._view(r, \"plain.html\")\n crud_string = self.crud_string\n message = crud_string(tablename, \"msg_record_created\")\n subheadings = _config(\"subheadings\")\n output[\"title\"] = crud_string(tablename, \"label_create\")\n output[\"details_btn\"] = \"\"\n output[\"item\"] = self.sqlform(request=request,\n resource=resource,\n data=self.data,\n onvalidation=onvalidation,\n onaccept=onaccept,\n #link=link,\n message=message,\n subheadings=subheadings,\n format=representation)\n\n elif representation == \"csv\":\n import cgi\n import csv\n csv.field_size_limit(1000000000)\n infile = request.vars.filename\n if isinstance(infile, cgi.FieldStorage) and infile.filename:\n infile = infile.file\n else:\n try:\n infile = open(infile, \"rb\")\n except:\n session.error = current.T(\"Cannot read from file: %(filename)s\") % \\\n dict(filename=infile)\n redirect(r.url(method=\"\", representation=\"html\"))\n try:\n self.import_csv(infile, table=table)\n except:\n session.error = current.T(\"Unable to parse CSV file or file contains invalid data\")\n else:\n session.confirmation = current.T(\"Data uploaded\")\n\n elif representation == \"pdf\":\n from s3pdf import S3PDF\n exporter = S3PDF()\n return exporter(r, **attr)\n\n elif representation == \"url\":\n results = self.import_url(r)\n return results\n\n else:\n r.error(415, current.ERROR.BAD_FORMAT)\n\n return output", "metadata": "root.S3CRUD.create", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 180 }, { "content": " def read(self, r, **attr):\n \"\"\"\n Read a single record\n\n @param r: the S3Request\n @param attr: dictionary of parameters for the method handler\n \"\"\"\n\n # Check authorization to read the record\n authorised = self._permitted()\n if not authorised:\n r.unauthorised()\n\n request = self.request\n response = current.response\n\n resource = self.resource\n table = resource.table\n tablename = resource.tablename\n\n representation = r.representation\n\n output = dict()\n\n _config = self._config\n editable = _config(\"editable\", True)\n\n # Get the target record ID\n record_id = self.record_id\n\n if r.interactive:\n\n # If this is a single-component and no record exists,\n # try to create one if the user is permitted\n if not record_id and r.component and not r.component.multiple:\n authorised = self._permitted(method=\"create\")\n if authorised:\n # This should become Native\n r.method = \"create\"\n return self.create(r, **attr)\n else:\n return self.select(r, **attr)\n\n # Redirect to update if user has permission unless\n # a method has been specified in the URL\n # MH: Is this really desirable? Many users would prefer to open as read\n if not r.method: #or r.method == \"review\":\n authorised = self._permitted(\"update\")\n if authorised and representation == \"html\" and editable:\n return self.update(r, **attr)\n\n # Form configuration\n subheadings = _config(\"subheadings\")\n\n # Title and subtitle\n crud_string = self.crud_string\n title = crud_string(r.tablename, \"title_display\")\n output[\"title\"] = title\n if r.component:\n subtitle = crud_string(tablename, \"title_display\")\n output[\"subtitle\"] = subtitle\n output[\"title_list\"] = crud_string(tablename, \"title_list\")\n\n # Item\n if record_id:\n try:\n item = self.sqlform(request=request,\n resource=resource,\n record_id=record_id,\n readonly=True,\n subheadings=subheadings,\n format=representation)\n except HTTP, e:\n message = current.ERROR.BAD_RECORD \\\n if e.status == 404 else e.message\n r.error(e.status, message)\n else:\n item = DIV(crud_string(tablename, \"msg_list_empty\"),\n _class=\"empty\")\n\n # View\n if representation == \"html\":\n response.view = self._view(r, \"display.html\")\n output[\"item\"] = item\n elif representation == \"popup\":\n response.view = self._view(r, \"popup.html\")\n output[\"form\"] = item\n caller = attr.get(\"caller\", None)\n output[\"caller\"] = caller\n elif representation == \"iframe\":\n response.view = self._view(r, \"iframe.html\")\n output[\"form\"] = item\n\n # Buttons\n buttons = self.render_buttons(r,\n [\"edit\", \"delete\", \"list\", \"summary\"],\n record_id=record_id,\n **attr)\n if buttons:\n output[\"buttons\"] = buttons\n\n # Last update\n last_update = self.last_update()\n if last_update:\n try:\n output[\"modified_on\"] = last_update[\"modified_on\"]\n except:\n # Field not in table\n pass\n try:\n output[\"modified_by\"] = last_update[\"modified_by\"]\n except:\n # Field not in table, such as auth_user\n pass\n\n # De-duplication\n from s3merge import S3Merge\n output[\"deduplicate\"] = S3Merge.bookmark(r, tablename, record_id)\n\n elif representation == \"plain\":\n # e.g. Map Popup\n T = current.T\n fields = [f for f in table if f.readable]\n if r.component:\n if record_id:\n record = current.db(table._id == record_id).select(limitby=(0, 1),\n *fields\n ).first()\n else:\n record = None\n else:\n record = r.record\n if record:\n # Hide empty fields from popups on map\n for field in fields:\n try:\n value = record[field]\n except:\n # e.g. gis_location.wkt\n value = None\n if value is None or value == \"\" or value == []:\n field.readable = False\n item = self.sqlform(request=request,\n resource=resource,\n record_id=record_id,\n readonly=True,\n format=representation)\n\n # Link to Open record\n popup_edit_url = _config(\"popup_edit_url\", None)\n if popup_edit_url and \\\n current.auth.s3_has_permission(\"update\", table, record_id):\n # Open edit form in iframe\n details_btn = A(T(\"Edit\"),\n _href=popup_edit_url,\n _class=\"btn iframe\",\n )\n output[\"details_btn\"] = details_btn\n else:\n # Open read view in new tab\n # Set popup_url to \"\" to have no button present\n popup_url = _config(\"popup_url\", None)\n if popup_url is None:\n popup_url = r.url(method=\"read\", representation=\"html\")\n if popup_url:\n details_btn = A(T(\"Open\"),\n _href=popup_url,\n _class=\"btn\",\n _target=\"_blank\",\n )\n output[\"details_btn\"] = details_btn\n\n # Title and subtitle\n title = self.crud_string(r.tablename, \"title_display\")\n output[\"title\"] = title\n\n else:\n item = T(\"Record not found\")\n\n output[\"item\"] = item\n response.view = self._view(r, \"plain.html\")\n\n elif representation == \"csv\":\n exporter = S3Exporter().csv\n output = exporter(resource)\n\n #elif representation == \"map\":\n # exporter = S3Map()\n # output = exporter(r, **attr)\n\n elif representation == \"pdf\":\n exporter = S3Exporter().pdf\n output = exporter(resource, request=r, **attr)\n\n elif representation == \"shp\":\n list_fields = resource.list_fields()\n exporter = S3Exporter().shp\n output = exporter(resource, list_fields=list_fields, **attr)\n\n elif representation == \"svg\":\n list_fields = resource.list_fields()\n exporter = S3Exporter().svg\n output = exporter(resource, list_fields=list_fields, **attr)\n\n elif representation == \"xls\":\n list_fields = resource.list_fields()\n exporter = S3Exporter().xls\n output = exporter(resource, list_fields=list_fields)\n\n elif representation == \"json\":\n exporter = S3Exporter().json\n\n # Render extra \"_tooltip\" field for each row?\n get_vars = request.get_vars\n if \"tooltip\" in get_vars:\n tooltip = get_vars[\"tooltip\"]\n else:\n tooltip = None\n\n output = exporter(resource, tooltip=tooltip)\n\n else:\n r.error(415, current.ERROR.BAD_FORMAT)\n\n return output", "metadata": "root.S3CRUD.read", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 553 }, { "content": " def update(self, r, **attr):\n \"\"\"\n Update a record\n\n @param r: the S3Request\n @param attr: dictionary of parameters for the method handler\n \"\"\"\n\n resource = self.resource\n table = resource.table\n tablename = resource.tablename\n\n representation = r.representation\n\n output = dict()\n\n # Get table configuration\n _config = self._config\n editable = _config(\"editable\", True)\n\n # Get callbacks\n onvalidation = _config(\"update_onvalidation\") or \\\n _config(\"onvalidation\")\n onaccept = _config(\"update_onaccept\") or \\\n _config(\"onaccept\")\n\n # Get the target record ID\n record_id = self.record_id\n if r.interactive and not record_id:\n r.error(404, current.ERROR.BAD_RECORD)\n\n # Check if editable\n if not editable:\n if r.interactive:\n return self.read(r, **attr)\n else:\n r.error(405, current.ERROR.METHOD_DISABLED)\n\n # Check permission for update\n authorised = self._permitted(method=\"update\")\n if not authorised:\n r.unauthorised()\n\n if r.interactive or representation == \"plain\":\n\n response = current.response\n s3 = response.s3\n\n # Form configuration\n subheadings = _config(\"subheadings\")\n\n # Set view\n if representation == \"html\":\n response.view = self._view(r, \"update.html\")\n elif representation in \"popup\":\n response.view = self._view(r, \"popup.html\")\n elif representation == \"plain\":\n response.view = self._view(r, \"plain.html\")\n elif representation == \"iframe\":\n response.view = self._view(r, \"iframe.html\")\n\n # Title and subtitle\n crud_string = self.crud_string\n if r.component:\n title = crud_string(r.tablename, \"title_display\")\n subtitle = crud_string(self.tablename, \"title_update\")\n output[\"title\"] = title\n output[\"subtitle\"] = subtitle\n else:\n title = crud_string(self.tablename, \"title_update\")\n output[\"title\"] = title\n output[\"title_list\"] = crud_string(tablename, \"title_list\")\n\n # Component join\n link = None\n if r.component:\n if resource.link is None:\n link = self._embed_component(resource, record=r.id)\n pkey = resource.pkey\n fkey = resource.fkey\n field = table[fkey]\n value = r.record[pkey]\n field.comment = None\n field.default = value\n field.update = value\n if r.http == \"POST\":\n r.post_vars.update({fkey: value})\n field.readable = False\n field.writable = False\n else:\n link = Storage(resource=resource.link, master=r.record)\n\n # Success message\n message = crud_string(self.tablename, \"msg_record_modified\")\n\n # Interim save button\n self._interim_save_button()\n\n # Default Cancel Button\n if r.representation == \"html\" and \\\n (r.method == \"update\" or not r.method):\n self._default_cancel_button(r)\n\n # Get the form\n try:\n form = self.sqlform(request=self.request,\n resource=resource,\n record_id=record_id,\n onvalidation=onvalidation,\n onaccept=onaccept,\n message=message,\n link=link,\n subheadings=subheadings,\n format=representation)\n except HTTP, e:\n message = current.ERROR.BAD_RECORD \\\n if e.status == 404 else e.message\n r.error(e.status, message)\n\n # Navigate-away confirmation\n if self.settings.navigate_away_confirm:\n s3.jquery_ready.append(\"S3EnableNavigateAwayConfirm()\")\n\n # Put form into output\n output[\"form\"] = form\n if representation == \"plain\":\n output[\"item\"] = form\n output[\"title\"] = \"\"\n\n # Add delete and list buttons\n buttons = self.render_buttons(r,\n [\"delete\"],\n record_id=record_id,\n **attr)\n if buttons:\n output[\"buttons\"] = buttons\n\n # Last update\n last_update = self.last_update()\n if last_update:\n try:\n output[\"modified_on\"] = last_update[\"modified_on\"]\n except:\n # Field not in table\n pass\n try:\n output[\"modified_by\"] = last_update[\"modified_by\"]\n except:\n # Field not in table, such as auth_user\n pass\n\n # De-duplication\n from s3merge import S3Merge\n output[\"deduplicate\"] = S3Merge.bookmark(r, tablename, record_id)\n\n # Redirection\n if r.http == \"POST\" and \"interim_save\" in r.post_vars:\n next_vars = self._remove_filters(r.get_vars)\n self.next = r.url(target=\"[id]\", method=\"update\",\n vars=next_vars)\n else:\n update_next = _config(\"update_next\")\n if representation in (\"popup\", \"iframe\", \"plain\", \"dl\"):\n self.next = None\n elif not update_next:\n next_vars = self._remove_filters(r.get_vars)\n if r.component:\n self.next = r.url(method=\"\", vars=next_vars)\n else:\n self.next = r.url(id=\"[id]\",\n method=\"read\",\n vars=next_vars)\n else:\n try:\n self.next = update_next(self)\n except TypeError:\n self.next = update_next\n\n elif representation == \"url\":\n return self.import_url(r)\n\n else:\n r.error(415, current.ERROR.BAD_FORMAT)\n\n return output", "metadata": "root.S3CRUD.update", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 780 }, { "content": " def review(self, r, **attr):\n \"\"\"\n Review/approve/reject an unapproved record.\n\n @param r: the S3Request\n @param attr: dictionary of parameters for the method handler\n \"\"\"\n\n if not self._permitted(\"review\"):\n r.unauthorized()\n\n T = current.T\n\n session = current.session\n response = current.response\n\n output = Storage()\n if r.interactive:\n\n _next = r.url(id=\"[id]\", method=\"review\")\n\n if self._permitted(\"approve\"):\n\n approve = FORM(INPUT(_value=T(\"Approve\"),\n _type=\"submit\",\n _name=\"approve-btn\",\n _id=\"approve-btn\",\n _class=\"action-btn\"))\n\n reject = FORM(INPUT(_value=T(\"Reject\"),\n _type=\"submit\",\n _name=\"reject-btn\",\n _id=\"reject-btn\",\n _class=\"action-btn\"))\n\n edit = A(T(\"Edit\"),\n _href=r.url(id=r.id, method=\"update\",\n vars={\"_next\": r.url(id=r.id, method=\"review\")}),\n _class=\"action-btn\")\n\n cancel = A(T(\"Cancel\"),\n _href=r.url(id=0),\n _class=\"action-lnk\")\n\n output[\"approve_form\"] = DIV(TABLE(TR(approve, reject, edit, cancel)),\n _id=\"approve_form\")\n\n reviewing = False\n if approve.accepts(r.post_vars, session, formname=\"approve\"):\n resource = current.s3db.resource(r.tablename, r.id,\n approved=False,\n unapproved=True)\n try:\n success = resource.approve()\n except:\n success = False\n if success:\n response.confirmation = T(\"Record approved\")\n output[\"approve_form\"] = \"\"\n else:\n response.warning = T(\"Record could not be approved.\")\n\n r.http = \"GET\"\n _next = r.url(id=0, method=\"review\")\n\n elif reject.accepts(r.post_vars, session, formname=\"reject\"):\n resource = current.s3db.resource(r.tablename, r.id,\n approved=False,\n unapproved=True)\n try:\n success = resource.reject()\n except:\n success = False\n if success:\n response.confirmation = T(\"Record deleted\")\n output[\"approve_form\"] = \"\"\n else:\n response.warning = T(\"Record could not be deleted.\")\n\n r.http = \"GET\"\n _next = r.url(id=0, method=\"review\")\n\n else:\n reviewing = True\n\n if reviewing:\n output.update(self.read(r, **attr))\n self.next = _next\n r.http = r.env.request_method\n current.response.view = \"review.html\"\n\n else:\n r.error(415, current.ERROR.BAD_FORMAT)\n\n return output", "metadata": "root.S3CRUD.review", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 1892 }, { "content": " def validate(self, r, **attr):\n \"\"\"\n Validate records (AJAX). This method reads a JSON object from\n the request body, validates it against the current resource,\n and returns a JSON object with either the validation errors or\n the text representations of the data.\n\n @param r: the S3Request\n @param attr: dictionary of parameters for the method handler\n\n Input JSON format:\n\n {\"<fieldname>\":\"<value>\", \"<fieldname>\":\"<value>\"}\n\n Output JSON format:\n\n {\"<fieldname>\": {\"value\":\"<value>\",\n \"text\":\"<representation>\",\n \"_error\":\"<error message>\"}}\n\n The input JSON can also be a list of multiple records. This\n will return a list of results accordingly. Note that \"text\"\n is not provided if there was a validation error, and vice\n versa.\n\n The record ID should always be present in the JSON to\n avoid false duplicate errors.\n\n Non-existent fields will return \"invalid field\" as _error.\n\n Representations will be URL-escaped and any markup stripped.\n\n The ?component=<alias> URL query can be used to specify a\n component of the current resource rather than the main table.\n\n This method does only accept .json format.\n \"\"\"\n\n if r.representation != \"json\":\n r.error(415, current.ERROR.BAD_FORMAT)\n\n resource = self.resource\n\n get_vars = r.get_vars\n if \"component\" in get_vars:\n alias = get_vars[\"component\"]\n else:\n alias = None\n if \"resource\" in get_vars:\n tablename = get_vars[\"resource\"]\n\n # Customise the resource\n customise = current.deployment_settings.customise_resource(tablename)\n if customise:\n customise(r, tablename)\n\n components = [alias] if alias else None\n try:\n resource = current.s3db.resource(tablename,\n components=components)\n except:\n r.error(404, current.ERROR.BAD_RESOURCE)\n if alias:\n if alias in resource.components:\n component = resource.components[alias]\n else:\n r.error(404, current.ERROR.BAD_RESOURCE)\n else:\n component = resource\n\n source = r.body\n source.seek(0)\n\n try:\n data = json.load(source)\n except ValueError:\n r.error(501, current.ERROR.BAD_SOURCE)\n\n if not isinstance(data, list):\n single = True\n data = [data]\n else:\n single = False\n\n table = component.table\n pkey = table._id.name\n\n get_config = current.s3db.get_config\n tablename = component.tablename\n onvalidation = get_config(tablename, \"onvalidation\")\n update_onvalidation = get_config(tablename, \"update_onvalidation\",\n onvalidation)\n create_onvalidation = get_config(tablename, \"create_onvalidation\",\n onvalidation)\n\n output = []\n for record in data:\n\n has_errors = False\n\n # Retrieve the record ID\n if pkey in record:\n original = {pkey: record[pkey]}\n elif \"_id\" in record:\n original = {pkey: record[\"_id\"]}\n else:\n original = None\n\n # Field validation\n fields = Storage()\n for fname in record:\n\n error = None\n validated = fields[fname] = Storage()\n\n # We do not validate primary keys\n # (because we don't update them)\n if fname in (pkey, \"_id\"):\n continue\n\n value = record[fname]\n\n if fname not in table.fields:\n validated[\"value\"] = value\n validated[\"_error\"] = \"invalid field\"\n continue\n else:\n field = table[fname]\n\n # Convert numeric type (does not always happen in the widget)\n field = table[fname]\n if field.type == \"integer\":\n if value not in (None, \"\"):\n try:\n value = int(value)\n except ValueError:\n value = 0\n else:\n value = None\n if field.type == \"double\":\n if value not in (None, \"\"):\n try:\n value = float(value)\n except ValueError:\n value = 0\n else:\n value = None\n\n widget = field.widget\n if isinstance(widget, S3Selector):\n # Use widget-validator instead of field-validator\n value, error = widget.validate(value,\n requires=field.requires,\n )\n validated[\"value\"] = widget.serialize(value)\n # Use widget-represent instead of standard represent\n widget_represent = widget.represent\n else:\n # Validate and format the value\n try:\n value, error = s3_validate(table, fname, value, original)\n except AttributeError:\n error = \"invalid field\"\n validated[\"value\"] = field.formatter(value)\n widget_represent = None\n\n # Handle errors, update the validated item\n if error:\n has_errors = True\n validated[\"_error\"] = s3_unicode(error)\n elif widget_represent:\n try:\n text = widget_represent(value)\n except:\n text = s3_unicode(value)\n validated[\"text\"] = text\n else:\n try:\n text = s3_represent_value(field, value = value)\n except:\n text = s3_unicode(value)\n validated[\"text\"] = text\n\n # Form validation (=onvalidation)\n if not has_errors:\n if original is not None:\n onvalidation = update_onvalidation\n else:\n onvalidation = create_onvalidation\n form = Storage(vars=Storage(record), errors=Storage())\n if onvalidation is not None:\n callback(onvalidation, form, tablename=tablename)\n for fn in form.errors:\n msg = s3_unicode(form.errors[fn])\n if fn in fields:\n validated = fields[fn]\n has_errors = True\n validated._error = msg\n if \"text\" in validated:\n del validated[\"text\"]\n else:\n msg = \"%s: %s\" % (fn, msg)\n if \"_error\" in fields:\n fields[\"_error\"] = \"\\n\".join([msg,\n fields[\"_error\"]])\n else:\n fields[\"_error\"] = msg\n\n output.append(fields)\n\n if single and len(output) == 1:\n output = output[0]\n\n return json.dumps(output, separators=SEPARATORS)", "metadata": "root.S3CRUD.validate", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 1989 }, { "content": " def _postprocess_embedded(self, form,\n component=None,\n key=None):\n \"\"\"\n Post-processes a form with an S3EmbeddedComponentWidget and\n created/updates the component record.\n\n @param form: the form\n @param component: the component tablename\n @param key: the field name of the foreign key for the component\n in the link table\n \"\"\"\n\n s3db = current.s3db\n request = current.request\n\n get_config = lambda key, tablename=component: \\\n s3db.get_config(tablename, key, None)\n try:\n selected = form.vars[key]\n except:\n selected = None\n\n if request.env.request_method == \"POST\":\n db = current.db\n table = db[component]\n\n # Extract data for embedded form from post_vars\n post_vars = request.post_vars\n form_vars = Storage(table._filter_fields(post_vars))\n\n # Pass values through validator to convert them into db-format\n for k in form_vars:\n value, error = s3_validate(table, k, form_vars[k])\n if not error:\n form_vars[k] = value\n\n _form = Storage(vars = form_vars, errors = Storage())\n if _form.vars:\n if selected:\n form_vars[table._id.name] = selected\n # Onvalidation\n onvalidation = get_config(\"update_onvalidation\") or \\\n get_config(\"onvalidation\")\n callback(onvalidation, _form, tablename=component)\n # Update the record if no errors\n if not _form.errors:\n db(table._id == selected).update(**_form.vars)\n else:\n form.errors.update(_form.errors)\n return\n # Update super-entity links\n s3db.update_super(table, dict(id=selected))\n # Update realm\n update_realm = s3db.get_config(table, \"update_realm\")\n if update_realm:\n current.auth.set_realm_entity(table, selected,\n force_update=True)\n # Onaccept\n onaccept = get_config(\"update_onaccept\") or \\\n get_config(\"onaccept\")\n callback(onaccept, _form, tablename=component)\n else:\n form_vars.pop(table._id.name, None)\n # Onvalidation\n onvalidation = get_config(\"create_onvalidation\") or \\\n get_config(\"onvalidation\")\n callback(onvalidation, _form, tablename=component)\n # Insert the record if no errors\n if not _form.errors:\n selected = table.insert(**_form.vars)\n else:\n form.errors.update(_form.errors)\n return\n if selected:\n # Update post_vars and form.vars\n post_vars[key] = str(selected)\n form.request_vars[key] = str(selected)\n form.vars[key] = selected\n # Update super-entity links\n s3db.update_super(table, dict(id=selected))\n # Set record owner\n auth = current.auth\n auth.s3_set_record_owner(table, selected)\n auth.s3_make_session_owner(table, selected)\n # Onaccept\n onaccept = get_config(\"create_onaccept\") or \\\n get_config(\"onaccept\")\n callback(onaccept, _form, tablename=component)\n else:\n form.errors[key] = current.T(\"Could not create record.\")\n return", "metadata": "root.S3CRUD._postprocess_embedded", "header": "['class', 'S3CRUD', '(', 'S3Method', ')', ':', '___EOS___']", "index": 2819 } ]
[ { "span": "except:", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 11 }, { "span": "except:", "start_line": 308, "start_column": 16, "end_line": 308, "end_column": 23 }, { "span": "except:", "start_line": 442, "start_column": 16, "end_line": 442, "end_column": 23 }, { "span": "except:", "start_line": 448, "start_column": 12, "end_line": 448, "end_column": 19 }, { "span": "except:", "start_line": 659, "start_column": 16, "end_line": 659, "end_column": 23 }, { "span": "except:", "start_line": 664, "start_column": 16, "end_line": 664, "end_column": 23 }, { "span": "except:", "start_line": 690, "start_column": 20, "end_line": 690, "end_column": 27 }, { "span": "except:", "start_line": 922, "start_column": 16, "end_line": 922, "end_column": 23 }, { "span": "except:", "start_line": 927, "start_column": 16, "end_line": 927, "end_column": 23 }, { "span": "except:", "start_line": 1946, "start_column": 20, "end_line": 1946, "end_column": 27 }, { "span": "except:", "start_line": 1963, "start_column": 20, "end_line": 1963, "end_column": 27 }, { "span": "except:", "start_line": 2049, "start_column": 12, "end_line": 2049, "end_column": 19 }, { "span": "except:", "start_line": 2162, "start_column": 20, "end_line": 2162, "end_column": 27 }, { "span": "except:", "start_line": 2168, "start_column": 20, "end_line": 2168, "end_column": 27 }, { "span": "except:", "start_line": 2839, "start_column": 8, "end_line": 2839, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "S", "3", " ", "REST", "ful", " ", "CRUD", " ", "Meth", "ods", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "see", ":", " ", "U", "{", "B", "{", "I", "{", "S", "3", "XR", "C", "}}", " ", "<", "http", "://", "eden", ".", "sa", "han", "af", "ound", "ation", ".", "org", "/", "wiki", "/", "S", "3", "XR", "C", ">}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "require", "s", ":", " ", "U", "{", "B", "{", "I", "{", "glu", "on", "}}", " ", "<", "http", "://", "web", "2py", ".", "com", ">}", "\\", "10", ";", " ", " ", " ", " ", "@", "require", "s", ":", " ", "U", "{", "B", "{", "I", "{", "lx", "ml", "}}", " ", "<", "http", "://", "codes", "peak", ".", "net", "/", "lx", "ml", ">}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "copyr", "ight", ":", " ", "200", "9", "-", "2016", " ", "(", "c", ")", " ", "Sa", "han", "a", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", "\\", "10", ";", " ", " ", " ", " ", "@", "license", ":", " ", "MIT", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", "\\", "10", ";", " ", " ", " ", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", "\\", "10", ";", " ", " ", " ", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", "\\", "10", ";", " ", " ", " ", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "\\", "10", ";", " ", " ", " ", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "include", "d", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", "\\", "10", ";", " ", " ", " ", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", "\\", "10", ";", " ", " ", " ", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", "\\", "10", ";", " ", " ", " ", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", "\\", "10", ";", " ", " ", " ", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", "\\", "10", ";", " ", " ", " ", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", "\\", "10", ";", " ", " ", " ", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\"", "S", "3", "CRUD", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "#", " ", "try", " ", "stdlib", " ", "(", "Pyth", "on", " ", "2.6", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "#", " ", "try", " ", "external", " ", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gluon_", "._", "contrib_", "._", "simplejson_", "as_", "json_", "#", " ", "fall", "back", " ", "to", " ", "pure", "-", "Pyth", "on", " ", "module_", "\\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 ", " _", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "ERROR", ":", " ", "lx", "ml", " ", "module", " ", "need", "ed", " ", "for", " ", "XML", " ", "handling", "\"_", "\\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_", "from_", "gluon_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "languages_", "import_", "lazy", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "storage_", "import_", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "tools_", "import_", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "s3", "datetime_", "import_", "S", "3", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "export_", "import_", "S", "3", "Exporter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "forms_", "import_", "S", "3", "SQL", "Default", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "rest_", "import_", "S", "3", "Method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "utils_", "import_", "s3", "\\u", "unicode_", ",_", "s3", "\\u", "validate_", ",_", "s3", "\\u", "represent", "\\u", "value_", ",_", "s3", "\\u", "set\\u", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "widgets_", "import_", "S", "3", "Emb", "edd", "ed", "Compo", "nent", "Widget_", ",_", "S", "3", "Selector_", ",_", "ICON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compact", " ", "JSO", "N", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "SEPA", "RAT", "ORS", "_", "=_", "(_", "\",\"_", ",_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\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_", "(_", "self_", ",_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "new", " ", "record", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "r", ":", " ", "the", " ", "S", "3", "Request", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", ":", " ", "dictionar", "y", " ", "of", " ", "parameter", "s", " ", "for", " ", "the", " ", "method", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "current_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "current_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "resource_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "resource_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "representation_", "=_", "r_", "._", "representation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "native_", "=_", "r_", "._", "method_", "==_", "\"", "create", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "table", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "config_", "=_", "self_", "._", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "able_", "=_", "\\u", "config_", "(_", "\"", "insert", "able", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "insert", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "405_", ",_", "current_", "._", "ERROR_", "._", "METH", "OD", "\\u", "DISABLED_", ")_", "\\u\\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_", "dict_", "(_", "form_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "authori", "sed_", "=_", "self_", "._", "\\u", "permit", "ted_", "(_", "method_", "=_", "\"", "create", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "authori", "sed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "unau", "thor", "ise", "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_", "dict_", "(_", "form_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "callbacks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "onv", "alid", "ation_", "=_", "\\u", "config_", "(_", "\"", "create", "\\u", "onv", "alid", "ation", "\"_", ")_", "or_", "\\u", "config_", "(_", "\"", "onv", "alid", "ation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "onac", "cept", "_", "=_", "\\u", "config_", "(_", "\"", "create", "\\u", "onac", "cept", "\"_", ")_", "or_", "\\u", "config_", "(_", "\"", "onac", "cept", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crud", "\\u", "string_", "=_", "self_", "._", "crud", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Page", " ", "details_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "representation_", "in_", "(_", "\"", "popu", "p", "\"_", ",_", "\"", "iframe", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "popu", "p", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "caller", "\"_", "]_", "=_", "request_", "._", "vars_", "._", "caller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "create", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Title_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "title_", "=_", "crud", "\\u", "string_", "(_", "r_", "._", "tablename_", ",_", "\"", "title", "\\u", "display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "title_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "label", "\\u", "create", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "title", "\\u", "list", "\"_", "]_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "title", "\\u", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Buttons_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "=_", "self_", "._", "render", "\\u", "buttons_", "(_", "r_", ",_", "[_", "\"", "list", "\"_", "]_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buttons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "[_", "\"", "buttons", "\"_", "]_", "=_", "buttons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compo", "nent", " ", "join_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resource_", "._", "link_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "link", " ", "table", " ", "-", " ", "direct", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "link_", "=_", "self_", "._", "\\u", "embed", "\\u", "component_", "(_", "resource_", ",_", "record_", "=_", "r_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkey_", "=_", "resource_", "._", "pkey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fkey", "_", "=_", "resource_", "._", "fkey", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "table_", "[_", "fkey", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "r_", "._", "record_", "[_", "pkey_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "comment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "default_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "update_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "http_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "._", "post", "\\u", "vars_", "._", "update_", "(_", "{_", "fkey", "_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "._", "readable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "writable_", "=_", "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 ", " ", "_", "link_", "=_", "Storage_", "(_", "resource_", "=_", "resource_", "._", "link_", ",_", "master_", "=_", "r_", "._", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "vars_", "=_", "r_", "._", "get", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hier", "arch", "y", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "hierarchy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "to", "\\u", "parent_", "=_", "get", "\\u", "vars_", "._", "get_", "(_", "\"", "link", "\\u", "to", "\\u", "parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link", "\\u", "to", "\\u", "parent_", ":_", "\\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 ", " ", "_", "parent_", "=_", "long_", "(_", "link", "\\u", "to", "\\u", "parent_", ")_", "\\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 ", " ", "_", "r_", "._", "error_", "(_", "400_", ",_", "\"", "Inva", "lid", " ", "parent", " ", "record", " ", "ID", ":", " ", "%", "s", "\"_", "%_", "link", "\\u", "to", "\\u", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from_", "s3", "hierarchy_", "import_", "S", "3", "Hier", "arch", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "S", "3", "Hier", "arch", "y_", "(_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "h_", "._", "config_", ":_", "\\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 ", " ", " _", "hierarchy_", "=_", "h_", "._", "preproc", "ess", "\\u", "create", "\\u", "node_", "(_", "r_", ",_", "parent_", ")_", "\\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 ", " ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "error_", "(_", "404_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "record_", "\\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_", "from", "\\u", "table_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "record_", "=_", "get", "\\u", "vars_", "._", "get_", "(_", "\"", "from", "\\u", "record", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "fields_", "=_", "get", "\\u", "vars_", "._", "get_", "(_", "\"", "from", "\\u", "fields", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "from", "\\u", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "get", "\\u", "vars_", "[_", "\"", "from", "\\u", "record", "\"_", "]_", "#", " ", "forget", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "\\u", "record_", "._", "find_", "(_", "\".\"_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from", "\\u", "table_", ",_", "from", "\\u", "record_", "=_", "from", "\\u", "record_", "._", "split_", "(_", "\".\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "table_", "=_", "current_", "._", "db_", "._", "get_", "(_", "from", "\\u", "table_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "from", "\\u", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "._", "error_", "(_", "404_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RESOURCE_", ")_", "\\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 ", " ", "_", "from", "\\u", "table_", "=_", "table_", "\\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", "\\u", "record_", "=_", "long_", "(_", "from", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "._", "error_", "(_", "404_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RECORD", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "authori", "sed_", "=_", "current_", "._", "auth_", "._", "s3", "\\u", "has", "\\u", "permission_", "(_", "\"", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "table_", "._", "\\u", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "authori", "sed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "._", "unau", "thor", "ise", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "map", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "r_", "._", "get", "\\u", "vars_", "[_", "\"", "from", "\\u", "fields", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "map", "\\u", "fields_", "._", "find_", "(_", "\"$\"_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mf_", "=_", "map", "\\u", "fields_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "[_", "f_", "._", "find_", "(_", "\"$\"_", ")_", "!=_", "-_", "1_", "and_", "f_", "._", "split_", "(_", "\"$\"_", ")_", "or_", "[_", "f_", ",_", "f_", "]_", "for_", "f_", "in_", "mf_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "fields_", "=_", "Storage_", "(_", "mf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "map", "\\u", "fields_", "=_", "map", "\\u", "fields_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Success", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "crud", "\\u", "string_", "(_", "self_", "._", "tablename_", ",_", "\"", "msg", "\\u", "record", "\\u", "created", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "form", "key", " ", "if", " ", "un", "-", "delet", "ing", " ", "a", " ", "duplicate_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "id", "\"_", "in_", "request_", "._", "post", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "vars_", "=_", "request_", "._", "post", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original_", "=_", "str_", "(_", "post", "\\u", "vars_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "key_", "=_", "session_", "._", "get_", "(_", "\"\\u", "form", "key", "[", "%", "s", "/", "Non", "e", "]\"_", "%_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "name_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "tablename_", ",_", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "\"\\u", "form", "key", "[", "%", "s", "]\"_", "%_", "form", "name_", "]_", "=_", "form", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "delete", "d", "\"_", "in_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "table_", "._", "deleted_", "._", "writable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "[_", "\"", "delete", "d", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "created", "\\u", "on", "\"_", "in_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "table_", "._", "created", "\\u", "on_", "._", "writable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "[_", "\"", "created", "\\u", "on", "\"_", "]_", "=_", "request_", "._", "utcnow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "created", "\\u", "by", "\"_", "in_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "table_", "._", "created", "\\u", "by_", "._", "writable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current_", "._", "auth_", "._", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "post", "\\u", "vars_", "[_", "\"", "created", "\\u", "by", "\"_", "]_", "=_", "current_", "._", "auth_", "._", "user_", "._", "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 ", " ", " _", "post", "\\u", "vars_", "[_", "\"", "created", "\\u", "by", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "post", "\\u", "vars_", "[_", "\"\\u", "unde", "lete", "\"_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "[_", "\"\\u", "form", "name", "\"_", "]_", "=_", "form", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "[_", "\"", "id", "\"_", "]_", "=_", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "vars_", "._", "update_", "(_", "**_", "post", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sub", "headings_", "=_", "\\u", "config_", "(_", "\"", "sub", "heading", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inter", "im", " ", "save", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "inter", "im", "\\u", "save", "\\u", "button_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "Cancel", " ", "Button_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "representation_", "==_", "\"", "html", "\"_", "and_", "r_", "._", "method_", "==_", "\"", "create", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "default", "\\u", "cancel", "\\u", "button_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "form", "\"_", "]_", "=_", "self_", "._", "sql", "form_", "(_", "request_", "=_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "original_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "table_", "=_", "from", "\\u", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "record_", "=_", "from", "\\u", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "map", "\\u", "fields_", "=_", "map", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "onv", "alid", "ation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onac", "cept", "_", "=_", "onac", "cept", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hierarchy_", "=_", "hierarchy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub", "headings_", "=_", "sub", "headings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "representation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Navigat", "e-", "awa", "y", " ", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "settings_", "._", "navigate", "\\u", "awa", "y", "\\u", "confirm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "s3_", "._", "jq", "uer", "y", "\\u", "ready_", "._", "append_", "(_", "\"", "S", "3", "Enable", "Navigat", "e", "Awa", "y", "Confirm", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "representation_", "in_", "(_", "\"", "popu", "p", "\"_", ",_", "\"", "iframe", "\"_", ",_", "\"", "plain", "\"_", ",_", "\"", "dl", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "next_", "=_", "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 ", " _", "if_", "r_", "._", "http_", "==_", "\"", "POST", "\"_", "and_", "\"", "inter", "im", "\\u", "save", "\"_", "in_", "r_", "._", "post", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "\\u", "vars_", "=_", "self_", "._", "\\u", "remove", "\\u", "filters_", "(_", "r_", "._", "get", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "next_", "=_", "r_", "._", "url_", "(_", "target_", "=_", "\"[", "id", "]\"_", ",_", "method_", "=_", "\"", "update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "r_", "._", "http_", "==_", "\"", "POST", "\"_", "and_", "\"", "save", "\\u", "close", "\"_", "in_", "r_", "._", "post", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "create", "\\u", "next_", "=_", "\\u", "config_", "(_", "\"", "create", "\\u", "next", "\\u", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "session_", "._", "s3_", "._", "rapid", "\\u", "data\\u", "entry_", "and_", "not_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "create", "\\u", "next_", "=_", "r_", "._", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "create", "\\u", "next_", "=_", "\\u", "config_", "(_", "\"", "create", "\\u", "next", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "create", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "\\u", "vars_", "=_", "self_", "._", "\\u", "remove", "\\u", "filters_", "(_", "r_", "._", "get", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "next_", "=_", "r_", "._", "url_", "(_", "method_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\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_", "._", "next_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "\"[", "id", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "callable_", "(_", "create", "\\u", "next_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "next_", "=_", "create", "\\u", "next_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "next_", "=_", "create", "\\u", "next_", "\\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_", "representation_", "==_", "\"", "plain", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NB", " ", "forms", "tyl", "e", " ", "will", " ", "be", " ", "\"", "table", "3c", "ols", "\"", " ", "so", " ", "widget", "s", " ", "need", " ", "to", " ", "support", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "or", " ", "else", " ", "we", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", " ", "override", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "plain", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crud", "\\u", "string_", "=_", "self_", "._", "crud", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "msg", "\\u", "record", "\\u", "created", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub", "headings_", "=_", "\\u", "config_", "(_", "\"", "sub", "heading", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "label", "\\u", "create", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "deta", "il", "s", "\\u", "btn", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "item", "\"_", "]_", "=_", "self_", "._", "sql", "form_", "(_", "request_", "=_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "onv", "alid", "ation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onac", "cept", "_", "=_", "onac", "cept", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "link", "=", "link", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub", "headings_", "=_", "sub", "headings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "representation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "csv", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv_", "._", "field", "\\u", "size", "\\u", "limit_", "(_", "1000000000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infile_", "=_", "request_", "._", "vars_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "infile_", ",_", "cgi_", "._", "Field", "Storage_", ")_", "and_", "infile_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", "=_", "infile_", "._", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "infile_", "=_", "open_", "(_", "infile_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "._", "error_", "=_", "current_", "._", "T_", "(_", "\"", "Cann", "ot", " ", "read", " ", "from", " ", "file", ":", " ", "%", "(", "filename", ")", "s", "\"_", ")_", "%_", "dict_", "(_", "filename_", "=_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirect_", "(_", "r_", "._", "url_", "(_", "method_", "=_", "\"\"_", ",_", "representation_", "=_", "\"", "html", "\"_", ")_", ")_", "\\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 ", " _", "self_", "._", "import", "\\u", "csv_", "(_", "infile_", ",_", "table_", "=_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "error_", "=_", "current_", "._", "T_", "(_", "\"", "Una", "ble", " ", "to", " ", "parse", " ", "CSV", " ", "file", " ", "or", " ", "file", " ", "contain", "s", " ", "invalid", " ", "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 ", " _", "session_", "._", "confirmation_", "=_", "current_", "._", "T_", "(_", "\"", "Data", " ", "uploade", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "pdf", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "s3", "pdf_", "import_", "S", "3", "PDF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter_", "=_", "S", "3", "PDF_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "exporter_", "(_", "r_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "url", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "import", "\\u", "url_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_", "\\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 ", " _", "r_", "._", "error_", "(_", "415", "_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "a", " ", "single", " ", "record", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "r", ":", " ", "the", " ", "S", "3", "Request", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", ":", " ", "dictionar", "y", " ", "of", " ", "parameter", "s", " ", "for", " ", "the", " ", "method", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "authoriz", "ation", " ", "to", " ", "read", " ", "the", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "authori", "sed_", "=_", "self_", "._", "\\u", "permit", "ted_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "authori", "sed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "unau", "thor", "ise", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "self_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "current_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "resource_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "resource_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "representation_", "=_", "r_", "._", "representation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "config_", "=_", "self_", "._", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editable_", "=_", "\\u", "config_", "(_", "\"", "edita", "ble", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "target", " ", "record", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "self_", "._", "record", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "a", " ", "single", "-", "component", " ", "and", " ", "no", " ", "record", " ", "exist", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "create", " ", "one", " ", "if", " ", "the", " ", "user", " ", "is", " ", "permit", "ted_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "record", "\\u", "id_", "and_", "r_", "._", "component_", "and_", "not_", "r_", "._", "component_", "._", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authori", "sed_", "=_", "self_", "._", "\\u", "permit", "ted_", "(_", "method_", "=_", "\"", "create", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authori", "sed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "bec", "ome", " ", "Nat", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "._", "method_", "=_", "\"", "create", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "create_", "(_", "r_", ",_", "**_", "attr_", ")_", "\\u\\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_", "._", "select_", "(_", "r_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", " ", "to", " ", "update", " ", "if", " ", "user", " ", "has", " ", "permissi", "on", " ", "unl", "ess_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "method", " ", "has", " ", "bee", "n", " ", "specified", " ", "in", " ", "the", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MH", ":", " ", "Is", " ", "this", " ", "reall", "y", " ", "desi", "rab", "le", "?", " ", "Many", " ", "users", " ", "wou", "ld", " ", "prefer", " ", "to", " ", "open", " ", "as", " ", "read_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "r_", "._", "method_", ":_", "#", "or", " ", "r", ".", "method", " ", "==", " ", "\"", "review", "\":", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authori", "sed_", "=_", "self_", "._", "\\u", "permit", "ted_", "(_", "\"", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authori", "sed_", "and_", "representation_", "==_", "\"", "html", "\"_", "and_", "editable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "update_", "(_", "r_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sub", "headings_", "=_", "\\u", "config_", "(_", "\"", "sub", "heading", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tit", "le", " ", "and", " ", "subtitle_", "\\u\\u\\uNL\\u\\u\\u_", "crud", "\\u", "string_", "=_", "self_", "._", "crud", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "crud", "\\u", "string_", "(_", "r_", "._", "tablename_", ",_", "\"", "title", "\\u", "display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subtitle_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "title", "\\u", "display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "subtit", "le", "\"_", "]_", "=_", "subtitle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "title", "\\u", "list", "\"_", "]_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "title", "\\u", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Item_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "record", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "=_", "self_", "._", "sql", "form_", "(_", "request_", "=_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "record", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "readonly_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub", "headings_", "=_", "sub", "headings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "representation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "HTTP_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "message_", "=_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RECORD", "_", "if_", "e_", "._", "status_", "==_", "404_", "else_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "error_", "(_", "e_", "._", "status_", ",_", "message_", ")_", "\\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 ", " _", "item_", "=_", "DIV_", "(_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "msg", "\\u", "list", "\\u", "empty", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "empty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "View_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "representation_", "==_", "\"", "html", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "display", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "item", "\"_", "]_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "popu", "p", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "popu", "p", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "form", "\"_", "]_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "caller_", "=_", "attr_", "._", "get_", "(_", "\"", "caller", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "caller", "\"_", "]_", "=_", "caller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "iframe", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "iframe", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "form", "\"_", "]_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Buttons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buttons_", "=_", "self_", "._", "render", "\\u", "buttons_", "(_", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "edit", "\"_", ",_", "\"", "delete", "\"_", ",_", "\"", "list", "\"_", ",_", "\"", "summar", "y", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "record", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buttons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "[_", "\"", "buttons", "\"_", "]_", "=_", "buttons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Las", "t", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "update_", "=_", "self_", "._", "last", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "update_", ":_", "\\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 ", " ", "_", "output_", "[_", "\"", "modifi", "ed", "\\u", "on", "\"_", "]_", "=_", "last", "\\u", "update_", "[_", "\"", "modifi", "ed", "\\u", "on", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "not", " ", "in", " ", "table_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "[_", "\"", "modifi", "ed", "\\u", "by", "\"_", "]_", "=_", "last", "\\u", "update_", "[_", "\"", "modifi", "ed", "\\u", "by", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "not", " ", "in", " ", "table", ",", " ", "suc", "h", " ", "as", " ", "auth", "\\u", "user_", "\\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_", "#", " ", "De", "-", "duplicat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "s3", "merge_", "import_", "S", "3", "Merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "dedup", "licat", "e", "\"_", "]_", "=_", "S", "3", "Merge_", "._", "bookmark_", "(_", "r_", ",_", "tablename_", ",_", "record", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "plain", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "Map", " ", "Popup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "current_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "f_", "for_", "f_", "in_", "table_", "if_", "f_", "._", "readable_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "record", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "record_", "=_", "current_", "._", "db_", "(_", "table_", "._", "\\u", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "fields_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "record_", "=_", "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 ", " _", "record_", "=_", "r_", "._", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hi", "de", " ", "empty", " ", "fields", " ", "from", " ", "popu", "ps", " ", "on", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "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 ", " ", " _", "value_", "=_", "record_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "gi", "s", "\\u", "location", ".", "wkt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "None_", "or_", "value_", "==_", "\"\"_", "or_", "value_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "field_", "._", "readable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item_", "=_", "self_", "._", "sql", "form_", "(_", "request_", "=_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "record", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "readonly_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "representation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Link", " ", "to", " ", "Open", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "popu", "p", "\\u", "edit", "\\u", "url_", "=_", "\\u", "config_", "(_", "\"", "popu", "p", "\\u", "edit", "\\u", "url", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "popu", "p", "\\u", "edit", "\\u", "url_", "and_", "current_", "._", "auth_", "._", "s3", "\\u", "has", "\\u", "permission_", "(_", "\"", "update", "\"_", ",_", "table_", ",_", "record", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Open", " ", "edit", " ", "form", " ", "in", " ", "iframe", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "deta", "il", "s", "\\u", "btn_", "=_", "A_", "(_", "T_", "(_", "\"", "Edit", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "popu", "p", "\\u", "edit", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", " ", "iframe", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "deta", "il", "s", "\\u", "btn", "\"_", "]_", "=_", "deta", "il", "s", "\\u", "btn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Open", " ", "read", " ", "view", " ", "in", " ", "new", " ", "tab_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "popu", "p", "\\u", "url", " ", "to", " ", "\"\"", " ", "to", " ", "have", " ", "no", " ", "button", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "popu", "p", "\\u", "url_", "=_", "\\u", "config_", "(_", "\"", "popu", "p", "\\u", "url", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "popu", "p", "\\u", "url_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "popu", "p", "\\u", "url_", "=_", "r_", "._", "url_", "(_", "method_", "=_", "\"", "read", "\"_", ",_", "representation_", "=_", "\"", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "popu", "p", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "deta", "il", "s", "\\u", "btn_", "=_", "A_", "(_", "T_", "(_", "\"", "Open", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "popu", "p", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "btn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "target_", "=_", "\"\\u", "blank", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "deta", "il", "s", "\\u", "btn", "\"_", "]_", "=_", "deta", "il", "s", "\\u", "btn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tit", "le", " ", "and", " ", "subtitle_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "title_", "=_", "self_", "._", "crud", "\\u", "string_", "(_", "r_", "._", "tablename_", ",_", "\"", "title", "\\u", "display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\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 ", " _", "item_", "=_", "T_", "(_", "\"", "Record", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "item", "\"_", "]_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "plain", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "csv", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "represent", "ation", " ", "==", " ", "\"", "map", "\":", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "exporter", " ", "=", " ", "S", "3", "Map", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "output", " ", "=", " ", "exporter", "(", "r", ",", " ", "**", "attr", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "pdf", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "pdf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ",_", "request_", "=_", "r_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "shp", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "fields_", "=_", "resource_", "._", "list", "\\u", "fields_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "shp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ",_", "list", "\\u", "fields_", "=_", "list", "\\u", "fields_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "svg", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "fields_", "=_", "resource_", "._", "list", "\\u", "fields_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "svg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ",_", "list", "\\u", "fields_", "=_", "list", "\\u", "fields_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "xls", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "fields_", "=_", "resource_", "._", "list", "\\u", "fields_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "xls", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ",_", "list", "\\u", "fields_", "=_", "list", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "json", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "=_", "S", "3", "Exporter_", "(_", ")_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Render", " ", "extra", " ", "\"\\u", "toolt", "ip", "\"", " ", "field", " ", "for", " ", "each", " ", "row", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "vars_", "=_", "request_", "._", "get", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "toolt", "ip", "\"_", "in_", "get", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tooltip_", "=_", "get", "\\u", "vars_", "[_", "\"", "toolt", "ip", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tooltip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "exporter_", "(_", "resource_", ",_", "tooltip_", "=_", "tooltip_", ")_", "\\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 ", " _", "r_", "._", "error_", "(_", "415", "_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "a", " ", "record", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "r", ":", " ", "the", " ", "S", "3", "Request", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", ":", " ", "dictionar", "y", " ", "of", " ", "parameter", "s", " ", "for", " ", "the", " ", "method", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "resource_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "resource_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "representation_", "=_", "r_", "._", "representation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "table", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "config_", "=_", "self_", "._", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editable_", "=_", "\\u", "config_", "(_", "\"", "edita", "ble", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "callbacks_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "\\u", "config_", "(_", "\"", "update", "\\u", "onv", "alid", "ation", "\"_", ")_", "or_", "\\u", "config_", "(_", "\"", "onv", "alid", "ation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "onac", "cept", "_", "=_", "\\u", "config_", "(_", "\"", "update", "\\u", "onac", "cept", "\"_", ")_", "or_", "\\u", "config_", "(_", "\"", "onac", "cept", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "target", " ", "record", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "self_", "._", "record", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "interactive_", "and_", "not_", "record", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "404_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RECORD", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "editable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "editable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r_", "._", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "read_", "(_", "r_", ",_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "405_", ",_", "current_", "._", "ERROR_", "._", "METH", "OD", "\\u", "DISABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "permissi", "on", " ", "for", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "authori", "sed_", "=_", "self_", "._", "\\u", "permit", "ted_", "(_", "method_", "=_", "\"", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "authori", "sed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "unau", "thor", "ise", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", "._", "interactive_", "or_", "representation_", "==_", "\"", "plain", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "current_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3_", "=_", "response_", "._", "s3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "sub", "headings_", "=_", "\\u", "config_", "(_", "\"", "sub", "heading", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "representation_", "==_", "\"", "html", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "update", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "in_", "\"", "popu", "p", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "popu", "p", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "plain", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "plain", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "representation_", "==_", "\"", "iframe", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "view_", "=_", "self_", "._", "\\u", "view_", "(_", "r_", ",_", "\"", "iframe", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tit", "le", " ", "and", " ", "subtitle_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "crud", "\\u", "string_", "=_", "self_", "._", "crud", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "crud", "\\u", "string_", "(_", "r_", "._", "tablename_", ",_", "\"", "title", "\\u", "display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subtitle_", "=_", "crud", "\\u", "string_", "(_", "self_", "._", "tablename_", ",_", "\"", "title", "\\u", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "subtit", "le", "\"_", "]_", "=_", "subtitle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "crud", "\\u", "string_", "(_", "self_", "._", "tablename_", ",_", "\"", "title", "\\u", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "title", "\\u", "list", "\"_", "]_", "=_", "crud", "\\u", "string_", "(_", "tablename_", ",_", "\"", "title", "\\u", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compo", "nent", " ", "join_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resource_", "._", "link_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "link_", "=_", "self_", "._", "\\u", "embed", "\\u", "component_", "(_", "resource_", ",_", "record_", "=_", "r_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkey_", "=_", "resource_", "._", "pkey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fkey", "_", "=_", "resource_", "._", "fkey", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "table_", "[_", "fkey", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "r_", "._", "record_", "[_", "pkey_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "comment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "default_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "update_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "http_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "._", "post", "\\u", "vars_", "._", "update_", "(_", "{_", "fkey", "_", ":_", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "._", "readable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "writable_", "=_", "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 ", " ", "_", "link_", "=_", "Storage_", "(_", "resource_", "=_", "resource_", "._", "link_", ",_", "master_", "=_", "r_", "._", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Success", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "crud", "\\u", "string_", "(_", "self_", "._", "tablename_", ",_", "\"", "msg", "\\u", "record", "\\u", "modifi", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inter", "im", " ", "save", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "inter", "im", "\\u", "save", "\\u", "button_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "Cancel", " ", "Button_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "representation_", "==_", "\"", "html", "\"_", "and_", "(_", "r_", "._", "method_", "==_", "\"", "update", "\"_", "or_", "not_", "r_", "._", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "default", "\\u", "cancel", "\\u", "button_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "form_", "\\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 ", " _", "form_", "=_", "self_", "._", "sql", "form_", "(_", "request_", "=_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "record", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "onv", "alid", "ation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onac", "cept", "_", "=_", "onac", "cept", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub", "headings_", "=_", "sub", "headings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "representation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "HTTP_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RECORD", "_", "if_", "e_", "._", "status_", "==_", "404_", "else_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "error_", "(_", "e_", "._", "status_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Navigat", "e-", "awa", "y", " ", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "settings_", "._", "navigate", "\\u", "awa", "y", "\\u", "confirm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s3_", "._", "jq", "uer", "y", "\\u", "ready_", "._", "append_", "(_", "\"", "S", "3", "Enable", "Navigat", "e", "Awa", "y", "Confirm", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "form", " ", "int", "o", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "\"", "form", "\"_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "representation_", "==_", "\"", "plain", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "[_", "\"", "item", "\"_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "title", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "delete", " ", "and", " ", "list", " ", "buttons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buttons_", "=_", "self_", "._", "render", "\\u", "buttons_", "(_", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "delete", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "id_", "=_", "record", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buttons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "[_", "\"", "buttons", "\"_", "]_", "=_", "buttons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Las", "t", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "update_", "=_", "self_", "._", "last", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "update_", ":_", "\\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 ", " ", "_", "output_", "[_", "\"", "modifi", "ed", "\\u", "on", "\"_", "]_", "=_", "last", "\\u", "update_", "[_", "\"", "modifi", "ed", "\\u", "on", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "not", " ", "in", " ", "table_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "[_", "\"", "modifi", "ed", "\\u", "by", "\"_", "]_", "=_", "last", "\\u", "update_", "[_", "\"", "modifi", "ed", "\\u", "by", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "not", " ", "in", " ", "table", ",", " ", "suc", "h", " ", "as", " ", "auth", "\\u", "user_", "\\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_", "#", " ", "De", "-", "duplicat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "s3", "merge_", "import_", "S", "3", "Merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "dedup", "licat", "e", "\"_", "]_", "=_", "S", "3", "Merge_", "._", "bookmark_", "(_", "r_", ",_", "tablename_", ",_", "record", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "http_", "==_", "\"", "POST", "\"_", "and_", "\"", "inter", "im", "\\u", "save", "\"_", "in_", "r_", "._", "post", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "vars_", "=_", "self_", "._", "\\u", "remove", "\\u", "filters_", "(_", "r_", "._", "get", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next_", "=_", "r_", "._", "url_", "(_", "target_", "=_", "\"[", "id", "]\"_", ",_", "method_", "=_", "\"", "update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\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", "\\u", "next_", "=_", "\\u", "config_", "(_", "\"", "update", "\\u", "next", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "representation_", "in_", "(_", "\"", "popu", "p", "\"_", ",_", "\"", "iframe", "\"_", ",_", "\"", "plain", "\"_", ",_", "\"", "dl", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "next_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "update", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "\\u", "vars_", "=_", "self_", "._", "\\u", "remove", "\\u", "filters_", "(_", "r_", "._", "get", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "component_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "next_", "=_", "r_", "._", "url_", "(_", "method_", "=_", "\"\"_", ",_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\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_", "._", "next_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "\"[", "id", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "next", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "next_", "=_", "update", "\\u", "next_", "(_", "self_", ")_", "\\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 ", " ", " _", "self_", "._", "next_", "=_", "update", "\\u", "next_", "\\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_", "elif_", "representation_", "==_", "\"", "url", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "import", "\\u", "url_", "(_", "r_", ")_", "\\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 ", " _", "r_", "._", "error_", "(_", "415", "_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "review_", "(_", "self_", ",_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Review", "/", "approve", "/", "reject", " ", "an", " ", "una", "ppro", "ved", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "r", ":", " ", "the", " ", "S", "3", "Request", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", ":", " ", "dictionar", "y", " ", "of", " ", "parameter", "s", " ", "for", " ", "the", " ", "method", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "permit", "ted_", "(_", "\"", "review", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "unauthorized", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "T_", "=_", "current_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "current_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "current_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "next_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "\"[", "id", "]\"_", ",_", "method_", "=_", "\"", "review", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "permit", "ted_", "(_", "\"", "approve", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "approve", "_", "=_", "FORM", "_", "(_", "INPUT_", "(_", "\\u", "value_", "=_", "T_", "(_", "\"", "Appro", "ve", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "name_", "=_", "\"", "approve", "-", "btn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "\"", "approve", "-", "btn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "action", "-", "btn", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reject_", "=_", "FORM", "_", "(_", "INPUT_", "(_", "\\u", "value_", "=_", "T_", "(_", "\"", "Reject", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "name_", "=_", "\"", "reject", "-", "btn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "\"", "reject", "-", "btn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "action", "-", "btn", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edit_", "=_", "A_", "(_", "T_", "(_", "\"", "Edit", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "r_", "._", "id_", ",_", "method_", "=_", "\"", "update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "{_", "\"\\u", "next", "\"_", ":_", "r_", "._", "url_", "(_", "id_", "=_", "r_", "._", "id_", ",_", "method_", "=_", "\"", "review", "\"_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "action", "-", "btn", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cancel_", "=_", "A_", "(_", "T_", "(_", "\"", "Cancel", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "action", "-", "lnk", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "[_", "\"", "approve", "\\u", "form", "\"_", "]_", "=_", "DIV_", "(_", "TABLE_", "(_", "TR_", "(_", "approve", "_", ",_", "reject_", ",_", "edit_", ",_", "cancel_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "\"", "approve", "\\u", "form", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "review", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "approve", "_", "._", "accepts", "_", "(_", "r_", "._", "post", "\\u", "vars_", ",_", "session_", ",_", "form", "name_", "=_", "\"", "approve", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "resource_", "=_", "current_", "._", "s3db_", "._", "resource_", "(_", "r_", "._", "tablename_", ",_", "r_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approved", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "una", "ppro", "ved", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "success_", "=_", "resource_", "._", "approve", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "._", "confirmation_", "=_", "T_", "(_", "\"", "Record", " ", "approved", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "approve", "\\u", "form", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "._", "warning_", "=_", "T_", "(_", "\"", "Record", " ", "coul", "d", " ", "not", " ", "be", " ", "approved", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "http_", "=_", "\"", "GET", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "next_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "0_", ",_", "method_", "=_", "\"", "review", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reject_", "._", "accepts", "_", "(_", "r_", "._", "post", "\\u", "vars_", ",_", "session_", ",_", "form", "name_", "=_", "\"", "reject", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "resource_", "=_", "current_", "._", "s3db_", "._", "resource_", "(_", "r_", "._", "tablename_", ",_", "r_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approved", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "una", "ppro", "ved", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "success_", "=_", "resource_", "._", "reject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "._", "confirmation_", "=_", "T_", "(_", "\"", "Record", " ", "delete", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "\"", "approve", "\\u", "form", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "._", "warning_", "=_", "T_", "(_", "\"", "Record", " ", "coul", "d", " ", "not", " ", "be", " ", "delete", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "http_", "=_", "\"", "GET", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "next_", "=_", "r_", "._", "url_", "(_", "id_", "=_", "0_", ",_", "method_", "=_", "\"", "review", "\"_", ")_", "\\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 ", " ", "_", "review", "ing_", "=_", "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_", "review", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "update_", "(_", "self_", "._", "read_", "(_", "r_", ",_", "**_", "attr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "next_", "=_", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "http_", "=_", "r_", "._", "env_", "._", "request", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "response_", "._", "view_", "=_", "\"", "review", ".", "html", "\"_", "\\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 ", " _", "r_", "._", "error_", "(_", "415", "_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "record", "s", " ", "(", "AJ", "AX", ").", " ", "Thi", "s", " ", "method", " ", "reads", " ", "a", " ", "JSO", "N", " ", "object", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "request", " ", "body", ",", " ", "validates", " ", "it", " ", "against", " ", "the", " ", "current", " ", "resource", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "return", "s", " ", "a", " ", "JSO", "N", " ", "object", " ", "with", " ", "eit", "her", " ", "the", " ", "validation", " ", "error", "s", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "text", " ", "representations", " ", "of", " ", "the", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "r", ":", " ", "the", " ", "S", "3", "Request", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", ":", " ", "dictionar", "y", " ", "of", " ", "parameter", "s", " ", "for", " ", "the", " ", "method", " ", "handler", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", " ", "JSO", "N", " ", "format", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\"<", "field", "name", ">\"", ":\"", "<", "value", ">\"", ",", " ", "\"<", "field", "name", ">\"", ":\"", "<", "value", ">\"", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "JSO", "N", " ", "format", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\"<", "field", "name", ">\"", ":", " ", "{", "\"", "value", "\":\"", "<", "value", ">\"", ",", "\\", "10", ";", " ", " ", " ", "\"", "text", "\":\"", "<", "represent", "ation", ">\"", ",", "\\", "10", ";", " ", " ", " ", "\"\\u", "error", "\":\"", "<", "error", " ", "message", ">\"", "}}\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "input", " ", "JSO", "N", " ", "can", " ", "als", "o", " ", "be", " ", "a", " ", "list", " ", "of", " ", "multiple", " ", "record", "s", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "return", " ", "a", " ", "list", " ", "of", " ", "results", " ", "according", "ly", ".", " ", "Not", "e", " ", "tha", "t", " ", "\"", "text", "\"", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "not", " ", "provided", " ", "if", " ", "there", " ", "was", " ", "a", " ", "validation", " ", "error", ",", " ", "and", " ", "vice", "\\", "10", ";", " ", " ", " ", " ", "versa", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "record", " ", "ID", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "presen", "t", " ", "in", " ", "the", " ", "JSO", "N", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "avoid", " ", "fal", "se", " ", "duplicat", "e", " ", "error", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Non", "-", "existen", "t", " ", "fields", " ", "will", " ", "return", " ", "\"", "invalid", " ", "field", "\"", " ", "as", " ", "\\u", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Representation", "s", " ", "will", " ", "be", " ", "URL", "-", "escaped", " ", "and", " ", "any", " ", "markup", " ", "strip", "ped", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "?", "component", "=", "<", "alias", ">", " ", "URL", " ", "query", " ", "can", " ", "be", " ", "used", " ", "to", " ", "speci", "fy", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "component", " ", "of", " ", "the", " ", "current", " ", "resource", " ", "rat", "her", " ", "than", " ", "the", " ", "main", " ", "table", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "doe", "s", " ", "only", " ", "accept", " ", ".", "json", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "r_", "._", "representation_", "!=_", "\"", "json", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "415", "_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "vars_", "=_", "r_", "._", "get", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "component", "\"_", "in_", "get", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alias_", "=_", "get", "\\u", "vars_", "[_", "\"", "component", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alias_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "resource", "\"_", "in_", "get", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tablename_", "=_", "get", "\\u", "vars_", "[_", "\"", "resource", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", "ise", " ", "the", " ", "resource_", "\\u\\u\\uNL\\u\\u\\u_", "customi", "se_", "=_", "current_", "._", "deploy", "ment", "\\u", "settings_", "._", "customi", "se", "\\u", "resource_", "(_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "customi", "se_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customi", "se_", "(_", "r_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "components_", "=_", "[_", "alias_", "]_", "if_", "alias_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "current_", "._", "s3db_", "._", "resource_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "components_", "=_", "components_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "404_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RESOURCE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "alias_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "alias_", "in_", "resource_", "._", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "component_", "=_", "resource_", "._", "components_", "[_", "alias_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "error_", "(_", "404_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "RESOURCE_", ")_", "\\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 ", " _", "component_", "=_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "r_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "seek_", "(_", "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 ", " _", "data_", "=_", "json_", "._", "load_", "(_", "source_", ")_", "\\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 ", " _", "r_", "._", "error_", "(_", "501_", ",_", "current_", "._", "ERROR_", "._", "BAD", "\\u", "SOURCE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "data_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "single_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "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 ", " _", "single_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "component_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkey_", "=_", "table_", "._", "\\u", "id_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "config_", "=_", "current_", "._", "s3db_", "._", "get", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "component_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "onv", "alid", "ation_", "=_", "get", "\\u", "config_", "(_", "tablename_", ",_", "\"", "onv", "alid", "ation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "onv", "alid", "ation_", "=_", "get", "\\u", "config_", "(_", "tablename_", ",_", "\"", "update", "\\u", "onv", "alid", "ation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "onv", "alid", "ation_", "=_", "get", "\\u", "config_", "(_", "tablename_", ",_", "\"", "create", "\\u", "onv", "alid", "ation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "errors_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Retrieve", " ", "the", " ", "record", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pkey_", "in_", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "{_", "pkey_", ":_", "record_", "[_", "pkey_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"\\u", "id", "\"_", "in_", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "{_", "pkey_", ":_", "record_", "[_", "\"\\u", "id", "\"_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Field", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields_", "=_", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fname_", "in_", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "=_", "fields_", "[_", "fname_", "]_", "=_", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "do", " ", "not", " ", "validat", "e", " ", "primary", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "bec", "aus", "e", " ", "we", " ", "don", "'", "t", " ", "update", " ", "them", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fname_", "in_", "(_", "pkey_", ",_", "\"\\u", "id", "\"_", ")_", ":_", "\\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_", "value_", "=_", "record_", "[_", "fname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fname_", "not_", "in_", "table_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "validated_", "[_", "\"", "value", "\"_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "[_", "\"\\u", "error", "\"_", "]_", "=_", "\"", "invalid", " ", "field", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field_", "=_", "table_", "[_", "fname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "numeri", "c", " ", "type", " ", "(", "doe", "s", " ", "not", " ", "alw", "ay", "s", " ", "happ", "en", " ", "in", " ", "the", " ", "widget", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "table_", "[_", "fname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field_", "._", "type_", "==_", "\"", "integ", "er", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "value_", "not_", "in_", "(_", "None_", ",_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "int_", "(_", "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 ", " ", " _", "value_", "=_", "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 ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field_", "._", "type_", "==_", "\"", "double", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "value_", "not_", "in_", "(_", "None_", ",_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "float_", "(_", "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 ", " ", " _", "value_", "=_", "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 ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "=_", "field_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "S", "3", "Selector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "widget", "-", "validator", " ", "inst", "ead", " ", "of", " ", "field", "-", "validator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", ",_", "error_", "=_", "widget_", "._", "validate_", "(_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "field_", "._", "requires_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "[_", "\"", "value", "\"_", "]_", "=_", "widget_", "._", "serialize_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "widget", "-", "represent", " ", "inst", "ead", " ", "of", " ", "standard", " ", "represent_", "\\u\\u\\uNL\\u\\u\\u_", "widget", "\\u", "represent_", "=_", "widget_", "._", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "and", " ", "format", " ", "the", " ", "value_", "\\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 ", " ", " _", "value_", ",_", "error_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "fname_", ",_", "value_", ",_", "original_", ")_", "\\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 ", " ", " _", "error_", "=_", "\"", "invalid", " ", "field", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validated_", "[_", "\"", "value", "\"_", "]_", "=_", "field_", "._", "formatter_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "represent_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", " ", "error", "s", ",", " ", "update", " ", "the", " ", "validat", "ed", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "has", "\\u", "errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "[_", "\"\\u", "error", "\"_", "]_", "=_", "s3", "\\u", "unicode_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "widget", "\\u", "represent_", ":_", "\\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 ", " ", " _", "text_", "=_", "widget", "\\u", "represent_", "(_", "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 ", " ", " _", "text_", "=_", "s3", "\\u", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validated_", "[_", "\"", "text", "\"_", "]_", "=_", "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 ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "text_", "=_", "s3", "\\u", "represent", "\\u", "value_", "(_", "field_", ",_", "value_", "=_", "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 ", " ", " _", "text_", "=_", "s3", "\\u", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validated_", "[_", "\"", "text", "\"_", "]_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Form", " ", "validation", " ", "(", "=", "onv", "alid", "ation", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "has", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "original_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "onv", "alid", "ation_", "=_", "update", "\\u", "onv", "alid", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "onv", "alid", "ation_", "=_", "create", "\\u", "onv", "alid", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "Storage_", "(_", "vars_", "=_", "Storage_", "(_", "record_", ")_", ",_", "errors_", "=_", "Storage_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "onv", "alid", "ation_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "callback_", "(_", "onv", "alid", "ation_", ",_", "form_", ",_", "tablename_", "=_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "form_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "s3", "\\u", "unicode_", "(_", "form_", "._", "errors_", "[_", "fn_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fn_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "validated_", "=_", "fields_", "[_", "fn_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "._", "\\u", "error_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "text", "\"_", "in_", "validated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "validated_", "[_", "\"", "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 ", " ", " _", "msg_", "=_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "fn_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"\\u", "error", "\"_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fields_", "[_", "\"\\u", "error", "\"_", "]_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "[_", "msg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "[_", "\"\\u", "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 ", " ", " _", "fields_", "[_", "\"\\u", "error", "\"_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "append_", "(_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "single_", "and_", "len_", "(_", "output_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "output_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "output_", ",_", "separators_", "=_", "SEPA", "RAT", "ORS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "CRUD", "_", "(_", "S", "3", "Method_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "postprocess", "\\u", "embedde", "d_", "(_", "self_", ",_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "component_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Post", "-", "process", "es", " ", "a", " ", "form", " ", "with", " ", "an", " ", "S", "3", "Emb", "edd", "ed", "Compo", "nent", "Wid", "get", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "created", "/", "update", "s", " ", "the", " ", "component", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "form", ":", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "component", ":", " ", "the", " ", "component", " ", "tablename", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "key", ":", " ", "the", " ", "field", " ", "name", " ", "of", " ", "the", " ", "foreign", " ", "key", " ", "for", " ", "the", " ", "component", "\\", "10", ";", " ", " ", "in", " ", "the", " ", "link", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s3db_", "=_", "current_", "._", "s3db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "current_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "config_", "=_", "lambda_", "key_", ",_", "tablename_", "=_", "component_", ":_", "s3db_", "._", "get", "\\u", "config_", "(_", "tablename_", ",_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selected_", "=_", "form_", "._", "vars_", "[_", "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 ", " _", "selected_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "env_", "._", "request", "\\u", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "[_", "component_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "data", " ", "for", " ", "embedde", "d", " ", "form", " ", "from", " ", "post", "\\u", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "vars_", "=_", "request_", "._", "post", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "vars_", "=_", "Storage_", "(_", "table_", "._", "\\u", "filter", "\\u", "fields_", "(_", "post", "\\u", "vars_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pass", " ", "values", " ", "through", " ", "validator", " ", "to", " ", "convert", " ", "them", " ", "int", "o", " ", "db", "-", "format_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "form", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", ",_", "error_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "k_", ",_", "form", "\\u", "vars_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "form", "\\u", "vars_", "[_", "k_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "form_", "=_", "Storage_", "(_", "vars_", "=_", "form", "\\u", "vars_", ",_", "errors_", "=_", "Storage_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "form_", "._", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "form", "\\u", "vars_", "[_", "table_", "._", "\\u", "id_", "._", "name_", "]_", "=_", "selected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "get", "\\u", "config_", "(_", "\"", "update", "\\u", "onv", "alid", "ation", "\"_", ")_", "or_", "get", "\\u", "config_", "(_", "\"", "onv", "alid", "ation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "onv", "alid", "ation_", ",_", "\\u", "form_", ",_", "tablename_", "=_", "component_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "record", " ", "if", " ", "no", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "\\u", "form_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "db_", "(_", "table_", "._", "\\u", "id_", "==_", "selected_", ")_", "._", "update_", "(_", "**_", "\\u", "form_", "._", "vars_", ")_", "\\u\\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_", "._", "errors_", "._", "update_", "(_", "\\u", "form_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "super", "-", "entity", " ", "links_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s3db_", "._", "update", "\\u", "super_", "(_", "table_", ",_", "dict_", "(_", "id_", "=_", "selected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "realm_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "realm_", "=_", "s3db_", "._", "get", "\\u", "config_", "(_", "table_", ",_", "\"", "update", "\\u", "real", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update", "\\u", "realm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "current_", "._", "auth_", "._", "set\\u", "real", "m", "\\u", "entity_", "(_", "table_", ",_", "selected_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "update_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "accept_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "onac", "cept", "_", "=_", "get", "\\u", "config_", "(_", "\"", "update", "\\u", "onac", "cept", "\"_", ")_", "or_", "get", "\\u", "config_", "(_", "\"", "onac", "cept", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "onac", "cept", "_", ",_", "\\u", "form_", ",_", "tablename_", "=_", "component_", ")_", "\\u\\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", "\\u", "vars_", "._", "pop_", "(_", "table_", "._", "\\u", "id_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "onv", "alid", "ation_", "=_", "get", "\\u", "config_", "(_", "\"", "create", "\\u", "onv", "alid", "ation", "\"_", ")_", "or_", "get", "\\u", "config_", "(_", "\"", "onv", "alid", "ation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "onv", "alid", "ation_", ",_", "\\u", "form_", ",_", "tablename_", "=_", "component_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "record", " ", "if", " ", "no", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "\\u", "form_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "selected_", "=_", "table_", "._", "insert_", "(_", "**_", "\\u", "form_", "._", "vars_", ")_", "\\u\\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_", "._", "errors_", "._", "update_", "(_", "\\u", "form_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "post", "\\u", "vars", " ", "and", " ", "form", ".", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "post", "\\u", "vars_", "[_", "key_", "]_", "=_", "str_", "(_", "selected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "request", "\\u", "vars_", "[_", "key_", "]_", "=_", "str_", "(_", "selected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "vars_", "[_", "key_", "]_", "=_", "selected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "super", "-", "entity", " ", "links_", "\\u\\u\\uNL\\u\\u\\u_", "s3db_", "._", "update", "\\u", "super_", "(_", "table_", ",_", "dict_", "(_", "id_", "=_", "selected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "record", " ", "owner_", "\\u\\u\\uNL\\u\\u\\u_", "auth_", "=_", "current_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "._", "s3", "\\u", "set\\u", "record", "\\u", "owner_", "(_", "table_", ",_", "selected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "._", "s3", "\\u", "make", "\\u", "session", "\\u", "owner_", "(_", "table_", ",_", "selected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "accept_", "\\u\\u\\uNL\\u\\u\\u_", "onac", "cept", "_", "=_", "get", "\\u", "config_", "(_", "\"", "create", "\\u", "onac", "cept", "\"_", ")_", "or_", "get", "\\u", "config_", "(_", "\"", "onac", "cept", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "onac", "cept", "_", ",_", "\\u", "form_", ",_", "tablename_", "=_", "component_", ")_", "\\u\\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_", "._", "errors_", "[_", "key_", "]_", "=_", "current_", "._", "T_", "(_", "\"", "Cou", "ld", " ", "not", " ", "create", " ", "record", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\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, 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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 ]
Unused import
RobotLocomotion/director/src/python/director/plannerPublisher.py
[ { "content": "from __future__ import division # for proper float division\n\nimport os\nimport sys\nimport math\nimport time\nimport types\nimport functools\nimport random\nimport numpy as np\nfrom director import ik\nfrom director import ikconstraints\nfrom director import ikconstraintencoder\nimport drc as lcmdrc\nimport json\nfrom director.utime import getUtime\nfrom director import lcmUtils\nfrom director import robotstate\n\n\n\nimport ikplanner\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PlannerPublisher(object):\n\n\n\n\n\n\n\n", "metadata": "root.PlannerPublisher", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self, ikPlanner, affordanceMan,robotModel):\n self.ikPlanner = ikPlanner\n self.affordanceManager = affordanceMan\n self.poses={}\n self.robotModel=robotModel\n self.jointLimits={}\n for jointName in robotstate.getDrakePoseJointNames():\n self.jointLimits[jointName]= [self.robotModel.model.getJointLimits(jointName)[0],self.robotModel.model.getJointLimits(jointName)[1]]", "metadata": "root.PlannerPublisher.__init__", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def updateJointLimits(self, limitData):\n for jointName, epsilon, jointPosition in limitData:\n if epsilon < 0:\n self.jointLimits[jointName][0]=jointPosition\n else:\n self.jointLimits[jointName][1]=jointPosition\n print limitData\n print self.jointLimits", "metadata": "root.PlannerPublisher.updateJointLimits", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 31 }, { "content": " def setupMessage(self, constraints, endPoseName=\"\", nominalPoseName=\"\", seedPoseName=\"\", additionalTimeSamples=None):\n poses = ikconstraintencoder.getPlanPoses(constraints, self.ikPlanner)\n poses.update(self.poses)\n msg = lcmdrc.exotica_planner_request_t()\n msg.utime = getUtime()\n msg.poses = json.dumps(poses)\n msg.constraints = ikconstraintencoder.encodeConstraints(constraints)\n msg.seed_pose = seedPoseName\n msg.nominal_pose = nominalPoseName\n msg.end_pose = endPoseName\n msg.joint_names = json.dumps(list(self.ikPlanner.jointController.jointNames))\n msg.affordances = self.processAffordances()\n opt=ikplanner.getIkOptions()._properties\n if additionalTimeSamples:\n opt.update({'timeSamples':additionalTimeSamples})\n opt['jointLimits']=self.jointLimits\n msg.options = json.dumps(opt)\n return msg", "metadata": "root.PlannerPublisher.setupMessage", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": " def processIK(self, constraints, endPoseName=\"\", nominalPoseName=\"\", seedPoseName=\"\", additionalTimeSamples=None):\n listener = self.ikPlanner.getManipIKListener()\n msg = self.setupMessage(constraints, endPoseName, nominalPoseName, seedPoseName, additionalTimeSamples)\n lcmUtils.publish('IK_REQUEST', msg)\n ikplan = listener.waitForResponse(timeout=12000)\n listener.finish()\n\n endPose = [0] * self.ikPlanner.jointController.numberOfJoints\n if ikplan.num_states>0:\n endPose[len(endPose)-len(ikplan.plan[ikplan.num_states-1].joint_position):] = ikplan.plan[ikplan.num_states-1].joint_position\n info=ikplan.plan_info[ikplan.num_states-1]\n else: \n info = -1\n self.ikPlanner.ikServer.infoFunc(info)\n return endPose, info", "metadata": "root.PlannerPublisher.processIK", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def processTraj(self, constraints, endPoseName=\"\", nominalPoseName=\"\", seedPoseName=\"\", additionalTimeSamples=None):\n # Temporary fix / HACK / TODO (should be done in exotica_json)\n largestTspan = [0, 0]\n for constraintIndex, _ in enumerate(constraints):\n # Get tspan extend to normalise time-span\n if np.isfinite(constraints[constraintIndex].tspan[0]) and np.isfinite(constraints[constraintIndex].tspan[1]):\n largestTspan[0] = constraints[constraintIndex].tspan[0] if (constraints[constraintIndex].tspan[0] < largestTspan[0]) else largestTspan[0]\n largestTspan[1] = constraints[constraintIndex].tspan[1] if (constraints[constraintIndex].tspan[1] > largestTspan[1]) else largestTspan[1]\n\n # Temporary fix / HACK/ TODO to normalise time spans\n for constraintIndex, _ in enumerate(constraints):\n if np.isfinite(constraints[constraintIndex].tspan[0]) and np.isfinite(constraints[constraintIndex].tspan[1]):\n if largestTspan[1] != 0:\n constraints[constraintIndex].tspan[0] = constraints[constraintIndex].tspan[0] / largestTspan[1]\n constraints[constraintIndex].tspan[1] = constraints[constraintIndex].tspan[1] / largestTspan[1]\n\n listener = self.ikPlanner.getManipPlanListener()\n msg = self.setupMessage(constraints, endPoseName, nominalPoseName, seedPoseName, additionalTimeSamples)\n lcmUtils.publish('PLANNER_REQUEST', msg)\n lastManipPlan = listener.waitForResponse(timeout=20000)\n listener.finish()\n\n self.ikPlanner.ikServer.infoFunc(lastManipPlan.plan_info[0])\n return lastManipPlan, lastManipPlan.plan_info[0]", "metadata": "root.PlannerPublisher.processTraj", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def processAddPose(self, pose, poseName):\n self.poses[poseName]=list(pose);", "metadata": "root.PlannerPublisher.processAddPose", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": " def processAffordances(self):\n affs = self.affordanceManager.getCollisionAffordances()\n s='['\n first=True\n for aff in affs:\n des=aff.getDescription()\n classname=des['classname'];\n if first:\n s+='{'\n else:\n s+='\\n,{'\n first=False\n s+='\"classname\":\"'+classname+'\"'\n s+=',\"name\":\"'+des['Name']+'\"'\n s+=',\"uuid\":\"'+des['uuid']+'\"'\n s+=',\"pose\": {\"position\":{\"__ndarray__\":'+repr(des['pose'][0].tolist())+'},\"quaternion\":{\"__ndarray__\":'+repr(des['pose'][1].tolist())+'}}'\n if self.affordanceManager.affordanceUpdater is not None: # attached collision object / frameSync\n if des['Name'] in self.affordanceManager.affordanceUpdater.attachedAffordances:\n s+=',\"attachedTo\":\"'+self.affordanceManager.affordanceUpdater.attachedAffordances[des['Name']]+'\"'\n else: # it's not attached\n s+=',\"attachedTo\":\"__world__\"' # __world__ means it's a fixed collision object (sometimes called world or map - we use __world__ here)\n else: # no affordanceUpdater - so no attached collision objects either\n s+=',\"attachedTo\":\"__world__\"'\n if classname=='MeshAffordanceItem':\n s+=',\"filename\":\"'+aff.getMeshManager().getFilesystemFilename(des['Filename'])+'\"'\n if classname=='SphereAffordanceItem':\n s+=',\"radius\":'+repr(des['Radius'])\n if classname=='CylinderAffordanceItem' or classname=='CapsuleAffordanceItem':\n s+=',\"radius\":'+repr(des['Radius'])\n s+=',\"length\":'+repr(des['Length'])\n if classname=='BoxAffordanceItem':\n s+=',\"dimensions\":'+repr(des['Dimensions'])\n if classname=='CapsuleRingAffordanceItem':\n s+=',\"radius\":'+repr(des['Radius'])\n s+=',\"tube_radius\":'+repr(des['Tube Radius'])\n s+=',\"segments\":'+repr(des['Segments'])\n s+='}'\n s=s+']'\n return s", "metadata": "root.PlannerPublisher.processAffordances", "header": "['class', 'PlannerPublisher', '(', 'object', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import math", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import time", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 }, { "span": "import types", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 12 }, { "span": "import functools", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 16 }, { "span": "import random", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "from director import ik", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 23 }, { "span": "from director import ikconstraints", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "#", " ", "for", " ", "proper", " ", "float", " ", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik", "constraints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "ik", "constraint", "encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dr", "c_", "as_", "lcm", "dr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "utime", "_", "import_", "get", "Ut", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robots", "tate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "import_", "ik", "planner", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "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_", ",_", "ik", "Plann", "er_", ",_", "aff", "orda", "nce", "Man", "_", ",_", "robot", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ik", "Plann", "er_", "=_", "ik", "Plann", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aff", "orda", "nce", "Manager_", "=_", "aff", "orda", "nce", "Man", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "poses", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "robot", "Model_", "=_", "robot", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "joint", "Limits_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "joint", "Name_", "in_", "robots", "tate_", "._", "get", "Dra", "ke", "Pose", "Joint", "Names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "joint", "Limits_", "[_", "joint", "Name_", "]_", "=_", "[_", "self_", "._", "robot", "Model_", "._", "model_", "._", "get", "Joint", "Limits_", "(_", "joint", "Name_", ")_", "[_", "0_", "]_", ",_", "self_", "._", "robot", "Model_", "._", "model_", "._", "get", "Joint", "Limits_", "(_", "joint", "Name_", ")_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "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_", "update", "Joint", "Limits_", "(_", "self_", ",_", "limit", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "joint", "Name_", ",_", "epsilon_", ",_", "joint", "Position_", "in_", "limit", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "epsilon_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "joint", "Limits_", "[_", "joint", "Name_", "]_", "[_", "0_", "]_", "=_", "joint", "Position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "joint", "Limits_", "[_", "joint", "Name_", "]_", "[_", "1_", "]_", "=_", "joint", "Position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "limit", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "joint", "Limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "Message_", "(_", "self_", ",_", "constraints_", ",_", "end", "Pose", "Name_", "=_", "\"\"_", ",_", "nominal", "Pose", "Name_", "=_", "\"\"_", ",_", "seed", "Pose", "Name_", "=_", "\"\"_", ",_", "addition", "al", "Time", "Samples_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poses", "_", "=_", "ik", "constraint", "encoder_", "._", "get", "Plan", "Pose", "s_", "(_", "constraints_", ",_", "self_", "._", "ik", "Plann", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poses", "_", "._", "update_", "(_", "self_", "._", "poses", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "lcm", "dr", "c_", "._", "exo", "tica", "\\u", "planner", "\\u", "request", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "poses", "_", "=_", "json_", "._", "dumps_", "(_", "poses", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "constraints_", "=_", "ik", "constraint", "encoder_", "._", "encode", "Constraints_", "(_", "constraints_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "seed", "\\u", "pose_", "=_", "seed", "Pose", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "nominal", "\\u", "pose_", "=_", "nominal", "Pose", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "end", "\\u", "pose_", "=_", "end", "Pose", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "joint", "\\u", "names_", "=_", "json_", "._", "dumps_", "(_", "list_", "(_", "self_", "._", "ik", "Plann", "er_", "._", "joint", "Controller_", "._", "joint", "Names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "aff", "orda", "nces_", "=_", "self_", "._", "process", "Aff", "orda", "nces_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt_", "=_", "ik", "planner", "_", "._", "get", "Ik", "Options_", "(_", ")_", "._", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addition", "al", "Time", "Samples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt_", "._", "update_", "(_", "{_", "'", "time", "Sampl", "es", "'_", ":_", "addition", "al", "Time", "Samples_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opt_", "[_", "'", "joint", "Limit", "s", "'_", "]_", "=_", "self_", "._", "joint", "Limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "options_", "=_", "json_", "._", "dumps_", "(_", "opt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "IK", "_", "(_", "self_", ",_", "constraints_", ",_", "end", "Pose", "Name_", "=_", "\"\"_", ",_", "nominal", "Pose", "Name_", "=_", "\"\"_", ",_", "seed", "Pose", "Name_", "=_", "\"\"_", ",_", "addition", "al", "Time", "Samples_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Mani", "p", "IK", "Listener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "setup", "Message_", "(_", "constraints_", ",_", "end", "Pose", "Name_", ",_", "nominal", "Pose", "Name_", ",_", "seed", "Pose", "Name_", ",_", "addition", "al", "Time", "Samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "IK", "\\u", "REQUEST", "'_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ik", "plan_", "=_", "listener_", "._", "wait", "For", "Response_", "(_", "timeout_", "=_", "1200", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "listener_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Pose", "_", "=_", "[_", "0_", "]_", "*_", "self_", "._", "ik", "Plann", "er_", "._", "joint", "Controller_", "._", "number", "Of", "Joint", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ik", "plan_", "._", "num", "\\u", "states_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "Pose", "_", "[_", "len_", "(_", "end", "Pose", "_", ")_", "-_", "len_", "(_", "ik", "plan_", "._", "plan_", "[_", "ik", "plan_", "._", "num", "\\u", "states_", "-_", "1_", "]_", "._", "joint", "\\u", "position_", ")_", ":_", "]_", "=_", "ik", "plan_", "._", "plan_", "[_", "ik", "plan_", "._", "num", "\\u", "states_", "-_", "1_", "]_", "._", "joint", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "ik", "plan_", "._", "plan", "\\u", "info_", "[_", "ik", "plan_", "._", "num", "\\u", "states_", "-_", "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 ", " _", "info_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "ik", "Server_", "._", "info", "Func_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "end", "Pose", "_", ",_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Tra", "j_", "(_", "self_", ",_", "constraints_", ",_", "end", "Pose", "Name_", "=_", "\"\"_", ",_", "nominal", "Pose", "Name_", "=_", "\"\"_", ",_", "seed", "Pose", "Name_", "=_", "\"\"_", ",_", "addition", "al", "Time", "Samples_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tempora", "ry", " ", "fix", " ", "/", " ", "HA", "CK", " ", "/", " ", "TOD", "O", " ", "(", "shou", "ld", " ", "be", " ", "don", "e", " ", "in", " ", "exo", "tica", "\\u", "json", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "large", "st", "Ts", "pan_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "constraint", "Index_", ",_", "\\u_", "in_", "enumerate_", "(_", "constraints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "tsp", "an", " ", "extend", " ", "to", " ", "normalise", " ", "time", "-", "span_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "isfinite_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", ")_", "and_", "np_", "._", "isfinite_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "large", "st", "Ts", "pan_", "[_", "0_", "]_", "=_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", "if_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", "<_", "large", "st", "Ts", "pan_", "[_", "0_", "]_", ")_", "else_", "large", "st", "Ts", "pan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", "=_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", "if_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", ">_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", ")_", "else_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tempora", "ry", " ", "fix", " ", "/", " ", "HA", "CK", "/", " ", "TOD", "O", " ", "to", " ", "normalise", " ", "time", " ", "spans_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "constraint", "Index_", ",_", "\\u_", "in_", "enumerate_", "(_", "constraints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "isfinite_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", ")_", "and_", "np_", "._", "isfinite_", "(_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", "=_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "0_", "]_", "/_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", "=_", "constraints_", "[_", "constraint", "Index_", "]_", "._", "tsp", "an_", "[_", "1_", "]_", "/_", "large", "st", "Ts", "pan_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "listener_", "=_", "self_", "._", "ik", "Plann", "er_", "._", "get", "Mani", "p", "Plan", "Listener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "setup", "Message_", "(_", "constraints_", ",_", "end", "Pose", "Name_", ",_", "nominal", "Pose", "Name_", ",_", "seed", "Pose", "Name_", ",_", "addition", "al", "Time", "Samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "PLAN", "NER", "\\u", "REQUEST", "'_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Mani", "p", "Plan_", "=_", "listener_", "._", "wait", "For", "Response_", "(_", "timeout_", "=_", "20000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "listener_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ik", "Plann", "er_", "._", "ik", "Server_", "._", "info", "Func_", "(_", "last", "Mani", "p", "Plan_", "._", "plan", "\\u", "info_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "last", "Mani", "p", "Plan_", ",_", "last", "Mani", "p", "Plan_", "._", "plan", "\\u", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Add", "Pose", "_", "(_", "self_", ",_", "pose_", ",_", "pose", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "poses", "_", "[_", "pose", "Name_", "]_", "=_", "list_", "(_", "pose_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plann", "er", "Publisher_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Aff", "orda", "nces_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "s_", "=_", "self_", "._", "aff", "orda", "nce", "Manager_", "._", "get", "Colli", "sion", "Aff", "orda", "nces_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "'['_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "aff", "_", "in_", "aff", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "des_", "=_", "aff", "_", "._", "get", "Description_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "des_", "[_", "'", "class", "name", "'_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "s_", "+=_", "'\\\\", "n", ",{", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "'\"", "class", "name", "\":\"", "'_", "+_", "classname_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "name", "\":\"", "'_", "+_", "des_", "[_", "'", "Name", "'_", "]_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "uuid", "\":\"", "'_", "+_", "des_", "[_", "'", "uuid", "'_", "]_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "pose", "\":", " ", "{", "\"", "position", "\":{", "\"\\u\\u", "ndar", "ray", "\\u\\u\"", ":'_", "+_", "repr_", "(_", "des_", "[_", "'", "pose", "'_", "]_", "[_", "0_", "]_", "._", "tolist_", "(_", ")_", ")_", "+_", "'}", ",\"", "quaternion", "\":{", "\"\\u\\u", "ndar", "ray", "\\u\\u\"", ":'_", "+_", "repr_", "(_", "des_", "[_", "'", "pose", "'_", "]_", "[_", "1_", "]_", "._", "tolist_", "(_", ")_", ")_", "+_", "'}", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "aff", "orda", "nce", "Manager_", "._", "aff", "orda", "nce", "Updater_", "is_", "not_", "None_", ":_", "#", " ", "attache", "d", " ", "colli", "sion", " ", "object", " ", "/", " ", "frame", "Sync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "des_", "[_", "'", "Name", "'_", "]_", "in_", "self_", "._", "aff", "orda", "nce", "Manager_", "._", "aff", "orda", "nce", "Updater_", "._", "attache", "d", "Aff", "orda", "nces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "attache", "d", "To", "\":\"", "'_", "+_", "self_", "._", "aff", "orda", "nce", "Manager_", "._", "aff", "orda", "nce", "Updater_", "._", "attache", "d", "Aff", "orda", "nces_", "[_", "des_", "[_", "'", "Name", "'_", "]_", "]_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "not", " ", "attache", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "attache", "d", "To", "\":\"", "\\u\\u", "world", "\\u\\u\"", "'_", "#", " ", "\\u\\u", "world", "\\u\\u", " ", "means", " ", "it", "'", "s", " ", "a", " ", "fixed", " ", "colli", "sion", " ", "object", " ", "(", "somet", "imes", " ", "call", "ed", " ", "world", " ", "or", " ", "map", " ", "-", " ", "we", " ", "use", " ", "\\u\\u", "world", "\\u\\u", " ", "here", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "no", " ", "aff", "orda", "nce", "Update", "r", " ", "-", " ", "so", " ", "no", " ", "attache", "d", " ", "colli", "sion", " ", "object", "s", " ", "eit", "her_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "attache", "d", "To", "\":\"", "\\u\\u", "world", "\\u\\u\"", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "classname_", "==_", "'", "Mesh", "Aff", "orda", "nce", "Item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "filename", "\":\"", "'_", "+_", "aff", "_", "._", "get", "Mesh", "Manager_", "(_", ")_", "._", "get", "Files", "yste", "m", "Filename_", "(_", "des_", "[_", "'", "File", "name", "'_", "]_", ")_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "classname_", "==_", "'", "Sphere", "Aff", "orda", "nce", "Item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "radi", "us", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Rad", "ius", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "classname_", "==_", "'", "Cylinder", "Aff", "orda", "nce", "Item", "'_", "or_", "classname_", "==_", "'", "Caps", "ule", "Aff", "orda", "nce", "Item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "radi", "us", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Rad", "ius", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "length", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Length", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "classname_", "==_", "'", "Box", "Aff", "orda", "nce", "Item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "dimension", "s", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Dimen", "sion", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "classname_", "==_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", "\"", "radi", "us", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Rad", "ius", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "tube", "\\u", "radi", "us", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "',", "\"", "segments", "\":", "'_", "+_", "repr_", "(_", "des_", "[_", "'", "Segments", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "s_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\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, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
projectatomic/atomic-reactor/tests/plugins/test_store_metadata.py
[ { "content": "\"\"\"\nCopyright (c) 2015 Red Hat, Inc\nAll rights reserved.\n\nThis software may be modified and distributed under the terms\nof the BSD license. See the LICENSE file for details.\n\"\"\"\n\nfrom __future__ import print_function, unicode_literals\n\nimport os\nimport json\nimport time\nfrom datetime import datetime, timedelta\nfrom copy import deepcopy\n\nfrom flexmock import flexmock\nfrom osbs.api import OSBS\nimport osbs.conf\nfrom atomic_reactor.inner import DockerBuildWorkflow\nfrom atomic_reactor.plugin import ExitPluginsRunner\nfrom atomic_reactor.plugins.post_rpmqa import PostBuildRPMqaPlugin\n\nfrom atomic_reactor.plugins.exit_store_metadata_in_osv3 import StoreMetadataInOSv3Plugin\nfrom atomic_reactor.plugins.exit_koji_promote import KojiPromotePlugin\nfrom atomic_reactor.plugins.pre_cp_dockerfile import CpDockerfilePlugin\nfrom atomic_reactor.plugins.pre_pyrpkg_fetch_artefacts import DistgitFetchArtefactsPlugin\nfrom atomic_reactor.util import ImageName, LazyGit\nimport pytest\nfrom tests.constants import LOCALHOST_REGISTRY, DOCKER0_REGISTRY, TEST_IMAGE, INPUT_IMAGE\nfrom tests.util import is_string_type\n\nDIGEST1 = \"sha256:1da9b9e1c6bf6ab40f1627d76e2ad58e9b2be14351ef4ff1ed3eb4a156138189\"\nDIGEST2 = \"sha256:0000000000000000000000000000000000000000000000000000000000000000\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Y(object):\n pass", "metadata": "root.Y", "header": "['module', '___EOS___']", "index": 36 }, { "content": "class X(object):\n image_id = INPUT_IMAGE\n source = Y()\n source.dockerfile_path = None\n source.path = None\n base_image = ImageName(repo=\"qwe\", tag=\"asd\")\n # image = ImageName.parse(\"test-image:unique_tag_123\")", "metadata": "root.X", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def prepare():\n def set_annotations_on_build(build_id, labels):\n pass\n def update_labels_on_build(build_id, labels):\n pass\n new_environ = deepcopy(os.environ)\n new_environ[\"BUILD\"] = '''\n{\n \"metadata\": {\n \"name\": \"asd\",\n \"namespace\": \"namespace\"\n }\n}\n'''\n flexmock(OSBS, set_annotations_on_build=set_annotations_on_build)\n flexmock(OSBS, update_labels_on_build=update_labels_on_build)\n (flexmock(osbs.conf)\n .should_call(\"Configuration\")\n .with_args(namespace=\"namespace\", conf_file=None, verify_ssl=True,\n openshift_url=\"http://example.com/\", openshift_uri=\"http://example.com/\",\n use_auth=True))\n flexmock(os)\n os.should_receive(\"environ\").and_return(new_environ)\n\n workflow = DockerBuildWorkflow({\"provider\": \"git\", \"uri\": \"asd\"}, \"test-image\")\n\n workflow.push_conf.add_pulp_registry(\"test\", LOCALHOST_REGISTRY)\n workflow.tag_conf.add_primary_image(TEST_IMAGE)\n workflow.tag_conf.add_unique_image(\"namespace/image:asd123\")\n\n r = workflow.push_conf.add_docker_registry(DOCKER0_REGISTRY)\n r.digests[TEST_IMAGE] = DIGEST1\n r.digests[\"namespace/image:asd123\"] = DIGEST2\n\n setattr(workflow, 'builder', X)\n setattr(workflow, '_base_image_inspect', {'Id': '01234567'})\n workflow.build_logs = [\n \"a\", \"b\",\n ]\n workflow.source.lg = LazyGit(None, commit=\"commit\")\n flexmock(workflow.source.lg)\n workflow.source.lg.should_receive(\"_commit_id\").and_return(\"commit\")\n\n return workflow", "metadata": "root.prepare", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def test_metadata_plugin(tmpdir):\n initial_timestamp = datetime.now()\n workflow = prepare()\n\n workflow.prebuild_results = {\n CpDockerfilePlugin.key: \"dockerfile-content\",\n DistgitFetchArtefactsPlugin.key: \"artefact1\\nartefact2\",\n }\n workflow.postbuild_results = {\n PostBuildRPMqaPlugin.key: \"rpm1\\nrpm2\",\n }\n workflow.plugins_timestamps = {\n CpDockerfilePlugin.key: initial_timestamp.isoformat(),\n DistgitFetchArtefactsPlugin.key: (initial_timestamp + timedelta(seconds=1)).isoformat(),\n PostBuildRPMqaPlugin.key: (initial_timestamp + timedelta(seconds=3)).isoformat(),\n }\n workflow.plugins_durations = {\n CpDockerfilePlugin.key: 1.01,\n DistgitFetchArtefactsPlugin.key: 2.02,\n PostBuildRPMqaPlugin.key: 3.03,\n }\n workflow.plugins_errors = {\n DistgitFetchArtefactsPlugin.key: 'foo'\n }\n\n runner = ExitPluginsRunner(\n None,\n workflow,\n [{\n 'name': StoreMetadataInOSv3Plugin.key,\n \"args\": {\n \"url\": \"http://example.com/\"\n }\n }]\n )\n output = runner.run()\n assert StoreMetadataInOSv3Plugin.key in output\n labels = output[StoreMetadataInOSv3Plugin.key][\"annotations\"]\n assert \"dockerfile\" in labels\n assert is_string_type(labels['dockerfile'])\n assert \"artefacts\" in labels\n assert is_string_type(labels['artefacts'])\n assert \"logs\" in labels\n assert is_string_type(labels['logs'])\n assert labels['logs'] == ''\n assert \"rpm-packages\" in labels\n assert is_string_type(labels['rpm-packages'])\n assert labels['rpm-packages'] == ''\n assert \"repositories\" in labels\n assert is_string_type(labels['repositories'])\n assert \"commit_id\" in labels\n assert is_string_type(labels['commit_id'])\n assert \"base-image-id\" in labels\n assert is_string_type(labels['base-image-id'])\n assert \"base-image-name\" in labels\n assert is_string_type(labels['base-image-name'])\n assert \"image-id\" in labels\n assert is_string_type(labels['image-id'])\n\n assert \"digests\" in labels\n assert is_string_type(labels['digests'])\n digests = json.loads(labels['digests'])\n expected = [{\n \"registry\": LOCALHOST_REGISTRY,\n \"repository\": TEST_IMAGE,\n \"tag\": 'latest',\n \"digest\": DIGEST1,\n },{\n \"registry\": LOCALHOST_REGISTRY,\n \"repository\": \"namespace/image\",\n \"tag\": 'asd123',\n \"digest\": DIGEST2,\n }]\n assert digests == expected or digests == reversed(expected)\n\n assert \"plugins-metadata\" in labels\n assert \"errors\" in labels[\"plugins-metadata\"]\n assert \"durations\" in labels[\"plugins-metadata\"]\n assert \"timestamps\" in labels[\"plugins-metadata\"]\n\n plugins_metadata = json.loads(labels[\"plugins-metadata\"])\n assert \"distgit_fetch_artefacts\" in plugins_metadata[\"errors\"]\n\n assert \"cp_dockerfile\" in plugins_metadata[\"durations\"]\n assert \"distgit_fetch_artefacts\" in plugins_metadata[\"durations\"]\n assert \"all_rpm_packages\" in plugins_metadata[\"durations\"]", "metadata": "root.test_metadata_plugin", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def test_metadata_plugin_rpmqa_failure(tmpdir):\n initial_timestamp = datetime.now()\n workflow = prepare()\n\n workflow.prebuild_results = {\n CpDockerfilePlugin.key: \"dockerfile-content\",\n DistgitFetchArtefactsPlugin.key: \"artefact1\\nartefact2\",\n }\n workflow.postbuild_results = {\n PostBuildRPMqaPlugin.key: RuntimeError(),\n }\n workflow.plugins_timestamps = {\n CpDockerfilePlugin.key: initial_timestamp.isoformat(),\n DistgitFetchArtefactsPlugin.key: (initial_timestamp + timedelta(seconds=1)).isoformat(),\n PostBuildRPMqaPlugin.key: (initial_timestamp + timedelta(seconds=3)).isoformat(),\n }\n workflow.plugins_durations = {\n CpDockerfilePlugin.key: 1.01,\n DistgitFetchArtefactsPlugin.key: 2.02,\n PostBuildRPMqaPlugin.key: 3.03,\n }\n workflow.plugins_errors = {\n PostBuildRPMqaPlugin.key: 'foo'\n }\n\n runner = ExitPluginsRunner(\n None,\n workflow,\n [{\n 'name': StoreMetadataInOSv3Plugin.key,\n \"args\": {\n \"url\": \"http://example.com/\"\n }\n }]\n )\n output = runner.run()\n assert StoreMetadataInOSv3Plugin.key in output\n labels = output[StoreMetadataInOSv3Plugin.key][\"annotations\"]\n assert \"dockerfile\" in labels\n assert \"artefacts\" in labels\n assert \"logs\" in labels\n assert \"rpm-packages\" in labels\n assert \"repositories\" in labels\n assert \"commit_id\" in labels\n assert \"base-image-id\" in labels\n assert \"base-image-name\" in labels\n assert \"image-id\" in labels\n\n # On rpmqa failure, rpm-packages should be empty\n assert len(labels[\"rpm-packages\"]) == 0\n\n assert \"plugins-metadata\" in labels\n assert \"errors\" in labels[\"plugins-metadata\"]\n assert \"durations\" in labels[\"plugins-metadata\"]\n assert \"timestamps\" in labels[\"plugins-metadata\"]\n\n plugins_metadata = json.loads(labels[\"plugins-metadata\"])\n assert \"all_rpm_packages\" in plugins_metadata[\"errors\"]\n\n assert \"cp_dockerfile\" in plugins_metadata[\"durations\"]\n assert \"distgit_fetch_artefacts\" in plugins_metadata[\"durations\"]\n assert \"all_rpm_packages\" in plugins_metadata[\"durations\"]", "metadata": "root.test_metadata_plugin_rpmqa_failure", "header": "['module', '___EOS___']", "index": 183 }, { "content": "def test_labels_metadata_plugin(tmpdir):\n\n koji_build_id = \"1234\"\n workflow = prepare()\n\n workflow.exit_results = {\n KojiPromotePlugin.key: koji_build_id,\n }\n\n runner = ExitPluginsRunner(\n None,\n workflow,\n [{\n 'name': StoreMetadataInOSv3Plugin.key,\n \"args\": {\n \"url\": \"http://example.com/\"\n }\n }]\n )\n output = runner.run()\n assert StoreMetadataInOSv3Plugin.key in output\n labels = output[StoreMetadataInOSv3Plugin.key][\"labels\"]\n assert \"koji-build-id\" in labels\n assert labels[\"koji-build-id\"] == koji_build_id", "metadata": "root.test_labels_metadata_plugin", "header": "['module', '___EOS___']", "index": 246 }, { "content": "def test_missing_koji_build_id(tmpdir):\n workflow = prepare()\n\n workflow.exit_results = {}\n\n runner = ExitPluginsRunner(\n None,\n workflow,\n [{\n 'name': StoreMetadataInOSv3Plugin.key,\n \"args\": {\n \"url\": \"http://example.com/\"\n }\n }]\n )\n output = runner.run()\n assert StoreMetadataInOSv3Plugin.key in output\n labels = output[StoreMetadataInOSv3Plugin.key][\"labels\"]\n assert \"koji-build-id\" not in labels", "metadata": "root.test_missing_koji_build_id", "header": "['module', '___EOS___']", "index": 271 } ]
[ { "span": "import time", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 11 }, { "span": "import pytest", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", " ", "Red", " ", "Hat", ",", " ", "Inc", "\\", "10", ";", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "software", " ", "may", " ", "be", " ", "modifi", "ed", " ", "and", " ", "distributed", " ", "under", " ", "the", " ", "term", "s", "\\", "10", ";", "of", " ", "the", " ", "BS", "D", " ", "license", ".", " ", "See", " ", "the", " ", "LICENSE", " ", "file", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flex", "mock_", "import_", "flex", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os", "bs_", "._", "api_", "import_", "OS", "BS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os", "bs_", "._", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "inner_", "import_", "Docke", "r", "Build", "Workflow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugin_", "import_", "Exi", "t", "Plug", "ins", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugins_", "._", "post", "\\u", "rpm", "qa_", "import_", "Post", "Build", "RPM", "qa", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugins_", "._", "exit", "\\u", "store", "\\u", "metadata", "\\u", "in", "\\u", "os", "v3_", "import_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugins_", "._", "exit", "\\u", "koj", "i", "\\u", "promote", "_", "import_", "Ko", "ji", "Promot", "e", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugins_", "._", "pre", "\\u", "cp", "\\u", "dockerfile", "_", "import_", "Cp", "Docke", "rfil", "e", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "plugins_", "._", "pre", "\\u", "pyr", "pkg", "\\u", "fetch", "\\u", "arte", "facts_", "import_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "atomi", "c\\u", "reactor_", "._", "util_", "import_", "Image", "Name_", ",_", "La", "zy", "Git", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "constants_", "import_", "LOCAL", "HOST", "\\u", "REGISTRY", "_", ",_", "DOCKER", "0", "\\u", "REGISTRY", "_", ",_", "TEST", "\\u", "IMAGE_", ",_", "INPUT", "\\u", "IMAGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "util_", "import_", "is", "\\u", "string", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIG", "EST", "1_", "=_", "\"", "sha2", "56", ":", "1d", "a9", "b9", "e1", "c6", "bf", "6a", "b4", "0f", "162", "7d", "7", "6e", "2a", "d5", "8e", "9", "b2", "be", "143", "5", "1e", "f4", "ff", "1e", "d3", "eb", "4a", "156", "138", "189", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DIG", "EST", "2_", "=_", "\"", "sha2", "56", ":", "0000000000000", "0000000000000", "0000000000000", "0000000000000", "00000000000", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Y_", "(_", "object_", ")_", ":_", "\\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_", "X_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "id_", "=_", "INPUT", "\\u", "IMAGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "Y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "dockerfile", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "image_", "=_", "Image", "Name_", "(_", "repo_", "=_", "\"", "qwe", "\"_", ",_", "tag_", "=_", "\"", "asd", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "image", " ", "=", " ", "Image", "Name", ".", "parse", "(\"", "test", "-", "image", ":", "unique", "\\u", "tag", "\\u", "123", "\")", "_", "\\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_", "prepare_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set\\u", "annotations\\u", "on", "\\u", "build_", "(_", "build", "\\u", "id_", ",_", "labels_", ")_", ":_", "\\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_", "def_", "update", "\\u", "labels", "\\u", "on", "\\u", "build_", "(_", "build", "\\u", "id_", ",_", "labels_", ")_", ":_", "\\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_", "new", "\\u", "environ_", "=_", "deepcopy_", "(_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "environ_", "[_", "\"", "BUILD", "\"_", "]_", "=_", "'''", "\\", "10", ";", "{", "\\", "10", ";", " ", " ", "\"", "metadata", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "name", "\":", " ", "\"", "asd", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "namespace", "\":", " ", "\"", "namespace", "\"", "\\", "10", ";", " ", " ", "}", "\\", "10", ";}", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flex", "mock_", "(_", "OS", "BS", "_", ",_", "set\\u", "annotations\\u", "on", "\\u", "build_", "=_", "set\\u", "annotations\\u", "on", "\\u", "build_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flex", "mock_", "(_", "OS", "BS", "_", ",_", "update", "\\u", "labels", "\\u", "on", "\\u", "build_", "=_", "update", "\\u", "labels", "\\u", "on", "\\u", "build_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "flex", "mock_", "(_", "os", "bs_", "._", "conf_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "shou", "ld", "\\u", "call_", "(_", "\"", "Configura", "tion", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "args_", "(_", "namespace_", "=_", "\"", "namespace", "\"_", ",_", "conf", "\\u", "file_", "=_", "None_", ",_", "verify", "\\u", "ssl_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opens", "hift", "\\u", "url_", "=_", "\"", "http", "://", "example", ".", "com", "/\"_", ",_", "opens", "hift", "\\u", "uri_", "=_", "\"", "http", "://", "example", ".", "com", "/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "auth_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flex", "mock_", "(_", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "shou", "ld", "\\u", "receive_", "(_", "\"", "environ", "\"_", ")_", "._", "and", "\\u", "return_", "(_", "new", "\\u", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "=_", "Docke", "r", "Build", "Workflow_", "(_", "{_", "\"", "provide", "r", "\"_", ":_", "\"", "git", "\"_", ",_", "\"", "uri", "\"_", ":_", "\"", "asd", "\"_", "}_", ",_", "\"", "test", "-", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "._", "push", "\\u", "conf_", "._", "add", "\\u", "pulp", "\\u", "registry_", "(_", "\"", "test", "\"_", ",_", "LOCAL", "HOST", "\\u", "REGISTRY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "tag", "\\u", "conf_", "._", "add", "\\u", "primary", "\\u", "image_", "(_", "TEST", "\\u", "IMAGE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "tag", "\\u", "conf_", "._", "add", "\\u", "unique", "\\u", "image_", "(_", "\"", "namespace", "/", "image", ":", "asd", "123", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "workflow_", "._", "push", "\\u", "conf_", "._", "add", "\\u", "docker", "\\u", "registry_", "(_", "DOCKER", "0", "\\u", "REGISTRY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "digest", "s_", "[_", "TEST", "\\u", "IMAGE_", "]_", "=_", "DIG", "EST", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "digest", "s_", "[_", "\"", "namespace", "/", "image", ":", "asd", "123", "\"_", "]_", "=_", "DIG", "EST", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setattr_", "(_", "workflow_", ",_", "'", "builde", "r", "'_", ",_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "workflow_", ",_", "'\\u", "base", "\\u", "image", "\\u", "inspect", "'_", ",_", "{_", "'", "Id", "'_", ":_", "'", "0123456", "7", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "build", "\\u", "logs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ",_", "\"", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "source_", "._", "lg_", "=_", "La", "zy", "Git", "_", "(_", "None_", ",_", "commit_", "=_", "\"", "commit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flex", "mock_", "(_", "workflow_", "._", "source_", "._", "lg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "source_", "._", "lg_", "._", "shou", "ld", "\\u", "receive_", "(_", "\"\\u", "commit", "\\u", "id", "\"_", ")_", "._", "and", "\\u", "return_", "(_", "\"", "commit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "workflow_", "\\u\\u\\uNEWLINE\\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", "metadata", "\\u", "plugin_", "(_", "tmpdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "timestamp_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "=_", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "._", "pre", "build", "\\u", "results_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "\"", "dockerfile", "-", "content", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "\"", "arte", "fact", "1", "\\\\", "nar", "tef", "act", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "post", "build", "\\u", "results_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "\"", "rpm", "1", "\\\\", "nr", "pm", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "timestamps_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "initial", "\\u", "timestamp_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "(_", "initial", "\\u", "timestamp_", "+_", "timedelta_", "(_", "seconds_", "=_", "1_", ")_", ")_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "(_", "initial", "\\u", "timestamp_", "+_", "timedelta_", "(_", "seconds_", "=_", "3_", ")_", ")_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "durations_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "1.01", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "2.0", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "3.0", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "'", "foo", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runner_", "=_", "Exi", "t", "Plug", "ins", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "\"", "http", "://", "example", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "runner_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "in_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "output_", "[_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "]_", "[_", "\"", "annot", "ation", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "dockerfile", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "dockerfile", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "arte", "fact", "s", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "arte", "fact", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "logs", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "logs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "labels_", "[_", "'", "logs", "'_", "]_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "rpm", "-", "package", "s", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "rpm", "-", "package", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "labels_", "[_", "'", "rpm", "-", "package", "s", "'_", "]_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "repos", "itori", "es", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "repos", "itori", "es", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "commit", "\\u", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "commit", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "base", "-", "image", "-", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "base", "-", "image", "-", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "base", "-", "image", "-", "name", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "base", "-", "image", "-", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "image", "-", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "image", "-", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "digest", "s", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "is", "\\u", "string", "\\u", "type_", "(_", "labels_", "[_", "'", "digest", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest", "s_", "=_", "json_", "._", "loads_", "(_", "labels_", "[_", "'", "digest", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "registr", "y", "\"_", ":_", "LOCAL", "HOST", "\\u", "REGISTRY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "repos", "itor", "y", "\"_", ":_", "TEST", "\\u", "IMAGE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tag", "\"_", ":_", "'", "late", "st", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "digest", "\"_", ":_", "DIG", "EST", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "registr", "y", "\"_", ":_", "LOCAL", "HOST", "\\u", "REGISTRY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "repos", "itor", "y", "\"_", ":_", "\"", "namespace", "/", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tag", "\"_", ":_", "'", "asd", "123", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "digest", "\"_", ":_", "DIG", "EST", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "digest", "s_", "==_", "expected_", "or_", "digest", "s_", "==_", "reversed_", "(_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "plugin", "s", "-", "metadata", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "error", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "duration", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "timestamp", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "s", "\\u", "metadata_", "=_", "json_", "._", "loads_", "(_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "dist", "git", "\\u", "fetch", "\\u", "arte", "fact", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "error", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "cp", "\\u", "dockerfile", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "dist", "git", "\\u", "fetch", "\\u", "arte", "fact", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "all", "\\u", "rpm", "\\u", "package", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metadata", "\\u", "plugin", "\\u", "rpm", "qa", "\\u", "failure_", "(_", "tmpdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "timestamp_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "=_", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "._", "pre", "build", "\\u", "results_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "\"", "dockerfile", "-", "content", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "\"", "arte", "fact", "1", "\\\\", "nar", "tef", "act", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "post", "build", "\\u", "results_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "Run", "time", "Error_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "timestamps_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "initial", "\\u", "timestamp_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "(_", "initial", "\\u", "timestamp_", "+_", "timedelta_", "(_", "seconds_", "=_", "1_", ")_", ")_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "(_", "initial", "\\u", "timestamp_", "+_", "timedelta_", "(_", "seconds_", "=_", "3_", ")_", ")_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "durations_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Cp", "Docke", "rfil", "e", "Plugin_", "._", "key_", ":_", "1.01", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dist", "git", "Fe", "tch", "Art", "efa", "ct", "s", "Plugin_", "._", "key_", ":_", "2.0", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "3.0", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "plugin", "s", "\\u", "errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Build", "RPM", "qa", "Plugin_", "._", "key_", ":_", "'", "foo", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runner_", "=_", "Exi", "t", "Plug", "ins", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "\"", "http", "://", "example", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "runner_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "in_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "output_", "[_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "]_", "[_", "\"", "annot", "ation", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "dockerfile", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "arte", "fact", "s", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "logs", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "rpm", "-", "package", "s", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "repos", "itori", "es", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "commit", "\\u", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "base", "-", "image", "-", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "base", "-", "image", "-", "name", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "image", "-", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "rpm", "qa", " ", "fail", "ure", ",", " ", "rpm", "-", "package", "s", " ", "shou", "ld", " ", "be", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "labels_", "[_", "\"", "rpm", "-", "package", "s", "\"_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "plugin", "s", "-", "metadata", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "error", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "duration", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "timestamp", "s", "\"_", "in_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "s", "\\u", "metadata_", "=_", "json_", "._", "loads_", "(_", "labels_", "[_", "\"", "plugin", "s", "-", "metadata", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "all", "\\u", "rpm", "\\u", "package", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "error", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "cp", "\\u", "dockerfile", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "dist", "git", "\\u", "fetch", "\\u", "arte", "fact", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "all", "\\u", "rpm", "\\u", "package", "s", "\"_", "in_", "plugin", "s", "\\u", "metadata_", "[_", "\"", "duration", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "labels", "\\u", "metadata", "\\u", "plugin_", "(_", "tmpdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "koj", "i", "\\u", "build", "\\u", "id_", "=_", "\"", "1234", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "=_", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "._", "exit", "\\u", "results_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Ko", "ji", "Promot", "e", "Plugin_", "._", "key_", ":_", "koj", "i", "\\u", "build", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runner_", "=_", "Exi", "t", "Plug", "ins", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "\"", "http", "://", "example", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "runner_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "in_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "output_", "[_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "]_", "[_", "\"", "labels", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "koj", "i", "-", "build", "-", "id", "\"_", "in_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "labels_", "[_", "\"", "koj", "i", "-", "build", "-", "id", "\"_", "]_", "==_", "koj", "i", "\\u", "build", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "koj", "i", "\\u", "build", "\\u", "id_", "(_", "tmpdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "=_", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", "._", "exit", "\\u", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runner_", "=_", "Exi", "t", "Plug", "ins", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "\"", "http", "://", "example", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "runner_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "in_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "output_", "[_", "Stor", "e", "Meta", "data", "In", "OS", "v", "3", "Plugin_", "._", "key_", "]_", "[_", "\"", "labels", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "koj", "i", "-", "build", "-", "id", "\"_", "not_", "in_", "labels_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Module is imported with 'import' and 'import from'
washingtontimes/django-repositories/repositories/vcs.old.py
[ { "content": " def create(self):\n \"\"\"\n Create a source code repository\n \"\"\"\n import subprocess\n if self.exists():\n return\n if not os.path.exists(self.config['public_path']):\n os.makedirs(self.config['public_path'])\n if not os.path.exists(self.config['private_path']):\n os.makedirs(self.config['private_path'])\n \n cmd = [\"svnadmin\",\"create\", self.path]\n if self.config['config_dir']:\n cmd.extend([\"--config-dir\", self.config['config_dir']])\n subprocess.check_call(cmd)\n \n if self.template:\n template = os.path.join(os.path.dirname(__file__),'repo-templates',\n self.template)\n url = 'file://%s'%self.path\n cmd = ['svn', 'import', template, url, \"-m\", \"\\\"Initial import.\\\"\"]\n if self.config['config_dir']:\n cmd.extend([\"--config-dir\", self.config['config_dir']])\n subprocess.check_call(cmd)", "metadata": "root.SubversionRepository.create", "header": "['class', 'SubversionRepository', '(', 'BaseVCS', ')', ':', '___EOS___']", "index": 124 }, { "content": " def add_remote(self, name, url, branch=None):\n import subprocess\n repo_path = self.path\n cmd = [\"cd %s;git remote add %s %s\" % (repo_path, name, url),]\n try:\n subprocess.check_call(cmd, shell=True)\n except:\n pass", "metadata": "root.GitRepository.add_remote", "header": "['class', 'GitRepository', '(', 'BaseVCS', ')', ':', '___EOS___']", "index": 206 }, { "content": " def remove_remote(self, name):\n import subprocess\n repo_path = self.path\n cmd = [\"cd %s;git remote rm %s\" % (repo_path, name),]\n try:\n subprocess.check_call(cmd, shell=True)\n except:\n pass", "metadata": "root.GitRepository.remove_remote", "header": "['class', 'GitRepository', '(', 'BaseVCS', ')', ':', '___EOS___']", "index": 215 }, { "content": " def update_remote(self, name, branch=None):\n import subprocess\n repo_path = self.path\n the_branch = branch or \"master\"\n cmd = [\"cd %s;git push %s %s\" % (repo_path, name, branch)]\n try:\n subproc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output = subproc.communicate()\n except:\n pass", "metadata": "root.GitRepository.update_remote", "header": "['class', 'GitRepository', '(', 'BaseVCS', ')', ':', '___EOS___']", "index": 224 }, { "content": " def create(self):\n import subprocess\n if self.exists():\n return\n if not os.path.exists(self.config['public_path']):\n os.makedirs(self.config['public_path'])\n if not os.path.exists(self.config['private_path']):\n os.makedirs(self.config['private_path'])\n repo_path = self.path\n os.mkdir(repo_path, 0744)\n cmd = [\"cd %s;git --bare init;git --bare update-server-info\" % repo_path,]\n subprocess.check_call(cmd, shell=True)\n cmd = ['%s file://%s/' % (os.path.join(settings.BIN_PATH, 'initialize_git_repo.sh'), repo_path)]\n subprocess.check_call(cmd, shell=True)", "metadata": "root.GitRepository.create", "header": "['class', 'GitRepository', '(', 'BaseVCS', ')', ':', '___EOS___']", "index": 235 } ]
[ { "span": "import subprocess", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 25 }, { "span": "import subprocess", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 25 }, { "span": "import subprocess", "start_line": 216, "start_column": 8, "end_line": 216, "end_column": 25 }, { "span": "import subprocess", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 25 }, { "span": "import subprocess", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "class_", "Sub", "version", "Repository_", "(_", "Base", "VCS", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "source", " ", "code", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "config_", "[_", "'", "public", "\\u", "path", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "config_", "[_", "'", "public", "\\u", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "config_", "[_", "'", "private", "\\u", "path", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "config_", "[_", "'", "private", "\\u", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "svn", "admin", "\"_", ",_", "\"", "create", "\"_", ",_", "self_", "._", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "config_", "[_", "'", "config", "\\u", "dir", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "._", "extend_", "(_", "[_", "\"--", "config", "-", "dir", "\"_", ",_", "self_", "._", "config_", "[_", "'", "config", "\\u", "dir", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "template_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "repo", "-", "template", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'", "file", "://", "%", "s", "'_", "%_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "svn", "'_", ",_", "'", "import", "'_", ",_", "template_", ",_", "url_", ",_", "\"-", "m", "\"_", ",_", "\"\\\\\"", "Initial", " ", "import", ".\\\\", "\"\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "config_", "[_", "'", "config", "\\u", "dir", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "._", "extend_", "(_", "[_", "\"--", "config", "-", "dir", "\"_", ",_", "self_", "._", "config_", "[_", "'", "config", "\\u", "dir", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Repository_", "(_", "Base", "VCS", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "remote_", "(_", "self_", ",_", "name_", ",_", "url_", ",_", "branch_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "cd", " ", "%", "s", ";", "git", " ", "remote", " ", "add", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "repo", "\\u", "path_", ",_", "name_", ",_", "url_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Repository_", "(_", "Base", "VCS", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "remote_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "cd", " ", "%", "s", ";", "git", " ", "remote", " ", "rm", " ", "%", "s", "\"_", "%_", "(_", "repo", "\\u", "path_", ",_", "name_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Repository_", "(_", "Base", "VCS", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "remote_", "(_", "self_", ",_", "name_", ",_", "branch_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "branch_", "=_", "branch_", "or_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "cd", " ", "%", "s", ";", "git", " ", "push", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "repo", "\\u", "path_", ",_", "name_", ",_", "branch_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subproc", "_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "subproc", "_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Repository_", "(_", "Base", "VCS", "_", ")_", ":_", "\\u\\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_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "config_", "[_", "'", "public", "\\u", "path", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "config_", "[_", "'", "public", "\\u", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "config_", "[_", "'", "private", "\\u", "path", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "config_", "[_", "'", "private", "\\u", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo", "\\u", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "repo", "\\u", "path_", ",_", "0_", "744", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\"", "cd", " ", "%", "s", ";", "git", " ", "--", "bare", " ", "init", ";", "git", " ", "--", "bare", " ", "update", "-", "server", "-", "info", "\"_", "%_", "repo", "\\u", "path_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'%", "s", " ", "file", "://", "%", "s", "/'_", "%_", "(_", "os_", "._", "path_", "._", "join_", "(_", "settings_", "._", "BIN", "\\u", "PATH_", ",_", "'", "initialize", "\\u", "git", "\\u", "repo", ".", "sh", "'_", ")_", ",_", "repo", "\\u", "path_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
Cimpress-MCP/JustReleaseNotes/tests/utils/EnvReplacer_Test.py
[ { "content": "import unittest\nimport os\nfrom JustReleaseNotes.utils import EnvReplacer\nfrom mock import MagicMock\nfrom mock import Mock\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EnvParser_Test(unittest.TestCase):\n\n\n\n\n\n\n\n\n", "metadata": "root.EnvParser_Test", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def test_listWithNoEnvStaysTheSame(self):\n conf = [1,2,3]\n self.assertEqual(conf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_listWithNoEnvStaysTheSame", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 8 }, { "content": " def test_primitiveWithNoEnvStaysTheSame(self):\n conf = 1\n self.assertEqual(conf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_primitiveWithNoEnvStaysTheSame", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 12 }, { "content": " def test_dictWithNoEnvStaysTheSame(self):\n conf = {\n \"a\" : \"bb\",\n \"b\" : [1, 2, 3, 4.5, \"1231\"],\n \"c\" : {\n \"x\" : \"y\"\n }\n }\n self.assertEqual(conf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_dictWithNoEnvStaysTheSame", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_stringWithNonExistentEnvVariableRaises(self):\n conf = \"ENV[non_existing_env_key]\"\n self.assertRaises(KeyError, EnvReplacer.replace, conf)", "metadata": "root.EnvParser_Test.test_stringWithNonExistentEnvVariableRaises", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_stringWithEmptyEnvKeyStaysTheSame(self):\n conf = \"ENV[]\"\n self.assertEqual(conf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_stringWithEmptyEnvKeyStaysTheSame", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_stringWithInvalidEnvKeyStaysTheSame(self):\n conf = \"ENV[ ]\"\n self.assertEqual(conf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_stringWithInvalidEnvKeyStaysTheSame", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_stringWithMixedCaseEnvIsReplaced(self):\n os.environ[\"a\"] = \"1\"\n os.environ[\"b\"] = \"2\"\n os.environ[\"c\"] = \"3\"\n conf = \"env[a] Env[b] ENV[c]\"\n self.assertEqual(\"1 2 3\", EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_stringWithMixedCaseEnvIsReplaced", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_dictWithEnvParsedCorrectly(self):\n os.environ['abc'] = 'xyz'\n os.environ['ab_12'] = \"xy99\"\n os.environ['AbAb'] = \"ZZZ\"\n conf = {\n \"a\" : \"bb\",\n \"b\" : [1, 2, 3, 4.5, \"ENV[abc]\"],\n \"c\" : {\n \"x\" : \"env[ab_12]\",\n \"d\" : \"Env[AbAb] x eNV[AbAb]\"\n }\n }\n expectedConf = {\n \"a\" : \"bb\",\n \"b\" : [1, 2, 3, 4.5, \"xyz\"],\n \"c\" : {\n \"x\" : \"xy99\",\n \"d\" : \"ZZZ x ZZZ\"\n }\n }\n self.assertEqual(expectedConf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_dictWithEnvParsedCorrectly", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_dictWithUnicodeEnvRaplacedCorrectly(self):\n os.environ['abc'] = 'xyz'\n os.environ['ab_12'] = \"xy99\"\n os.environ['AbAb'] = \"ZZZ\"\n conf = {\n u\"a\" : \"ENV[abc]\",\n \"c\" : {\n u\"x\" : \"env[ab_12]\",\n u\"d\" : \"Env[AbAb] x eNV[AbAb]\"\n }\n }\n expectedConf = {\n u\"a\" : \"xyz\",\n \"c\" : {\n u\"x\" : \"xy99\",\n u\"d\" : \"ZZZ x ZZZ\"\n }\n }\n self.assertEqual(expectedConf, EnvReplacer.replace(conf))", "metadata": "root.EnvParser_Test.test_dictWithUnicodeEnvRaplacedCorrectly", "header": "['class', 'EnvParser_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "from mock import MagicMock", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 26 }, { "span": "from mock import Mock", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Ju", "st", "Release", "Notes_", "._", "utils_", "import_", "Env", "Replace", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mock_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Env", "Parser", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "list", "With", "No", "Env", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "primi", "tiv", "e", "With", "No", "Env", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "dict", "With", "No", "Env", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "\"", "bb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", "\"_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4.5_", ",_", "\"", "1231", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "\"_", ":_", "\"", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "string", "With", "Non", "Exist", "ent", "Env", "Varia", "ble", "Raises_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "\"", "ENV", "[", "non", "\\u", "exist", "ing", "\\u", "env", "\\u", "key", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "Env", "Replace", "r_", "._", "replace_", ",_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "string", "With", "Emp", "ty", "Env", "Key", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "\"", "ENV", "[]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "string", "With", "Inva", "lid", "Env", "Key", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "\"", "ENV", "[", " ", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "string", "With", "Mix", "ed", "Case", "Env", "Is", "Replace", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "\"", "a", "\"_", "]_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"", "b", "\"_", "]_", "=_", "\"", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"", "c", "\"_", "]_", "=_", "\"", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "\"", "env", "[", "a", "]", " ", "Env", "[", "b", "]", " ", "ENV", "[", "c", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "1", " ", "2", " ", "3", "\"_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "dict", "With", "Env", "Pars", "ed", "Correct", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "abc", "'_", "]_", "=_", "'", "xyz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "ab", "\\u", "1", "2", "'_", "]_", "=_", "\"", "xy", "9", "9", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "Ab", "Ab", "'_", "]_", "=_", "\"", "ZZ", "Z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "\"", "bb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", "\"_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4.5_", ",_", "\"", "ENV", "[", "abc", "]\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "\"_", ":_", "\"", "env", "[", "ab", "\\u", "1", "2", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "d", "\"_", ":_", "\"", "Env", "[", "Ab", "Ab", "]", " ", "x", " ", "e", "NV", "[", "Ab", "Ab", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Conf_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "\"", "bb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", "\"_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4.5_", ",_", "\"", "xyz", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "\"_", ":_", "\"", "xy", "9", "9", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "d", "\"_", ":_", "\"", "ZZ", "Z", " ", "x", " ", "ZZ", "Z", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "Conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "Parser", "\\u", "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", "dict", "With", "Unic", "ode", "Env", "Ra", "place", "d", "Correct", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "abc", "'_", "]_", "=_", "'", "xyz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "ab", "\\u", "1", "2", "'_", "]_", "=_", "\"", "xy", "9", "9", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "Ab", "Ab", "'_", "]_", "=_", "\"", "ZZ", "Z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "a", "\"_", ":_", "\"", "ENV", "[", "abc", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "x", "\"_", ":_", "\"", "env", "[", "ab", "\\u", "1", "2", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "d", "\"_", ":_", "\"", "Env", "[", "Ab", "Ab", "]", " ", "x", " ", "e", "NV", "[", "Ab", "Ab", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Conf_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "a", "\"_", ":_", "\"", "xyz", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "x", "\"_", ":_", "\"", "xy", "9", "9", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "d", "\"_", ":_", "\"", "ZZ", "Z", " ", "x", " ", "ZZ", "Z", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "Conf_", ",_", "Env", "Replace", "r_", "._", "replace_", "(_", "conf_", ")_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Constant in conditional expression or statement
anandology/pyjamas/examples/libtest/BuiltinTest.py
[ { "content": " def testIfExp(self):\n var = 1 if True else 0\n self.assertEqual(var, 1)\n var = 1 if False else 0\n self.assertEqual(var, 0)\n var = 1 if [] else 0\n self.assertEqual(var, 0)\n var = 1 if not [] else 0\n self.assertEqual(var, 1)", "metadata": "root.BuiltinTest.testIfExp", "header": "['class', 'BuiltinTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 370 } ]
[ { "span": "True ", "start_line": 371, "start_column": 19, "end_line": 371, "end_column": 23 }, { "span": "False ", "start_line": 373, "start_column": 19, "end_line": 373, "end_column": 24 }, { "span": "[] ", "start_line": 375, "start_column": 19, "end_line": 375, "end_column": 21 }, { "span": "not [] ", "start_line": 377, "start_column": 19, "end_line": 377, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "class_", "Bu", "ilt", "in", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "If", "Exp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "1_", "if_", "True_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "var_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "1_", "if_", "False_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "var_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "1_", "if_", "[_", "]_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "var_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "1_", "if_", "not_", "[_", "]_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "var_", ",_", "1_", ")_", "\\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, 0, 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, 0, 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 ]
Unused local variable
igordejanovic/Arpeggio/tests/unit/test_decorator_combine.py
[ { "content": "def test_combine_python():\n\n # This will result in NonTerminal node\n def root(): return my_rule(), \".\"\n # This will result in Terminal node\n def my_rule(): return Combine(ZeroOrMore(\"a\"), OneOrMore(\"b\"))\n\n parser = ParserPython(root)\n\n input1 = \"abbb.\"\n\n # Whitespaces are preserved in lexical rules so the following input\n # should not be recognized.\n input2 = \"a b bb.\"\n\n ptree1 = parser.parse(input1)\n\n with pytest.raises(NoMatch):\n ptree2 = parser.parse(input2)\n\n assert isinstance(ptree1, NonTerminal)\n assert isinstance(ptree1[0], Terminal)\n assert ptree1[0].value == \"abbb\"", "metadata": "root.test_combine_python", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "ptree2 ", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "combin", "e\\u", "python_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "result", " ", "in", " ", "Non", "Termin", "al", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "root_", "(_", ")_", ":_", "return_", "my", "\\u", "rule_", "(_", ")_", ",_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "result", " ", "in", " ", "Termin", "al", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "my", "\\u", "rule_", "(_", ")_", ":_", "return_", "Combine", "_", "(_", "Zero", "Or", "More_", "(_", "\"", "a", "\"_", ")_", ",_", "One", "Or", "More_", "(_", "\"", "b", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "Parser", "Python_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "1_", "=_", "\"", "abb", "b", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whitespace", "s", " ", "are", " ", "preserved", " ", "in", " ", "lexica", "l", " ", "rule", "s", " ", "so", " ", "the", " ", "follow", "ing", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "not", " ", "be", " ", "recognize", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "input", "2_", "=_", "\"", "a", " ", "b", " ", "bb", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ptr", "ee", "1_", "=_", "parser_", "._", "parse_", "(_", "input", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "No", "Match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptr", "ee", "2_", "=_", "parser_", "._", "parse_", "(_", "input", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "isinstance_", "(_", "ptr", "ee", "1_", ",_", "Non", "Terminal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "ptr", "ee", "1_", "[_", "0_", "]_", ",_", "Terminal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ptr", "ee", "1_", "[_", "0_", "]_", "._", "value_", "==_", "\"", "abb", "b", "\"_" ]
[ 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, 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 ]
Variable defined multiple times
renmengye/imageqa-public/src/nn/recurrent_tests.py
[ { "content": " def func(self, multiOutput):\n N = 5\n D = 10\n D2 = 5\n Time = 5\n I = RecurrentAdapter(Map(\n name='I',\n inputNames=['input(0)', 'H(-1)', 'C(-1)'],\n outputDim=D2,\n activeFn=SigmoidActiveFn(),\n initRange=0.1,\n initSeed=5,\n biasInitConst=1.0,\n learningRate=0.8,\n momentum=0.9\n ))\n\n F = RecurrentAdapter(Map(\n name='F',\n inputNames=['input(0)', 'H(-1)', 'C(-1)'],\n outputDim=D2,\n activeFn=SigmoidActiveFn(),\n initRange=0.1,\n initSeed=6,\n biasInitConst=1.0,\n learningRate=0.8,\n momentum=0.9\n ))\n\n Z = RecurrentAdapter(Map(\n name='Z',\n inputNames=['input(0)', 'H(-1)'],\n outputDim=D2,\n activeFn=TanhActiveFn(),\n initRange=0.1,\n initSeed=7,\n biasInitConst=0.0,\n learningRate=0.8,\n momentum=0.9\n ))\n\n FC = RecurrentAdapter(ElementProduct(\n name='F.C',\n inputNames=['F(0)', 'C(-1)'],\n outputDim=D2\n ))\n\n IZ = RecurrentAdapter(ElementProduct(\n name='I.Z',\n inputNames=['I(0)', 'Z(0)'],\n outputDim=D2\n ))\n\n C = RecurrentAdapter(Sum(\n name='C',\n inputNames=['F.C(0)', 'I.Z(0)'],\n numComponents=2,\n outputDim=D2\n ))\n\n O = RecurrentAdapter(Map(\n name='O',\n inputNames=['input(0)', 'H(-1)', 'C(0)'],\n outputDim=D2,\n activeFn=SigmoidActiveFn(),\n initRange=0.1,\n initSeed=8,\n biasInitConst=1.0,\n learningRate=0.8,\n momentum=0.9\n ))\n\n U = RecurrentAdapter(Active(\n name='U',\n inputNames=['C(0)'],\n outputDim=D2,\n activeFn=TanhActiveFn()\n ))\n\n H = RecurrentAdapter(ElementProduct(\n name='H',\n inputNames=['O(0)', 'U(0)'],\n outputDim=D2\n ))\n\n lstm = RecurrentContainer(\n name='lstm',\n stages=[I, F, Z, FC, IZ, C, O, U, H],\n timespan=Time,\n inputDim=D,\n outputDim=D2,\n outputStageNames=['H'],\n multiOutput=multiOutput,\n outputdEdX=True)\n\n lstm2 = LSTM_Old(\n name='lstm2',\n inputDim=D,\n outputDim=D2,\n needInit=False,\n initRange=0.1,\n initSeed=0,\n cutOffZeroEnd=True,\n multiErr=multiOutput,\n learningRate=0.8,\n momentum=0.9\n )\n\n random = np.random.RandomState(1)\n costFn = crossEntOne\n for i in range(3):\n X = random.rand(N, Time, D) * 0.1\n if multiOutput:\n T = random.rand(N, Time, D2) * 0.1\n else:\n T = random.rand(N, D2) * 0.1\n\n Y = lstm.forward(X)\n E, dEdY = costFn(Y, T)\n dEdX = lstm.backward(dEdY)\n if i == 0:\n if I.stages[0].gpu: \n W = np.concatenate((\n gpu.as_numpy_array(I.getWeights()),\n gpu.as_numpy_array(F.getWeights()),\n gpu.as_numpy_array(Z.getWeights()),\n gpu.as_numpy_array(O.getWeights())), axis=0)\n else:\n W = np.concatenate((I.getWeights(), \n F.getWeights(), Z.getWeights(), \n O.getWeights()), axis=0)\n lstm2.W = W.transpose()\n if multiOutput:\n Y2 = lstm2.forward(X)[:,:-1]\n else:\n Y2 = lstm2.forward(X)\n\n E, dEdY2 = costFn(Y2, T)\n if multiOutput:\n dEdX2 = lstm2.backward(np.concatenate((dEdY2, np.zeros((N, 1, D2))), axis=1))\n else:\n dEdX2 = lstm2.backward(dEdY2)\n\n if I.stages[0].gpu:\n dEdW = np.concatenate((\n gpu.as_numpy_array(I.getGradient()),\n gpu.as_numpy_array(F.getGradient()),\n gpu.as_numpy_array(Z.getGradient()),\n gpu.as_numpy_array(O.getGradient())), axis=0)\n else:\n dEdW = np.concatenate((I.getGradient(),\n F.getGradient(),\n Z.getGradient(),\n O.getGradient()), axis=0)\n dEdW2 = lstm2.dEdW\n lstm.updateWeights()\n lstm2.updateWeights()\n #self.chkEqual(Y, Y2)\n\n #self.chkEqual(dEdX, dEdX2)\n self.chkEqual(dEdW.transpose(), dEdW2)\n if I.stages[0].gpu: \n W = np.concatenate((\n gpu.as_numpy_array(I.getWeights()),\n gpu.as_numpy_array(F.getWeights()),\n gpu.as_numpy_array(Z.getWeights()),\n gpu.as_numpy_array(O.getWeights())), axis=0)\n else:\n W = np.concatenate((I.getWeights(), \n F.getWeights(), Z.getWeights(), \n O.getWeights()), axis=0)\n W2 = lstm2.W\n #self.chkEqual(W.transpose(), W2)", "metadata": "root.LSTM_Recurrent_Random_Tests.func", "header": "['class', 'LSTM_Recurrent_Random_Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "dEdX2 ", "start_line": 212, "start_column": 16, "end_line": 212, "end_column": 21 }, { "span": "dEdX2 ", "start_line": 214, "start_column": 16, "end_line": 214, "end_column": 21 }, { "span": "W ", "start_line": 235, "start_column": 16, "end_line": 235, "end_column": 17 }, { "span": "W ", "start_line": 241, "start_column": 16, "end_line": 241, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "LSTM", "\\u", "Recurren", "t", "\\u", "Random", "\\u", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func_", "(_", "self_", ",_", "multi", "Output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D2_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Time_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "I_", "=_", "Recurren", "t", "Adapter_", "(_", "Map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "I", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "input", "(", "0", ")'_", ",_", "'", "H", "(-", "1", ")'_", ",_", "'", "C", "(-", "1", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Fn_", "=_", "Sigm", "oid", "Activ", "e", "Fn_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Range_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Seed_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "Ini", "t", "Const_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "Rate_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "momentum_", "=_", "0.9_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "F_", "=_", "Recurren", "t", "Adapter_", "(_", "Map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "input", "(", "0", ")'_", ",_", "'", "H", "(-", "1", ")'_", ",_", "'", "C", "(-", "1", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Fn_", "=_", "Sigm", "oid", "Activ", "e", "Fn_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Range_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Seed_", "=_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "Ini", "t", "Const_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "Rate_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "momentum_", "=_", "0.9_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Z_", "=_", "Recurren", "t", "Adapter_", "(_", "Map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "input", "(", "0", ")'_", ",_", "'", "H", "(-", "1", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Fn_", "=_", "Tan", "h", "Activ", "e", "Fn_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Range_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Seed_", "=_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "Ini", "t", "Const_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "Rate_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "momentum_", "=_", "0.9_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FC_", "=_", "Recurren", "t", "Adapter_", "(_", "Element", "Product_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "F", ".", "C", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "F", "(", "0", ")'_", ",_", "'", "C", "(-", "1", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "IZ", "_", "=_", "Recurren", "t", "Adapter_", "(_", "Element", "Product_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "I", ".", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "I", "(", "0", ")'_", ",_", "'", "Z", "(", "0", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "Recurren", "t", "Adapter_", "(_", "Sum_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "C", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "F", ".", "C", "(", "0", ")'_", ",_", "'", "I", ".", "Z", "(", "0", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Components_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "=_", "Recurren", "t", "Adapter_", "(_", "Map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "O", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "input", "(", "0", ")'_", ",_", "'", "H", "(-", "1", ")'_", ",_", "'", "C", "(", "0", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Fn_", "=_", "Sigm", "oid", "Activ", "e", "Fn_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Range_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Seed_", "=_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "Ini", "t", "Const_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "Rate_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "momentum_", "=_", "0.9_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "U_", "=_", "Recurren", "t", "Adapter_", "(_", "Active_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "U", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "C", "(", "0", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Fn_", "=_", "Tan", "h", "Activ", "e", "Fn_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "Recurren", "t", "Adapter_", "(_", "Element", "Product_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "H", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Names_", "=_", "[_", "'", "O", "(", "0", ")'_", ",_", "'", "U", "(", "0", ")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lstm", "_", "=_", "Recurren", "t", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "lstm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stages_", "=_", "[_", "I_", ",_", "F_", ",_", "Z_", ",_", "FC_", ",_", "IZ", "_", ",_", "C_", ",_", "O_", ",_", "U_", ",_", "H_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timespan", "_", "=_", "Time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Dim_", "=_", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Stage", "Names_", "=_", "[_", "'", "H", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi", "Output_", "=_", "multi", "Output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "d", "Ed", "X_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lstm", "2_", "=_", "LSTM", "\\u", "Old", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "lstm", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Dim_", "=_", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Dim_", "=_", "D2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "need", "Init_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Range_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Seed_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cut", "Off", "Zero", "End_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi", "Err_", "=_", "multi", "Output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "Rate_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "momentum_", "=_", "0.9_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "=_", "np_", "._", "random_", "._", "Random", "State_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost", "Fn_", "=_", "cross", "Ent", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "random_", "._", "rand_", "(_", "N_", ",_", "Time_", ",_", "D_", ")_", "*_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multi", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "random_", "._", "rand_", "(_", "N_", ",_", "Time_", ",_", "D2_", ")_", "*_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "random_", "._", "rand_", "(_", "N_", ",_", "D2_", ")_", "*_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Y_", "=_", "lstm", "_", "._", "forward_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "E_", ",_", "d", "Ed", "Y_", "=_", "cost", "Fn_", "(_", "Y_", ",_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Ed", "X_", "=_", "lstm", "_", "._", "backward_", "(_", "d", "Ed", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I_", "._", "stages_", "[_", "0_", "]_", "._", "gpu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "I_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "F_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "Z_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "O_", "._", "get", "Weights_", "(_", ")_", ")_", ")_", ",_", "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 ", " ", "_", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "I_", "._", "get", "Weights_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "F_", "._", "get", "Weights_", "(_", ")_", ",_", "Z_", "._", "get", "Weights_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lstm", "2_", "._", "W_", "=_", "W_", "._", "transpose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "multi", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Y2_", "=_", "lstm", "2_", "._", "forward_", "(_", "X_", ")_", "[_", ":_", ",_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Y2_", "=_", "lstm", "2_", "._", "forward_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", ",_", "d", "Ed", "Y2_", "=_", "cost", "Fn_", "(_", "Y2_", ",_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multi", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d", "Ed", "X2_", "=_", "lstm", "2_", "._", "backward_", "(_", "np_", "._", "concatenate_", "(_", "(_", "d", "Ed", "Y2_", ",_", "np_", "._", "zeros_", "(_", "(_", "N_", ",_", "1_", ",_", "D2_", ")_", ")_", ")_", ",_", "axis_", "=_", "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 ", " _", "d", "Ed", "X2_", "=_", "lstm", "2_", "._", "backward_", "(_", "d", "Ed", "Y2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "I_", "._", "stages_", "[_", "0_", "]_", "._", "gpu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d", "Ed", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "I_", "._", "get", "Gradient_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "F_", "._", "get", "Gradient_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "Z_", "._", "get", "Gradient_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "O_", "._", "get", "Gradient_", "(_", ")_", ")_", ")_", ",_", "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 ", " _", "d", "Ed", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "I_", "._", "get", "Gradient_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "F_", "._", "get", "Gradient_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Z_", "._", "get", "Gradient_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "._", "get", "Gradient_", "(_", ")_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d", "Ed", "W2", "_", "=_", "lstm", "2_", "._", "d", "Ed", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lstm", "_", "._", "update", "Weights_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lstm", "2_", "._", "update", "Weights_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "chk", "Equal", "(", "Y", ",", " ", "Y", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "chk", "Equal", "(", "d", "Ed", "X", ",", " ", "d", "Ed", "X", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "chk", "Equal_", "(_", "d", "Ed", "W_", "._", "transpose_", "(_", ")_", ",_", "d", "Ed", "W2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "I_", "._", "stages_", "[_", "0_", "]_", "._", "gpu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "I_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "F_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "Z_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu_", "._", "as", "\\u", "nump", "y", "\\u", "array_", "(_", "O_", "._", "get", "Weights_", "(_", ")_", ")_", ")_", ",_", "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 ", " _", "W_", "=_", "np_", "._", "concatenate_", "(_", "(_", "I_", "._", "get", "Weights_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "F_", "._", "get", "Weights_", "(_", ")_", ",_", "Z_", "._", "get", "Weights_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "O_", "._", "get", "Weights_", "(_", ")_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "W2", "_", "=_", "lstm", "2_", "._", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "chk", "Equal", "(", "W", ".", "transpose", "()", ",", " ", "W2", ")_", "\\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,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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, 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 ]
Except block handles 'BaseException'
django-leonardo/django-leonardo/leonardo/module/web/widgets/views.py
[ { "content": " def get_success_url(self):\n if self.request.META.get(\"HTTP_REFERER\") != \\\n self.request.build_absolute_uri():\n return self.request.META.get('HTTP_REFERER')\n\n try:\n success_url = self.object.parent.get_absolute_url()\n except:\n pass\n else:\n return success_url\n\n return super(WidgetActionMixin, self).get_success_url()", "metadata": "root.SuccessUrlMixin.get_success_url", "header": "['class', 'SuccessUrlMixin', '(', 'object', ')', ':', '___EOS___']", "index": 211 }, { "content": " def post(self, *args, **kwargs):\n\n widgets = self.request.POST.getlist('widgets[]', [])\n\n widget_list = []\n\n try:\n for widget_id in widgets:\n widget = get_widget_from_id(widget_id)\n if widget:\n widget_list.append(widget)\n except:\n messages.error(\n self.request, _('Error occured while sorting widgets.'))\n\n i = 0\n\n for widget in widget_list:\n widget.ordering = i\n widget.save()\n i += 1\n\n messages.success(self.request, _('Widget sorting success.'))\n\n return HttpResponse('ok')", "metadata": "root.WidgetSortView.post", "header": "['class', 'WidgetSortView', '(', 'WidgetActionMixin', ',', 'ModalFormView', ')', ':', '___EOS___']", "index": 288 } ]
[ { "span": "except:", "start_line": 218, "start_column": 8, "end_line": 218, "end_column": 15 }, { "span": "except:", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Success", "Ur", "l", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "success", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "request_", "._", "META_", "._", "get_", "(_", "\"", "HTTP", "\\u", "REFE", "RER", "\"_", ")_", "!=_", "self_", "._", "request_", "._", "build", "\\u", "abs", "olute", "\\u", "uri_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "REFE", "RER", "'_", ")_", "\\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 ", " _", "success", "\\u", "url_", "=_", "self_", "._", "object_", "._", "parent_", "._", "get", "\\u", "abs", "olute", "\\u", "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 ", " _", "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 ", " _", "return_", "success", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Wid", "get", "Action", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "success", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Sort", "View_", "(_", "Wid", "get", "Action", "Mixin_", ",_", "Modal", "Form", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widgets_", "=_", "self_", "._", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "widget", "s", "[]'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "widget", "\\u", "list_", "=_", "[_", "]_", "\\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_", "widget", "\\u", "id_", "in_", "widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "get", "\\u", "widget", "\\u", "from", "\\u", "id_", "(_", "widget", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "widget_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "widget", "\\u", "list_", "._", "append_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", ",_", "\\u_", "(_", "'", "Error", " ", "occure", "d", " ", "whi", "le", " ", "sorting", " ", "widget", "s", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "widget_", "in_", "widget", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "ordering_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "success_", "(_", "self_", "._", "request_", ",_", "\\u_", "(_", "'", "Wid", "get", " ", "sorting", " ", "success", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "'", "ok", "'_", ")_", "\\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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]
Unused import
niwinz/django-greenqueue/greenqueue/management/commands/run_greenqueue.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\nfrom optparse import make_option\n\nimport logging\nimport zmq\nimport sys\nimport os\n\nlog = logging.getLogger('greenqueue')\n\nfrom greenqueue import settings as gq_settings\nfrom greenqueue.shortcuts import load_backend_class\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_option('--socket', action=\"store\", dest=\"socket\", default=gq_settings.GREENQUEUE_BIND_ADDRESS,\n help=\"Tells greenqueue server to use this zmq push socket path instead a default.\"),\n )\n\n help = \"Starts a greenqueue worker.\"\n args = \"[]\"\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def handle(self, *args, **options):\n gq_settings.GREENQUEUE_BIND_ADDRESS = options['socket']\n \n service_handler = load_backend_class().instance()\n verbosity = int(options.get('verbosity'))\n\n if verbosity > 1:\n log.setLevel(logging.DEBUG)\n else:\n log.setLevel(logging.INFO)\n \n try:\n service_handler.start()\n except KeyboardInterrupt:\n pass", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 25 } ]
[ { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 65 }, { "span": "from django.conf import settings", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 }, { "span": "import zmq", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 10 }, { "span": "import sys", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 10 }, { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "make", "\\u", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "green", "queue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "green", "queue_", "import_", "settings_", "as_", "gq", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green", "queue_", "._", "shortcuts_", "import_", "load", "\\u", "back", "end", "\\u", "class_", "\\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_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "\\u", "list_", "=_", "Base", "Command_", "._", "option", "\\u", "list_", "+_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "option_", "(_", "'--", "socket", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "dest_", "=_", "\"", "socket", "\"_", ",_", "default_", "=_", "gq", "\\u", "settings_", "._", "GREEN", "QUEUE", "\\u", "BIND", "\\u", "ADDRESS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Tell", "s", " ", "green", "queue", " ", "server", " ", "to", " ", "use", " ", "this", " ", "zmq", " ", "push", " ", "socket", " ", "path", " ", "inst", "ead", " ", "a", " ", "default", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Start", "s", " ", "a", " ", "green", "queue", " ", "worker", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "\"[", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gq", "\\u", "settings_", "._", "GREEN", "QUEUE", "\\u", "BIND", "\\u", "ADDRESS_", "=_", "options_", "[_", "'", "socket", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "handler_", "=_", "load", "\\u", "back", "end", "\\u", "class_", "(_", ")_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbosity_", "=_", "int_", "(_", "options_", "._", "get_", "(_", "'", "verbo", "sity", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbosity_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\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 ", " _", "service", "\\u", "handler_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/tests/restapi/__init__.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf_8 -*-\n\nimport sys\nimport os\nimport unittest\nimport re\nimport web\n\nfrom paste.fixture import TestApp\n#from nose.tools import *\n\nimport logging\nimport karesansui\nimport karesansui.urls\n\nusername = \"ja@localhost\"\npassword = \"password\"\n\n\n\n\n \nif __name__ == '__main__':\n main()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestRestAPI(unittest.TestCase):\n\n\n\n \n\n\n\n\n\n", "metadata": "root.TestRestAPI", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def setUp(self):\n middleware = []\n self.logger = logging.getLogger('restapi')\n urls = karesansui.urls.urls\n app = web.application(urls, globals(), autoreload=False)\n\n from karesansui.app import load_sqlalchemy_karesansui,load_sqlalchemy_pysilhouette\n app.add_processor(load_sqlalchemy_karesansui)\n app.add_processor(load_sqlalchemy_pysilhouette)\n\n self.prefix = \"\"\n if karesansui.config['application.url.prefix']:\n mapping = (karesansui.config['application.url.prefix'], app)\n app = web.subdir_application(mapping)\n self.prefix = karesansui.config['application.url.prefix']\n\n self.app = TestApp(app.wsgifunc(*middleware))\n\n self.headers = {}\n if username != None and password != None:\n from base64 import b64encode\n base64string =b64encode(\"%s:%s\" % (username, password))\n self.headers = {\"Authorization\": \"Basic %s\" % base64string}\n\n return True", "metadata": "root.TestRestAPI.setUp", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def tearDown(self):\n return True", "metadata": "root.TestRestAPI.tearDown", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_dummy(self):\n self.assertEqual(True,True)", "metadata": "root.TestRestAPI.test_dummy", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_get_index(self):\n r = self.app.get(\"%s/\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('Now Loading')", "metadata": "root.TestRestAPI.test_get_index", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_get_host_1_index(self):\n r = self.app.get(\"%s/host/1/\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('Now Loading')", "metadata": "root.TestRestAPI.test_get_host_1_index", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_get_host_1_json(self):\n r = self.app.get(\"%s/host/1.json\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('other_url')", "metadata": "root.TestRestAPI.test_get_host_1_json", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_get_host_1_guest_2_index(self):\n r = self.app.get(\"%s/host/1/guest/2/\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('Now Loading')", "metadata": "root.TestRestAPI.test_get_host_1_guest_2_index", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_get_host_1_guest_2_json(self):\n r = self.app.get(\"%s/host/1/guest/2.json\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('other_url')", "metadata": "root.TestRestAPI.test_get_host_1_guest_2_json", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_post_host_1_guest(self):\n\n params = {}\n params['domain_name'] = 'foobar'\n params['m_name'] = 'foobar'\n params['icon_filename'] = ''\n params['m_hypervisor'] = '1'\n params['note_title'] = 'title'\n params['note_value'] = 'value'\n params['tags'] = ''\n params['nic_type'] = 'phydev'\n params['phydev'] = 'xenbr0'\n params['virnet'] = 'default'\n params['xen_disk_size'] = '4096'\n params['xen_extra'] = ''\n params['xen_initrd'] = '/var/ftp/images/xen/initrd.img'\n params['xen_kernel'] = '/var/ftp/images/xen/vmlinuz'\n params['xen_mac'] = '00:16:3e:4e:4d:e2'\n params['xen_mem_size'] = '256'\n params['xen_graphics_port'] = '5910'\n upload_files=None\n\n r = self.app.post(\"%s/host/1/guest.part\" % self.prefix,params=params,headers=self.headers,upload_files=upload_files)\n assert_equal(r.status, 200)\n r.mustcontain('other_url')", "metadata": "root.TestRestAPI.test_post_host_1_guest", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def test_del_host_1_guest_2(self):\n r = self.app.delete(\"%s/host/1/guest/2\" % self.prefix,headers=self.headers)\n assert_equal(r.status, 200)\n r.mustcontain('other_url')", "metadata": "root.TestRestAPI.test_del_host_1_guest_2", "header": "['class', 'TestRestAPI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 }, { "content": "class SuiteRestAPI(unittest.TestSuite):", "metadata": "root.SuiteRestAPI", "header": "['module', '___EOS___']", "index": 109 }, { "content": " def __init__(self):\n tests = ['test_dummy',\n 'test_get_index',\n 'test_get_host_1_index',\n 'test_get_host_1_json',\n 'test_get_host_1_guest_2_index',\n 'test_get_host_1_guest_2_json',\n 'test_post_host_1_guest',\n ]\n unittest.TestSuite.__init__(self,map(TestRestAPI, tests))", "metadata": "root.SuiteRestAPI.__init__", "header": "['class', 'SuiteRestAPI', '(', 'unittest', '.', 'TestSuite', ')', ':', '___EOS___']", "index": 110 }, { "content": "def all_suite_restapi():\n return unittest.TestSuite([SuiteRestAPI()])", "metadata": "root.all_suite_restapi", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def main():\n unittest.TextTestRunner(verbosity=2).run(all_suite_restapi())", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 124 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import re", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "\\u", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "paste_", "._", "fixture_", "import_", "Test", "App_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "nose", ".", "tool", "s", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "kar", "esa", "nsu", "i_", "._", "urls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "ja", "@", "local", "host", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "\"", "password", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "middleware_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "resta", "pi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "=_", "kar", "esa", "nsu", "i_", "._", "urls_", "._", "urls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "web_", "._", "application_", "(_", "urls_", ",_", "globals_", "(_", ")_", ",_", "autore", "load_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "app_", "import_", "load", "\\u", "sqla", "lche", "my", "\\u", "kar", "esa", "nsu", "i_", ",_", "load", "\\u", "sqla", "lche", "my", "\\u", "pys", "il", "hou", "ette", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "processor_", "(_", "load", "\\u", "sqla", "lche", "my", "\\u", "kar", "esa", "nsu", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "processor_", "(_", "load", "\\u", "sqla", "lche", "my", "\\u", "pys", "il", "hou", "ette", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prefix_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "url", ".", "prefix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapping_", "=_", "(_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "url", ".", "prefix", "'_", "]_", ",_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "web_", "._", "subdir", "\\u", "application_", "(_", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prefix_", "=_", "kar", "esa", "nsu", "i_", "._", "config_", "[_", "'", "applica", "tion", ".", "url", ".", "prefix", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "=_", "Test", "App_", "(_", "app_", "._", "wsgi", "func_", "(_", "*_", "middleware_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "!=_", "None_", "and_", "password_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "base64_", "import_", "b64encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base64", "string_", "=_", "b64encode_", "(_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "username_", ",_", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headers_", "=_", "{_", "\"", "Authoriz", "ation", "\"_", ":_", "\"", "Basic", " ", "%", "s", "\"_", "%_", "base64", "string_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dummy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\"%", "s", "/\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "No", "w", " ", "Load", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\"%", "s", "/", "host", "/", "1", "/\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "No", "w", " ", "Load", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\"%", "s", "/", "host", "/", "1", ".", "json", "\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "other", "\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "guest", "\\u", "2", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\"%", "s", "/", "host", "/", "1", "/", "guest", "/", "2", "/\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "No", "w", " ", "Load", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "guest", "\\u", "2", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\"%", "s", "/", "host", "/", "1", "/", "guest", "/", "2", ".", "json", "\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "other", "\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "host", "\\u", "1", "\\u", "guest_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "domain", "\\u", "name", "'_", "]_", "=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "m", "\\u", "name", "'_", "]_", "=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "icon", "\\u", "filename", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "m", "\\u", "hypervisor", "'_", "]_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "note", "\\u", "title", "'_", "]_", "=_", "'", "title", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "note", "\\u", "value", "'_", "]_", "=_", "'", "value", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "tags", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "nic", "\\u", "type", "'_", "]_", "=_", "'", "phy", "dev", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "phy", "dev", "'_", "]_", "=_", "'", "xen", "br", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "vir", "net", "'_", "]_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "disk", "\\u", "size", "'_", "]_", "=_", "'", "409", "6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "extra", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "initrd", "'_", "]_", "=_", "'/", "var", "/", "ftp", "/", "images", "/", "xen", "/", "initrd", ".", "img", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "kernel", "'_", "]_", "=_", "'/", "var", "/", "ftp", "/", "images", "/", "xen", "/", "vm", "lin", "uz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "mac", "'_", "]_", "=_", "'", "00", ":", "16", ":", "3e", ":", "4e", ":", "4d", ":", "e2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "mem", "\\u", "size", "'_", "]_", "=_", "'", "256", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "xen", "\\u", "graphic", "s", "\\u", "port", "'_", "]_", "=_", "'", "591", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "self_", "._", "app_", "._", "post_", "(_", "\"%", "s", "/", "host", "/", "1", "/", "guest", ".", "part", "\"_", "%_", "self_", "._", "prefix_", ",_", "params_", "=_", "params_", ",_", "headers_", "=_", "self_", "._", "headers_", ",_", "upload", "\\u", "files_", "=_", "upload", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "other", "\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rest", "API_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "del", "\\u", "host", "\\u", "1", "\\u", "guest", "\\u", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "app_", "._", "delete_", "(_", "\"%", "s", "/", "host", "/", "1", "/", "guest", "/", "2", "\"_", "%_", "self_", "._", "prefix_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "r_", "._", "status_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "must", "contain", "_", "(_", "'", "other", "\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Suit", "e", "Rest", "API_", "(_", "unittest_", "._", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Suit", "e", "Rest", "API_", "(_", "unittest_", "._", "Test", "Suite_", ")_", ":_", "\\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 ", " _", "tests_", "=_", "[_", "'", "test\\u", "dummy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "get", "\\u", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "guest", "\\u", "2", "\\u", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "get", "\\u", "host", "\\u", "1", "\\u", "guest", "\\u", "2", "\\u", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "post", "\\u", "host", "\\u", "1", "\\u", "guest", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Test", "Suite_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "map_", "(_", "Test", "Rest", "API_", ",_", "tests_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "suit", "e\\u", "resta", "pi_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unittest_", "._", "Test", "Suite_", "(_", "[_", "Suit", "e", "Rest", "API_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "all", "\\u", "suit", "e\\u", "resta", "pi_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
gkno/gkno_launcher/src/networkx/algorithms/tests/test_graphical.py
[ { "content": "@raises(nx.NetworkXException)\ndef test_string_input():\n a = nx.is_valid_degree_sequence([],'foo')", "metadata": "root.test_string_input", "header": "['module', '___EOS___']", "index": 21 } ]
[ { "span": "a ", "start_line": 23, "start_column": 4, "end_line": 23, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "nx_", "._", "Network", "XE", "xcept", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "string", "\\u", "input_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "nx_", "._", "is", "\\u", "valid", "\\u", "degr", "ee", "\\u", "sequence_", "(_", "[_", "]_", ",_", "'", "foo", "'_", ")_", "\\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 ]
Unused import
momyc/gevent-fastcgi/setup.py
[ { "content": "import os\nimport sys\nfrom setuptools import setup, Extension, find_packages\n\n\next_modules = []\n# C speedups are no good for PyPy\nif '__pypy__' not in sys.builtin_module_names:\n ext_modules.append(\n Extension('gevent_fastcgi.speedups', ['gevent_fastcgi/speedups.c']))\n\nsetup(\n name='gevent-fastcgi',\n version='1.0.2.1',\n description='''FastCGI/WSGI client and server implemented using gevent\n library''',\n long_description='''\n FastCGI/WSGI server implementation using gevent library. No need to\n monkeypatch and slow down your favourite FastCGI server in order to make\n it \"green\".\n\n Supports connection multiplexing. Out-of-the-box support for Django and\n frameworks that use PasteDeploy including Pylons and Pyramid.\n ''',\n keywords='fastcgi gevent wsgi',\n author='Alexander Kulakov',\n author_email='a.kulakov@mail.ru',\n url='http://github.com/momyc/gevent-fastcgi',\n packages=find_packages(exclude=('gevent_fastcgi.tests.*',)),\n zip_safe=True,\n license='MIT',\n install_requires=[\n \"zope.interface\",\n \"gevent>=0.13.6\",\n ],\n entry_points={\n 'paste.server_runner': [\n 'fastcgi = gevent_fastcgi.adapters.paste_deploy:fastcgi_server_runner',\n 'wsgi = gevent_fastcgi.adapters.paste_deploy:wsgi_server_runner',\n 'wsgiref = gevent_fastcgi.adapters.paste_deploy:wsgiref_server_runner',\n ],\n },\n test_suite=\"tests\",\n tests_require=['mock'],\n ext_modules=ext_modules\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "Extension_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "C", " ", "speed", "ups", " ", "are", " ", "no", " ", "good", " ", "for", " ", "Py", "Py_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "\\u", "pypy", "\\u\\u'_", "not_", "in_", "sys_", "._", "bui", "lti", "n", "\\u", "module", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "\\u", "modules_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Extension_", "(_", "'", "gev", "ent", "\\u", "fast", "cgi", ".", "speed", "ups", "'_", ",_", "[_", "'", "gev", "ent", "\\u", "fast", "cgi", "/", "speed", "ups", ".", "c", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "gev", "ent", "-", "fast", "cgi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "1.0", ".2", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'''", "Fast", "CGI", "/", "WS", "GI", " ", "client", " ", "and", " ", "server", " ", "implemented", " ", "usi", "ng", " ", "gev", "ent", "\\", "10", ";", " ", " ", " ", " ", "librar", "y", "'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fast", "CGI", "/", "WS", "GI", " ", "server", " ", "implementation", " ", "usi", "ng", " ", "gev", "ent", " ", "librar", "y", ".", " ", "No", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "monkey", "patch", " ", "and", " ", "slow", " ", "down", " ", "your", " ", "favourite", " ", "Fast", "CGI", " ", "server", " ", "in", " ", "order", " ", "to", " ", "make", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "\"", "green", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Supp", "orts", " ", "connecti", "on", " ", "multiple", "xin", "g", ".", " ", "Out", "-", "of", "-", "the", "-", "box", " ", "support", " ", "for", " ", "Dj", "ang", "o", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "frameworks", " ", "tha", "t", " ", "use", " ", "Past", "e", "Deploy", " ", "inclu", "ding", " ", "Py", "lon", "s", " ", "and", " ", "Pyr", "amid", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "fast", "cgi", " ", "gev", "ent", " ", "wsgi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Alexa", "nder", " ", "Ku", "la", "kov", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "a", ".", "kul", "ak", "ov", "@", "mail", ".", "ru", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://", "git", "hub", ".", "com", "/", "mom", "yc", "/", "gev", "ent", "-", "fast", "cgi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "exclude_", "=_", "(_", "'", "gev", "ent", "\\u", "fast", "cgi", ".", "tests", ".*'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "zop", "e", ".", "interface", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gev", "ent", ">=", "0.13", ".6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "points_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "paste", ".", "server", "\\u", "runn", "er", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fast", "cgi", " ", "=", " ", "gev", "ent", "\\u", "fast", "cgi", ".", "adapter", "s", ".", "paste", "\\u", "deploy", ":", "fast", "cgi", "\\u", "server", "\\u", "runn", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", " ", "=", " ", "gev", "ent", "\\u", "fast", "cgi", ".", "adapter", "s", ".", "paste", "\\u", "deploy", ":", "wsgi", "\\u", "server", "\\u", "runn", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", "ref", " ", "=", " ", "gev", "ent", "\\u", "fast", "cgi", ".", "adapter", "s", ".", "paste", "\\u", "deploy", ":", "wsgi", "ref", "\\u", "server", "\\u", "runn", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "\"", "tests", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests", "\\u", "require_", "=_", "[_", "'", "mock", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "ext", "\\u", "modules_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
openstack/group-based-policy/gbpservice/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py
[ { "content": " def test_enhanced_subnet_options(self):\n self.driver.enable_metadata_opt = False\n l3p = self.create_l3_policy(name='myl3',\n ip_pool='192.168.0.0/16')['l3_policy']\n l2p = self.create_l2_policy(name='myl2',\n l3_policy_id=l3p['id'])['l2_policy']\n ptg = self.create_policy_target_group(\n name=\"ptg1\", l2_policy_id=l2p['id'])['policy_target_group']\n pt1 = self.create_policy_target(\n policy_target_group_id=ptg['id'])['policy_target']\n self._bind_port_to_host(pt1['port_id'], 'h1')\n sub = self._get_object('subnets', ptg['subnets'][0],\n self.api)\n with self.port(subnet=sub, device_owner='network:dhcp',\n tenant_id='onetenant') as dhcp:\n dhcp = dhcp['port']\n details = self.driver.get_gbp_details(\n context.get_admin_context(),\n device='tap%s' % pt1['port_id'], host='h1')\n\n self.assertEqual(1, len(details['subnets']))\n # Verify that DNS nameservers are correctly set\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dns_nameservers'])\n # Verify Default route via GW\n self.assertTrue({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])\n\n # Verify Metadata route via DHCP\n self.assertTrue(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])\n\n # Verify no extra routes are leaking inside\n self.assertEqual(2, len(details['subnets'][0]['host_routes']))\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dhcp_server_ips'])", "metadata": "root.TestPolicyTarget.test_enhanced_subnet_options", "header": "['class', 'TestPolicyTarget', '(', 'ApicMappingTestCase', ')', ':', '___EOS___']", "index": 493 }, { "content": " def test_update_l2p_inject_default_route_false(self):\n self.driver.enable_metadata_opt = False\n l3p = self.create_l3_policy(name='myl3',\n ip_pool='192.168.0.0/16')['l3_policy']\n l2p = self.create_l2_policy(name='myl2',\n l3_policy_id=l3p['id'])['l2_policy']\n ptg = self.create_policy_target_group(\n name=\"ptg1\", l2_policy_id=l2p['id'])['policy_target_group']\n pt1 = self.create_policy_target(\n policy_target_group_id=ptg['id'])['policy_target']\n self._bind_port_to_host(pt1['port_id'], 'h1')\n sub = self._get_object('subnets', ptg['subnets'][0],\n self.api)\n\n # Add one more host_route to the subnet\n more_host_routes = [{'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'}]\n data = {'subnet': {'host_routes': more_host_routes}}\n req = self.new_update_request('subnets', data, sub['subnet']['id'])\n res = self.deserialize(self.fmt, req.get_response(self.api))\n self.assertEqual(sorted(res['subnet']['host_routes']),\n sorted(more_host_routes))\n\n with self.port(subnet=sub, device_owner='network:dhcp',\n tenant_id='onetenant') as dhcp:\n dhcp = dhcp['port']\n details = self.driver.get_gbp_details(\n context.get_admin_context(),\n device='tap%s' % pt1['port_id'], host='h1')\n\n self.assertEqual(1, len(details['subnets']))\n # Verify that DNS nameservers are correctly set\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dns_nameservers'])\n # Verify Default route via GW\n self.assertTrue({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])\n\n # Verify Metadata route via DHCP\n self.assertTrue(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])\n\n # Verify additional host_routes are also added:\n # GW + Metadata + 1 additional route = 3\n self.assertEqual(3, len(details['subnets'][0]['host_routes']))\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dhcp_server_ips'])\n\n # Verify gateway_ip is set\n self.assertTrue('gateway_ip' in details['subnets'][0])\n\n data = {'l2_policy': {'inject_default_route': False}}\n res = self.new_update_request('l2_policies', data, l2p['id'],\n self.fmt).get_response(self.ext_api)\n pt2 = self.create_policy_target(\n policy_target_group_id=ptg['id'])['policy_target']\n self._bind_port_to_host(pt2['port_id'], 'h1')\n with self.port(subnet=sub, tenant_id='onetenant'):\n details = self.driver.get_gbp_details(\n context.get_admin_context(),\n device='tap%s' % pt2['port_id'], host='h1')\n\n self.assertEqual(1, len(details['subnets']))\n # Verify Default route via GW is not present\n self.assertFalse({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])\n\n # Verify Metadata route via DHCP is not present\n self.assertFalse(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])\n\n # Verify only extra route is present\n self.assertEqual(1, len(details['subnets'][0]['host_routes']))\n self.assertTrue(\n {'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'} in\n details['subnets'][0]['host_routes'])\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dhcp_server_ips'])\n # Verify gateway_ip is not set\n self.assertFalse('gateway_ip' in details['subnets'][0])", "metadata": "root.TestPolicyTarget.test_update_l2p_inject_default_route_false", "header": "['class', 'TestPolicyTarget', '(', 'ApicMappingTestCase', ')', ':', '___EOS___']", "index": 533 }, { "content": " def test_create_l2p_inject_default_route_false(self):\n self.driver.enable_metadata_opt = False\n l3p = self.create_l3_policy(name='myl3',\n ip_pool='192.168.0.0/16')['l3_policy']\n l2p = self.create_l2_policy(name='myl2',\n l3_policy_id=l3p['id'],\n inject_default_route=False)['l2_policy']\n ptg = self.create_policy_target_group(\n name=\"ptg1\", l2_policy_id=l2p['id'])['policy_target_group']\n pt1 = self.create_policy_target(\n policy_target_group_id=ptg['id'])['policy_target']\n self._bind_port_to_host(pt1['port_id'], 'h1')\n sub = self._get_object('subnets', ptg['subnets'][0],\n self.api)\n\n # Add one more host_route to the subnet\n more_host_routes = [{'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'}]\n data = {'subnet': {'host_routes': more_host_routes}}\n req = self.new_update_request('subnets', data, sub['subnet']['id'])\n res = self.deserialize(self.fmt, req.get_response(self.api))\n self.assertEqual(sorted(res['subnet']['host_routes']),\n sorted(more_host_routes))\n\n with self.port(subnet=sub, device_owner='network:dhcp',\n tenant_id='onetenant') as dhcp:\n dhcp = dhcp['port']\n details = self.driver.get_gbp_details(\n context.get_admin_context(),\n device='tap%s' % pt1['port_id'], host='h1')\n\n self.assertEqual(1, len(details['subnets']))\n # Verify that DNS nameservers are correctly set\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dns_nameservers'])\n # Verify Default route via GW is not present\n self.assertFalse({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])\n\n # Verify Metadata route via DHCP is not present\n self.assertFalse(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])\n\n # Verify only extra route is present\n self.assertEqual(1, len(details['subnets'][0]['host_routes']))\n self.assertTrue(\n {'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'} in\n details['subnets'][0]['host_routes'])\n self.assertEqual([dhcp['fixed_ips'][0]['ip_address']],\n details['subnets'][0]['dhcp_server_ips'])\n # Verify gateway_ip is not set\n self.assertFalse('gateway_ip' in details['subnets'][0])", "metadata": "root.TestPolicyTarget.test_create_l2p_inject_default_route_false", "header": "['class', 'TestPolicyTarget', '(', 'ApicMappingTestCase', ')', ':', '___EOS___']", "index": 621 }, { "content": " def test_icmp_rule_created_on_apic(self):\n pr = self._create_simple_policy_rule('in', 'icmp', None)\n tenant = pr['tenant_id']\n\n mgr = self.driver.apic_manager\n expected_calls = [\n mock.call(pr['id'], owner=tenant, entry='os-entry-0', etherT='ip',\n prot='icmp', transaction=mock.ANY),\n mock.call(amap.REVERSE_PREFIX + pr['id'], owner=tenant,\n entry=mock.ANY, etherT='ip', icmpv4T='echo-rep',\n prot='icmp', transaction=mock.ANY),\n mock.call(amap.REVERSE_PREFIX + pr['id'], owner=tenant,\n entry=mock.ANY, etherT='ip', icmpv4T='dst-unreach',\n prot='icmp', transaction=mock.ANY),\n mock.call(amap.REVERSE_PREFIX + pr['id'], owner=tenant,\n entry=mock.ANY, etherT='ip', icmpv4T='src-quench',\n prot='icmp', transaction=mock.ANY),\n mock.call(amap.REVERSE_PREFIX + pr['id'], owner=tenant,\n entry=mock.ANY, etherT='ip', icmpv4T='time-exceeded',\n prot='icmp', transaction=mock.ANY)]\n # verify that entry is always different\n found = set()\n for call in mgr.create_tenant_filter.call_args_list:\n # Only for reverse filters\n if call[0][0].startswith(amap.REVERSE_PREFIX):\n self.assertFalse(call[1]['entry'] in found)\n found.add(call[1]['entry'])\n\n self._check_call_list(\n expected_calls, mgr.create_tenant_filter.call_args_list)", "metadata": "root.TestPolicyRule.test_icmp_rule_created_on_apic", "header": "['class', 'TestPolicyRule', '(', 'ApicMappingTestCase', ')', ':', '___EOS___']", "index": 2679 }, { "content": " def _test_create_fip(self, shared):\n self._mock_external_dict([('supported', '192.168.0.2/24')])\n es = self.create_external_segment(name='supported',\n expected_res_status=webob.exc.HTTPCreated.code,\n shared=shared)['external_segment']\n self.create_nat_pool(external_segment_id=es['id'],\n ip_version=4, ip_pool='192.168.1.0/24', shared=shared,\n expected_res_status=webob.exc.HTTPCreated.code)\n subnet = self._get_object('subnets', es['subnet_id'],\n self.api)['subnet']\n\n fip_dict = {'floating_network_id': subnet['network_id']}\n fip_id = self.driver.create_floatingip_in_nat_pool(\n context.get_admin_context(),\n es['tenant_id'], {'floatingip': fip_dict})\n self.assertIsNotNone(fip_id)\n fip = self._get_object(\n 'floatingips', fip_id, self.ext_api)['floatingip']\n self.assertTrue(\n netaddr.IPAddress(fip['floating_ip_address']) in\n netaddr.IPNetwork('192.168.1.0/24'))", "metadata": "root.TestNatPool._test_create_fip", "header": "['class', 'TestNatPool', '(', 'ApicMappingTestCase', ')', ':', '___EOS___']", "index": 4135 } ]
[ { "span": "self.assertTrue({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])", "start_line": 518, "start_column": 12, "end_line": 520, "end_column": 65 }, { "span": "self.assertTrue(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])", "start_line": 523, "start_column": 12, "end_line": 526, "end_column": 53 }, { "span": "self.assertTrue({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])", "start_line": 568, "start_column": 12, "end_line": 570, "end_column": 65 }, { "span": "self.assertTrue(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])", "start_line": 573, "start_column": 12, "end_line": 576, "end_column": 53 }, { "span": "self.assertTrue('gateway_ip' in details['subnets'][0])", "start_line": 585, "start_column": 12, "end_line": 585, "end_column": 66 }, { "span": "self.assertFalse({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])", "start_line": 600, "start_column": 12, "end_line": 602, "end_column": 65 }, { "span": "self.assertFalse(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])", "start_line": 605, "start_column": 12, "end_line": 608, "end_column": 53 }, { "span": "self.assertTrue(\n {'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'} in\n details['subnets'][0]['host_routes'])", "start_line": 612, "start_column": 12, "end_line": 615, "end_column": 53 }, { "span": "self.assertFalse('gateway_ip' in details['subnets'][0])", "start_line": 619, "start_column": 12, "end_line": 619, "end_column": 67 }, { "span": "self.assertFalse({'destination': '0.0.0.0/0',\n 'nexthop': '192.168.0.1'} in\n details['subnets'][0]['host_routes'])", "start_line": 657, "start_column": 12, "end_line": 659, "end_column": 65 }, { "span": "self.assertFalse(\n {'destination': '169.254.169.254/16',\n 'nexthop': dhcp['fixed_ips'][0]['ip_address']} in\n details['subnets'][0]['host_routes'])", "start_line": 662, "start_column": 12, "end_line": 665, "end_column": 53 }, { "span": "self.assertTrue(\n {'destination': '172.16.0.0/24',\n 'nexthop': '10.0.2.2'} in\n details['subnets'][0]['host_routes'])", "start_line": 669, "start_column": 12, "end_line": 672, "end_column": 53 }, { "span": "self.assertFalse('gateway_ip' in details['subnets'][0])", "start_line": 676, "start_column": 12, "end_line": 676, "end_column": 67 }, { "span": "self.assertFalse(call[1]['entry'] in found)", "start_line": 2704, "start_column": 16, "end_line": 2704, "end_column": 59 }, { "span": "self.assertTrue(\n netaddr.IPAddress(fip['floating_ip_address']) in\n netaddr.IPNetwork('192.168.1.0/24'))", "start_line": 4153, "start_column": 8, "end_line": 4155, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Polic", "y", "Target_", "(_", "Ap", "ic", "Map", "ping", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "enhance", "d\\u", "subnet", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "enable", "\\u", "metadata", "\\u", "opt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l3", "p_", "=_", "self_", "._", "create", "\\u", "l3", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "pool_", "=_", "'", "192", ".1", "68.", "0.", "0", "/", "16", "'_", ")_", "[_", "'", "l3", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "p_", "=_", "self_", "._", "create", "\\u", "l2", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "l3", "\\u", "policy", "\\u", "id_", "=_", "l3", "p_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "l2", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt", "g_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target", "\\u", "group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "pt", "g1", "\"_", ",_", "l2", "\\u", "policy", "\\u", "id_", "=_", "l2", "p_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "\\u", "group", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt1_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "group", "\\u", "id_", "=_", "pt", "g_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "bind", "\\u", "port", "\\u", "to", "\\u", "host_", "(_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "\\u", "get", "\\u", "object_", "(_", "'", "subnet", "s", "'_", ",_", "pt", "g_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "port_", "(_", "subnet_", "=_", "sub_", ",_", "device", "\\u", "owner_", "=_", "'", "network", ":", "dhcp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "'", "onet", "ena", "nt", "'_", ")_", "as_", "dhcp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dhcp_", "=_", "dhcp_", "[_", "'", "port", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "details_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "gbp", "\\u", "details_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device_", "=_", "'", "tap", "%", "s", "'_", "%_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "host_", "=_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "DNS", " ", "nameservers", " ", "are", " ", "correct", "ly", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dns", "\\u", "nameservers", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "Default", " ", "route", " ", "via", " ", "GW", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "0.", "0.", "0.", "0", "/", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "192", ".1", "68.", "0.", "1", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "Meta", "data", " ", "route", " ", "via", " ", "DHC", "P_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "169", ".2", "54.", "169", ".2", "5", "4", "/", "16", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "no", " ", "extra", " ", "route", "s", " ", "are", " ", "leak", "ing", " ", "inside_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dhcp", "\\u", "server", "\\u", "ips", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Polic", "y", "Target_", "(_", "Ap", "ic", "Map", "ping", "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", "update", "\\u", "l2", "p", "\\u", "inject", "\\u", "default", "\\u", "route", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "enable", "\\u", "metadata", "\\u", "opt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l3", "p_", "=_", "self_", "._", "create", "\\u", "l3", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "pool_", "=_", "'", "192", ".1", "68.", "0.", "0", "/", "16", "'_", ")_", "[_", "'", "l3", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "p_", "=_", "self_", "._", "create", "\\u", "l2", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "l3", "\\u", "policy", "\\u", "id_", "=_", "l3", "p_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "l2", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt", "g_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target", "\\u", "group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "pt", "g1", "\"_", ",_", "l2", "\\u", "policy", "\\u", "id_", "=_", "l2", "p_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "\\u", "group", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt1_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "group", "\\u", "id_", "=_", "pt", "g_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "bind", "\\u", "port", "\\u", "to", "\\u", "host_", "(_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "\\u", "get", "\\u", "object_", "(_", "'", "subnet", "s", "'_", ",_", "pt", "g_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "one", " ", "more", " ", "host", "\\u", "route", " ", "to", " ", "the", " ", "subnet_", "\\u\\u\\uNL\\u\\u\\u_", "more", "\\u", "host", "\\u", "routes_", "=_", "[_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "172", ".1", "6.0", ".0", "/", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "10.", "0.", "2.2", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "'", "subnet", "'_", ":_", "{_", "'", "host", "\\u", "route", "s", "'_", ":_", "more", "\\u", "host", "\\u", "routes_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "self_", "._", "new", "\\u", "update", "\\u", "request_", "(_", "'", "subnet", "s", "'_", ",_", "data_", ",_", "sub_", "[_", "'", "subnet", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "deserialize_", "(_", "self_", "._", "fmt_", ",_", "req_", "._", "get", "\\u", "response_", "(_", "self_", "._", "api_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "res_", "[_", "'", "subnet", "'_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "more", "\\u", "host", "\\u", "routes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "port_", "(_", "subnet_", "=_", "sub_", ",_", "device", "\\u", "owner_", "=_", "'", "network", ":", "dhcp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "'", "onet", "ena", "nt", "'_", ")_", "as_", "dhcp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dhcp_", "=_", "dhcp_", "[_", "'", "port", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "details_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "gbp", "\\u", "details_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device_", "=_", "'", "tap", "%", "s", "'_", "%_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "host_", "=_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "DNS", " ", "nameservers", " ", "are", " ", "correct", "ly", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dns", "\\u", "nameservers", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "Default", " ", "route", " ", "via", " ", "GW", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "0.", "0.", "0.", "0", "/", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "192", ".1", "68.", "0.", "1", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "Meta", "data", " ", "route", " ", "via", " ", "DHC", "P_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "169", ".2", "54.", "169", ".2", "5", "4", "/", "16", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "addition", "al", " ", "host", "\\u", "route", "s", " ", "are", " ", "als", "o", " ", "adde", "d", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GW", " ", "+", " ", "Meta", "data", " ", "+", " ", "1", " ", "addition", "al", " ", "route", " ", "=", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dhcp", "\\u", "server", "\\u", "ips", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "gateway", "\\u", "ip", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "gateway", "\\u", "ip", "'_", "in_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "{_", "'", "l2", "\\u", "policy", "'_", ":_", "{_", "'", "inject", "\\u", "default", "\\u", "route", "'_", ":_", "False_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "new", "\\u", "update", "\\u", "request_", "(_", "'", "l2", "\\u", "poli", "cies", "'_", ",_", "data_", ",_", "l2", "p_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fmt_", ")_", "._", "get", "\\u", "response_", "(_", "self_", "._", "ext", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt2_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "group", "\\u", "id_", "=_", "pt", "g_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "bind", "\\u", "port", "\\u", "to", "\\u", "host_", "(_", "pt2_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "port_", "(_", "subnet_", "=_", "sub_", ",_", "tenan", "t", "\\u", "id_", "=_", "'", "onet", "ena", "nt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "details_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "gbp", "\\u", "details_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device_", "=_", "'", "tap", "%", "s", "'_", "%_", "pt2_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "host_", "=_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "Default", " ", "route", " ", "via", " ", "GW", " ", "is", " ", "not", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "0.", "0.", "0.", "0", "/", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "192", ".1", "68.", "0.", "1", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "Meta", "data", " ", "route", " ", "via", " ", "DHC", "P", " ", "is", " ", "not", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "169", ".2", "54.", "169", ".2", "5", "4", "/", "16", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "only", " ", "extra", " ", "route", " ", "is", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "172", ".1", "6.0", ".0", "/", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "10.", "0.", "2.2", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dhcp", "\\u", "server", "\\u", "ips", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "gateway", "\\u", "ip", " ", "is", " ", "not", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "gateway", "\\u", "ip", "'_", "in_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Polic", "y", "Target_", "(_", "Ap", "ic", "Map", "ping", "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", "l2", "p", "\\u", "inject", "\\u", "default", "\\u", "route", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "enable", "\\u", "metadata", "\\u", "opt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l3", "p_", "=_", "self_", "._", "create", "\\u", "l3", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "pool_", "=_", "'", "192", ".1", "68.", "0.", "0", "/", "16", "'_", ")_", "[_", "'", "l3", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l2", "p_", "=_", "self_", "._", "create", "\\u", "l2", "\\u", "policy_", "(_", "name_", "=_", "'", "myl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "l3", "\\u", "policy", "\\u", "id_", "=_", "l3", "p_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inject", "\\u", "default", "\\u", "route_", "=_", "False_", ")_", "[_", "'", "l2", "\\u", "policy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt", "g_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target", "\\u", "group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "pt", "g1", "\"_", ",_", "l2", "\\u", "policy", "\\u", "id_", "=_", "l2", "p_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "\\u", "group", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt1_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "group", "\\u", "id_", "=_", "pt", "g_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "bind", "\\u", "port", "\\u", "to", "\\u", "host_", "(_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "self_", "._", "\\u", "get", "\\u", "object_", "(_", "'", "subnet", "s", "'_", ",_", "pt", "g_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "one", " ", "more", " ", "host", "\\u", "route", " ", "to", " ", "the", " ", "subnet_", "\\u\\u\\uNL\\u\\u\\u_", "more", "\\u", "host", "\\u", "routes_", "=_", "[_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "172", ".1", "6.0", ".0", "/", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "10.", "0.", "2.2", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "'", "subnet", "'_", ":_", "{_", "'", "host", "\\u", "route", "s", "'_", ":_", "more", "\\u", "host", "\\u", "routes_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "self_", "._", "new", "\\u", "update", "\\u", "request_", "(_", "'", "subnet", "s", "'_", ",_", "data_", ",_", "sub_", "[_", "'", "subnet", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "deserialize_", "(_", "self_", "._", "fmt_", ",_", "req_", "._", "get", "\\u", "response_", "(_", "self_", "._", "api_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "res_", "[_", "'", "subnet", "'_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "more", "\\u", "host", "\\u", "routes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "port_", "(_", "subnet_", "=_", "sub_", ",_", "device", "\\u", "owner_", "=_", "'", "network", ":", "dhcp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "'", "onet", "ena", "nt", "'_", ")_", "as_", "dhcp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dhcp_", "=_", "dhcp_", "[_", "'", "port", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "details_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "gbp", "\\u", "details_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device_", "=_", "'", "tap", "%", "s", "'_", "%_", "pt1_", "[_", "'", "port", "\\u", "id", "'_", "]_", ",_", "host_", "=_", "'", "h1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "DNS", " ", "nameservers", " ", "are", " ", "correct", "ly", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dns", "\\u", "nameservers", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "Default", " ", "route", " ", "via", " ", "GW", " ", "is", " ", "not", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "0.", "0.", "0.", "0", "/", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "192", ".1", "68.", "0.", "1", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "Meta", "data", " ", "route", " ", "via", " ", "DHC", "P", " ", "is", " ", "not", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "169", ".2", "54.", "169", ".2", "5", "4", "/", "16", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "only", " ", "extra", " ", "route", " ", "is", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "destinat", "ion", "'_", ":_", "'", "172", ".1", "6.0", ".0", "/", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nexthop", "'_", ":_", "'", "10.", "0.", "2.2", "'_", "}_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "host", "\\u", "route", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "dhcp_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "[_", "0_", "]_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "dhcp", "\\u", "server", "\\u", "ips", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "gateway", "\\u", "ip", " ", "is", " ", "not", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "gateway", "\\u", "ip", "'_", "in_", "details_", "[_", "'", "subnet", "s", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Polic", "y", "Rule_", "(_", "Ap", "ic", "Map", "ping", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "icmp", "\\u", "rule", "\\u", "created", "\\u", "on", "\\u", "apic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr_", "=_", "self_", "._", "\\u", "create", "\\u", "simple", "\\u", "policy", "\\u", "rule_", "(_", "'", "in", "'_", ",_", "'", "icmp", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tenant_", "=_", "pr_", "[_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "=_", "self_", "._", "driver_", "._", "apic", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "calls_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "pr_", "[_", "'", "id", "'_", "]_", ",_", "owner_", "=_", "tenant_", ",_", "entry_", "=_", "'", "os", "-", "entry", "-0", "'_", ",_", "ether", "T_", "=_", "'", "ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prot_", "=_", "'", "icmp", "'_", ",_", "transaction_", "=_", "mock_", "._", "ANY_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "ama", "p_", "._", "REVERSE", "\\u", "PREFIX_", "+_", "pr_", "[_", "'", "id", "'_", "]_", ",_", "owner_", "=_", "tenant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "=_", "mock_", "._", "ANY_", ",_", "ether", "T_", "=_", "'", "ip", "'_", ",_", "icmp", "v", "4", "T_", "=_", "'", "echo", "-", "rep", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prot_", "=_", "'", "icmp", "'_", ",_", "transaction_", "=_", "mock_", "._", "ANY_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "ama", "p_", "._", "REVERSE", "\\u", "PREFIX_", "+_", "pr_", "[_", "'", "id", "'_", "]_", ",_", "owner_", "=_", "tenant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "=_", "mock_", "._", "ANY_", ",_", "ether", "T_", "=_", "'", "ip", "'_", ",_", "icmp", "v", "4", "T_", "=_", "'", "dst", "-", "unre", "ach", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prot_", "=_", "'", "icmp", "'_", ",_", "transaction_", "=_", "mock_", "._", "ANY_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "ama", "p_", "._", "REVERSE", "\\u", "PREFIX_", "+_", "pr_", "[_", "'", "id", "'_", "]_", ",_", "owner_", "=_", "tenant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "=_", "mock_", "._", "ANY_", ",_", "ether", "T_", "=_", "'", "ip", "'_", ",_", "icmp", "v", "4", "T_", "=_", "'", "src", "-", "quenc", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prot_", "=_", "'", "icmp", "'_", ",_", "transaction_", "=_", "mock_", "._", "ANY_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "ama", "p_", "._", "REVERSE", "\\u", "PREFIX_", "+_", "pr_", "[_", "'", "id", "'_", "]_", ",_", "owner_", "=_", "tenant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "=_", "mock_", "._", "ANY_", ",_", "ether", "T_", "=_", "'", "ip", "'_", ",_", "icmp", "v", "4", "T_", "=_", "'", "time", "-", "exceed", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prot_", "=_", "'", "icmp", "'_", ",_", "transaction_", "=_", "mock_", "._", "ANY_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "tha", "t", " ", "entry", " ", "is", " ", "alw", "ay", "s", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "found_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "call_", "in_", "mgr_", "._", "create", "\\u", "tenan", "t", "\\u", "filter_", "._", "call", "\\u", "args", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "for", " ", "reverse", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "call_", "[_", "0_", "]_", "[_", "0_", "]_", "._", "startswith_", "(_", "ama", "p_", "._", "REVERSE", "\\u", "PREFIX_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "call_", "[_", "1_", "]_", "[_", "'", "entry", "'_", "]_", "in_", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "._", "add_", "(_", "call_", "[_", "1_", "]_", "[_", "'", "entry", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "call", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "calls_", ",_", "mgr_", "._", "create", "\\u", "tenan", "t", "\\u", "filter_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Nat", "Pool_", "(_", "Ap", "ic", "Map", "ping", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "create", "\\u", "fip_", "(_", "self_", ",_", "shared_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "dict_", "(_", "[_", "(_", "'", "support", "ed", "'_", ",_", "'", "192", ".1", "68.", "0.", "2", "/", "24", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "self_", "._", "create", "\\u", "external", "\\u", "segment_", "(_", "name_", "=_", "'", "support", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "res", "\\u", "status_", "=_", "webob_", "._", "exc_", "._", "HTTP", "Created_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared_", "=_", "shared_", ")_", "[_", "'", "external", "\\u", "segment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "nat", "\\u", "pool_", "(_", "external", "\\u", "segment", "\\u", "id_", "=_", "es_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "version_", "=_", "4_", ",_", "ip", "\\u", "pool_", "=_", "'", "192", ".1", "68.", "1.0", "/", "24", "'_", ",_", "shared_", "=_", "shared_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "res", "\\u", "status_", "=_", "webob_", "._", "exc_", "._", "HTTP", "Created_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subnet_", "=_", "self_", "._", "\\u", "get", "\\u", "object_", "(_", "'", "subnet", "s", "'_", ",_", "es_", "[_", "'", "subnet", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", ")_", "[_", "'", "subnet", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fi", "p", "\\u", "dict_", "=_", "{_", "'", "float", "ing", "\\u", "network", "\\u", "id", "'_", ":_", "subnet_", "[_", "'", "network", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fi", "p", "\\u", "id_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "floatingip", "\\u", "in", "\\u", "nat", "\\u", "pool_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "es_", "[_", "'", "tenan", "t", "\\u", "id", "'_", "]_", ",_", "{_", "'", "floatingip", "'_", ":_", "fi", "p", "\\u", "dict_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "fi", "p", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fip_", "=_", "self_", "._", "\\u", "get", "\\u", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "floatingip", "s", "'_", ",_", "fi", "p", "\\u", "id_", ",_", "self_", "._", "ext", "\\u", "api_", ")_", "[_", "'", "floatingip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "netaddr_", "._", "IPA", "ddress", "_", "(_", "fip_", "[_", "'", "float", "ing", "\\u", "ip", "\\u", "address", "'_", "]_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "netaddr_", "._", "IP", "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"content": "@csrf_exempt\ndef user_system_quicksearch_ajax(request):\n \"\"\"Returns systems sort table\"\"\"\n search = request.POST['quicksearch']\n filters = [\n Q(**{\"%s__icontains\" % t: search})\n for t in models.UnmanagedSystem.search_fields\n ]\n\n systems = models.UnmanagedSystem.objects.filter(\n reduce(operator.or_, filters)\n )\n\n # For some reason systems are referencing server model classes that do not\n # exist. I have no idea how this happened but it did. If accessing the\n # server model causes and error set the server_model to None so we don't\n # get an exception later during page loads.\n # TOOD: Clean up defunt server model references\n for s in systems:\n try:\n s.server_model\n except:\n s.server_model = None\n\n return render_to_response(\n 'user_systems/quicksearch.html',\n {'systems': systems, 'BUG_URL': BUG_URL},\n RequestContext(request)\n )", "metadata": "root.user_system_quicksearch_ajax", "header": "['module', '___EOS___']", "index": 166 }, { "content": "def get_changed_by(request):\n try:\n remote_user = request.META['REMOTE_USER']\n except:\n remote_user = None\n\n return remote_user", "metadata": "root.get_changed_by", "header": "['module', '___EOS___']", "index": 329 }, { "content": "def user_system_csv(request):\n systems = models.UnmanagedSystem.objects.all().order_by('owner__name')\n try:\n ref_split = request.META['HTTP_REFERER'].split('/')\n type, id = ref_split[-3:-1]\n if type == 'model':\n systems = systems.filter(server_model__id=id)\n except:\n pass\n\n\n response = HttpResponse(mimetype='text/csv')\n response['Content-Disposition'] = 'attachment; filename=user_systems.csv'\n\n writer = csv.writer(response)\n writer.writerow(['Owner', 'Location', 'Serial', 'Asset Tag',\n 'Operating System', 'Model', 'Date Purchased', 'Cost'])\n\n for s in systems:\n try:\n location = s.owner.user_location\n except AttributeError:\n location = ''\n writer.writerow([s.owner, location, s.serial, s.asset_tag,\n s.operating_system, s.server_model, s.date_purchased, s.cost])\n\n return response", "metadata": "root.user_system_csv", "header": "['module', '___EOS___']", "index": 498 } ]
[ { "span": "except:", "start_line": 187, "start_column": 8, "end_line": 187, "end_column": 15 }, { "span": "except:", "start_line": 332, "start_column": 4, "end_line": 332, "end_column": 11 }, { "span": "except:", "start_line": 505, "start_column": 4, "end_line": 505, "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_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "quicks", "ear", "ch", "\\u", "ajax_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "system", "s", " ", "sort", " ", "table", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search_", "=_", "request_", "._", "POST_", "[_", "'", "quicks", "ear", "ch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Q_", "(_", "**_", "{_", "\"%", "s", "\\u\\u", "icon", "tain", "s", "\"_", "%_", "t_", ":_", "search_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "models_", "._", "Unma", "nage", "d", "System_", "._", "search", "\\u", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "systems_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "operator_", "._", "or\\u_", ",_", "filters_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "some", " ", "reason", " ", "system", "s", " ", "are", " ", "referenci", "ng", " ", "server", " ", "model", " ", "classe", "s", " ", "tha", "t", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", ".", " ", "I", " ", "have", " ", "no", " ", "idea", " ", "how", " ", "this", " ", "happ", "ened", " ", "but", " ", "it", " ", "did", ".", " ", "If", " ", "accessi", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", " ", "model", " ", "caus", "es", " ", "and", " ", "error", " ", "set", " ", "the", " ", "server", "\\u", "model", " ", "to", " ", "Non", "e", " ", "so", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "an", " ", "exception", " ", "late", "r", " ", "dur", "ing", " ", "page", " ", "load", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOO", "D", ":", " ", "Clean", " ", "up", " ", "defu", "nt", " ", "server", " ", "model", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "systems_", ":_", "\\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 ", " _", "s_", "._", "server", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "server", "\\u", "model_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "s", "/", "quicks", "ear", "ch", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "system", "s", "'_", ":_", "systems_", ",_", "'", "BUG", "\\u", "URL", "'_", ":_", "BUG", "\\u", "URL_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "user_", "=_", "request_", "._", "META_", "[_", "'", "REMO", "TE", "\\u", "USER", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "remote", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "csv_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "owner", "\\u\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "split_", "=_", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", ",_", "id_", "=_", "ref", "\\u", "split_", "[_", "-_", "3_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "'", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "systems_", "._", "filter_", "(_", "server", "\\u", "model", "\\u\\u", "id_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "mimetype_", "=_", "'", "text", "/", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=", "user", "\\u", "system", "s", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "=_", "csv_", "._", "writer_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "'", "Owne", "r", "'_", ",_", "'", "Locat", "ion", "'_", ",_", "'", "Ser", "ial", "'_", ",_", "'", "Asset", " ", "Ta", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", "'_", ",_", "'", "Model", "'_", ",_", "'", "Date", " ", "Pur", "chase", "d", "'_", ",_", "'", "Cost", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "systems_", ":_", "\\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 ", " _", "location_", "=_", "s_", "._", "owner_", "._", "user", "\\u", "location_", "\\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 ", " _", "location_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "s_", "._", "owner_", ",_", "location_", ",_", "s_", "._", "serial_", ",_", "s_", "._", "asset", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "operati", "ng", "\\u", "system_", ",_", "s_", "._", "server", "\\u", "model_", ",_", "s_", "._", "date", "\\u", "purchase", "d_", ",_", "s_", "._", "cost_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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extras.widgets import SelectDateWidget\nfrom django.db import connection\nfrom django.core.urlresolvers import reverse\nfrom django.db.models import Q\nfrom django.utils import simplejson as json\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom django.core.mail import send_mail\n\nimport forms\nimport models\nfrom systems import models as system_models\nfrom datetime import datetime, timedelta\nfrom libs import ldap_lib\nimport settings\nfrom settings.local import USER_SYSTEM_ALLOWED_DELETE, FROM_EMAIL_ADDRESS, UNAUTHORIZED_EMAIL_ADDRESS\nfrom settings import BUG_URL as BUG_URL\nfrom django.core.exceptions import PermissionDenied\nfrom django.shortcuts import redirect, get_object_or_404, render\nfrom libs.jinja import render_to_response as render_to_response\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\nfrom MozInvAuthorization.UnmanagedSystemACL import UnmanagedSystemACL\n\n\n\n\n\n\n\n\n\n#def license_new(request):\n#\treturn render_to_response('user_systems/userlicense_new.html')\n\n \n\n\n \n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def license_version_search(request):\n query = request.GET.get('query')\n tmp = [str(m['version']) for m in models.UserLicense.objects.filter(version__icontains=query).values('version').distinct()]\n versions = list(set(tmp))\n ret_dict = {}\n ret_dict['query'] = query\n ret_dict['suggestions'] = versions\n ret_dict['data'] = versions\n return HttpResponse(json.dumps(ret_dict))", "metadata": "root.license_version_search", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def license_type_search(request):\n query = request.GET.get('query')\n types = [m['license_type'] for m in models.UserLicense.objects.filter(license_type__icontains=query).values('license_type').distinct()]\n ret_dict = {}\n ret_dict['query'] = query\n ret_dict['suggestions'] = types\n ret_dict['data'] = types\n return HttpResponse(json.dumps(ret_dict))", "metadata": "root.license_type_search", "header": "['module', '___EOS___']", "index": 37 }, { "content": "@csrf_exempt\ndef owners_quicksearch_ajax(request):\n \"\"\"Returns systems sort table\"\"\"\n search = request.POST['quicksearch']\n filters = [Q(**{\"%s__icontains\" % t: search})\n for t in models.Owner.search_fields]\n\n owners = models.Owner.objects.filter(\n reduce(operator.or_, filters))\n\n return render_to_response('user_systems/owners_quicksearch.html', {\n 'owners': owners,\n },\n RequestContext(request))", "metadata": "root.owners_quicksearch_ajax", "header": "['module', '___EOS___']", "index": 45 }, { "content": "@csrf_exempt\ndef license_edit(request, object_id):\n license = get_object_or_404(models.UserLicense, pk=object_id)\n if request.method == 'POST':\n form = forms.UserLicenseForm(request.POST, instance=license)\n if form.is_valid():\n form.save()\n return HttpResponseRedirect('/user_systems/licenses/')\n else:\n form = forms.UserLicenseForm(instance=license)\n\n return render_to_response('user_systems/userlicense_form.html', {\n 'form': form,\n },\n RequestContext(request))", "metadata": "root.license_edit", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def owner_list(request):\n owners = models.Owner.objects.select_related('user_location').all()\n upgradeable_users = models.Owner.objects.filter(unmanagedsystem__date_purchased__lt=datetime.now() - timedelta(days=730)).distinct().count()\n return render_to_response('user_systems/owner_list.html', {\n 'owner_list': owners,\n 'upgradeable_users':upgradeable_users,\n },\n RequestContext(request))", "metadata": "root.owner_list", "header": "['module', '___EOS___']", "index": 74 }, { "content": "def owner_show(request, object_id):\n owner = get_object_or_404(models.Owner, pk=object_id)\n\n return render_to_response('user_systems/owner_detail.html', {\n 'owner': owner,\n },\n RequestContext(request))", "metadata": "root.owner_show", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def owner_delete(request, object_id):\n owner = get_object_or_404(models.Owner, pk=object_id)\n if request.method == \"POST\":\n owner.delete()\n return HttpResponseRedirect('/user_systems/owners/')\n else:\n return render_to_response('user_systems/owner_confirm_delete.html', {\n 'owner': owner,\n },\n RequestContext(request))", "metadata": "root.owner_delete", "header": "['module', '___EOS___']", "index": 90 }, { "content": "@csrf_exempt\ndef owner_edit(request, object_id):\n owner = get_object_or_404(models.Owner, pk=object_id)\n initial = {}\n if request.method == 'POST':\n form = forms.OwnerForm(request.POST, instance=owner)\n if form.is_valid():\n form.save()\n return HttpResponseRedirect('/user_systems/owners/')\n else:\n form = forms.OwnerForm(instance=owner)\n\n return render_to_response('user_systems/owner_form.html', {\n 'form': form,\n },\n RequestContext(request))", "metadata": "root.owner_edit", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def owner_create(request):\n initial = {}\n if request.method == 'POST':\n form = forms.OwnerForm(request.POST, initial=initial)\n if form.is_valid():\n form.save()\n return HttpResponseRedirect('/user_systems/owners/')\n else:\n form = forms.OwnerForm(initial=initial)\n\n return render_to_response('user_systems/owner_form.html', {\n 'form': form,\n },\n RequestContext(request))", "metadata": "root.owner_create", "header": "['module', '___EOS___']", "index": 116 }, { "content": "def license_new(request):\n initial = {}\n if request.method == 'POST':\n form = forms.UserLicenseForm(request.POST, initial=initial)\n if form.is_valid():\n form.save()\n return HttpResponseRedirect('/user_systems/licenses/')\n else:\n form = forms.UserLicenseForm(initial=initial)\n\n return render_to_response('user_systems/userlicense_form.html', {\n 'form': form,\n },\n RequestContext(request))", "metadata": "root.license_new", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def license_quicksearch_ajax(request):\n \"\"\"Returns systems sort table\"\"\"\n # Try to get quicksearch from post\n # If fail, try to get from GET\n # return None otherwise\n search = request.GET.get('quicksearch', None)\n if search:\n filters = [Q(**{\"%s__icontains\" % t: search})\n for t in models.UserLicense.search_fields]\n\n licenses = models.UserLicense.objects.filter(\n reduce(operator.or_, filters))\n else:\n licenses = None\n return render_to_response('user_systems/license_quicksearch.html', {\n 'licenses': licenses,\n },\n RequestContext(request))", "metadata": "root.license_quicksearch_ajax", "header": "['module', '___EOS___']", "index": 146 }, { "content": "@csrf_exempt\ndef user_system_quicksearch_ajax(request):\n \"\"\"Returns systems sort table\"\"\"\n search = request.POST['quicksearch']\n filters = [\n Q(**{\"%s__icontains\" % t: search})\n for t in models.UnmanagedSystem.search_fields\n ]\n\n systems = models.UnmanagedSystem.objects.filter(\n reduce(operator.or_, filters)\n )\n\n # For some reason systems are referencing server model classes that do not\n # exist. I have no idea how this happened but it did. If accessing the\n # server model causes and error set the server_model to None so we don't\n # get an exception later during page loads.\n # TOOD: Clean up defunt server model references\n for s in systems:\n try:\n s.server_model\n except:\n s.server_model = None\n\n return render_to_response(\n 'user_systems/quicksearch.html',\n {'systems': systems, 'BUG_URL': BUG_URL},\n RequestContext(request)\n )", "metadata": "root.user_system_quicksearch_ajax", "header": "['module', '___EOS___']", "index": 166 }, { "content": "@csrf_exempt\ndef user_system_view(request, template, data, instance=None):\n if request.method == 'POST':\n post_data = request.POST.copy()\n\n owner, c = models.Owner.objects.get_or_create(\n name=request.POST['owner_name'])\n\n post_data['owner'] = owner.id\n\n try:\n os, c = models.OperatingSystem.objects.get_or_create(\n name=request.POST['js_os_name'],\n version=request.POST['js_os_version'])\n post_data['operating_system'] = os.id\n except KeyError:\n pass\n\n try:\n server_model, c = models.ServerModel.objects.get_or_create(\n vendor=request.POST['js_server_model_vendor'],\n model=request.POST['js_server_model_model'])\n post_data['server_model'] = server_model.id\n except KeyError:\n pass\n\n if instance:\n old_owner = instance.owner\n old_serial = instance.serial\n old_asset_tag = instance.asset_tag\n old_notes = instance.notes\n else:\n old_owner = None\n old_serial = None\n old_asset_tag = None\n old_notes = None\n\n form = forms.UserSystemForm(post_data, instance=instance)\n if form.is_valid():\n saved_instance = form.save()\n if not instance or old_notes != saved_instance.notes:\n if old_notes:\n models.History(\n change=\"Notes changed from %s\" % old_notes,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if saved_instance.notes:\n models.History(\n change=\"Notes changed to %s\" % saved_instance.notes,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n else:\n models.History(\n change=\"System has no Notes\",\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if not instance or old_asset_tag != saved_instance.asset_tag:\n if old_asset_tag:\n models.History(\n change=\"Asset Tag changed from %s\" % old_asset_tag,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if saved_instance.asset_tag:\n models.History(\n change=\"Asset Tag changed to %s\" % saved_instance.asset_tag,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n else:\n models.History(\n change=\"System has no Asset Tag\",\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if not instance or old_serial != saved_instance.serial:\n if old_serial:\n models.History(\n change=\"Serial changed from %s\" % old_serial,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if saved_instance.serial:\n models.History(\n change=\"Serial changed to %s\" % saved_instance.serial,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n else:\n models.History(\n change=\"System has no serial\",\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if not instance or old_owner != saved_instance.owner:\n if old_owner:\n models.History(\n change=\"Owner changed from %s\" % old_owner,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n if saved_instance.owner:\n models.History(\n change=\"Owner changed to %s\" % saved_instance.owner,\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n else:\n models.History(\n change=\"System has no owner\",\n changed_by=get_changed_by(request),\n system=saved_instance).save()\n return redirect('user-system-list')\n else:\n form = forms.UserSystemForm(instance=instance)\n\n data['form'] = form\n if settings.USE_LDAP:\n the_owner_list = ldap_lib.get_all_names()\n else:\n the_owner_list = []\n the_owner_list.append(\"STOCK\")\n the_owner_list.append(\"STOCK-SFO\")\n the_owner_list.append(\"STOCK-MTV\")\n the_owner_list.append(\"STOCK-TOR\")\n the_owner_list.append(\"STOCK-LON\")\n the_owner_list.append(\"STOCK-PAR\")\n the_owner_list.append(\"STOCK-PDX\")\n the_owner_list.append(\"desktop-mtv1\")\n the_owner_list.append(\"desktop-sfo1\")\n the_owner_list.append(\"desktop-tor1\")\n the_owner_list.append(\"desktop-lon1\")\n the_owner_list.append(\"desktop-par1\")\n the_owner_list.append(\"desktop-yvr1\")\n the_owner_list.append(\"Release Engineering\")\n data['owner_json'] = json.dumps(the_owner_list)\n\n #data['owner_json'] = json.dumps(ldap_lib.get_all_names())\n #data['owner_json'].append(\"Stock\")\n\n return render_to_response(template, data, RequestContext(request))", "metadata": "root.user_system_view", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def get_changed_by(request):\n try:\n remote_user = request.META['REMOTE_USER']\n except:\n remote_user = None\n\n return remote_user", "metadata": "root.get_changed_by", "header": "['module', '___EOS___']", "index": 329 }, { "content": "def license_show(request, object_id):\n license = get_object_or_404(models.UserLicense, pk=object_id)\n\n return render_to_response('user_systems/userlicense_detail.html', {\n 'license': license,\n },RequestContext(request) )", "metadata": "root.license_show", "header": "['module', '___EOS___']", "index": 340 }, { "content": "def license_index(request):\n from settings import BUG_URL as BUG_URL\n system_list = models.UserLicense.objects.select_related('owner').all()\n paginator = Paginator(system_list, 25) \n \n if 'page' in request.GET:\n page = request.GET.get('page')\n else: \n page = 1\n \n try:\n systems = paginator.page(page)\n except PageNotAnInteger:\n # If page is not an integer, deliver first page.\n systems = paginator.page(1)\n except EmptyPage:\n # If page is out of range (e.g. 9999), deliver last page of results.\n systems = paginator.page(paginator.num_pages)\n\n return render_to_response('user_systems/userlicense_list.html', {\n 'license_list': systems,\n 'BUG_URL': BUG_URL\n },RequestContext(request) )", "metadata": "root.license_index", "header": "['module', '___EOS___']", "index": 346 }, { "content": "def user_system_index(request):\n from settings import BUG_URL as BUG_URL\n system_list = models.UnmanagedSystem.objects.select_related('owner', 'server_model', 'operating_system').order_by('owner__name')\n paginator = Paginator(system_list, 25) \n \n if 'page' in request.GET:\n page = request.GET.get('page')\n else: \n page = 1\n \n try:\n systems = paginator.page(page)\n except PageNotAnInteger:\n # If page is not an integer, deliver first page.\n systems = paginator.page(1)\n except EmptyPage:\n # If page is out of range (e.g. 9999), deliver last page of results.\n systems = paginator.page(paginator.num_pages)\n\n return render_to_response('user_systems/unmanagedsystem_list.html', {\n 'user_system_list': systems,\n 'BUG_URL': BUG_URL\n },RequestContext(request) )", "metadata": "root.user_system_index", "header": "['module', '___EOS___']", "index": 369 }, { "content": "def license_delete(request, object_id):\n license = get_object_or_404(models.UserLicense, pk=object_id)\n try:\n license.delete()\n return HttpResponseRedirect( reverse('license-list') )\n except PermissionDenied, e:\n return render_to_response('user_systems/unauthorized_delete.html', {\n 'content': 'You do not have permission to delete this license',\n },\n RequestContext(request))", "metadata": "root.license_delete", "header": "['module', '___EOS___']", "index": 394 }, { "content": "def unmanaged_system_delete(request, object_id):\n #Dummy comment\n user_system = get_object_or_404(models.UnmanagedSystem, pk=object_id)\n if request.method == 'POST':\n try:\n acl = UnmanagedSystemACL(request)\n acl.check_delete()\n user_system_notes = user_system.notes\n user_system.delete()\n send_mail('System Deleted', '%s Deleted by %s\\nSystem Notes:\\n%s' % (user_system, request.user.username, user_system_notes), FROM_EMAIL_ADDRESS, UNAUTHORIZED_EMAIL_ADDRESS, fail_silently=False)\n return HttpResponseRedirect( reverse('user-system-list') )\n except PermissionDenied, e:\n send_mail('Unauthorized System Delete Attempt', 'Unauthorized Attempt to Delete %s by %s' % (user_system, request.user.username), FROM_EMAIL_ADDRESS, UNAUTHORIZED_EMAIL_ADDRESS, fail_silently=False)\n return render_to_response('user_systems/unauthorized_delete.html', {\n 'content': 'You do not have permission to delete this system',\n },\n RequestContext(request))\n else:\n return render_to_response('user_systems/unmanagedsystem_confirm_delete.html', {\n 'owner': user_system,\n },\n RequestContext(request))", "metadata": "root.unmanaged_system_delete", "header": "['module', '___EOS___']", "index": 405 }, { "content": "def show_by_model(request, object_id):\n system_list = models.UnmanagedSystem.objects.filter(server_model=models.ServerModel.objects.get(id=object_id))\n if 'show_all' in request.GET:\n paginator = Paginator(system_list, system_list.count()) \n else:\n paginator = Paginator(system_list, 25) \n \n if 'page' in request.GET:\n page = request.GET.get('page')\n else: \n page = 1\n \n try:\n systems = paginator.page(page)\n except PageNotAnInteger:\n # If page is not an integer, deliver first page.\n systems = paginator.page(1)\n except EmptyPage:\n # If page is out of range (e.g. 9999), deliver last page of results.\n systems = paginator.page(paginator.num_pages)\n return render_to_response('user_systems/unmanagedsystem_list.html', {\n 'user_system_list': systems,\n 'show_all': True,\n },\n RequestContext(request))", "metadata": "root.show_by_model", "header": "['module', '___EOS___']", "index": 429 }, { "content": "def user_system_show(request, object_id):\n system = get_object_or_404(models.UnmanagedSystem, id=object_id)\n #system = models.UnmanagedSystem.objects.select_related(\n # 'owner', 'server_model', 'operating_system'\n # ).filter(asset_tag=id).order_by('owner__name')\n\n #system = get_object_or_404(models.UnmanagedSystem\n return render_to_response('user_systems/unmanagedsystem_detail.html', {\n 'user_system': system,\n 'settings': settings,\n },\n RequestContext(request))", "metadata": "root.user_system_show", "header": "['module', '___EOS___']", "index": 455 }, { "content": "def user_system_show_by_asset_tag(request, id):\n system = get_object_or_404(models.UnmanagedSystem, asset_tag=id)\n #system = models.UnmanagedSystem.objects.select_related(\n # 'owner', 'server_model', 'operating_system'\n # ).filter(asset_tag=id).order_by('owner__name')\n\n #system = get_object_or_404(models.UnmanagedSystem\n return render_to_response('user_systems/unmanagedsystem_detail.html', {\n 'user_system': system,\n },\n RequestContext(request))", "metadata": "root.user_system_show_by_asset_tag", "header": "['module', '___EOS___']", "index": 467 }, { "content": "def user_system_new(request):\n return user_system_view(\n request,\n 'user_systems/unmanagedsystem_create.html',\n {})", "metadata": "root.user_system_new", "header": "['module', '___EOS___']", "index": 480 }, { "content": "@csrf_exempt\ndef user_system_edit(request, id):\n system = get_object_or_404(models.UnmanagedSystem, pk=id)\n\n return user_system_view(\n request,\n 'user_systems/unmanagedsystem_modify.html', {\n 'system': system},\n system)", "metadata": "root.user_system_edit", "header": "['module', '___EOS___']", "index": 487 }, { "content": "def user_system_csv(request):\n systems = models.UnmanagedSystem.objects.all().order_by('owner__name')\n try:\n ref_split = request.META['HTTP_REFERER'].split('/')\n type, id = ref_split[-3:-1]\n if type == 'model':\n systems = systems.filter(server_model__id=id)\n except:\n pass\n\n\n response = HttpResponse(mimetype='text/csv')\n response['Content-Disposition'] = 'attachment; filename=user_systems.csv'\n\n writer = csv.writer(response)\n writer.writerow(['Owner', 'Location', 'Serial', 'Asset Tag',\n 'Operating System', 'Model', 'Date Purchased', 'Cost'])\n\n for s in systems:\n try:\n location = s.owner.user_location\n except AttributeError:\n location = ''\n writer.writerow([s.owner, location, s.serial, s.asset_tag,\n s.operating_system, s.server_model, s.date_purchased, s.cost])\n\n return response", "metadata": "root.user_system_csv", "header": "['module', '___EOS___']", "index": 498 }, { "content": "def fillin_csv(request):\n \"\"\"Important columns:\n 4: serial number\n 6: employee\n 7: location\n \"\"\"\n\n if request.method == 'POST':\n f = forms.CSVForm(request.POST, request.FILES)\n if f.is_valid():\n response = HttpResponse(mimetype='text/csv')\n response['Content-Disposition'] = 'attachment; filename=ComputerEquipment.csv'\n in_csv = csv.reader(f.cleaned_data['csv'].read().splitlines())\n out_csv = csv.writer(response)\n for row in in_csv:\n if row[4]:\n serials = [i.strip() for i in row[4].split(';')]\n owners = [\n str(i.owner)\n for i in models.UnmanagedSystem.objects.filter(\n serial__in=serials).filter(owner__isnull=False)]\n locations = [\n str(i.system_rack.location)\n for i in system_models.System.objects.filter(\n serial__in=serials).filter(system_rack__location__isnull=False)]\n\n locations += [\n str(i.owner.user_location)\n for i in models.UnmanagedSystem.objects.filter(\n serial__in=serials).filter(owner__user_location__isnull=False)]\n\n if owners:\n row[6] = \"; \".join(owners)\n if locations:\n row[7] = \"; \".join(locations)\n\n out_csv.writerow(row)\n return response\n else:\n f = forms.CSVForm()\n\n return render_to_response(\n 'user_systems/fillin_csv.html',\n {'form': f},\n RequestContext(request))", "metadata": "root.fillin_csv", "header": "['module', '___EOS___']", "index": 527 } ]
[ { "span": "from django.forms.extras.widgets import SelectDateWidget", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 56 }, { "span": "from django.db import connection", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 32 }, { "span": "from settings.local import USER_SYSTEM_ALLOWED_DELETE, FROM_EMAIL_ADDRESS, UNAUTHORIZED_EMAIL_ADDRESS", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 101 }, { "span": "from django.shortcuts import redirect, get_object_or_404, render", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "extras_", "._", "widgets_", "import_", "Select", "Date", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "mail_", "import_", "send", "\\u", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "systems_", "import_", "models_", "as_", "system", "\\u", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libs_", "import_", "ldap", "\\u", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "._", "local_", "import_", "USER", "\\u", "SYSTEM", "\\u", "ALLOWED", "\\u", "DELETE_", ",_", "FROM", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ",_", "UNA", "UTH", "ORI", "ZED", "\\u", "EMA", "IL", "\\u", "ADDRESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "BUG", "\\u", "URL_", "as_", "BUG", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "redirect_", ",_", "get", "\\u", "object\\u", "or", "\\u", "404_", ",_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libs_", "._", "jin", "ja_", "import_", "render", "\\u", "to", "\\u", "response_", "as_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "csrf_", "import_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "paginator_", "import_", "Paginator_", ",_", "Emp", "ty", "Page_", ",_", "Page", "Not", "An", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Mo", "z", "Inv", "Authorization_", "._", "Unma", "nage", "d", "System", "ACL", "_", "import_", "Unma", "nage", "d", "System", "ACL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "def", " ", "license", "\\u", "new", "(", "request", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "user", "\\u", "system", "s", "/", "userl", "ice", "nse", "\\u", "new", ".", "html", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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_", "license", "\\u", "version", "\\u", "search_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "[_", "str_", "(_", "m_", "[_", "'", "version", "'_", "]_", ")_", "for_", "m_", "in_", "models_", "._", "User", "License", "_", "._", "objects_", "._", "filter_", "(_", "version", "\\u\\u", "icontains_", "=_", "query_", ")_", "._", "values_", "(_", "'", "version", "'_", ")_", "._", "distinct_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "list_", "(_", "set_", "(_", "tmp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "query", "'_", "]_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "suggestions", "'_", "]_", "=_", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "data", "'_", "]_", "=_", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "ret", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "type", "\\u", "search_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "=_", "[_", "m_", "[_", "'", "license", "\\u", "type", "'_", "]_", "for_", "m_", "in_", "models_", "._", "User", "License", "_", "._", "objects_", "._", "filter_", "(_", "license", "\\u", "type\\u\\u", "icontains_", "=_", "query_", ")_", "._", "values_", "(_", "'", "license", "\\u", "type", "'_", ")_", "._", "distinct_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "query", "'_", "]_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "suggestions", "'_", "]_", "=_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "\\u", "dict_", "[_", "'", "data", "'_", "]_", "=_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "ret", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "owner", "s", "\\u", "quicks", "ear", "ch", "\\u", "ajax_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "system", "s", " ", "sort", " ", "table", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search_", "=_", "request_", "._", "POST_", "[_", "'", "quicks", "ear", "ch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "Q_", "(_", "**_", "{_", "\"%", "s", "\\u\\u", "icon", "tain", "s", "\"_", "%_", "t_", ":_", "search_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "models_", "._", "Owner_", "._", "search", "\\u", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "owners_", "=_", "models_", "._", "Owner_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "operator_", "._", "or\\u_", ",_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "s", "\\u", "quicks", "ear", "ch", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "s", "'_", ":_", "owners_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "license", "\\u", "edit_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "license_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "User", "License", "_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "User", "License", "Form_", "(_", "request_", "._", "POST_", ",_", "instance_", "=_", "license_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "user", "\\u", "system", "s", "/", "license", "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 ", " _", "form_", "=_", "forms_", "._", "User", "License", "Form_", "(_", "instance_", "=_", "license_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "userl", "ice", "nse", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "owner", "\\u", "list_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owners_", "=_", "models_", "._", "Owner_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "user", "\\u", "location", "'_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "able", "\\u", "users_", "=_", "models_", "._", "Owner_", "._", "objects_", "._", "filter_", "(_", "unma", "nage", "ds", "yste", "m", "\\u\\u", "date", "\\u", "purchase", "d\\u", "\\u", "lt_", "=_", "datetime_", "._", "now_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "730", "_", ")_", ")_", "._", "distinct_", "(_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "\\u", "list", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "list", "'_", ":_", "owners_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upgrade", "able", "\\u", "users", "'_", ":_", "upgrade", "able", "\\u", "users_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "owner", "\\u", "show_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Owner_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "owner", "\\u", "delete_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Owner_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "user", "\\u", "system", "s", "/", "owner", "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_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "owner", "\\u", "edit_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Owner_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "Owne", "r", "Form_", "(_", "request_", "._", "POST_", ",_", "instance_", "=_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "user", "\\u", "system", "s", "/", "owner", "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 ", " _", "form_", "=_", "forms_", "._", "Owne", "r", "Form_", "(_", "instance_", "=_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "owner", "\\u", "create_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "Owne", "r", "Form_", "(_", "request_", "._", "POST_", ",_", "initial_", "=_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "user", "\\u", "system", "s", "/", "owner", "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 ", " _", "form_", "=_", "forms_", "._", "Owne", "r", "Form_", "(_", "initial_", "=_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "owner", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "new_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "User", "License", "Form_", "(_", "request_", "._", "POST_", ",_", "initial_", "=_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "user", "\\u", "system", "s", "/", "license", "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 ", " _", "form_", "=_", "forms_", "._", "User", "License", "Form_", "(_", "initial_", "=_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "userl", "ice", "nse", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "quicks", "ear", "ch", "\\u", "ajax_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "system", "s", " ", "sort", " ", "table", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "get", " ", "quicks", "ear", "ch", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fail", ",", " ", "try", " ", "to", " ", "get", " ", "from", " ", "GET_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Non", "e", " ", "other", "wise_", "\\u\\u\\uNL\\u\\u\\u_", "search_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "quicks", "ear", "ch", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "[_", "Q_", "(_", "**_", "{_", "\"%", "s", "\\u\\u", "icon", "tain", "s", "\"_", "%_", "t_", ":_", "search_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "models_", "._", "User", "License", "_", "._", "search", "\\u", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "license", "s_", "=_", "models_", "._", "User", "License", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "operator_", "._", "or\\u_", ",_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "license", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "license", "\\u", "quicks", "ear", "ch", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "s", "'_", ":_", "license", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "quicks", "ear", "ch", "\\u", "ajax_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "system", "s", " ", "sort", " ", "table", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search_", "=_", "request_", "._", "POST_", "[_", "'", "quicks", "ear", "ch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Q_", "(_", "**_", "{_", "\"%", "s", "\\u\\u", "icon", "tain", "s", "\"_", "%_", "t_", ":_", "search_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "models_", "._", "Unma", "nage", "d", "System_", "._", "search", "\\u", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "systems_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "operator_", "._", "or\\u_", ",_", "filters_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "some", " ", "reason", " ", "system", "s", " ", "are", " ", "referenci", "ng", " ", "server", " ", "model", " ", "classe", "s", " ", "tha", "t", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", ".", " ", "I", " ", "have", " ", "no", " ", "idea", " ", "how", " ", "this", " ", "happ", "ened", " ", "but", " ", "it", " ", "did", ".", " ", "If", " ", "accessi", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", " ", "model", " ", "caus", "es", " ", "and", " ", "error", " ", "set", " ", "the", " ", "server", "\\u", "model", " ", "to", " ", "Non", "e", " ", "so", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "an", " ", "exception", " ", "late", "r", " ", "dur", "ing", " ", "page", " ", "load", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOO", "D", ":", " ", "Clean", " ", "up", " ", "defu", "nt", " ", "server", " ", "model", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "systems_", ":_", "\\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 ", " _", "s_", "._", "server", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "server", "\\u", "model_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "s", "/", "quicks", "ear", "ch", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "system", "s", "'_", ":_", "systems_", ",_", "'", "BUG", "\\u", "URL", "'_", ":_", "BUG", "\\u", "URL_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "view_", "(_", "request_", ",_", "template_", ",_", "data_", ",_", "instance_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "data_", "=_", "request_", "._", "POST_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", ",_", "c_", "=_", "models_", "._", "Owner_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "request_", "._", "POST_", "[_", "'", "owner", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "owner", "'_", "]_", "=_", "owner_", "._", "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 ", " _", "os_", ",_", "c_", "=_", "models_", "._", "Opera", "ting", "System_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "request_", "._", "POST_", "[_", "'", "js", "\\u", "os", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "request_", "._", "POST_", "[_", "'", "js", "\\u", "os", "\\u", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "operati", "ng", "\\u", "system", "'_", "]_", "=_", "os_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "model_", ",_", "c_", "=_", "models_", "._", "Server", "Model_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vendor_", "=_", "request_", "._", "POST_", "[_", "'", "js", "\\u", "server", "\\u", "model", "\\u", "vendor", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "request_", "._", "POST_", "[_", "'", "js", "\\u", "server", "\\u", "model", "\\u", "model", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "server", "\\u", "model", "'_", "]_", "=_", "server", "\\u", "model_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "owner_", "=_", "instance_", "._", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "serial_", "=_", "instance_", "._", "serial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "asset", "\\u", "tag_", "=_", "instance_", "._", "asset", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "notes_", "=_", "instance_", "._", "notes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "owner_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "serial_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "asset", "\\u", "tag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "notes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "forms_", "._", "User", "System", "Form_", "(_", "post", "\\u", "data_", ",_", "instance_", "=_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "instance_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "instance_", "or_", "old", "\\u", "notes_", "!=_", "saved", "\\u", "instance_", "._", "notes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "notes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Not", "es", " ", "change", "d", " ", "from", " ", "%", "s", "\"_", "%_", "old", "\\u", "notes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "saved", "\\u", "instance_", "._", "notes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Not", "es", " ", "change", "d", " ", "to", " ", "%", "s", "\"_", "%_", "saved", "\\u", "instance_", "._", "notes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "System", " ", "has", " ", "no", " ", "Not", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instance_", "or_", "old", "\\u", "asset", "\\u", "tag_", "!=_", "saved", "\\u", "instance_", "._", "asset", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "asset", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Asset", " ", "Ta", "g", " ", "change", "d", " ", "from", " ", "%", "s", "\"_", "%_", "old", "\\u", "asset", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "saved", "\\u", "instance_", "._", "asset", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Asset", " ", "Ta", "g", " ", "change", "d", " ", "to", " ", "%", "s", "\"_", "%_", "saved", "\\u", "instance_", "._", "asset", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "System", " ", "has", " ", "no", " ", "Asset", " ", "Ta", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instance_", "or_", "old", "\\u", "serial_", "!=_", "saved", "\\u", "instance_", "._", "serial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "serial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Ser", "ial", " ", "change", "d", " ", "from", " ", "%", "s", "\"_", "%_", "old", "\\u", "serial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "saved", "\\u", "instance_", "._", "serial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Ser", "ial", " ", "change", "d", " ", "to", " ", "%", "s", "\"_", "%_", "saved", "\\u", "instance_", "._", "serial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "System", " ", "has", " ", "no", " ", "serial", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instance_", "or_", "old", "\\u", "owner_", "!=_", "saved", "\\u", "instance_", "._", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Owne", "r", " ", "change", "d", " ", "from", " ", "%", "s", "\"_", "%_", "old", "\\u", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "saved", "\\u", "instance_", "._", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "Owne", "r", " ", "change", "d", " ", "to", " ", "%", "s", "\"_", "%_", "saved", "\\u", "instance_", "._", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "models_", "._", "History_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "=_", "\"", "System", " ", "has", " ", "no", " ", "owner", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "by_", "=_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "saved", "\\u", "instance_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "redirect_", "(_", "'", "user", "-", "system", "-", "list", "'_", ")_", "\\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_", "=_", "forms_", "._", "User", "System", "Form_", "(_", "instance_", "=_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "'", "form", "'_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "USE", "\\u", "LDA", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "\\u", "owner", "\\u", "list_", "=_", "ldap", "\\u", "lib_", "._", "get", "\\u", "all", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "\\u", "owner", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "SF", "O", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "MT", "V", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "TOR", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "LON", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "PAR", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "STO", "CK", "-", "PD", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "mt", "v1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "sfo", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "tor", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "lon", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "par", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "desk", "top", "-", "yv", "r1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "owner", "\\u", "list_", "._", "append_", "(_", "\"", "Release", " ", "Engine", "erin", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "owner", "\\u", "json", "'_", "]_", "=_", "json_", "._", "dumps_", "(_", "the", "\\u", "owner", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", "['", "owner", "\\u", "json", "']", " ", "=", " ", "json", ".", "dump", "s", "(", "ldap", "\\u", "lib", ".", "get", "\\u", "all", "\\u", "names", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", "['", "owner", "\\u", "json", "']", ".", "append", "(\"", "Stock", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "template_", ",_", "data_", ",_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "change", "d\\u", "by_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "user_", "=_", "request_", "._", "META_", "[_", "'", "REMO", "TE", "\\u", "USER", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "remote", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "show_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "license_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "User", "License", "_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "userl", "ice", "nse", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "'_", ":_", "license_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "index_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "settings_", "import_", "BUG", "\\u", "URL_", "as_", "BUG", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "list_", "=_", "models_", "._", "User", "License", "_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "owner", "'_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginator_", "=_", "Paginator_", "(_", "system", "\\u", "list_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "page", "'_", "in_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Page", "Not", "An", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "not", " ", "an", " ", "integ", "er", ",", " ", "deliver", " ", "first", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "out", " ", "of", " ", "range", " ", "(", "e", ".", "g", ".", " ", "9999", "),", " ", "deliver", " ", "last", " ", "page", " ", "of", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "userl", "ice", "nse", "\\u", "list", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "\\u", "list", "'_", ":_", "systems_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BUG", "\\u", "URL", "'_", ":_", "BUG", "\\u", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "index_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "settings_", "import_", "BUG", "\\u", "URL_", "as_", "BUG", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "list_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "owner", "'_", ",_", "'", "server", "\\u", "model", "'_", ",_", "'", "operati", "ng", "\\u", "system", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'", "owner", "\\u\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginator_", "=_", "Paginator_", "(_", "system", "\\u", "list_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "page", "'_", "in_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Page", "Not", "An", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "not", " ", "an", " ", "integ", "er", ",", " ", "deliver", " ", "first", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "out", " ", "of", " ", "range", " ", "(", "e", ".", "g", ".", " ", "9999", "),", " ", "deliver", " ", "last", " ", "page", " ", "of", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "list", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "\\u", "list", "'_", ":_", "systems_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BUG", "\\u", "URL", "'_", ":_", "BUG", "\\u", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "license", "\\u", "delete_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "license_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "User", "License", "_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "license_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "'", "license", "-", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Permi", "ssion", "Denied_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unauthorized", "\\u", "delete", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "'", "You", " ", "do", " ", "not", " ", "have", " ", "permissi", "on", " ", "to", " ", "delete", " ", "this", " ", "license", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unma", "nage", "d\\u", "system", "\\u", "delete_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Du", "mm", "y", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Unma", "nage", "d", "System_", ",_", "pk_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "Unma", "nage", "d", "System", "ACL", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "._", "check", "\\u", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "system", "\\u", "notes_", "=_", "user", "\\u", "system_", "._", "notes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "system_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "mail_", "(_", "'", "System", " ", "Delete", "d", "'_", ",_", "'%", "s", " ", "Delete", "d", " ", "by", " ", "%", "s", "\\\\", "n", "System", " ", "Not", "es", ":\\\\", "n", "%", "s", "'_", "%_", "(_", "user", "\\u", "system_", ",_", "request_", "._", "user_", "._", "username_", ",_", "user", "\\u", "system", "\\u", "notes_", ")_", ",_", "FROM", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ",_", "UNA", "UTH", "ORI", "ZED", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ",_", "fail", "\\u", "silently", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "'", "user", "-", "system", "-", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Permi", "ssion", "Denied_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "send", "\\u", "mail_", "(_", "'", "Una", "uthor", "ize", "d", " ", "System", " ", "Delete", " ", "Atte", "mpt", "'_", ",_", "'", "Una", "uthor", "ize", "d", " ", "Atte", "mpt", " ", "to", " ", "Delete", " ", "%", "s", " ", "by", " ", "%", "s", "'_", "%_", "(_", "user", "\\u", "system_", ",_", "request_", "._", "user_", "._", "username_", ")_", ",_", "FROM", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ",_", "UNA", "UTH", "ORI", "ZED", "\\u", "EMA", "IL", "\\u", "ADDRESS_", ",_", "fail", "\\u", "silently", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unauthorized", "\\u", "delete", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "'", "You", " ", "do", " ", "not", " ", "have", " ", "permissi", "on", " ", "to", " ", "delete", " ", "this", " ", "system", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\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_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "user", "\\u", "system_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "by", "\\u", "model_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system", "\\u", "list_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "filter_", "(_", "server", "\\u", "model_", "=_", "models_", "._", "Server", "Model_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "object\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "show", "\\u", "all", "'_", "in_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paginator_", "=_", "Paginator_", "(_", "system", "\\u", "list_", ",_", "system", "\\u", "list_", "._", "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 ", " _", "paginator_", "=_", "Paginator_", "(_", "system", "\\u", "list_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "page", "'_", "in_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Page", "Not", "An", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "not", " ", "an", " ", "integ", "er", ",", " ", "deliver", " ", "first", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "out", " ", "of", " ", "range", " ", "(", "e", ".", "g", ".", " ", "9999", "),", " ", "deliver", " ", "last", " ", "page", " ", "of", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "paginator_", "._", "page_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "list", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "\\u", "list", "'_", ":_", "systems_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "all", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "show_", "(_", "request_", ",_", "object\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Unma", "nage", "d", "System_", ",_", "id_", "=_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "system", " ", "=", " ", "model", "s", ".", "Unma", "nage", "d", "System", ".", "object", "s", ".", "select", "\\u", "relate", "d", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "owner", "',", " ", "'", "server", "\\u", "model", "',", " ", "'", "operati", "ng", "\\u", "system", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", ").", "filter", "(", "asset", "\\u", "tag", "=", "id", ").", "order", "\\u", "by", "('", "owner", "\\u\\u", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "system", " ", "=", " ", "get", "\\u", "object\\u", "or", "\\u", "404", "(", "model", "s", ".", "Unma", "nage", "d", "System_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "'_", ":_", "system_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "settings", "'_", ":_", "settings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "show", "\\u", "by", "\\u", "asset", "\\u", "tag_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Unma", "nage", "d", "System_", ",_", "asset", "\\u", "tag_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "system", " ", "=", " ", "model", "s", ".", "Unma", "nage", "d", "System", ".", "object", "s", ".", "select", "\\u", "relate", "d", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "owner", "',", " ", "'", "server", "\\u", "model", "',", " ", "'", "operati", "ng", "\\u", "system", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", ").", "filter", "(", "asset", "\\u", "tag", "=", "id", ").", "order", "\\u", "by", "('", "owner", "\\u\\u", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "system", " ", "=", " ", "get", "\\u", "object\\u", "or", "\\u", "404", "(", "model", "s", ".", "Unma", "nage", "d", "System_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "'_", ":_", "system_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "new_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "user", "\\u", "system", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "create", ".", "html", "'_", ",_", "\\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_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "edit_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "models_", "._", "Unma", "nage", "d", "System_", ",_", "pk_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "user", "\\u", "system", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "system", "s", "/", "unma", "nage", "ds", "yste", "m", "\\u", "modif", "y", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "system", "'_", ":_", "system_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "system", "\\u", "csv_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "owner", "\\u\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "split_", "=_", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", ",_", "id_", "=_", "ref", "\\u", "split_", "[_", "-_", "3_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "'", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "systems_", "=_", "systems_", "._", "filter_", "(_", "server", "\\u", "model", "\\u\\u", "id_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "mimetype_", "=_", "'", "text", "/", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=", "user", "\\u", "system", "s", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "=_", "csv_", "._", "writer_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "'", "Owne", "r", "'_", ",_", "'", "Locat", "ion", "'_", ",_", "'", "Ser", "ial", "'_", ",_", "'", "Asset", " ", "Ta", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", "'_", ",_", "'", "Model", "'_", ",_", "'", "Date", " ", "Pur", "chase", "d", "'_", ",_", "'", "Cost", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "systems_", ":_", "\\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 ", " _", "location_", "=_", "s_", "._", "owner_", "._", "user", "\\u", "location_", "\\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 ", " _", "location_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "s_", "._", "owner_", ",_", "location_", ",_", "s_", "._", "serial_", ",_", "s_", "._", "asset", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "operati", "ng", "\\u", "system_", ",_", "s_", "._", "server", "\\u", "model_", ",_", "s_", "._", "date", "\\u", "purchase", "d_", ",_", "s_", "._", "cost_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fill", "in", "\\u", "csv_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Importa", "nt", " ", "column", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "4", ":", " ", "serial", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "6", ":", " ", "employ", "ee", "\\", "10", ";", " ", " ", " ", " ", "7", ":", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "forms_", "._", "CSV", "Form_", "(_", "request_", "._", "POST_", ",_", "request_", "._", "FILES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Http", "Response_", "(_", "mimetype_", "=_", "'", "text", "/", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=", "Compute", "r", "Equip", "ment", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "csv_", "=_", "csv_", "._", "reader_", "(_", "f_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "csv", "'_", "]_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "csv_", "=_", "csv_", "._", "writer_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "in", "\\u", "csv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "4_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "serial", "s_", "=_", "[_", "i_", "._", "strip_", "(_", ")_", "for_", "i_", "in_", "row_", "[_", "4_", "]_", "._", "split_", "(_", "';'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owners_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "i_", "._", "owner_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u\\u", "in_", "=_", "serial", "s_", ")_", "._", "filter_", "(_", "owner", "\\u\\u", "isnull_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "i_", "._", "system", "\\u", "rack_", "._", "location_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "system", "\\u", "models_", "._", "System_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u\\u", "in_", "=_", "serial", "s_", ")_", "._", "filter_", "(_", "system", "\\u", "rack", "\\u\\u", "location", "\\u\\u", "isnull_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locations_", "+=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "i_", "._", "owner_", "._", "user", "\\u", "location_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "models_", "._", "Unma", "nage", "d", "System_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u\\u", "in_", "=_", "serial", "s_", ")_", "._", "filter_", "(_", "owner", "\\u\\u", "user", "\\u", "location", "\\u\\u", "isnull_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "owners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "[_", "6_", "]_", "=_", "\";", " ", "\"_", "._", "join_", "(_", "owners_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "[_", "7_", "]_", "=_", "\";", " ", "\"_", "._", "join_", "(_", "locations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "csv_", "._", "writerow_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\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 ", " _", "f_", "=_", "forms_", "._", "CSV", "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_", "'", "user", "\\u", "system", "s", "/", "fill", "in", "\\u", "csv", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "form", "'_", ":_", "f_", "}_",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Implicit string concatenation in a list
kuri65536/python-for-android/python-modules/twisted/twisted/scripts/trial.py
[ { "content": "class Options(usage.Options, app.ReactorSelectionMixin):\n synopsis = \"\"\"%s [options] [[file|package|module|TestCase|testmethod]...]\n \"\"\" % (os.path.basename(sys.argv[0]),)\n longdesc = (\"trial loads and executes a suite of unit tests, obtained \"\n \"from modules, packages and files listed on the command line.\")\n\n optFlags = [[\"help\", \"h\"],\n [\"rterrors\", \"e\", \"realtime errors, print out tracebacks as \"\n \"soon as they occur\"],\n [\"debug\", \"b\", \"Run tests in the Python debugger. Will load \"\n \"'.pdbrc' from current directory if it exists.\"],\n [\"debug-stacktraces\", \"B\", \"Report Deferred creation and \"\n \"callback stack traces\"],\n [\"nopm\", None, \"don't automatically jump into debugger for \"\n \"postmorteming of exceptions\"],\n [\"dry-run\", 'n', \"do everything but run the tests\"],\n [\"force-gc\", None, \"Have Trial run gc.collect() before and \"\n \"after each test case.\"],\n [\"profile\", None, \"Run tests under the Python profiler\"],\n [\"unclean-warnings\", None,\n \"Turn dirty reactor errors into warnings\"],\n [\"until-failure\", \"u\", \"Repeat test until it fails\"],\n [\"no-recurse\", \"N\", \"Don't recurse into packages\"],\n ['help-reporters', None,\n \"Help on available output plugins (reporters)\"]\n ]\n\n optParameters = [\n [\"logfile\", \"l\", \"test.log\", \"log file name\"],\n [\"random\", \"z\", None,\n \"Run tests in random order using the specified seed\"],\n ['temp-directory', None, '_trial_temp',\n 'Path to use as working directory for tests.'],\n ['reporter', None, 'verbose',\n 'The reporter to use for this test run. See --help-reporters for '\n 'more info.']]\n\n zsh_actions = {\"tbformat\":\"(plain emacs cgitb)\",\n \"reporter\":_zshReporterAction}\n zsh_actionDescr = {\"logfile\":\"log file name\",\n \"random\":\"random seed\"}\n zsh_extras = [\"*:file|module|package|TestCase|testMethod:_files -g '*.py'\"]\n\n fallbackReporter = reporter.TreeReporter\n extra = None\n tracer = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n opt_x = opt_extra\n\n\n\n\n\n\n", "metadata": "root.Options", "header": "['module', '___EOS___']", "index": 91 } ]
[ { "span": "\"realtime errors, print out tracebacks as \"\n \"soon as they occur\"]", "start_line": 98, "start_column": 34, "end_line": 99, "end_column": 37 }, { "span": "\"Run tests in the Python debugger. Will load \"\n \"'.pdbrc' from current directory if it exists.\"]", "start_line": 100, "start_column": 31, "end_line": 101, "end_column": 64 }, { "span": "\"Report Deferred creation and \"\n \"callback stack traces\"]", "start_line": 102, "start_column": 43, "end_line": 103, "end_column": 40 }, { "span": "\"don't automatically jump into debugger for \"\n \"postmorteming of exceptions\"]", "start_line": 104, "start_column": 31, "end_line": 105, "end_column": 46 }, { "span": "\"Have Trial run gc.collect() before and \"\n \"after each test case.\"]", "start_line": 107, "start_column": 35, "end_line": 108, "end_column": 40 }, { "span": "'The reporter to use for this test run. See --help-reporters for '\n 'more info.']", "start_line": 125, "start_column": 9, "end_line": 126, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Options_", "(_", "usage_", "._", "Options_", ",_", "app_", "._", "Reactor", "Selecti", "on", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "synopsis", "_", "=_", "\"\"\"", "%", "s", " ", "[", "options", "]", " ", "[[", "file", "|", "package", "|", "module", "|", "Test", "Case", "|", "testm", "ethod", "].", "..", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "desc_", "=_", "(_", "\"", "tria", "l", " ", "load", "s", " ", "and", " ", "execute", "s", " ", "a", " ", "suit", "e", " ", "of", " ", "unit", " ", "tests", ",", " ", "obtain", "ed", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", " ", "module", "s", ",", " ", "package", "s", " ", "and", " ", "files", " ", "liste", "d", " ", "on", " ", "the", " ", "command", " ", "line", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "Flags_", "=_", "[_", "[_", "\"", "help", "\"_", ",_", "\"", "h", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "rte", "rror", "s", "\"_", ",_", "\"", "e", "\"_", ",_", "\"", "realtime", " ", "error", "s", ",", " ", "print", " ", "out", " ", "traceback", "s", " ", "as", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "soo", "n", " ", "as", " ", "the", "y", " ", "occur", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "debug", "\"_", ",_", "\"", "b", "\"_", ",_", "\"", "Run", " ", "tests", " ", "in", " ", "the", " ", "Pyth", "on", " ", "debugg", "er", ".", " ", "Wil", "l", " ", "load", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", ".", "pdb", "rc", "'", " ", "from", " ", "current", " ", "director", "y", " ", "if", " ", "it", " ", "exist", "s", ".\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "debug", "-", "stack", "trace", "s", "\"_", ",_", "\"", "B", "\"_", ",_", "\"", "Report", " ", "Defe", "rre", "d", " ", "creati", "on", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "callback", " ", "stack", " ", "trace", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "nop", "m", "\"_", ",_", "None_", ",_", "\"", "don", "'", "t", " ", "automati", "call", "y", " ", "jump", " ", "int", "o", " ", "debugg", "er", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "post", "mort", "emi", "ng", " ", "of", " ", "exception", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "dry", "-", "run", "\"_", ",_", "'", "n", "'_", ",_", "\"", "do", " ", "every", "thing", " ", "but", " ", "run", " ", "the", " ", "tests", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "force", "-", "gc", "\"_", ",_", "None_", ",_", "\"", "Ha", "ve", " ", "Trial", " ", "run", " ", "gc", ".", "collect", "()", " ", "bef", "ore", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "after", " ", "each", " ", "test", " ", "case", ".\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "profile", "\"_", ",_", "None_", ",_", "\"", "Run", " ", "tests", " ", "under", " ", "the", " ", "Pyth", "on", " ", "profiler", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "uncl", "ean", "-", "warn", "ings", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Turn", " ", "dir", "ty", " ", "react", "or", " ", "error", "s", " ", "int", "o", " ", "warn", "ings", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "unti", "l", "-", "fail", "ure", "\"_", ",_", "\"", "u", "\"_", ",_", "\"", "Repeat", " ", "test", " ", "unti", "l", " ", "it", " ", "fail", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "no", "-", "recurse", "\"_", ",_", "\"", "N", "\"_", ",_", "\"", "Don", "'", "t", " ", "recurse", " ", "int", "o", " ", "package", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "help", "-", "reporter", "s", "'_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Help", " ", "on", " ", "avail", "able", " ", "output", " ", "plugin", "s", " ", "(", "reporter", "s", ")\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "Parameters_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "logfile", "\"_", ",_", "\"", "l", "\"_", ",_", "\"", "test", ".", "log", "\"_", ",_", "\"", "log", " ", "file", " ", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "random", "\"_", ",_", "\"", "z", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Run", " ", "tests", " ", "in", " ", "random", " ", "order", " ", "usi", "ng", " ", "the", " ", "specified", " ", "seed", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "temp", "-", "director", "y", "'_", ",_", "None_", ",_", "'\\u", "tria", "l\\u", "temp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "to", " ", "use", " ", "as", " ", "working", " ", "director", "y", " ", "for", " ", "tests", ".'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "reporter", "'_", ",_", "None_", ",_", "'", "verbo", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "reporter", " ", "to", " ", "use", " ", "for", " ", "this", " ", "test", " ", "run", ".", " ", " ", "See", " ", "--", "help", "-", "reporter", "s", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "more", " ", "info", ".'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zs", "h", "\\u", "actions_", "=_", "{_", "\"", "tb", "format", "\"_", ":_", "\"(", "plain", " ", "ema", "cs", " ", "cgi", "tb", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reporter", "\"_", ":_", "\\u", "zs", "h", "Reporte", "r", "Action_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zs", "h", "\\u", "action", "Descr", "_", "=_", "{_", "\"", "logfile", "\"_", ":_", "\"", "log", " ", "file", " ", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "random", "\"_", ":_", "\"", "random", " ", "seed", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zs", "h", "\\u", "extras_", "=_", "[_", "\"*", ":", "file", "|", "module", "|", "package", "|", "Test", "Case", "|", "test", "Meth", "od", ":\\u", "files", " ", "-", "g", " ", "'*", ".", "py", "'\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fall", "back", "Reporter_", "=_", "reporter_", "._", "Tree", "Reporter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "opt", "\\u", "x_", "=_", "opt", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
CGATOxford/cgat/scripts/gff_compare.py
[ { "content": "'''gff_compare.py - compare two gene sets\n======================================\n\n:Author: Andreas Heger\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nPurpose\n-------\n\nThis script benchmarks two gene predictions. Predictions are given as\ngff files.\n\nThis script is transcript aware but not gene aware, i.e. if there are several\ntranscripts for a gene, overcounting happens.\n\nUsage\n-----\n\nExample::\n\n python gff_compare.py --help\n\nType::\n\n python gff_compare.py --help\n\nfor command line help.\n\nCommand line options\n--------------------\n\n'''\nimport sys\nimport re\nimport CGAT.Experiment as E\nimport numpy\n\n\n\n# ------------------------------------------------------------------------\n\n\n\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 sys.exit(main(sys.argv))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(argv=None):\n \"\"\"script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n \"\"\"\n\n if argv is None:\n argv = sys.argv\n\n parser = E.OptionParser(\n version=\"%prog version: $Id: gff_compare.py 2781 2009-09-10 11:33:14Z andreas $\", usage=globals()[\"__doc__\"])\n\n parser.add_option(\"-f\", \"--output-full\", dest=\"write_full\",\n help=\"write full gff entries.\", action=\"store_true\")\n parser.add_option(\"-e\", \"--output-matched-exons\", dest=\"write_matched_exons\",\n help=\"write matched exons.\", action=\"store_true\")\n parser.add_option(\"-o\", \"--output-missed-exons\", dest=\"write_missed_exons\", action=\"store_true\",\n help=\"write missed exons.\")\n parser.add_option(\"-g\", \"--output-missed-genes\", dest=\"write_missed_genes\", action=\"store_true\",\n help=\"write missed genes.\")\n parser.add_option(\"-r\", \"--regex-reference\", dest=\"regex_reference\", type=\"string\",\n help=\"regular expression mapping exon to transcript in reference.\")\n parser.add_option(\"-t\", \"--regex-target\", dest=\"regex_target\", type=\"string\",\n help=\"regular expression mapping exon to transcript in target.\")\n parser.add_option(\"--no-nucleotides\", dest=\"do_nucleotides\", action=\"store_false\",\n help=\"skip nucleotide benchmark.\")\n parser.add_option(\"--no-exons\", dest=\"do_exons\", action=\"store_false\",\n help=\"skip exon benchmark.\")\n parser.add_option(\"--no-genes\", dest=\"do_genes\", action=\"store_false\",\n help=\"skip gene benchmark.\")\n parser.add_option(\"--output-filename-pattern\", dest=\"outfile_pattern\", type=\"string\",\n help=\"output filename pattern for extra info (%s will be substituted with reference,target).\")\n\n parser.set_defaults(\n remove_redundancy=False,\n max_exon_slippage=9,\n write_missed_exons=False,\n write_matched_exons=False,\n write_missed_genes=False,\n write_wrong_exons=False,\n write_wrong_genes=False,\n do_nucleotides=True,\n do_exons=True,\n do_genes=True,\n regex_reference=None,\n regex_target=None,\n outfile_pattern=\"%s.info\",\n )\n\n (options, args) = E.Start(parser)\n\n if len(args) != 2:\n print USAGE\n print \"two arguments required\"\n sys.exit(1)\n\n input_filename_target, input_filename_reference = args\n\n if options.loglevel >= 1:\n print \"# target entries from %s\" % input_filename_target\n print \"# reading target entries ...\",\n sys.stdout.flush()\n\n gff_targets = GTF.readFromFile(open(input_filename_target, \"r\"))\n\n if options.loglevel >= 1:\n print \"finished: %i\" % (len(gff_targets))\n sys.stdout.flush()\n\n if options.loglevel >= 1:\n print \"# reference entries from %s\" % input_filename_reference\n print \"# reading reference entries ...\",\n sys.stdout.flush()\n\n gff_references = GTF.readFromFile(open(input_filename_reference, \"r\"))\n\n if options.loglevel >= 1:\n print \"finished: %i\" % (len(gff_references))\n sys.stdout.flush()\n\n if options.remove_redundancy:\n gff_targets = GTF.CombineOverlaps(gff_targets)\n gff_references = GTF.CombineOverlaps(gff_references)\n\n if options.loglevel >= 1:\n print \"# after filtering: targets=%i, references=%i\" % (len(gff_targets), len(gff_references))\n\n ##########################################################################\n # sort exons\n if options.loglevel >= 1:\n print \"# sorting exons ...\",\n sys.stdout.flush()\n\n gff_targets.sort(lambda x, y: cmp((x.mName, x.strand, x.start, x.end),\n (y.mName, y.strand, y.start, y.end)))\n\n gff_references.sort(lambda x, y: cmp((x.mName, x.strand, x.start, x.end),\n (y.mName, y.strand, y.start, y.end)))\n\n ntargets = len(gff_targets)\n nreferences = len(gff_references)\n\n if options.loglevel >= 1:\n print \"finished\"\n sys.stdout.flush()\n\n ##########################################################################\n # get nucleotide level accuracy\n # process each fragment separately\n if options.do_nucleotides:\n print \"\"\"##############################################################################\n# nucleotide accuracy\n#\n# TP: true postives : nucleotides to be predicted coding in both target and reference.\n# FN: true negatives : nucleotides to be predicted non-coding in both target and reference.\n# FP: false positives: nucleotides to be predicted non-coding in target but not in reference.\n# FN: false negatives: nucleotides to be predicted non-coding in reference but not in target.\n#\n# Sensitivity: TP / TP + FN = correct exons / actual exons\n# Specificity: TP / TP + FP\n# CC: correlation coefficient: (tp*tn-fn*fp)/((tp+fn)*(tn+fp)*(tp+fp)*(tn+fn))\"\"\"\n\n headers = (\n \"contig\", \"strand\", \"tp\", \"fp\", \"tn\", \"fn\", \"sp\", \"sn\", \"cc\")\n\n print \"\\t\".join(headers)\n\n first_r, first_t = 0, 0\n r, t = 0, 0\n\n ttp, tfp, ttn, tfn = 0, 0, 0, 0\n\n # this only works, if all contigs in reference are present in target.\n while r < nreferences and t < ntargets:\n\n this_name = gff_references[r].mName\n this_strand = gff_references[r].strand\n\n # get all in references\n while r < nreferences and \\\n gff_references[r].mName == this_name and \\\n gff_references[r].strand == this_strand:\n r += 1\n\n # skip over extra contigs in target\n while t < ntargets and \\\n (gff_targets[t].mName != this_name or\n gff_targets[t].strand != this_strand):\n t += 1\n first_t = t\n\n # get all in targets\n while t < ntargets and \\\n gff_targets[t].mName == this_name and \\\n gff_targets[t].strand == this_strand:\n t += 1\n\n tp, fp, tn, fn = AnalyseOverlaps(gff_references[first_r:r],\n gff_targets[first_t:t])\n\n spec, sens = CalculateSpecificitySensitivity(tp, fp, tn, fn)\n cc = CalculateCorrelationCoefficient(tp, fp, tn, fn)\n print \"%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\" % (this_name, this_strand, tp, fp, tn, fn, spec, sens, cc)\n\n ttp += tp\n tfp += fp\n ttn += tn\n tfn += fn\n first_r, first_t = r, t\n\n spec, sens = CalculateSpecificitySensitivity(ttp, tfp, ttn, tfn)\n cc = CalculateCorrelationCoefficient(ttp, tfp, ttn, tfn)\n print \"%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\" % (\"all\", \"all\", ttp, tfp, ttn, tfn, spec, sens, cc)\n\n sys.stdout.flush()\n\n ##########################################################################\n if options.do_exons or options.do_genes:\n\n print \"\"\"##############################################################################\n# exon accuracy (see Burset & Guigo (1996))\n#\n# TP: true postives : exons matching both exon boundaries exactly (a deviation of\n# maximal %i nucleotides is allowed).\n# FN: true negatives : not counted.\n# FP: false positives: exons in target not overlapping with in reference.\n# FN: false negatives: exons overlapping, but with deviant boundaries and exons\n# in reference not overlapping with any target exon.\n#\n# ME: missed exons: exons in reference not overlapping with exons in target\n# (add to false negative count).\n# WE: wrong exons: exons in target not overlapping with exons in reference\n# (add to false positive count).\n#\n# Sensitivity: TP / (TP + FN) = correct exons / actual exons\n# Specificity: TP / (TP + FP) = correct exons / predicted exons\n# CC: (sensitivity + specificity) / 2\n#\n# Values are calculated where both exon boundaries of a target exon have to be\n# correct (category \"full\") and where only one exon boundary has to be correct (catgory \"half\").\"\"\" %\\\n (options.max_exon_slippage)\n\n headers = (\"category\", \"contig\", \"strand\", \"tp\", \"fp\", \"tn\",\n \"fn\", \"sp\", \"sn\", \"cc\", \"me\", \"we\", \"me\", \"we\")\n\n print \"\\t\".join(headers)\n\n r, t = 0, 0\n next_r, next_t = r, t\n\n # strict false positves/negatives\n tp, fp, tn, fn = 0, 0, 0, 0\n ttp, tfp, ttn, tfn = 0, 0, 0, 0\n # partial false positives/negatives\n ptp, pfp, ptn, pfn = 0, 0, 0, 0\n tptp, tpfp, tptn, tpfn = 0, 0, 0, 0\n\n # missed and wrong exons\n missed_exons, wrong_exons = 0, 0\n tmissed_exons, twrong_exons = 0, 0\n\n # Flag set, if partial overlap in previous pair\n last_partial_overlap = False\n # Flag set, if partial overlap and reference was last increased\n last_increased_ref = False\n\n while r < nreferences and t < ntargets:\n\n this_name = gff_references[r].mName\n this_strand = gff_references[r].strand\n\n # get overlap segments\n if next_r == r:\n ref_overlaps, next_r, ref_start, ref_end = GetFirstOverlaps(\n gff_references, r)\n if next_t == t:\n target_overlaps, next_t, target_start, target_end = GetFirstOverlaps(\n gff_targets, t)\n\n if options.loglevel >= 3:\n print \"########################################################\"\n for x in ref_overlaps:\n print \"#\", str(x)\n for x in target_overlaps:\n print \"#\", str(x)\n\n do_summary = False\n # check strand switch in reference\n if next_r < nreferences and \\\n (this_name != gff_references[next_r].mName or\n this_strand != gff_references[next_r].strand):\n if options.loglevel >= 3:\n print \"# target advance\"\n do_summary = True\n\n last_increased_ref = False\n last_partial_overlap = False\n\n # advance in target until next name is found\n next_name = gff_references[next_r].mName\n next_strand = gff_references[next_r].strand\n while next_t < ntargets and \\\n next_name != gff_targets[next_t].mName or \\\n next_strand != gff_targets[next_t].strand:\n fp += 1\n pfp += 1\n target_overlaps, next_t, target_start, target_end = GetFirstOverlaps(\n gff_targets, next_t)\n\n for x in gff_targets[t:next_t]:\n x.mStatus = \"extra\"\n for x in gff_references[r:next_r]:\n x.mStatus = \"extra\"\n\n r, t = next_r, next_t\n # check strand switch in target\n elif next_t < ntargets and \\\n (this_name != gff_targets[next_t].mName or\n this_strand != gff_targets[next_t].strand):\n # advance in reference until next name is found\n if options.loglevel >= 3:\n print \"# reference advance\"\n do_summary = True\n\n last_increased_ref = False\n last_partial_overlap = False\n\n next_name = gff_targets[next_t].mName\n next_strand = gff_targets[next_t].strand\n while next_r < nreferences and \\\n next_name != gff_references[next_r].mName or \\\n next_strand != gff_references[next_r].strand:\n fn += 1\n pfn += 1\n reference_overlaps, next_r, references_start, references_end = GetFirstOverlaps(\n gff_references, next_r)\n\n for x in gff_targets[t:next_t]:\n x.mStatus = \"extra\"\n for x in gff_references[r:next_r]:\n x.mStatus = \"extra\"\n\n r, t = next_r, next_t\n # otherwise\n else:\n\n ref_status, target_status = None, None\n\n if options.loglevel >= 3:\n print \"# same chromosome\"\n\n # overlap between segments\n if min(ref_end, target_end) - max(ref_start, target_start) > 0:\n\n # clear flags\n last_increased_ref = False\n last_partial_overlap = False\n found = False\n\n for rr in ref_overlaps:\n xfound = False\n for tt in target_overlaps:\n if GTF.Identity(rr, tt, max_slippage=options.max_exon_slippage):\n xfound = True\n break\n if xfound:\n found = True\n break\n\n if found:\n ref_status = \"match\"\n target_status = \"match\"\n tp += 1\n ptp += 1\n if options.write_matched_exons:\n print \"############# matching exons ###########################\"\n for x in ref_overlaps:\n print \"#\", str(x)\n for x in target_overlaps:\n print \"#\", str(x)\n else:\n fn += 1\n\n # check for one-sided matches\n for rr in ref_overlaps:\n xfound = False\n for tt in target_overlaps:\n if GTF.HalfIdentity(rr, tt, max_slippage=options.max_exon_slippage):\n xfound = True\n break\n if xfound:\n found = True\n break\n\n if found:\n ptp += 1\n code = \"partial\"\n ref_status = \"partial\"\n target_status = \"partial\"\n else:\n pfn += 1\n code = \"complete\"\n ref_status = \"mismatch\"\n target_status = \"mismatch\"\n\n if options.write_missed_exons:\n print \"############# %s non-overlapping exons ###########################\" % code\n for x in ref_overlaps:\n print \"#\", str(x)\n for x in target_overlaps:\n print \"#\", str(x)\n\n ###########################################################\n # r, t = next_r, next_t\n if ref_end == target_end:\n r, t = next_r, next_t\n elif ref_end < target_end:\n r = next_r\n last_increased_ref = True\n last_partial_overlap = True\n else:\n t = next_t\n last_increased_ref = False\n last_partial_overlap = True\n\n # non-overlap between segments\n else:\n\n if ref_end < target_start:\n\n # for non-overlap, check whether there was partial overlap before\n # and reference was not increased.\n # if there was, just increment reference, but do not\n # count.\n\n if not (last_partial_overlap and not last_increased_ref):\n\n if options.write_missed_exons:\n print \"############# missed exon ###########################\"\n for x in ref_overlaps:\n print \"#\", str(x)\n missed_exons += 1\n fn += 1\n pfn += 1\n ref_status = \"extra\"\n\n r = next_r\n\n else:\n\n # for non-overlap, check whether there was partial overlap before\n # and target was not increased.\n # if there was, just increment target, but do not\n # count.\n\n if not (last_partial_overlap and last_increased_ref):\n if options.write_wrong_exons:\n print \"############# wrong exon ###########################\"\n for x in target_overlaps:\n print \"#\", str(x)\n\n wrong_exons += 1\n fp += 1\n pfp += 1\n target_status = \"extra\"\n\n t = next_t\n\n last_partial_overlap = False\n\n if options.loglevel >= 3:\n print \"# ref_status=%s, target_status=%s\" % (ref_status, target_status)\n\n if ref_status:\n for rr in ref_overlaps:\n rr.mStatus = ref_status\n\n if ref_status in (\"match\", \"partial\") and options.do_genes:\n for rr in ref_overlaps:\n rr.mMatches = target_overlaps\n\n if target_status:\n for tt in target_overlaps:\n tt.mStatus = target_status\n\n if target_status in (\"match\", \"partial\") and options.do_genes:\n for tt in target_overlaps:\n tt.mMatches = ref_overlaps\n\n if do_summary or r >= nreferences or t >= ntargets:\n ttp += tp\n tfp += fp\n ttn += tn\n tfn += fn\n\n tptp += ptp\n tpfp += pfp\n tptn += ptn\n tpfn += pfn\n\n tmissed_exons += missed_exons\n twrong_exons += wrong_exons\n\n if tp + fn != 0:\n pmissed_exons = \"%5.2f\" % (float(missed_exons) / (tp + fn))\n else:\n pmissed_exons = \"0\"\n\n if tp + fp != 0:\n pwrong_exons = \"%5.2f\" % (float(wrong_exons) / (tp + fp))\n else:\n pwrong_exons = \"na\"\n\n spec, sens = CalculateSpecificitySensitivity(tp, fp, tn, fn)\n cc = (spec + sens) / 2.0\n print \"full\\t%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%s\\t%s\" % \\\n (this_name, this_strand,\n tp, fp, tn, fn,\n spec, sens, cc,\n missed_exons, wrong_exons,\n pmissed_exons, pwrong_exons)\n\n spec, sens = CalculateSpecificitySensitivity(\n ptp, pfp, ptn, pfn)\n cc = (spec + sens) / 2.0\n print \"half\\t%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%s\\t%s\" %\\\n (this_name, this_strand,\n ptp, pfp, ptn, pfn,\n spec, sens, cc,\n missed_exons, wrong_exons,\n pmissed_exons, pwrong_exons)\n\n tp, fp, tn, fn = 0, 0, 0, 0\n ptp, pfp, ptn, pfn = 0, 0, 0, 0\n missed_exons, wrong_exons = 0, 0\n\n if t < ntargets:\n for x in gff_targets[t:ntargets]:\n x.mStatus = \"extra\"\n if r < nreferences:\n for x in gff_references[r:nreferences]:\n x.mStatus = \"extra\"\n\n spec, sens = CalculateSpecificitySensitivity(ttp, tfp, ttn, tfn)\n cc = (spec + sens) / 2.0\n print \"full\\t%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%5.2f\\t%5.2f\" % \\\n (\"all\", \"all\", ttp, tfp, ttn, tfn,\n spec, sens, cc,\n tmissed_exons, twrong_exons,\n float(tmissed_exons) / (ttp + tfn),\n float(twrong_exons) / (ttp + tfp))\n\n spec, sens = CalculateSpecificitySensitivity(tptp, tpfp, tptn, tpfn)\n cc = (spec + sens) / 2.0\n print \"half\\t%s\\t%s\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%5.2f\\t%5.2f\" %\\\n (\"all\", \"all\", tptp, tpfp, tptn, tpfn,\n spec, sens, cc,\n tmissed_exons, twrong_exons,\n float(tmissed_exons) / (ttp + tfn),\n float(twrong_exons) / (ttp + tfp))\n\n if options.do_genes and \\\n options.regex_reference and \\\n options.regex_target:\n\n print \"\"\"##############################################################################\n# gene accuracy (see Burset & Guigo (1996))\n#\n# TP: true postives : genes with exons matching both exon boundaries exactly (a deviation of\n# maximal %i nucleotides is allowed).\n# FN: true negatives : not counted.\n# FP: false positives: genes in target not overlapping with in reference.\n# FN: false negatives: genes overlapping, but with deviant exon boundaries and genes\n# in reference not overlapping with any target exon.\n#\n# MG: missed genes: exons in reference not overlapping with exons in target\n# (add to false negative count).\n# WG: wrong genes: exons in target not overlapping with exons in reference\n# (add to false positive count).\n#\n# Sensitivity: TP / (TP + FN) = correct genes / actual genes\n# Specificity: TP / (TP + FP) = correct genes / predicted genes\n# CC: (sensitivity + specificity) / 2\n#\n# Values are calculated where both exon boundaries of a target exon have to be\n# correct (category \"full\") and where only one exon boundary has to be correct (catgory \"half\").\"\"\" %\\\n (options.max_exon_slippage)\n\n out_options = []\n if options.write_missed_genes:\n out_options.append(\"missed\")\n\n if options.loglevel >= 2:\n print \"# counting matches for reference.\"\n sys.stdout.flush()\n\n (ref_total, ref_match, ref_partial, ref_extra) =\\\n CountMatchesPerGene(gff_references,\n re.compile(options.regex_reference),\n re.compile(options.regex_target),\n write=out_options,\n outfile=open(options.outfile_pattern % \"reference\", \"w\"))\n\n if options.loglevel >= 2:\n print \"# counting matches for target.\"\n sys.stdout.flush()\n\n (target_total, target_match, target_partial, target_extra) =\\\n CountMatchesPerGene(gff_targets,\n re.compile(options.regex_target),\n re.compile(\n options.regex_reference),\n write=out_options,\n outfile=open(options.outfile_pattern % \"target\", \"w\"))\n\n if options.loglevel >= 1:\n print \"# reference: genes=%6i, matches=%6i, partial=%6i, extra=%6i\" % \\\n (ref_total, ref_match, ref_partial, ref_extra)\n print \"# target : genes=%6i, matches=%6i, partial=%6i, extra=%6i\" % \\\n (target_total, target_match, target_partial, target_extra)\n\n headers = (\"category\", \"tp\", \"fp\", \"tn\", \"fn\",\n \"sp\", \"sn\", \"cc\", \"mg\", \"wg\", \"mg\", \"wg\")\n print \"\\t\".join(headers)\n\n tp = ref_match\n fp = target_extra\n tn = 0\n fn = ref_total - ref_match\n wrong_genes = target_extra\n missed_genes = ref_extra\n\n spec, sens = CalculateSpecificitySensitivity(tp, fp, tn, fn)\n cc = (spec + sens) / 2.0\n\n if tp + fp == 0:\n fp = nreferences\n\n print \"full\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%5.2f\\t%5.2f\" % \\\n (tp, fp, tn, fn,\n spec, sens, cc,\n missed_genes, wrong_genes,\n float(missed_genes) / (tp + fn),\n float(wrong_genes) / (tp + fp))\n\n tp = ref_match + ref_partial\n fp = target_extra\n tn = 0\n fn = ref_total - ref_match - ref_partial\n wrong_genes = target_extra\n missed_genes = ref_extra\n\n spec, sens = CalculateSpecificitySensitivity(tp, fp, tn, fn)\n cc = (spec + sens) / 2.0\n print \"half\\t%i\\t%i\\t%i\\t%i\\t%5.2f\\t%5.2f\\t%5.2f\\t%i\\t%i\\t%5.2f\\t%5.2f\" % \\\n (tp, fp, tn, fn,\n spec, sens, cc,\n missed_genes, wrong_genes,\n float(missed_genes) / (tp + fn),\n float(wrong_genes) / (tp + fp))\n\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 260 } ]
[ { "span": "main(sys.argv))", "start_line": 885, "start_column": 13, "end_line": 885, "end_column": 27 } ]
[ { "span": "def main(argv=None):", "start_line": 260, "start_column": 0, "end_line": 260, "end_column": 20 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "gff", "\\u", "compare", ".", "py", " ", "-", " ", "compare", " ", "two", " ", "gene", " ", "sets", "\\", "10", ";", "==============", "==============", "=========", "=", "\\", "10", ";", "\\", "10", ";", ":", "Author", ":", " ", "Andre", "as", " ", "He", "ger", "\\", "10", ";", ":", "Release", ":", " ", "$", "Id", "$", "\\", "10", ";", ":", "Date", ":", " ", "|", "toda", "y", "|", "\\", "10", ";", ":", "Ta", "gs", ":", " ", "Pyth", "on", "\\", "10", ";", "\\", "10", ";", "Pur", "pose", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "benchmarks", " ", "two", " ", "gene", " ", "predicti", "ons", ".", " ", "Prediction", "s", " ", "are", " ", "give", "n", " ", "as", "\\", "10", ";", "gff", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "is", " ", "transcri", "pt", " ", "awa", "re", " ", "but", " ", "not", " ", "gene", " ", "awa", "re", ",", " ", "i", ".", "e", ".", " ", "if", " ", "there", " ", "are", " ", "sever", "al", "\\", "10", ";", "transcripts", " ", "for", " ", "a", " ", "gene", ",", " ", "over", "counti", "ng", " ", "happ", "ens", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", "\\", "10", ";", "-----", "\\", "10", ";", "\\", "10", ";", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "gff", "\\u", "compare", ".", "py", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", "Type", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "gff", "\\u", "compare", ".", "py", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", "for", " ", "command", " ", "line", " ", "help", ".", "\\", "10", ";", "\\", "10", ";", "Command", " ", "line", " ", "options", "\\", "10", ";", "--------------", "------", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Experiment_", "as_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "script", " ", "main", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "parse", "s", " ", "command", " ", "line", " ", "options", " ", "in", " ", "sys", ".", "argv", ",", " ", "unl", "ess", " ", "*", "argv", "*", " ", "is", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", ":", " ", "gff", "\\u", "compare", ".", "py", " ", "278", "1", " ", "200", "9", "-0", "9", "-1", "0", " ", "11", ":", "3", "3", ":", "14", "Z", " ", "andr", "eas", " ", "$\"_", ",_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "f", "\"_", ",_", "\"--", "output", "-", "full", "\"_", ",_", "dest_", "=_", "\"", "write", "\\u", "full", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "write", " ", "full", " ", "gff", " ", "entri", "es", ".\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "e", "\"_", ",_", "\"--", "output", "-", "matche", "d", "-", "exon", "s", "\"_", ",_", "dest_", "=_", "\"", "write", "\\u", "matche", "d\\u", "exon", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "write", " ", "matche", "d", " ", "exon", "s", ".\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "o", "\"_", ",_", "\"--", "output", "-", "missed", "-", "exon", "s", "\"_", ",_", "dest_", "=_", "\"", "write", "\\u", "missed", "\\u", "exon", "s", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "write", " ", "missed", " ", "exon", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "g", "\"_", ",_", "\"--", "output", "-", "missed", "-", "gene", "s", "\"_", ",_", "dest_", "=_", "\"", "write", "\\u", "missed", "\\u", "gene", "s", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "write", " ", "missed", " ", "gene", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "r", "\"_", ",_", "\"--", "regex", "-", "reference", "\"_", ",_", "dest_", "=_", "\"", "regex", "\\u", "reference", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "regular", " ", "express", "ion", " ", "mapping", " ", "exon", " ", "to", " ", "transcri", "pt", " ", "in", " ", "reference", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "t", "\"_", ",_", "\"--", "regex", "-", "target", "\"_", ",_", "dest_", "=_", "\"", "regex", "\\u", "target", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "regular", " ", "express", "ion", " ", "mapping", " ", "exon", " ", "to", " ", "transcri", "pt", " ", "in", " ", "target", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "no", "-", "nucleotide", "s", "\"_", ",_", "dest_", "=_", "\"", "do", "\\u", "nucleotide", "s", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "skip", " ", "nucleotide", " ", "bench", "mark", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "no", "-", "exon", "s", "\"_", ",_", "dest_", "=_", "\"", "do", "\\u", "exon", "s", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "skip", " ", "exon", " ", "bench", "mark", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "no", "-", "gene", "s", "\"_", ",_", "dest_", "=_", "\"", "do", "\\u", "gene", "s", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "skip", " ", "gene", " ", "bench", "mark", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "output", "-", "filename", "-", "pattern", "\"_", ",_", "dest_", "=_", "\"", "outfile", "\\u", "pattern", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "output", " ", "filename", " ", "pattern", " ", "for", " ", "extra", " ", "info", " ", "(%", "s", " ", "will", " ", "be", " ", "substitute", "d", " ", "with", " ", "reference", ",", "target", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "\\u", "redu", "ndancy", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "exon", "\\u", "slip", "page_", "=_", "9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "missed", "\\u", "exons_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "matche", "d\\u", "exons_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "missed", "\\u", "genes_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "wrong", "\\u", "exons_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "wrong", "\\u", "genes_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "nucleotide", "s_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "exons_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "genes_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex", "\\u", "reference_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex", "\\u", "target_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outfile", "\\u", "pattern_", "=_", "\"%", "s", ".", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "USAGE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "two", " ", "argu", "ment", "s", " ", "require", "d", "\"_", "\\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_", "input", "\\u", "filename", "\\u", "target_", ",_", "input", "\\u", "filename", "\\u", "reference_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "target", " ", "entri", "es", " ", "from", " ", "%", "s", "\"_", "%_", "input", "\\u", "filename", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"#", " ", "readi", "ng", " ", "target", " ", "entri", "es", " ", "...\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gff", "\\u", "targets_", "=_", "GT", "F_", "._", "read", "Fro", "m", "File_", "(_", "open_", "(_", "input", "\\u", "filename", "\\u", "target_", ",_", "\"", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "finish", "ed", ":", " ", "%", "i", "\"_", "%_", "(_", "len_", "(_", "gff", "\\u", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "reference", " ", "entri", "es", " ", "from", " ", "%", "s", "\"_", "%_", "input", "\\u", "filename", "\\u", "reference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"#", " ", "readi", "ng", " ", "reference", " ", "entri", "es", " ", "...\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gff", "\\u", "references_", "=_", "GT", "F_", "._", "read", "Fro", "m", "File_", "(_", "open_", "(_", "input", "\\u", "filename", "\\u", "reference_", ",_", "\"", "r", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "finish", "ed", ":", " ", "%", "i", "\"_", "%_", "(_", "len_", "(_", "gff", "\\u", "references_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "remove", "\\u", "redu", "ndancy", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gff", "\\u", "targets_", "=_", "GT", "F_", "._", "Combine", "Overlap", "s_", "(_", "gff", "\\u", "targets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gff", "\\u", "references_", "=_", "GT", "F_", "._", "Combine", "Overlap", "s_", "(_", "gff", "\\u", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "after", " ", "filtering", ":", " ", "target", "s", "=", "%", "i", ",", " ", "reference", "s", "=", "%", "i", "\"_", "%_", "(_", "len_", "(_", "gff", "\\u", "targets_", ")_", ",_", "len_", "(_", "gff", "\\u", "references_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sort", " ", "exons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "sorting", " ", "exon", "s", " ", "...\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gff", "\\u", "targets_", "._", "sort_", "(_", "lambda_", "x_", ",_", "y_", ":_", "cmp_", "(_", "(_", "x_", "._", "m", "Name_", ",_", "x_", "._", "strand_", ",_", "x_", "._", "start_", ",_", "x_", "._", "end_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "y_", "._", "m", "Name_", ",_", "y_", "._", "strand_", ",_", "y_", "._", "start_", ",_", "y_", "._", "end_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "references_", "._", "sort_", "(_", "lambda_", "x_", ",_", "y_", ":_", "cmp_", "(_", "(_", "x_", "._", "m", "Name_", ",_", "x_", "._", "strand_", ",_", "x_", "._", "start_", ",_", "x_", "._", "end_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "y_", "._", "m", "Name_", ",_", "y_", "._", "strand_", ",_", "y_", "._", "start_", ",_", "y_", "._", "end_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nta", "rget", "s_", "=_", "len_", "(_", "gff", "\\u", "targets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nre", "ference", "s_", "=_", "len_", "(_", "gff", "\\u", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "finish", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "nucleotide", " ", "level", " ", "accuracy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "each", " ", "fragment", " ", "separately", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "do", "\\u", "nucleotide", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"#", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "\\", "10", ";", "#", " ", "nucleotide", " ", "accu", "rac", "y", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "TP", ":", " ", "true", " ", "posti", "ves", " ", " ", ":", " ", "nucleotide", "s", " ", "to", " ", "be", " ", "predi", "cte", "d", " ", "codi", "ng", " ", "in", " ", "bot", "h", " ", "target", " ", "and", " ", "reference", ".", "\\", "10", ";", "#", " ", "FN", ":", " ", "true", " ", "negatives", " ", ":", " ", "nucleotide", "s", " ", "to", " ", "be", " ", "predi", "cte", "d", " ", "non", "-", "codi", "ng", " ", "in", " ", "bot", "h", " ", "target", " ", "and", " ", "reference", ".", "\\", "10", ";", "#", " ", "FP", ":", " ", "fal", "se", " ", "positives", ":", " ", "nucleotide", "s", " ", "to", " ", "be", " ", "predi", "cte", "d", " ", "non", "-", "codi", "ng", " ", "in", " ", "target", " ", "but", " ", "not", " ", "in", " ", "reference", ".", "\\", "10", ";", "#", " ", "FN", ":", " ", "fal", "se", " ", "negatives", ":", " ", "nucleotide", "s", " ", "to", " ", "be", " ", "predi", "cte", "d", " ", "non", "-", "codi", "ng", " ", "in", " ", "reference", " ", "but", " ", "not", " ", "in", " ", "target", ".", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Sensitiv", "it", "y", ":", " ", "TP", " ", "/", " ", "TP", " ", "+", " ", "FN", " ", "=", " ", "correct", " ", "exon", "s", " ", "/", " ", "actual", " ", "exon", "s", "\\", "10", ";", "#", " ", "Specifi", "city", ":", " ", "TP", " ", "/", " ", "TP", " ", "+", " ", "FP", "\\", "10", ";", "#", " ", "CC", ":", " ", "correlation", " ", "coefficient", ":", " ", " ", "(", "tp", "*", "tn", "-", "fn", "*", "fp", ")/(", "(", "tp", "+", "fn", ")*", "(", "tn", "+", "fp", ")*", "(", "tp", "+", "fp", ")*", "(", "tn", "+", "fn", "))", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "conti", "g", "\"_", ",_", "\"", "strand", "\"_", ",_", "\"", "tp", "\"_", ",_", "\"", "fp", "\"_", ",_", "\"", "tn", "\"_", ",_", "\"", "fn", "\"_", ",_", "\"", "sp", "\"_", ",_", "\"", "sn", "\"_", ",_", "\"", "cc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "r_", ",_", "first", "\\u", "t_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", ",_", "t_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "only", " ", "works", ",", " ", "if", " ", "all", " ", "contigs", " ", "in", " ", "reference", " ", "are", " ", "presen", "t", " ", "in", " ", "target", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "r_", "<_", "nre", "ference", "s_", "and_", "t_", "<_", "nta", "rget", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "name_", "=_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "m", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "strand_", "=_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "strand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "in", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "r_", "<_", "nre", "ference", "s_", "and_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "m", "Name_", "==_", "this", "\\u", "name_", "and_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "strand_", "==_", "this", "\\u", "strand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", " ", "over", " ", "extra", " ", "contigs", " ", "in", " ", "target_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "t_", "<_", "nta", "rget", "s_", "and_", "(_", "gff", "\\u", "targets_", "[_", "t_", "]_", "._", "m", "Name_", "!=_", "this", "\\u", "name_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "targets_", "[_", "t_", "]_", "._", "strand_", "!=_", "this", "\\u", "strand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "first", "\\u", "t_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "in", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "t_", "<_", "nta", "rget", "s_", "and_", "gff", "\\u", "targets_", "[_", "t_", "]_", "._", "m", "Name_", "==_", "this", "\\u", "name_", "and_", "gff", "\\u", "targets_", "[_", "t_", "]_", "._", "strand_", "==_", "this", "\\u", "strand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", "=_", "Analyse", "Overlap", "s_", "(_", "gff", "\\u", "references_", "[_", "first", "\\u", "r_", ":_", "r_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "targets_", "[_", "first", "\\u", "t_", ":_", "t_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "Calculat", "e", "Correla", "tion", "Coeff", "icient", "_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "this", "\\u", "name_", ",_", "this", "\\u", "strand_", ",_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ",_", "spec_", ",_", "sens", "_", ",_", "cc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ttp", "_", "+=_", "tp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "p_", "+=_", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt", "n_", "+=_", "tn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "n_", "+=_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "r_", ",_", "first", "\\u", "t_", "=_", "r_", ",_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "Calculat", "e", "Correla", "tion", "Coeff", "icient", "_", "(_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "\"", "all", "\"_", ",_", "\"", "all", "\"_", ",_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", ",_", "spec_", ",_", "sens", "_", ",_", "cc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\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_", "options_", "._", "do", "\\u", "exons_", "or_", "options_", "._", "do", "\\u", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"#", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "\\", "10", ";", "#", " ", "exon", " ", "accu", "rac", "y", " ", "(", "see", " ", "Bur", "set", " ", "&", " ", "Gui", "go", " ", "(", "1996", "))\\", "10", ";", "#", "\\", "10", ";", "#", " ", "TP", ":", " ", "true", " ", "posti", "ves", " ", " ", ":", " ", "exon", "s", " ", "matchi", "ng", " ", "bot", "h", " ", "exon", " ", "bound", "aries", " ", "exact", "ly", " ", "(", "a", " ", "deviation", " ", "of", "\\", "10", ";", "#", " ", " ", " ", "maximal", " ", "%", "i", " ", "nucleotide", "s", " ", "is", " ", "allow", "ed", ").", "\\", "10", ";", "#", " ", "FN", ":", " ", "true", " ", "negatives", " ", ":", " ", "not", " ", "counted", ".", "\\", "10", ";", "#", " ", "FP", ":", " ", "fal", "se", " ", "positives", ":", " ", "exon", "s", " ", "in", " ", "target", " ", "not", " ", "overlapping", " ", "with", " ", "in", " ", "reference", ".", "\\", "10", ";", "#", " ", "FN", ":", " ", "fal", "se", " ", "negatives", ":", " ", "exon", "s", " ", "overlapping", ",", " ", "but", " ", "with", " ", "devi", "ant", " ", "bound", "aries", " ", "and", " ", "exon", "s", "\\", "10", ";", "#", " ", " ", " ", "in", " ", "reference", " ", "not", " ", "overlapping", " ", "with", " ", "any", " ", "target", " ", "exon", ".", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "ME", ":", " ", "missed", " ", "exon", "s", ":", " ", "exon", "s", " ", "in", " ", "reference", " ", "not", " ", "overlapping", " ", "with", " ", "exon", "s", " ", "in", " ", "target", "\\", "10", ";", "#", " ", " ", " ", " ", " ", "(", "add", " ", "to", " ", "fal", "se", " ", "negati", "ve", " ", "count", ").", "\\", "10", ";", "#", " ", "WE", ":", " ", "wrong", " ", "exon", "s", ":", " ", "exon", "s", " ", "in", " ", "target", " ", "not", " ", "overlapping", " ", "with", " ", "exon", "s", " ", "in", " ", "reference", "\\", "10", ";", "#", " ", " ", " ", " ", " ", "(", "add", " ", "to", " ", "fal", "se", " ", "posit", "ive", " ", "count", ").", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Sensitiv", "it", "y", ":", " ", "TP", " ", "/", " ", "(", "TP", " ", "+", " ", "FN", ")", " ", "=", " ", "correct", " ", "exon", "s", " ", "/", " ", "actual", " ", "exon", "s", "\\", "10", ";", "#", " ", "Specifi", "city", ":", " ", "TP", " ", "/", " ", "(", "TP", " ", "+", " ", "FP", ")", " ", "=", " ", "correct", " ", "exon", "s", " ", "/", " ", "predi", "cte", "d", " ", "exon", "s", "\\", "10", ";", "#", " ", "CC", ":", " ", "(", "sensitivity", " ", "+", " ", "specific", "it", "y", ")", " ", "/", " ", "2", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Value", "s", " ", "are", " ", "calculated", " ", "where", " ", "bot", "h", " ", "exon", " ", "bound", "aries", " ", "of", " ", "a", " ", "target", " ", "exon", " ", "have", " ", "to", " ", "be", "\\", "10", ";", "#", " ", "correct", " ", "(", "category", " ", "\"", "full", "\")", " ", "and", " ", "where", " ", "only", " ", "one", " ", "exon", " ", "bound", "ary", " ", "has", " ", "to", " ", "be", " ", "correct", " ", "(", "cat", "gory", " ", "\"", "half", "\")", ".\"\"\"_", "%_", "(_", "options_", "._", "max", "\\u", "exon", "\\u", "slip", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "(_", "\"", "category", "\"_", ",_", "\"", "conti", "g", "\"_", ",_", "\"", "strand", "\"_", ",_", "\"", "tp", "\"_", ",_", "\"", "fp", "\"_", ",_", "\"", "tn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fn", "\"_", ",_", "\"", "sp", "\"_", ",_", "\"", "sn", "\"_", ",_", "\"", "cc", "\"_", ",_", "\"", "me", "\"_", ",_", "\"", "we", "\"_", ",_", "\"", "me", "\"_", ",_", "\"", "we", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", ",_", "t_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "r_", ",_", "next", "\\u", "t_", "=_", "r_", ",_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "strict", " ", "fal", "se", " ", "posit", "ves", "/", "negatives", "_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "partial", " ", "fal", "se", " ", "positives", "/", "negatives", "_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "p_", ",_", "pf", "p_", ",_", "pt", "n_", ",_", "pf", "n_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp", "tp_", ",_", "tp", "fp_", ",_", "tp", "tn_", ",_", "tp", "fn_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missed", " ", "and", " ", "wrong", " ", "exons_", "\\u\\u\\uNL\\u\\u\\u_", "missed", "\\u", "exons_", ",_", "wrong", "\\u", "exons_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmi", "sse", "d\\u", "exons_", ",_", "tw", "ron", "g", "\\u", "exons_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "g", " ", "set", ",", " ", "if", " ", "partial", " ", "overl", "ap", " ", "in", " ", "previ", "ous", " ", "pair_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fla", "g", " ", "set", ",", " ", "if", " ", "partial", " ", "overl", "ap", " ", "and", " ", "reference", " ", "was", " ", "last", " ", "increase", "d_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "r_", "<_", "nre", "ference", "s_", "and_", "t_", "<_", "nta", "rget", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "name_", "=_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "m", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "strand_", "=_", "gff", "\\u", "references_", "[_", "r_", "]_", "._", "strand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "overl", "ap", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "next", "\\u", "r_", "==_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "overlaps_", ",_", "next", "\\u", "r_", ",_", "ref", "\\u", "start_", ",_", "ref", "\\u", "end_", "=_", "Get", "Fi", "rst", "Overlap", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "references_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "next", "\\u", "t_", "==_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "overlaps_", ",_", "next", "\\u", "t_", ",_", "target", "\\u", "start_", ",_", "target", "\\u", "end_", "=_", "Get", "Fi", "rst", "Overlap", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "targets_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"############", "###########", "###########", "###########", "###########", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "do", "\\u", "summary_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "strand", " ", "switch", " ", "in", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "next", "\\u", "r_", "<_", "nre", "ference", "s_", "and_", "(_", "this", "\\u", "name_", "!=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "m", "Name_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "strand_", "!=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "strand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "loglevel_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#", " ", "target", " ", "advance", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "do", "\\u", "summary_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "advance", " ", "in", " ", "target", " ", "unti", "l", " ", "next", " ", "name", " ", "is", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "name_", "=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "m", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "strand_", "=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "strand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "next", "\\u", "t_", "<_", "nta", "rget", "s_", "and_", "next", "\\u", "name_", "!=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "m", "Name_", "or_", "next", "\\u", "strand_", "!=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "strand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "p_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "overlaps_", ",_", "next", "\\u", "t_", ",_", "target", "\\u", "start_", ",_", "target", "\\u", "end_", "=_", "Get", "Fi", "rst", "Overlap", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "targets_", ",_", "next", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "gff", "\\u", "targets_", "[_", "t_", ":_", "next", "\\u", "t_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "gff", "\\u", "references_", "[_", "r_", ":_", "next", "\\u", "r_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", ",_", "t_", "=_", "next", "\\u", "r_", ",_", "next", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "strand", " ", "switch", " ", "in", " ", "target_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "next", "\\u", "t_", "<_", "nta", "rget", "s_", "and_", "(_", "this", "\\u", "name_", "!=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "m", "Name_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "strand_", "!=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "strand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "advance", " ", "in", " ", "reference", " ", "unti", "l", " ", "next", " ", "name", " ", "is", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "loglevel_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#", " ", "reference", " ", "advance", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "do", "\\u", "summary_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "name_", "=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "m", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "strand_", "=_", "gff", "\\u", "targets_", "[_", "next", "\\u", "t_", "]_", "._", "strand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "next", "\\u", "r_", "<_", "nre", "ference", "s_", "and_", "next", "\\u", "name_", "!=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "m", "Name_", "or_", "next", "\\u", "strand_", "!=_", "gff", "\\u", "references_", "[_", "next", "\\u", "r_", "]_", "._", "strand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fn_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "\\u", "overlaps_", ",_", "next", "\\u", "r_", ",_", "reference", "s", "\\u", "start_", ",_", "reference", "s", "\\u", "end_", "=_", "Get", "Fi", "rst", "Overlap", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gff", "\\u", "references_", ",_", "next", "\\u", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "gff", "\\u", "targets_", "[_", "t_", ":_", "next", "\\u", "t_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "gff", "\\u", "references_", "[_", "r_", ":_", "next", "\\u", "r_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", ",_", "t_", "=_", "next", "\\u", "r_", ",_", "next", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "status_", ",_", "target", "\\u", "status_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#", " ", "same", " ", "chromo", "some", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "overl", "ap", " ", "bet", "ween", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "min_", "(_", "ref", "\\u", "end_", ",_", "target", "\\u", "end_", ")_", "-_", "max_", "(_", "ref", "\\u", "start_", ",_", "target", "\\u", "start_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rr_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xf", "ound_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tt_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "GT", "F_", "._", "Identity_", "(_", "rr_", ",_", "tt_", ",_", "max", "\\u", "slip", "page_", "=_", "options_", "._", "max", "\\u", "exon", "\\u", "slip", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xf", "ound_", "=_", "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_", "xf", "ound_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found_", "=_", "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_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "\\u", "status_", "=_", "\"", "match", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "status_", "=_", "\"", "match", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt", "p_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "write", "\\u", "matche", "d\\u", "exons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"############", "#", " ", "matchi", "ng", " ", "exon", "s", " ", "###########", "###########", "#####", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fn_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "one", "-", "side", "d", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rr_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xf", "ound_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tt_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "GT", "F_", "._", "Hal", "f", "Identity_", "(_", "rr_", ",_", "tt_", ",_", "max", "\\u", "slip", "page_", "=_", "options_", "._", "max", "\\u", "exon", "\\u", "slip", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xf", "ound_", "=_", "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_", "xf", "ound_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found_", "=_", "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_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pt", "p_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "partial", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "status_", "=_", "\"", "partial", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "status_", "=_", "\"", "partial", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pf", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "complete", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "status_", "=_", "\"", "mism", "atch", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "status_", "=_", "\"", "mism", "atch", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "write", "\\u", "missed", "\\u", "exons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"############", "#", " ", "%", "s", " ", "non", "-", "overlapping", " ", "exon", "s", " ", "###########", "###########", "#####", "\"_", "%_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "r", ",", " ", "t", " ", "=", " ", "next", "\\u", "r", ",", " ", "next", "\\u", "t_", "\\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_", "ref", "\\u", "end_", "==_", "target", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", ",_", "t_", "=_", "next", "\\u", "r_", ",_", "next", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ref", "\\u", "end_", "<_", "target", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "=_", "next", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "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 ", " ", " _", "t_", "=_", "next", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "increase", "d\\u", "ref_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "overl", "ap", " ", "bet", "ween", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "ref", "\\u", "end_", "<_", "target", "\\u", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "non", "-", "overl", "ap", ",", " ", "check", " ", "whe", "ther", " ", "there", " ", "was", " ", "partial", " ", "overl", "ap", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "reference", " ", "was", " ", "not", " ", "increase", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "was", ",", " ", "just", " ", "increment", " ", "reference", ",", " ", "but", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "(_", "last", "\\u", "partial", "\\u", "overlap_", "and_", "not_", "last", "\\u", "increase", "d\\u", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "options_", "._", "write", "\\u", "missed", "\\u", "exons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"############", "#", " ", "missed", " ", "exon", " ", "###########", "###########", "#####", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "missed", "\\u", "exons_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "next", "\\u", "r_", "\\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\\uNL\\u\\u\\u_", "#", " ", "for", " ", "non", "-", "overl", "ap", ",", " ", "check", " ", "whe", "ther", " ", "there", " ", "was", " ", "partial", " ", "overl", "ap", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "target", " ", "was", " ", "not", " ", "increase", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "was", ",", " ", "just", " ", "increment", " ", "target", ",", " ", "but", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "(_", "last", "\\u", "partial", "\\u", "overlap_", "and_", "last", "\\u", "increase", "d\\u", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "options_", "._", "write", "\\u", "wrong", "\\u", "exons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"############", "#", " ", "wrong", " ", "exon", " ", "###########", "###########", "#####", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"#\"_", ",_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrong", "\\u", "exons_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "p_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "next", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "partial", "\\u", "overlap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"#", " ", "ref", "\\u", "status", "=", "%", "s", ",", " ", "target", "\\u", "status", "=", "%", "s", "\"_", "%_", "(_", "ref", "\\u", "status_", ",_", "target", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ref", "\\u", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "rr_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rr_", "._", "m", "Status_", "=_", "ref", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ref", "\\u", "status_", "in_", "(_", "\"", "match", "\"_", ",_", "\"", "partial", "\"_", ")_", "and_", "options_", "._", "do", "\\u", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "rr_", "in_", "ref", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rr_", "._", "m", "Matches_", "=_", "target", "\\u", "overlaps_", "\\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_", "target", "\\u", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "tt_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tt_", "._", "m", "Status_", "=_", "target", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target", "\\u", "status_", "in_", "(_", "\"", "match", "\"_", ",_", "\"", "partial", "\"_", ")_", "and_", "options_", "._", "do", "\\u", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "tt_", "in_", "target", "\\u", "overlaps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tt_", "._", "m", "Matches_", "=_", "ref", "\\u", "overlaps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "\\u", "summary_", "or_", "r_", ">=_", "nre", "ference", "s_", "or_", "t_", ">=_", "nta", "rget", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ttp", "_", "+=_", "tp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "p_", "+=_", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt", "n_", "+=_", "tn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "n_", "+=_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tp", "tp_", "+=_", "pt", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp", "fp_", "+=_", "pf", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp", "tn_", "+=_", "pt", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp", "fn_", "+=_", "pf", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmi", "sse", "d\\u", "exons_", "+=_", "missed", "\\u", "exons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tw", "ron", "g", "\\u", "exons_", "+=_", "wrong", "\\u", "exons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tp_", "+_", "fn_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pmi", "sse", "d\\u", "exons_", "=_", "\"%", "5.2", "f", "\"_", "%_", "(_", "float_", "(_", "missed", "\\u", "exons_", ")_", "/_", "(_", "tp_", "+_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pmi", "sse", "d\\u", "exons_", "=_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tp_", "+_", "fp_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pwr", "ong", "\\u", "exons_", "=_", "\"%", "5.2", "f", "\"_", "%_", "(_", "float_", "(_", "wrong", "\\u", "exons_", ")_", "/_", "(_", "tp_", "+_", "fp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pwr", "ong", "\\u", "exons_", "=_", "\"", "na", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "full", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\"_", "%_", "(_", "this", "\\u", "name_", ",_", "this", "\\u", "strand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "missed", "\\u", "exons_", ",_", "wrong", "\\u", "exons_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pmi", "sse", "d\\u", "exons_", ",_", "pwr", "ong", "\\u", "exons_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "p_", ",_", "pf", "p_", ",_", "pt", "n_", ",_", "pf", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "half", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\"_", "%_", "(_", "this", "\\u", "name_", ",_", "this", "\\u", "strand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "p_", ",_", "pf", "p_", ",_", "pt", "n_", ",_", "pf", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "missed", "\\u", "exons_", ",_", "wrong", "\\u", "exons_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pmi", "sse", "d\\u", "exons_", ",_", "pwr", "ong", "\\u", "exons_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt", "p_", ",_", "pf", "p_", ",_", "pt", "n_", ",_", "pf", "n_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missed", "\\u", "exons_", ",_", "wrong", "\\u", "exons_", "=_", "0_", ",_", "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_", "t_", "<_", "nta", "rget", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "gff", "\\u", "targets_", "[_", "t_", ":_", "nta", "rget", "s_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", "<_", "nre", "ference", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "gff", "\\u", "references_", "[_", "r_", ":_", "nre", "ference", "s_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "._", "m", "Status_", "=_", "\"", "extra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "full", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "\"", "all", "\"_", ",_", "\"", "all", "\"_", ",_", "ttp", "_", ",_", "tf", "p_", ",_", "tt", "n_", ",_", "tf", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmi", "sse", "d\\u", "exons_", ",_", "tw", "ron", "g", "\\u", "exons_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "tmi", "sse", "d\\u", "exons_", ")_", "/_", "(_", "ttp", "_", "+_", "tf", "n_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "tw", "ron", "g", "\\u", "exons_", ")_", "/_", "(_", "ttp", "_", "+_", "tf", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "tp", "tp_", ",_", "tp", "fp_", ",_", "tp", "tn_", ",_", "tp", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "half", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "\"", "all", "\"_", ",_", "\"", "all", "\"_", ",_", "tp", "tp_", ",_", "tp", "fp_", ",_", "tp", "tn_", ",_", "tp", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmi", "sse", "d\\u", "exons_", ",_", "tw", "ron", "g", "\\u", "exons_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "tmi", "sse", "d\\u", "exons_", ")_", "/_", "(_", "ttp", "_", "+_", "tf", "n_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "tw", "ron", "g", "\\u", "exons_", ")_", "/_", "(_", "ttp", "_", "+_", "tf", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "do", "\\u", "genes_", "and_", "options_", "._", "regex", "\\u", "reference_", "and_", "options_", "._", "regex", "\\u", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"#", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "\\", "10", ";", "#", " ", "gene", " ", "accu", "rac", "y", " ", "(", "see", " ", "Bur", "set", " ", "&", " ", "Gui", "go", " ", "(", "1996", "))\\", "10", ";", "#", "\\", "10", ";", "#", " ", "TP", ":", " ", "true", " ", "posti", "ves", " ", " ", ":", " ", "gene", "s", " ", "with", " ", "exon", "s", " ", "matchi", "ng", " ", "bot", "h", " ", "exon", " ", "bound", "aries", " ", "exact", "ly", " ", "(", "a", " ", "deviation", " ", "of", "\\", "10", ";", "#", " ", " ", " ", "maximal", " ", "%", "i", " ", "nucleotide", "s", " ", "is", " ", "allow", "ed", ").", "\\", "10", ";", "#", " ", "FN", ":", " ", "true", " ", "negatives", " ", ":", " ", "not", " ", "counted", ".", "\\", "10", ";", "#", " ", "FP", ":", " ", "fal", "se", " ", "positives", ":", " ", "gene", "s", " ", "in", " ", "target", " ", "not", " ", "overlapping", " ", "with", " ", "in", " ", "reference", ".", "\\", "10", ";", "#", " ", "FN", ":", " ", "fal", "se", " ", "negatives", ":", " ", "gene", "s", " ", "overlapping", ",", " ", "but", " ", "with", " ", "devi", "ant", " ", "exon", " ", "bound", "aries", " ", "and", " ", "gene", "s", "\\", "10", ";", "#", " ", " ", " ", "in", " ", "reference", " ", "not", " ", "overlapping", " ", "with", " ", "any", " ", "target", " ", "exon", ".", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "MG", ":", " ", "missed", " ", "gene", "s", ":", " ", "exon", "s", " ", "in", " ", "reference", " ", "not", " ", "overlapping", " ", "with", " ", "exon", "s", " ", "in", " ", "target", "\\", "10", ";", "#", " ", " ", " ", " ", " ", "(", "add", " ", "to", " ", "fal", "se", " ", "negati", "ve", " ", "count", ").", "\\", "10", ";", "#", " ", "WG", ":", " ", "wrong", " ", "gene", "s", ":", " ", "exon", "s", " ", "in", " ", "target", " ", "not", " ", "overlapping", " ", "with", " ", "exon", "s", " ", "in", " ", "reference", "\\", "10", ";", "#", " ", " ", " ", " ", " ", "(", "add", " ", "to", " ", "fal", "se", " ", "posit", "ive", " ", "count", ").", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Sensitiv", "it", "y", ":", " ", "TP", " ", "/", " ", "(", "TP", " ", "+", " ", "FN", ")", " ", "=", " ", "correct", " ", "gene", "s", " ", "/", " ", "actual", " ", "gene", "s", "\\", "10", ";", "#", " ", "Specifi", "city", ":", " ", "TP", " ", "/", " ", "(", "TP", " ", "+", " ", "FP", ")", " ", "=", " ", "correct", " ", "gene", "s", " ", "/", " ", "predi", "cte", "d", " ", "gene", "s", "\\", "10", ";", "#", " ", "CC", ":", " ", "(", "sensitivity", " ", "+", " ", "specific", "it", "y", ")", " ", "/", " ", "2", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Value", "s", " ", "are", " ", "calculated", " ", "where", " ", "bot", "h", " ", "exon", " ", "bound", "aries", " ", "of", " ", "a", " ", "target", " ", "exon", " ", "have", " ", "to", " ", "be", "\\", "10", ";", "#", " ", "correct", " ", "(", "category", " ", "\"", "full", "\")", " ", "and", " ", "where", " ", "only", " ", "one", " ", "exon", " ", "bound", "ary", " ", "has", " ", "to", " ", "be", " ", "correct", " ", "(", "cat", "gory", " ", "\"", "half", "\")", ".\"\"\"_", "%_", "(_", "options_", "._", "max", "\\u", "exon", "\\u", "slip", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "write", "\\u", "missed", "\\u", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "options_", "._", "append_", "(_", "\"", "missed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "counti", "ng", " ", "matche", "s", " ", "for", " ", "reference", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "ref", "\\u", "total_", ",_", "ref", "\\u", "match_", ",_", "ref", "\\u", "partial_", ",_", "ref", "\\u", "extra_", ")_", "=_", "Count", "Match", "es", "Per", "Gene", "_", "(_", "gff", "\\u", "references_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "compile_", "(_", "options_", "._", "regex", "\\u", "reference_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "compile_", "(_", "options_", "._", "regex", "\\u", "target_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write_", "=_", "out", "\\u", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "options_", "._", "outfile", "\\u", "pattern_", "%_", "\"", "reference", "\"_", ",_", "\"", "w", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "counti", "ng", " ", "matche", "s", " ", "for", " ", "target", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "target", "\\u", "total_", ",_", "target", "\\u", "match_", ",_", "target", "\\u", "partial_", ",_", "target", "\\u", "extra_", ")_", "=_", "Count", "Match", "es", "Per", "Gene", "_", "(_", "gff", "\\u", "targets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "compile_", "(_", "options_", "._", "regex", "\\u", "target_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "regex", "\\u", "reference_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write_", "=_", "out", "\\u", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "options_", "._", "outfile", "\\u", "pattern_", "%_", "\"", "target", "\"_", ",_", "\"", "w", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "reference", ":", " ", "gene", "s", "=", "%", "6", "i", ",", " ", "matche", "s", "=", "%", "6", "i", ",", " ", "partial", "=", "%", "6", "i", ",", " ", "extra", "=", "%", "6", "i", "\"_", "%_", "(_", "ref", "\\u", "total_", ",_", "ref", "\\u", "match_", ",_", "ref", "\\u", "partial_", ",_", "ref", "\\u", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"#", " ", "target", " ", " ", " ", ":", " ", "gene", "s", "=", "%", "6", "i", ",", " ", "matche", "s", "=", "%", "6", "i", ",", " ", "partial", "=", "%", "6", "i", ",", " ", "extra", "=", "%", "6", "i", "\"_", "%_", "(_", "target", "\\u", "total_", ",_", "target", "\\u", "match_", ",_", "target", "\\u", "partial_", ",_", "target", "\\u", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "(_", "\"", "category", "\"_", ",_", "\"", "tp", "\"_", ",_", "\"", "fp", "\"_", ",_", "\"", "tn", "\"_", ",_", "\"", "fn", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sp", "\"_", ",_", "\"", "sn", "\"_", ",_", "\"", "cc", "\"_", ",_", "\"", "mg", "\"_", ",_", "\"", "wg", "\"_", ",_", "\"", "mg", "\"_", ",_", "\"", "wg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", "=_", "ref", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "target", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tn_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "ref", "\\u", "total_", "-_", "ref", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrong", "\\u", "genes_", "=_", "target", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missed", "\\u", "genes_", "=_", "ref", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tp_", "+_", "fp_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "nre", "ference", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "full", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "missed", "\\u", "genes_", ",_", "wrong", "\\u", "genes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "missed", "\\u", "genes_", ")_", "/_", "(_", "tp_", "+_", "fn_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "wrong", "\\u", "genes_", ")_", "/_", "(_", "tp_", "+_", "fp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", "=_", "ref", "\\u", "match_", "+_", "ref", "\\u", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "target", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tn_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "ref", "\\u", "total_", "-_", "ref", "\\u", "match_", "-_", "ref", "\\u", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrong", "\\u", "genes_", "=_", "target", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missed", "\\u", "genes_", "=_", "ref", "\\u", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", "=_", "Calculat", "e", "Specifi", "city", "Sensitiv", "ity_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "(_", "spec_", "+_", "sens", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "half", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "5.2", "f", "\\\\", "t", "%", "5.2", "f", "\"_", "%_", "(_", "tp_", ",_", "fp_", ",_", "tn_", ",_", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "sens", "_", ",_", "cc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "missed", "\\u", "genes_", ",_", "wrong", "\\u", "genes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "missed", "\\u", "genes_", ")_", "/_", "(_", "tp_", "+_", "fn_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "wrong", "\\u", "genes_", ")_", "/_", "(_", "tp_", "+_", "fp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\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,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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 ]
Unused import
PhysicalGraph/SmartThings-Alfred/alfredworkflow/refresh_devices.py
[ { "content": "import json\nimport urllib2\nimport string\nfrom settings import PROTOCOL, HOSTNAME\nfrom http_server import stop\n\n\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def refresh_devices():\n stop()\n\n tokenFile = open(\"token.txt\")\n token = tokenFile.read()\n tokenFile.close()\n \n devicesFile = open(\"devices.txt\", \"w\")\n\n with open(\"endpoints.txt\", 'r') as fh:\n for endpoint in fh.readlines():\n if endpoint.__len__() > 1:\n ### collect devices for each endpoint\n \n for deviceType in (\"switches\", \"locks\"):\n endpoint = endpoint.strip()\n url = \"{protocol}://{hostname}{endpoint}/{deviceType}\".format(protocol=PROTOCOL, hostname=HOSTNAME, endpoint=endpoint, deviceType=deviceType)\n\n req = urllib2.Request(url)\n req.add_header('Authorization', \"Bearer %s\" % token)\n response = urllib2.urlopen(req)\n the_page = response.read()\n jsonData = json.loads(the_page)\n \n for device in jsonData:\n deviceKey = \"{endpoint}/{deviceType}/{deviceId}\".format(endpoint=endpoint, deviceType=deviceType, deviceId=device['id']) \n deviceValue = device['name'] if len(device['label']) == 0 else device['label']\n deviceCache = \"{key}:{value}\\n\".format(key=deviceKey, value=deviceValue)\n devicesFile.write(deviceCache)\n \n devicesFile.close()\n \n return \"Your SmartThings device cache has been updated\"", "metadata": "root.refresh_devices", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "import string", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "PROTOCOL_", ",_", "HOSTNAME", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "http", "\\u", "server_", "import_", "stop_", "\\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_", "refre", "sh", "\\u", "devices_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "token", "File_", "=_", "open_", "(_", "\"", "token", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "token", "File_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "device", "s", "File_", "=_", "open_", "(_", "\"", "device", "s", ".", "txt", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "\"", "endpoint", "s", ".", "txt", "\"_", ",_", "'", "r", "'_", ")_", "as_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "endpoint_", "in_", "fh_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "endpoint_", "._", "\\u\\u", "len\\u\\u_", "(_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "collect", " ", "device", "s", " ", "for", " ", "each", " ", "endpoint_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "device", "Type_", "in_", "(_", "\"", "switche", "s", "\"_", ",_", "\"", "lock", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "endpoint_", "=_", "endpoint_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"{", "protoc", "ol", "}:", "//", "{", "host", "name", "}{", "endpoint", "}/", "{", "device", "Type", "}\"_", "._", "format_", "(_", "protocol_", "=_", "PROTOCOL_", ",_", "hostname_", "=_", "HOSTNAME", "_", ",_", "endpoint_", "=_", "endpoint_", ",_", "device", "Type_", "=_", "device", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "add", "\\u", "header_", "(_", "'", "Authoriz", "ation", "'_", ",_", "\"", "Bear", "er", " ", "%", "s", "\"_", "%_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "page_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "Data_", "=_", "json_", "._", "loads_", "(_", "the", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "device_", "in_", "json", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "device", "Key_", "=_", "\"{", "endpoint", "}/", "{", "device", "Type", "}/", "{", "device", "Id", "}\"_", "._", "format_", "(_", "endpoint_", "=_", "endpoint_", ",_", "device", "Type_", "=_", "device", "Type_", ",_", "device", "Id_", "=_", "device_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "Value_", "=_", "device_", "[_", "'", "name", "'_", "]_", "if_", "len_", "(_", "device_", "[_", "'", "label", "'_", "]_", ")_", "==_", "0_", "else_", "device_", "[_", "'", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "Cache_", "=_", "\"{", "key", "}:", "{", "value", "}\\\\", "n", "\"_", "._", "format_", "(_", "key_", "=_", "device", "Key_", ",_", "value_", "=_", "device", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "s", "File_", "._", "write_", "(_", "device", "Cache_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "device", "s", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", "You", "r", " ", "Sma", "rt", "Thin", "gs", " ", "device", " ", "cache", " ", "has", " ", "bee", "n", " ", "update", "d", "\"_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
SickRage/SickRage/lib/enum34/__init__.py
[ { "content": "\"\"\"Python Enumerations\"\"\"\n\nimport sys as _sys\n\n__all__ = ['Enum', 'IntEnum', 'unique']\n\nversion = 1, 0, 4\n\npyver = float('%s.%s' % _sys.version_info[:2])\n\ntry:\n any\nexcept NameError:\n\ntry:\n from collections import OrderedDict\nexcept ImportError:\n OrderedDict = None\n\ntry:\n basestring\nexcept NameError:\n # In Python 2 basestring is the ancestor of both str and unicode\n # in Python 3 it's just str, but was missing in 3.1\n basestring = str\n\ntry:\n unicode\nexcept NameError:\n # In Python 3 unicode no longer exists (it's just str)\n unicode = str\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Dummy value for Enum as EnumMeta explicity checks for it, but of course until\n# EnumMeta finishes running the first time the Enum class doesn't exist. This\n# is also why there are checks in EnumMeta like `if Enum is not None`\nEnum = None\n\n\n\n\n########################################################\n# In order to support Python 2 and 3 with a single\n# codebase we have to create the Enum methods separately\n# and then use the `type(name, bases, dict)` method to\n# create the class.\n########################################################\ntemp_enum_dict = {}\ntemp_enum_dict['__doc__'] = \"Generic enumeration.\\n\\n Derive from this class to define new enumerations.\\n\\n\"\n\ntemp_enum_dict['__new__'] = __new__\ndel __new__\n\ntemp_enum_dict['__repr__'] = __repr__\ndel __repr__\n\ntemp_enum_dict['__str__'] = __str__\ndel __str__\n\ntemp_enum_dict['__dir__'] = __dir__\ndel __dir__\n\ntemp_enum_dict['__format__'] = __format__\ndel __format__\n\n\n####################################\n# Python's less than 2.6 use __cmp__\n\nif pyver < 2.6:\n\n temp_enum_dict['__cmp__'] = __cmp__\n del __cmp__\n\nelse:\n\n temp_enum_dict['__le__'] = __le__\n del __le__\n\n temp_enum_dict['__lt__'] = __lt__\n del __lt__\n\n temp_enum_dict['__ge__'] = __ge__\n del __ge__\n\n temp_enum_dict['__gt__'] = __gt__\n del __gt__\n \n\ntemp_enum_dict['__eq__'] = __eq__\ndel __eq__\n\ntemp_enum_dict['__ne__'] = __ne__\ndel __ne__\n\ntemp_enum_dict['__hash__'] = __hash__\ndel __hash__\n\ntemp_enum_dict['__reduce_ex__'] = __reduce_ex__\ndel __reduce_ex__\n\n# _RouteClassAttributeToGetattr is used to provide access to the `name`\n# and `value` properties of enum members while keeping some measure of\n# protection from modification, while still allowing for an enumeration\n# to have members named `name` and `value`. This works because enumeration\n# members are not set directly on the enum class -- __getattr__ is\n# used to look them up.\n\ntemp_enum_dict['name'] = name\ndel name\n\ntemp_enum_dict['value'] = value\ndel value\n\nEnum = EnumMeta('Enum', (object, ), temp_enum_dict)\ndel temp_enum_dict\n\n# Enum has now been created\n###########################\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def __cmp__(self, other):\n if type(other) is self.__class__:\n if self is other:\n return 0\n return -1\n return NotImplemented\n raise TypeError(\"unorderable types: %s() and %s()\" % (self.__class__.__name__, other.__class__.__name__))", "metadata": "root.__cmp__", "header": "['module', '___EOS___']", "index": 690 } ]
[ { "span": "except NameError:", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 17 }, { "span": "raise TypeError(\"unorderable types: %s() and %s()\" % (self.__class__.__name__, other.__class__.__name__))", "start_line": 696, "start_column": 8, "end_line": 696, "end_column": 113 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Pyth", "on", " ", "Enum", "eratio", "ns", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "as_", "\\u", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Enum", "'_", ",_", "'", "Int", "Enum", "'_", ",_", "'", "unique", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "1_", ",_", "0_", ",_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pyv", "er_", "=_", "float_", "(_", "'%", "s", ".", "%", "s", "'_", "%_", "\\u", "sys_", "._", "version", "\\u", "info_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "any_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\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 ", " _", "Order", "ed", "Dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "Pyth", "on", " ", "2", " ", "basest", "ring", " ", "is", " ", "the", " ", "ancestor", " ", "of", " ", "bot", "h", " ", "str", " ", "and", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "Pyth", "on", " ", "3", " ", "it", "'", "s", " ", "just", " ", "str", ",", " ", "but", " ", "was", " ", "missi", "ng", " ", "in", " ", "3.1", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "=_", "str_", "\\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 ", " _", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "Pyth", "on", " ", "3", " ", "unicode", " ", "no", " ", "long", "er", " ", "exist", "s", " ", "(", "it", "'", "s", " ", "just", " ", "str", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Du", "mm", "y", " ", "value", " ", "for", " ", "Enum", " ", "as", " ", "Enum", "Meta", " ", "explicit", "y", " ", "checks", " ", "for", " ", "it", ",", " ", "but", " ", "of", " ", "course", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enum", "Meta", " ", "finish", "es", " ", "runn", "ing", " ", "the", " ", "first", " ", "time", " ", "the", " ", "Enum", " ", "class", " ", "doe", "sn", "'", "t", " ", "exist", ".", " ", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "als", "o", " ", "wh", "y", " ", "there", " ", "are", " ", "checks", " ", "in", " ", "Enum", "Meta", " ", "like", " ", "`", "if", " ", "Enum", " ", "is", " ", "not", " ", "Non", "e", "`_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Enum_", "=_", "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\\uNL\\u\\u\\u_", "#", " ", "In", " ", "order", " ", "to", " ", "support", " ", "Pyth", "on", " ", "2", " ", "and", " ", "3", " ", "with", " ", "a", " ", "single_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "codeb", "ase", " ", "we", " ", "have", " ", "to", " ", "create", " ", "the", " ", "Enum", " ", "method", "s", " ", "separately", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "then", " ", "use", " ", "the", " ", "`", "type", "(", "name", ",", " ", "base", "s", ",", " ", "dict", ")`", " ", "method", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "class", "._", "\\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_", "temp", "\\u", "enum", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "doc", "\\u\\u'_", "]_", "=_", "\"", "Gene", "ric", " ", "enumerati", "on", ".\\\\", "n", "\\\\", "n", " ", " ", " ", " ", "Derive", " ", "from", " ", "this", " ", "class", " ", "to", " ", "defin", "e", " ", "new", " ", "enumerati", "ons", ".\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "new", "\\u\\u'_", "]_", "=_", "\\u\\u", "new\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "new\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "repr", "\\u\\u'_", "]_", "=_", "\\u\\u", "repr\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "repr\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "str", "\\u\\u'_", "]_", "=_", "\\u\\u", "str\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "str\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "dir\\u", "\\u'_", "]_", "=_", "\\u\\u", "dir\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "dir\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "format\\u", "\\u'_", "]_", "=_", "\\u\\u", "format\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "format\\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_", "#", " ", "Pyth", "on", "'", "s", " ", "less", " ", "than", " ", "2.6", " ", "use", " ", "\\u\\u", "cmp", "\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pyv", "er_", "<_", "2.6", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "cmp", "\\u\\u'_", "]_", "=_", "\\u\\u", "cmp", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "cmp", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "le", "\\u\\u'_", "]_", "=_", "\\u\\u", "le", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "le", "\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "lt", "\\u\\u'_", "]_", "=_", "\\u\\u", "lt\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "lt\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "ge", "\\u\\u'_", "]_", "=_", "\\u\\u", "ge", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "ge", "\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "gt", "\\u\\u'_", "]_", "=_", "\\u\\u", "gt", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "gt", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "eq", "\\u\\u'_", "]_", "=_", "\\u\\u", "eq\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "eq\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "ne", "\\u\\u'_", "]_", "=_", "\\u\\u", "ne\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "ne\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "hash", "\\u\\u'_", "]_", "=_", "\\u\\u", "hash\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "hash\\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_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'\\u", "\\u", "reduce", "\\u", "ex", "\\u\\u'_", "]_", "=_", "\\u\\u", "reduce", "\\u", "ex", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u\\u", "reduce", "\\u", "ex", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "Route", "Class", "Attribute", "To", "Get", "attr", " ", "is", " ", "used", " ", "to", " ", "provide", " ", "access", " ", "to", " ", "the", " ", "`", "name", "`_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "`", "value", "`", " ", "proper", "ties", " ", "of", " ", "enum", " ", "member", "s", " ", "whi", "le", " ", "keep", "ing", " ", "some", " ", "measure", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "protection", " ", "from", " ", "modification", ",", " ", "whi", "le", " ", "still", " ", "allow", "ing", " ", "for", " ", "an", " ", "enumeration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "have", " ", "member", "s", " ", "named", " ", "`", "name", "`", " ", "and", " ", "`", "value", "`.", " ", " ", "Thi", "s", " ", "works", " ", "bec", "aus", "e", " ", "enumeration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "member", "s", " ", "are", " ", "not", " ", "set", " ", "direct", "ly", " ", "on", " ", "the", " ", "enum", " ", "class", " ", "--", " ", "\\u\\u", "getattr", "\\u\\u", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "to", " ", "look", " ", "them", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "enum", "\\u", "dict_", "[_", "'", "value", "'_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Enum_", "=_", "Enum", "Meta_", "(_", "'", "Enum", "'_", ",_", "(_", "object_", ",_", ")_", ",_", "temp", "\\u", "enum", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "temp", "\\u", "enum", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enum", " ", "has", " ", "now", " ", "bee", "n", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "cmp", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "other_", ")_", "is_", "self_", "._", "\\u\\u", "class\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "is_", "other_", ":_", "\\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_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "\"", "uno", "rder", "able", " ", "types", ":", " ", "%", "s", "()", " ", "and", " ", "%", "s", "()\"_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "other_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
marionmari/pyGPs/pyGPs/Core/cov.py
[ { "content": " def getCovMatrix(self,x=None,z=None,mode=None):\n self.checkInputGetCovMatrix(x,z,mode)\n Q = self.para[0]\n if mode == 'self_test':\n nn, D = z.shape\n else:\n nn, D = x.shape\n assert Q == old_div(len(self.hyp), (1 + 2 * D))\n\n w = np.exp(self.hyp[:Q])\n m = np.exp(np.reshape(self.hyp[Q:Q + Q * D], (D, Q)))\n v = np.exp(2 * np.reshape(self.hyp[Q + Q * D:], (D, Q)))\n\n if mode == 'self_test': # self covariances for the test cases\n d2 = np.zeros((nn, 1, D))\n elif mode == 'train': # compute covariance matix for dataset x\n d2 = np.zeros((nn, nn, D))\n for j in range(D):\n xslice = np.atleast_2d(x[:, j]).T\n d2[:, :, j] = spdist.cdist(xslice, xslice, 'sqeuclidean')\n elif mode == 'cross': # compute covariance between data sets x and z\n d2 = np.zeros((nn, z.shape[0], D))\n for j in range(D):\n xslice = np.atleast_2d(x[:, j]).T\n zslice = np.atleast_2d(z[:, j]).T\n d2[:, :, j] = spdist.cdist(xslice, zslice, 'sqeuclidean')\n d = np.sqrt(d2)\n\n k = lambda d2v_dm: np.exp(-2 * np.pi ** 2 * d2v_dm[0]) * np.cos(2* np.pi * d2v_dm[1]) # evaluation of the covariance\n km = lambda dm: -2 * np.pi * np.tan(2 * np.pi * dm) * dm # remainder when differentiating w.r.t. m\n kv = lambda d2v: -d2v * (2 * np.pi) ** 2 # remainder when differentiating w.r.t. v\n\n A = 0.\n c = 1.\n qq = list(range(Q))\n for q in qq:\n C = w[q] * c\n for j in range(D):\n C = C * k((d2[:, :, j] * v[j, q], d[:, :, j] * m[j, q]))\n A = A + C\n return A", "metadata": "root.SM.getCovMatrix", "header": "['class', 'SM', '(', 'Kernel', ')', ':', '___EOS___']", "index": 520 } ]
[ { "span": "km ", "start_line": 549, "start_column": 8, "end_line": 549, "end_column": 10 }, { "span": "kv ", "start_line": 550, "start_column": 8, "end_line": 550, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "SM_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Cov", "Matrix_", "(_", "self_", ",_", "x_", "=_", "None_", ",_", "z_", "=_", "None_", ",_", "mode_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "Inp", "ut", "Get", "Cov", "Matrix_", "(_", "x_", ",_", "z_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Q_", "=_", "self_", "._", "para_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mode_", "==_", "'", "self", "\\u", "test", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nn_", ",_", "D_", "=_", "z_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nn_", ",_", "D_", "=_", "x_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "Q_", "==_", "old", "\\u", "div_", "(_", "len_", "(_", "self_", "._", "hyp", "_", ")_", ",_", "(_", "1_", "+_", "2_", "*_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "np_", "._", "exp_", "(_", "self_", "._", "hyp", "_", "[_", ":_", "Q_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "np_", "._", "exp_", "(_", "np_", "._", "reshape_", "(_", "self_", "._", "hyp", "_", "[_", "Q_", ":_", "Q_", "+_", "Q_", "*_", "D_", "]_", ",_", "(_", "D_", ",_", "Q_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "np_", "._", "exp_", "(_", "2_", "*_", "np_", "._", "reshape_", "(_", "self_", "._", "hyp", "_", "[_", "Q_", "+_", "Q_", "*_", "D_", ":_", "]_", ",_", "(_", "D_", ",_", "Q_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mode_", "==_", "'", "self", "\\u", "test", "'_", ":_", "#", " ", "self", " ", "covariance", "s", " ", "for", " ", "the", " ", "test", " ", "cases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d2_", "=_", "np_", "._", "zeros_", "(_", "(_", "nn_", ",_", "1_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "train", "'_", ":_", "#", " ", "compute", " ", "covariance", " ", "mati", "x", " ", "for", " ", "dataset", " ", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d2_", "=_", "np_", "._", "zeros_", "(_", "(_", "nn_", ",_", "nn_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xsl", "ice_", "=_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "x_", "[_", ":_", ",_", "j_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "[_", ":_", ",_", ":_", ",_", "j_", "]_", "=_", "spd", "ist_", "._", "cdi", "st_", "(_", "xsl", "ice_", ",_", "xsl", "ice_", ",_", "'", "sq", "euclidean", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "cross", "'_", ":_", "#", " ", "compute", " ", "covariance", " ", "bet", "ween", " ", "data", " ", "sets", " ", "x", " ", "and", " ", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d2_", "=_", "np_", "._", "zeros_", "(_", "(_", "nn_", ",_", "z_", "._", "shape_", "[_", "0_", "]_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xsl", "ice_", "=_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "x_", "[_", ":_", ",_", "j_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zs", "lice", "_", "=_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "z_", "[_", ":_", ",_", "j_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "[_", ":_", ",_", ":_", ",_", "j_", "]_", "=_", "spd", "ist_", "._", "cdi", "st_", "(_", "xsl", "ice_", ",_", "zs", "lice", "_", ",_", "'", "sq", "euclidean", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "np_", "._", "sqrt_", "(_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "lambda_", "d2", "v", "\\u", "dm_", ":_", "np_", "._", "exp_", "(_", "-_", "2_", "*_", "np_", "._", "pi_", "**_", "2_", "*_", "d2", "v", "\\u", "dm_", "[_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "2_", "*_", "np_", "._", "pi_", "*_", "d2", "v", "\\u", "dm_", "[_", "1_", "]_", ")_", "#", " ", "evaluat", "ion", " ", "of", " ", "the", " ", "covariance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", "=_", "lambda_", "dm_", ":_", "-_", "2_", "*_", "np_", "._", "pi_", "*_", "np_", "._", "tan_", "(_", "2_", "*_", "np_", "._", "pi_", "*_", "dm_", ")_", "*_", "dm_", "#", " ", "remainder", " ", "whe", "n", " ", "different", "iati", "ng", " ", "w", ".", "r", ".", "t", ".", " ", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv_", "=_", "lambda_", "d2", "v_", ":_", "-_", "d2", "v_", "*_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", "**_", "2_", "#", " ", "remainder", " ", "whe", "n", " ", "different", "iati", "ng", " ", "w", ".", "r", ".", "t", ".", " ", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qq", "_", "=_", "list_", "(_", "range_", "(_", "Q_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q_", "in_", "qq", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "=_", "w_", "[_", "q_", "]_", "*_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "=_", "C_", "*_", "k_", "(_", "(_", "d2_", "[_", ":_", ",_", ":_", ",_", "j_", "]_", "*_", "v_", "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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 ]
Unused local variable
EasyEngine/easyengine/ee/cli/plugins/debug.py
[ { "content": " @expose(hide=True)\n def debug_wp(self):\n \"\"\"Start/Stop WordPress debug\"\"\"\n if (self.app.pargs.wp == 'on' and self.app.pargs.site_name):\n wp_config = (\"{0}/{1}/wp-config.php\"\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name))\n webroot = \"{0}{1}\".format(EEVariables.ee_webroot,\n self.app.pargs.site_name)\n # Check wp-config.php file into htdocs folder\n if not os.path.isfile(wp_config):\n wp_config = (\"{0}/{1}/htdocs/wp-config.php\"\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name))\n if os.path.isfile(wp_config):\n if not EEShellExec.cmd_exec(self, \"grep \\\"\\'WP_DEBUG\\'\\\" {0} |\"\n \" grep true\".format(wp_config)):\n Log.info(self, \"Starting WordPress debug\")\n open(\"{0}/htdocs/wp-content/debug.log\".format(webroot),\n encoding='utf-8', mode='a').close()\n EEShellExec.cmd_exec(self, \"chown {1}: {0}/htdocs/wp-\"\n \"content/debug.log\"\n \"\".format(webroot,\n EEVariables.ee_php_user))\n EEShellExec.cmd_exec(self, \"sed -i \\\"s/define(\\'WP_DEBUG\\'\"\n \".*/define(\\'WP_DEBUG\\', true);\\\\n\"\n \"define(\\'WP_DEBUG_DISPLAY\\', false);\"\n \"\\\\ndefine(\\'WP_DEBUG_LOG\\', true);\"\n \"\\\\ndefine(\\'SAVEQUERIES\\', true);/\\\"\"\n \" {0}\".format(wp_config))\n EEShellExec.cmd_exec(self, \"cd {0}/htdocs/ && wp\"\n \" plugin --allow-root install \"\n \"developer query-monitor\"\n .format(webroot))\n EEShellExec.cmd_exec(self, \"chown -R {1}: {0}/htdocs/\"\n \"wp-content/plugins\"\n .format(webroot,\n EEVariables.ee_php_user))\n\n self.msg = self.msg + ['{0}{1}/htdocs/wp-content'\n '/debug.log'\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name)]\n\n else:\n Log.info(self, \"Unable to find wp-config.php for site: {0}\"\n .format(self.app.pargs.site_name))\n\n elif (self.app.pargs.wp == 'off' and self.app.pargs.site_name):\n wp_config = (\"{0}{1}/wp-config.php\"\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name))\n webroot = \"{0}{1}\".format(EEVariables.ee_webroot,\n self.app.pargs.site_name)\n # Check wp-config.php file into htdocs folder\n if not os.path.isfile(wp_config):\n wp_config = (\"{0}/{1}/htdocs/wp-config.php\"\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name))\n if os.path.isfile(wp_config):\n if EEShellExec.cmd_exec(self, \"grep \\\"\\'WP_DEBUG\\'\\\" {0} | \"\n \"grep true\".format(wp_config)):\n Log.info(self, \"Disabling WordPress debug\")\n EEShellExec.cmd_exec(self, \"sed -i \\\"s/define(\\'WP_DEBUG\\'\"\n \", true);/define(\\'WP_DEBUG\\', \"\n \"false);/\\\" {0}\".format(wp_config))\n EEShellExec.cmd_exec(self, \"sed -i \\\"/define(\\'\"\n \"WP_DEBUG_DISPLAY\\', false);/d\\\" {0}\"\n .format(wp_config))\n EEShellExec.cmd_exec(self, \"sed -i \\\"/define(\\'\"\n \"WP_DEBUG_LOG\\', true);/d\\\" {0}\"\n .format(wp_config))\n EEShellExec.cmd_exec(self, \"sed -i \\\"/define(\\'\"\n \"SAVEQUERIES\\', \"\n \"true);/d\\\" {0}\".format(wp_config))\n else:\n Log.info(self, \"WordPress debug all already disabled\")\n else:\n Log.error(self, \"Missing argument site name\")", "metadata": "root.EEDebugController.debug_wp", "header": "['class', 'EEDebugController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 442 } ]
[ { "span": "webroot ", "start_line": 494, "start_column": 12, "end_line": 494, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "EE", "Deb", "ug", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\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_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "debug", "\\u", "wp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "/", "Sto", "p", " ", "Word", "Press", " ", "debug", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "wp_", "==_", "'", "on", "'_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp", "\\u", "config_", "=_", "(_", "\"{", "0", "}/", "{", "1", "}/", "wp", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webr", "oot_", "=_", "\"{", "0", "}{", "1", "}\"_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "wp", "-", "config", ".", "php", " ", "file", " ", "int", "o", " ", "ht", "docs", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "wp", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp", "\\u", "config_", "=_", "(_", "\"{", "0", "}/", "{", "1", "}/", "ht", "docs", "/", "wp", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "wp", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "grep", " ", "\\\\\"", "\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'\\\\", "\"", " ", "{", "0", "}", " ", "|\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "grep", " ", "true", "\"_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Start", "ing", " ", "Word", "Press", " ", "debug", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "\"{", "0", "}/", "ht", "docs", "/", "wp", "-", "content", "/", "debug", ".", "log", "\"_", "._", "format_", "(_", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "a", "'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "chown", " ", "{", "1", "}:", " ", "{", "0", "}/", "ht", "docs", "/", "wp", "-\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "content", "/", "debug", ".", "log", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "._", "format_", "(_", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EE", "Variables_", "._", "ee", "\\u", "php", "\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "sed", " ", "-", "i", " ", "\\\\\"", "s", "/", "defin", "e", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\".*", "/", "defin", "e", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'", ",", " ", "true", ");", "\\\\\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "defin", "e", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\u", "DISPLAY", "\\\\'", ",", " ", "fal", "se", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\\\\\", "ndef", "ine", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\u", "LOG", "\\\\'", ",", " ", "true", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\\\\\", "ndef", "ine", "(\\\\'", "SAVE", "QUE", "RIE", "S", "\\\\'", ",", " ", "true", ");", "/\\\\", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "cd", " ", "{", "0", "}/", "ht", "docs", "/", " ", "&&", " ", "wp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "plugin", " ", "--", "allow", "-", "root", " ", "install", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "developer", " ", "query", "-", "monit", "or", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "webr", "oot_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "chown", " ", "-", "R", " ", "{", "1", "}:", " ", "{", "0", "}/", "ht", "docs", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wp", "-", "content", "/", "plugin", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EE", "Variables_", "._", "ee", "\\u", "php", "\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "msg_", "=_", "self_", "._", "msg_", "+_", "[_", "'{", "0", "}{", "1", "}/", "ht", "docs", "/", "wp", "-", "content", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "debug", ".", "log", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "]_", "\\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 ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "find", " ", "wp", "-", "config", ".", "php", " ", "for", " ", "site", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "wp_", "==_", "'", "off", "'_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp", "\\u", "config_", "=_", "(_", "\"{", "0", "}{", "1", "}/", "wp", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webr", "oot_", "=_", "\"{", "0", "}{", "1", "}\"_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "wp", "-", "config", ".", "php", " ", "file", " ", "int", "o", " ", "ht", "docs", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "wp", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp", "\\u", "config_", "=_", "(_", "\"{", "0", "}/", "{", "1", "}/", "ht", "docs", "/", "wp", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "wp", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "grep", " ", "\\\\\"", "\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'\\\\", "\"", " ", "{", "0", "}", " ", "|", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "grep", " ", "true", "\"_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Disa", "blin", "g", " ", "Word", "Press", " ", "debug", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "sed", " ", "-", "i", " ", "\\\\\"", "s", "/", "defin", "e", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "true", ");", "/", "defin", "e", "(\\\\'", "WP", "\\u", "DEBU", "G", "\\\\'", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fal", "se", ");", "/\\\\", "\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "sed", " ", "-", "i", " ", "\\\\\"", "/", "defin", "e", "(\\\\'", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WP", "\\u", "DEBU", "G", "\\u", "DISPLAY", "\\\\'", ",", " ", "fal", "se", ");", "/", "d", "\\\\\"", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "sed", " ", "-", "i", " ", "\\\\\"", "/", "defin", "e", "(\\\\'", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WP", "\\u", "DEBU", "G", "\\u", "LOG", "\\\\'", ",", " ", "true", ");", "/", "d", "\\\\\"", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "sed", " ", "-", "i", " ", "\\\\\"", "/", "defin", "e", "(\\\\'", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SAVE", "QUE", "RIE", "S", "\\\\'", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "true", ");", "/", "d", "\\\\\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "wp", "\\u", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Word", "Press", " ", "debug", " ", "all", " ", "alr", "ead", "y", " ", "disable", "d", "\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Missing", " ", "argu", "ment", " ", "site", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
franapoli/pyleaf/pyleaf/ptl.py
[ { "content": " def export(self, ofile, layout='LR'):\n \"\"\"Exports the protocol to a pdf file.\"\"\"\n import textwrap\n #ofile = self._metafolder+'/'+ofile\n ofile = ofile\n f=open(ofile, 'w')\n f.write('digraph G {'+\n 'node [shape=box, style=rounded];'+\n 'rankdir='+\n ('TB' if layout.lower()=='tb' else 'LR')+\n ';')\n for idx, node in enumerate(self._getGraph().getNodes()):\n\n if self._isFileMod(node):\n shape = 'note'\n else:\n shape = 'box'\n\n f.write(str(node))\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n f.write('[shape = ' + shape + ', label = <<table border=\"0\"><tr><td><B>' +\n self._getGraph().getAttrib(node, 'label') +\n '</B></td></tr><tr><td align = \"left\"><font POINT-SIZE=\"10\">'+\n ('-' if docstr == None else textwrap.fill(docstr, 30)).replace('\\n','<br/>') +\n '</font></td></tr></table>>]\\n')\n for node in self._getGraph().keys():\n for onode in self._getGraph()[node]:\n f.write(node + ' -> ' + onode + '\\n')\n f.write('}')\n f.close()\n t=os.system('dot -Tpdf -o' + ofile + '.pdf ' + ofile)\n if t!=0:\n raise NameError('Problems running dot: have you installed it?')", "metadata": "root.protocol.export", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 261 }, { "content": " def publish(self, ofile, odir='', layout='LR'):\n \"\"\"Publish the protocol to a HTML file.\"\"\"\n import textwrap\n import os.path\n oname = ofile\n if odir == '':\n odir = 'html'\n if not os.path.exists(odir):\n os.mkdir(odir)\n fullname = os.path.join(odir, ofile)\n #ofile = os.path.join(self._metafolder, ofile)\n f=open(fullname+'.dot', 'w')\n f.write('digraph G {\\n'+\n 'graph [size=\"20, 20\"];\\n' +\n 'node [shape=box, style=rounded];'+\n 'rankdir='+\n ('TB' if layout.lower()=='tb' else 'LR')+\n ';\\n')\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write(str(node))\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n\n if self._isFileMod(node):\n shape = 'note'\n if self._isAvailable(node):\n content = self._getResource(node).getValue()\n if isinstance(content, tuple) or isinstance(content, list):\n output_line = '\\t\\t<td href=\"'+'(multiple)'+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td href=\"'+content+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td><font POINT-SIZE=\"8\"><u>not built</u></font></td>\\n' \n else:\n output_line='\\t\\t<td></td>\\n'\n shape = 'box'\n\n \n f.write('[shape = ' + shape + ', label = <<table border=\"0\">\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\"><B>' +\n self._getGraph().getAttrib(node, 'label') +\n '</B></td>\\n'+\n '\\t</tr>\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\" align = \"left\"><font POINT-SIZE=\"10\">'+\n ('-' if docstr == None else textwrap.fill(docstr, 30)).replace('\\n','<br/>') +\n '</font></td>\\n'+\n '\\t</tr>\\n' +\n '\\t<tr>\\n'+\n '\\t\\t<td href=\"#'+node+'_details\"><font POINT-SIZE=\"8\"><u>details</u></font></td>\\n'+\n output_line +\n '\\t</tr>\\n'+\n '</table>>]\\n')\n for node in self._getGraph().keys():\n for onode in self._getGraph()[node]:\n f.write(node + ' -> ' + onode + '\\n')\n f.write('}')\n f.close()\n t=os.system('dot -s160 -Tcmapx -o' +\n fullname + '.map -Tgif -o' + fullname + '.gif ' + fullname + '.dot')\n t=os.system('dot -Tpdf -o' + fullname + '.pdf ' + fullname + '.dot')\n\n if t!=0:\n raise NameError('Problems running dot: have you installed it?')\n\n\n\n\n\n html_header = \"\"\"\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>\"\"\" + oname + \"\"\"</title>\n<meta http-equiv=\"Content-Language\" content=\"English\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" media=\"screen\" />\n</head>\n<body>\n\n<div id=\"wrap\">\n<div id=\"top\"></div>\n<div id=\"content\">\n\n<div class=\"header\">\n<a href=\"index.html\"><img src=\"leaf.png\"></a>\n<br><br><br><br><br>\n</div>\t\n\n\"\"\"\n\n html_footer = \"\"\"\n</body>\n</html>\n\"\"\"\n\n\n f = open(fullname+'.html', 'w')\n f.write(html_header)\n f.write('<div class=\"breadcrumbs\"><h1>' + oname + '</h1></div><div class=\"middle\">')\n f.write('<h2>Project Summary</h2>')\n f.write('<div style=\"width: 90%\">')\n if len(self._doc)>0:\n f.write('<b>Description:</b> ' + self._doc + '<br>')\n f.write('<b>Number of Modules:</b> ' + str(len(self._getGraph())) + '<br>')\n f.write('<b>Number of Output modules:</b> ' + str(sum([self._isFileMod(node) for node in self._getGraph().getNodes()]))+'<br>')\n f.write('<b>Total CPU time required:</b> '+ self._readabletime(sum([self._resmap[x]._buildtime for x in self._resmap]))+'<br>')\n f.write('</div><br>')\n f.write('<h2>Protocol map</h2>')\n f.write('<div align = \"center\">')\n f.write('<IMG SRC=\"' + oname + '.gif\" USEMAP=\"#G\" />\\n')\n f.write('</div>')\n map = open(fullname + '.map').read()\n f.write(map)\n\n f.write('<h2>Modules'' details<h2>\\n')\n\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write('<h3><a name=\"'+str(node)+'_details\">'+str(node)+'</a></h3>\\n')\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n if docstr == None:\n f.write('[documentation not available]')\n else:\n f.write(docstr)\n \n if not self._resmap[node]._timestamp == None:\n tstamp = self._resmap[node]._timestamp\n btime = self._resmap[node]._buildtime\n else:\n tstamp = 'never'\n btime = 'uknknown'\n\n f.write('<br><br>Last build was on ' + tstamp + '.<br>')\n f.write('Time it took: ' + str(self._readabletime(btime)) + '.<br>')\n \n\n f.write('<div class=\"code\"><pre>')\n srccode = inspect.getsource(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n f.write(srccode.replace('\\n','<br>'))\n f.write('</pre></div>')\n f.write('<hr>')\n\n\n f.write('<div id=\"footer\">')\n f.write('<br><br><i>Automatically generated on ' + time.asctime() + ' using Leaf</i>')\n f.write('</div>')\n f.write(html_footer)\n f.close()\n\n try:\n ## copying external resources\n from pkg_resources import resource_filename\n stylef = resource_filename('pyleaf', 'resources/style.css')\n logof = resource_filename('pyleaf', 'resources/leaf.png')\n\n #stylef = os.path.join(sys.prefix, 'style.css')\n #logof = os.path.join(sys.prefix, 'leaf.png')\n\n import shutil\n shutil.copy(stylef, odir)\n shutil.copy(logof, odir)\n except:\n print('Couldn\\'t copy resource files. HTML file will miss style and logo.')", "metadata": "root.protocol.publish", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 300 }, { "content": " def _manageGraphChange(self, newGraph):\n if newGraph==None:\n return\n #checking for change in graph structure\n #a node is flagged as to-be-untrustest if its inputs have changed\n #not untrusted on the fly because of dependancies with untrusts\n #from source code changes\n oldg = self._graphres.getValue()\n untrustme = list()\n# import pdb; pdb.set_trace()\n\n for node in newGraph.getNodes():\n #check wether node is (not) new\n if node in oldg.getNodes():\n #check if node inputs have changed\n innodes1 = newGraph.getInNodes(node)\n innodes2 = oldg.getInNodes(node)\n for inNode in innodes1:\n if not inNode in innodes2:\n dbgstr('Inputs to ' + node + ' have changed, untrusting it.')\n untrustme.append(node)\n #check if node properties have changed \n #cycling through attrib names of node 'node'\n # for attrib in [a[1] for a in newGraph._nodeattribs if a[0]==node]:\n # if newGraph.getAttrib(node, attrib) != oldg.getAttrib(node, attrib):\n # dbgstr('Node attribs of ' + node +\n # ' have changed, untrusting it.')\n # untrustme.append(node) \n\n return untrustme", "metadata": "root.protocol._manageGraphChange", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 605 }, { "content": " def _buildResName(self, inode, onode, rawres):\n if onode == None:\n return inode\n else:\n return inode", "metadata": "root.protocol._buildResName", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 910 }, { "content": " def _isFileMod(self, node):\n flags = self._getGraph().getAttrib(node, 'LEAF_FLAGS')\n if flags == None:\n return False\n return 'f' in flags or 'F' in flags", "metadata": "root.protocol._isFileMod", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 917 }, { "content": " def _ChangeME_resToPath(self, res):\n if self._getGraph().getAttrib(res[0], 'hashout'):\n if res[0] == None: first_part = ''\n else: first_part = res[0]\n if res[1] == None: second_part = ''\n else: second_part = res[1]\n if first_part != '' and second_part !='':\n mid_part = 'TO'\n else: mid_part = ''\n \n fname = first_part + mid_part + second_part + '.dmp'\n else:\n fname = res[0]\n \n dbgstr('Dump file for resource ' + str(res) + ' is ' + self._metafolder + '/' + fname, 2)\n return self._metafolder + '/' + fname", "metadata": "root.protocol._ChangeME_resToPath", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 988 } ]
[ { "span": "docstr == None ", "start_line": 284, "start_column": 27, "end_line": 284, "end_column": 41 }, { "span": "docstr == None ", "start_line": 345, "start_column": 27, "end_line": 345, "end_column": 41 }, { "span": "docstr == None:", "start_line": 420, "start_column": 15, "end_line": 420, "end_column": 29 }, { "span": "self._resmap[node]._timestamp == None:", "start_line": 425, "start_column": 19, "end_line": 425, "end_column": 56 }, { "span": "newGraph==None:", "start_line": 606, "start_column": 11, "end_line": 606, "end_column": 25 }, { "span": "onode == None:", "start_line": 911, "start_column": 11, "end_line": 911, "end_column": 24 }, { "span": "flags == None:", "start_line": 919, "start_column": 11, "end_line": 919, "end_column": 24 }, { "span": "res[0] == None:", "start_line": 990, "start_column": 15, "end_line": 990, "end_column": 29 }, { "span": "res[1] == None:", "start_line": 992, "start_column": 15, "end_line": 992, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export_", "(_", "self_", ",_", "ofile_", ",_", "layout_", "=_", "'", "LR", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Export", "s", " ", "the", " ", "protoc", "ol", " ", "to", " ", "a", " ", "pdf", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ofi", "le", " ", "=", " ", "self", ".\\u", "metaf", "older", "+'", "/'", "+", "ofile_", "\\u\\u\\uNL\\u\\u\\u_", "ofile_", "=_", "ofile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "ofile_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "digraph", " ", "G", " ", "{'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", " ", "[", "shape", "=", "box", ",", " ", "style", "=", "rounded", "];", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rank", "dir", "='_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "TB", "'_", "if_", "layout_", "._", "lower_", "(_", ")_", "==_", "'", "tb", "'_", "else_", "'", "LR", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "';'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "'", "note", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "'", "box", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "str_", "(_", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'[", "shape", " ", "=", " ", "'_", "+_", "shape_", "+_", "',", " ", "label", " ", "=", " ", "<<", "table", " ", "border", "=\"", "0", "\">", "<", "tr", "><", "td", "><", "B", ">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "node_", ",_", "'", "label", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "B", "><", "/", "td", "><", "/", "tr", "><", "tr", "><", "td", " ", "align", " ", "=", " ", "\"", "left", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "10", "\">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'-'_", "if_", "docstr", "_", "==_", "None_", "else_", "textwrap_", "._", "fill_", "(_", "docstr", "_", ",_", "30_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", "/>'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "font", "><", "/", "td", "><", "/", "tr", "><", "/", "table", ">>", "]\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ono", "de_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "[_", "node_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "node_", "+_", "'", " ", "->", " ", "'_", "+_", "ono", "de_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "Tp", "df", " ", "-", "o", "'_", "+_", "ofile_", "+_", "'.", "pdf", " ", "'_", "+_", "ofile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "'", "Problems", " ", "runn", "ing", " ", "dot", ":", " ", "have", " ", "you", " ", "install", "ed", " ", "it", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publish_", "(_", "self_", ",_", "ofile_", ",_", "odi", "r_", "=_", "''_", ",_", "layout_", "=_", "'", "LR", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Publish", " ", "the", " ", "protoc", "ol", " ", "to", " ", "a", " ", "HTM", "L", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ona", "me_", "=_", "ofile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "odi", "r_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "odi", "r_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "odi", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "odi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fullname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "odi", "r_", ",_", "ofile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ofi", "le", " ", "=", " ", "os", ".", "path", ".", "join", "(", "self", ".\\u", "metaf", "older", ",", " ", "ofi", "le", ")_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "fullname_", "+_", "'.", "dot", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "digraph", " ", "G", " ", "{\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "graph", " ", "[", "size", "=\"", "20", ",", " ", "20", "\"]", ";\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", " ", "[", "shape", "=", "box", ",", " ", "style", "=", "rounded", "];", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rank", "dir", "='_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "TB", "'_", "if_", "layout_", "._", "lower_", "(_", ")_", "==_", "'", "tb", "'_", "else_", "'", "LR", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "';", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "str_", "(_", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "'", "note", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "Available_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "=_", "self_", "._", "\\u", "get", "Resource_", "(_", "node_", ")_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "content_", ",_", "tuple_", ")_", "or_", "isinstance_", "(_", "content_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"'_", "+_", "'(", "multiple", ")'_", "+_", "'\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "output", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "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 ", " ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"'_", "+_", "content_", "+_", "'\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "output", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "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 ", " ", "_", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", "><", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "not", " ", "bui", "lt", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "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 ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", "><", "/", "td", ">\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "'", "box", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'[", "shape", " ", "=", " ", "'_", "+_", "shape_", "+_", "',", " ", "label", " ", "=", " ", "<<", "table", " ", "border", "=\"", "0", "\">", "\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "colsp", "an", "=\"", "2", "\">", "<", "B", ">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "node_", ",_", "'", "label", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "B", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "colsp", "an", "=\"", "2", "\"", " ", "align", " ", "=", " ", "\"", "left", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "10", "\">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'-'_", "if_", "docstr", "_", "==_", "None_", "else_", "textwrap_", "._", "fill_", "(_", "docstr", "_", ",_", "30_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", "/>'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"", "#'_", "+_", "node_", "+_", "'\\u", "deta", "il", "s", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "deta", "il", "s", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "line_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "table", ">>", "]\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ono", "de_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "[_", "node_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "node_", "+_", "'", " ", "->", " ", "'_", "+_", "ono", "de_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "s1", "60", " ", "-", "Tc", "map", "x", " ", "-", "o", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "fullname_", "+_", "'.", "map", " ", "-", "Tg", "if", " ", "-", "o", "'_", "+_", "fullname_", "+_", "'.", "gif", " ", "'_", "+_", "fullname_", "+_", "'.", "dot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "Tp", "df", " ", "-", "o", "'_", "+_", "fullname_", "+_", "'.", "pdf", " ", "'_", "+_", "fullname_", "+_", "'.", "dot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "t_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "'", "Problems", " ", "runn", "ing", " ", "dot", ":", " ", "have", " ", "you", " ", "install", "ed", " ", "it", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "\\u", "header_", "=_", "\"\"\"", "\\", "10", ";<", "!", "DOC", "TYPE", " ", "html", " ", "PUBLIC", " ", "\"-", "//", "W3", "C", "//", "DT", "D", " ", "XH", "TML", " ", "1.0", " ", "Stri", "ct", "//", "EN", "\"", " ", "\"", "http", "://", "www", ".", "w3", ".", "org", "/", "TR", "/", "xh", "tml", "1", "/", "DT", "D", "/", "xh", "tml", "1", "-", "strict", ".", "dtd", "\">", "\\", "10", ";<", "html", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xh", "tml", "\">", "\\", "10", ";<", "head", ">", "\\", "10", ";<", "title", ">\"\"\"_", "+_", "ona", "me_", "+_", "\"\"\"", "</", "title", ">", "\\", "10", ";<", "meta", " ", "http", "-", "equiv", "=\"", "Conten", "t", "-", "Lang", "ua", "ge", "\"", " ", "content", "=\"", "Eng", "lish", "\"", " ", "/>", "\\", "10", ";<", "meta", " ", "http", "-", "equiv", "=\"", "Conten", "t", "-", "Type", "\"", " ", "content", "=\"", "text", "/", "html", ";", " ", "charset", "=", "UT", "F", "-", "8", "\"", " ", "/>", "\\", "10", ";<", "link", " ", "rel", "=\"", "stylesheet", "\"", " ", "type", "=\"", "text", "/", "css", "\"", " ", "href", "=\"", "style", ".", "css", "\"", " ", "media", "=\"", "screen", "\"", " ", "/>", "\\", "10", ";<", "/", "head", ">", "\\", "10", ";<", "body", ">", "\\", "10", ";", "\\", "10", ";<", "div", " ", "id", "=\"", "wrap", "\">", "\\", "10", ";<", "div", " ", "id", "=\"", "top", "\">", "</", "div", ">", "\\", "10", ";<", "div", " ", "id", "=\"", "content", "\">", "\\", "10", ";", "\\", "10", ";<", "div", " ", "class", "=\"", "header", "\">", "\\", "10", ";<", "a", " ", "href", "=\"", "index", ".", "html", "\">", "<", "img", " ", "src", "=\"", "leaf", ".", "png", "\">", "</", "a", ">", "\\", "10", ";<", "br", "><", "br", "><", "br", "><", "br", "><", "br", ">", "\\", "10", ";<", "/", "div", ">", "\t", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "footer_", "=_", "\"\"\"", "\\", "10", ";<", "/", "body", ">", "\\", "10", ";<", "/", "html", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "fullname_", "+_", "'.", "html", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "html", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "class", "=\"", "breadcrumb", "s", "\">", "<", "h1", ">'_", "+_", "ona", "me_", "+_", "'<", "/", "h1", "><", "/", "div", "><", "div", " ", "class", "=\"", "middle", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Project", " ", "Summ", "ary", "</", "h2", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "style", "=\"", "widt", "h", ":", " ", "90", "%", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "doc_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'<", "b", ">", "Descripti", "on", ":", "</", "b", ">", " ", "'_", "+_", "self_", "._", "\\u", "doc_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Number", " ", "of", " ", "Modul", "es", ":", "</", "b", ">", " ", "'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Number", " ", "of", " ", "Output", " ", "module", "s", ":", "</", "b", ">", " ", "'_", "+_", "str_", "(_", "sum_", "(_", "[_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", "]_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Total", " ", "CPU", " ", "time", " ", "require", "d", ":", "</", "b", ">", " ", "'_", "+_", "self_", "._", "\\u", "reada", "ble", "time_", "(_", "sum_", "(_", "[_", "self_", "._", "\\u", "res", "map_", "[_", "x_", "]_", "._", "\\u", "build", "time_", "for_", "x_", "in_", "self_", "._", "\\u", "res", "map_", "]_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", "><", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Proto", "col", " ", "map", "</", "h2", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "align", " ", "=", " ", "\"", "center", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "IMG", " ", "SR", "C", "=\"'_", "+_", "ona", "me_", "+_", "'.", "gif", "\"", " ", "USE", "MAP", "=\"", "#", "G", "\"", " ", "/>", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "open_", "(_", "fullname_", "+_", "'.", "map", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Modul", "es", "'_", "'", " ", "deta", "il", "s", "<", "h2", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'<", "h", "3", "><", "a", " ", "name", "=\"'_", "+_", "str_", "(_", "node_", ")_", "+_", "'\\u", "deta", "il", "s", "\">'_", "+_", "str_", "(_", "node_", ")_", "+_", "'<", "/", "a", "><", "/", "h", "3", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "docstr", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'[", "documentation", " ", "not", " ", "avail", "able", "]'_", ")_", "\\u\\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_", "._", "write_", "(_", "docstr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "timestamp_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "mp_", "=_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bt", "ime_", "=_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "build", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "mp_", "=_", "'", "neve", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bt", "ime_", "=_", "'", "uk", "nk", "now", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "br", "><", "br", ">", "Las", "t", " ", "build", " ", "was", " ", "on", " ", "'_", "+_", "tsta", "mp_", "+_", "'.", "<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "Time", " ", "it", " ", "too", "k", ":", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "reada", "ble", "time_", "(_", "bt", "ime_", ")_", ")_", "+_", "'.", "<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "class", "=\"", "code", "\">", "<", "pre", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "code_", "=_", "inspect_", "._", "gets", "ource_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "src", "code_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", ">'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "pre", "><", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "hr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "id", "=\"", "footer", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "br", "><", "br", "><", "i", ">", "Automat", "ical", "ly", " ", "generat", "ed", " ", "on", " ", "'_", "+_", "time_", "._", "asc", "time_", "(_", ")_", "+_", "'", " ", "usi", "ng", " ", "Lea", "f", "</", "i", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "html", "\\u", "footer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "copy", "ing", " ", "external", " ", "resources_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pkg", "\\u", "resources_", "import_", "resource", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "f_", "=_", "resource", "\\u", "filename_", "(_", "'", "pyl", "ea", "f", "'_", ",_", "'", "resource", "s", "/", "style", ".", "css", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logo", "f_", "=_", "resource", "\\u", "filename_", "(_", "'", "pyl", "ea", "f", "'_", ",_", "'", "resource", "s", "/", "leaf", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "style", "f", " ", "=", " ", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", " ", "'", "style", ".", "css", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logo", "f", " ", "=", " ", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", " ", "'", "leaf", ".", "png", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "style", "f_", ",_", "odi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "logo", "f_", ",_", "odi", "r_", ")_", "\\u\\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_", "(_", "'", "Cou", "ld", "n", "\\\\'", "t", " ", "copy", " ", "resource", " ", "files", ".", " ", "HTM", "L", " ", "file", " ", "will", " ", "miss", " ", "style", " ", "and", " ", "logo", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "manage", "Graph", "Change_", "(_", "self_", ",_", "new", "Graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "Graph_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "checking", " ", "for", " ", "change", " ", "in", " ", "graph", " ", "structure_", "\\u\\u\\uNL\\u\\u\\u_", "#", "a", " ", "node", " ", "is", " ", "flagged", " ", "as", " ", "to", "-", "be", "-", "untr", "uste", "st", " ", "if", " ", "its", " ", "inputs", " ", "have", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "not", " ", "untr", "uste", "d", " ", "on", " ", "the", " ", "fly", " ", "bec", "aus", "e", " ", "of", " ", "depend", "anci", "es", " ", "with", " ", "untr", "ust", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "source", " ", "code", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "g_", "=_", "self_", "._", "\\u", "graph", "res_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "import", " ", "pdb", ";", " ", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "new", "Graph_", "._", "get", "Nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "wet", "her", " ", "node", " ", "is", " ", "(", "not", ")", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "in_", "old", "g_", "._", "get", "Nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "node", " ", "inputs", " ", "have", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inno", "des", "1_", "=_", "new", "Graph_", "._", "get", "In", "Nodes_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inno", "des", "2_", "=_", "old", "g_", "._", "get", "In", "Nodes_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "in", "Node_", "in_", "inno", "des", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "in", "Node_", "in_", "inno", "des", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dbg", "str_", "(_", "'", "Inp", "uts", " ", "to", " ", "'_", "+_", "node_", "+_", "'", " ", "have", " ", "change", "d", ",", " ", "untr", "usti", "ng", " ", "it", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "node", " ", "proper", "ties", " ", "have", " ", "change", "d", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "cycl", "ing", " ", "through", " ", "attrib", " ", "names", " ", "of", " ", "node", " ", "'", "node", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "attrib", " ", "in", " ", "[", "a", "[", "1", "]", " ", "for", " ", "a", " ", "in", " ", "new", "Graph", ".\\u", "node", "attrib", "s", " ", "if", " ", "a", "[", "0", "]=", "=", "node", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "new", "Graph", ".", "get", "Attrib", "(", "node", ",", " ", "attrib", ")", " ", "!=", " ", "old", "g", ".", "get", "Attrib", "(", "node", ",", " ", "attrib", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "dbg", "str", "('", "Node", " ", "attrib", "s", " ", "of", " ", "'", " ", "+", " ", "node", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", " ", "have", " ", "change", "d", ",", " ", "untr", "usti", "ng", " ", "it", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "untr", "ust", "me", ".", "append", "(", "node", ")", " ", " _", "\\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_", "return_", "untr", "ust", "me_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\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", "build", "Res", "Name_", "(_", "self_", ",_", "inode_", ",_", "ono", "de_", ",_", "raw", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ono", "de_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "inode_", "\\u\\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_", "inode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\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", "is", "File", "Mod_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "node_", ",_", "'", "LEA", "F", "\\u", "FLAG", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flags_", "==_", "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_", "'", "f", "'_", "in_", "flags_", "or_", "'", "F", "'_", "in_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\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", "Change", "ME", "\\u", "res", "To", "Path_", "(_", "self_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "res_", "[_", "0_", "]_", ",_", "'", "hash", "out", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", "[_", "0_", "]_", "==_", "None_", ":_", "first", "\\u", "part_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "first", "\\u", "part_", "=_", "res_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "[_", "1_", "]_", "==_", "None_", ":_", "second", "\\u", "part_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "second", "\\u", "part_", "=_", "res_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first", "\\u", "part_", "!=_", "''_", "and_", "second", "\\u", "part_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mid", "\\u", "part_", "=_", "'", "TO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "mid", "\\u", "part_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", "=_", "first", "\\u", "part_", "+_", "mid", "\\u", "part_", "+_", "second", "\\u", "part_", "+_", "'.", "dmp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "res_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dbg", "str_", "(_", "'", "Dump", " ", "file", " ", "for", " ", "resource", " ", "'_", "+_", "str_", "(_", "res_", ")_", "+_", "'", " ", "is", " ", "'_", "+_", "self_", "._", "\\u", "metaf", "older_", "+_", "'/'_", "+_", "fname_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "metaf", "older_", "+_", "'/'_", "+_", "fname_", "\\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, 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, 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 ]
Unused import
OSCAAR/OSCAAR/oscaar/astrometry/trackSmooth.py
[ { "content": "'''oscaar v2.0 \n Module for differential photometry\n Developed by Brett Morris, 2011-2013'''\nimport numpy as np\nfrom numpy import linalg as LA\nimport pyfits\nfrom matplotlib import pyplot as plt\nimport matplotlib.cm as cm\nfrom scipy import ndimage, optimize\nfrom time import sleep\nimport shutil\nfrom glob import glob\nfrom re import split\nimport cPickle\nfrom shutil import copy\nimport os\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def quadraticFit(derivative,ext):\n '''\n Find an extremum in the data and use it and the points on either side, fit\n a quadratic function to the three points, and return the x-position of the \n apex of the best-fit parabola. \n \n Called by oscaar.trackSmooth()\n \n Parameters\n ----------\n derivative : numpy.ndarray\n The first derivative of the series of points, usually calculated by np.diff()\n \n ext : string \n Extremum to look find. May be either \"max\" or \"min\"\n \n Returns\n -------\n extremum : float\n The (non-integer) index where the extremum was found\n \n '''\n rangeOfFit = 1\n lenDer = len(derivative)/2\n if ext == \"max\":\n indExtrema = np.argmax(derivative[:lenDer])\n elif ext == \"min\":\n indExtrema = np.argmin(derivative[lenDer:])+lenDer\n\n fitPart = derivative[indExtrema-rangeOfFit:indExtrema+rangeOfFit+1]\n if len(fitPart) == 3:\n stackPolynomials = np.zeros([3,3])\n for i in range(0,len(fitPart)):\n stackPolynomials[i,:] = [i**2,i,1.0]\n estimatedCoeffs = np.dot(LA.inv(stackPolynomials),fitPart)\n d_fit = -estimatedCoeffs[1]/(2.0*estimatedCoeffs[0]) #d_fit = -b_fit/(2.*a_fit)\n extremum = d_fit+indExtrema-rangeOfFit\n else: \n extremum = indExtrema\n return extremum", "metadata": "root.quadraticFit", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def trackSmooth(image, est_x, est_y, smoothingConst, plottingThings, preCropped=False, zoom=20.0,plots=False):\n '''\n Method for tracking stellar centroids. \n \n Parameters\n ---------- \n image : numpy.ndarray\n FITS image read in by PyFITS\n \n est_x : float\n Inital estimate for the x-centroid of the star\n \n est_y : float\n Inital estimate for the y-centroid of the star\n \n smoothingConstant : float\n Controls the degree to which the raw stellar intensity profile will be smoothed by a Gaussian filter (0 = no smoothing)\n \n preCropped : bool\n If preCropped=False, image is assumed to be a raw image, if preCropped=True, image is assumed to be only the \n portion of the image near the star\n \n zoom : int or float\n How many pixels in each direction away from the estimated centroid to consider when tracking the centroid. Be \n sure to choose a large enough zoom value the stellar centroid in the next exposure will fit within the zoom\n \n plots : bool\n If plots=True, display stellar intensity profile in two axes and the centroid solution\n \n Returns\n ------- \n xCenter : float\n The best-fit x-centroid of the star\n \n yCenter : float\n The best-fit y-centroid of the star\n \n averageRadius : float\n Average radius of the SMOOTHED star in pixels\n \n errorFlag : bool\n Boolean corresponding to whether or not any error occured when running oscaar.trackSmooth(). If an \n error occured, the flag is True; otherwise False.\n \n Core developer: Brett Morris\n Modifications by: Luuk Visser, 2-12-2013\n '''\n '''If you have an interpolated grid as input, small inputs for smoothingConst\n it won't have any effect. Thus it has to be increased by the\n zoom factor you used to sub-pixel interpolate. \n \n np.e seems to give nice smoothing results if frame is already cut out, you can \n set preCropped to True, so the script won't cut a frame out again. '''\n try:\n\t if plots:\n\t [fig,subplotsDimensions,photSubplotsOffset] = plottingThings\n\t if preCropped:\n\t zoom = image.shape[0]/2\n\t est_x, est_y = 0,0\n\t target = image ## Assume image is pre-cropped image of the star\n\t else:\n\t #smoothingConst *= zoom/20 \n\t target = image[est_x-zoom:est_x+zoom,est_y-zoom:est_y+zoom] ## Crop image of just the target star\n\t \n\t #Save original (unsmoothed) data for plotting purposses\n\t if plots:\n\t target_orig = target.copy()\n\t axisA_orig = np.sum(target,axis=0) ## Take the sums of all values in each column,\n\t axisB_orig = np.sum(target,axis=1) ## then repeat for each row\n\t \n\t target = ndimage.gaussian_filter(target, sigma=smoothingConst,order=0)\n\t \n\t ## Sum columns\n\t axisA = np.sum(target,axis=0) ## Take the sums of all values in each column,\n\t axisB = np.sum(target,axis=1) ## then repeat for each row\n\t\n\t axisADeriv = np.diff(axisA) ## Find the differences between each pixel intensity and\n\t axisBDeriv = np.diff(axisB) ## the neighboring pixel (derivative of intensity profile)\n\t\n\t lenaxisADeriv = len(axisADeriv)\n\t lenaxisADeriv_2 = lenaxisADeriv/2\n\t lenaxisBDeriv = len(axisBDeriv)\n\t lenaxisBDeriv_2 = lenaxisBDeriv/2\n\t \n\t derivMinAind = np.where(axisADeriv == min(axisADeriv[lenaxisADeriv_2:lenaxisADeriv]))[0][0] ## Minimum in the derivative\n\t derivMinBind = np.where(axisBDeriv == min(axisBDeriv[lenaxisBDeriv_2:lenaxisBDeriv]))[0][0] ## of the intensity plot\n\t\n\t derivMaxAind = np.where(axisADeriv == max(axisADeriv[0:lenaxisADeriv_2]))[0][0] ## Maximum in the derivative\n\t derivMaxBind = np.where(axisBDeriv == max(axisBDeriv[0:lenaxisBDeriv_2]))[0][0] ## of the intensity plot\n\t\n\t extremumA = quadraticFit(axisADeriv,ext=\"max\")\n\t extremumB = quadraticFit(axisADeriv,ext=\"min\")\n\t extremumC = quadraticFit(axisBDeriv,ext=\"max\")\n\t extremumD = quadraticFit(axisBDeriv,ext=\"min\")\n\t\n\t averageRadius = (abs(derivMinAind-derivMaxAind)+ \\\n\t abs(derivMinBind-derivMaxBind))/4. ## Average diameter / 2\n\t axisAcenter = (extremumA+extremumB)/2.\n\t axisBcenter = (extremumC+extremumD)/2.\n\t \n\t xCenter = est_x-zoom+axisBcenter\n\t yCenter = est_y-zoom+axisAcenter\n\t \n\t if plots:\n\t plt.clf()\n\t #plt.clf(fig)\n\t def format_coord(x, y):\n\t '''Function to also give data value on mouse over with imshow.'''\n\t col = int(x+0.5)\n\t row = int(y+0.5)\n\t try:\n\t return 'x=%1.4f, y=%1.4f, z=%1.4f' % (x, y, target[row,col])\n\t except:\n\t return 'x=%1.4f, y=%1.4f' % (x, y)\n\t \n\t dimx,dimy = target.shape\n\t med = np.median(target)\n\t dsig = np.std(target)\n\t \n\t ax = fig.add_subplot(subplotsDimensions+1)\n\t ax.imshow(target_orig, cmap=cm.gray, interpolation=\"nearest\",vmin = med-0.5*dsig, vmax =med+2*dsig)\n\t ax.set_title('Star Center')\n\t ax.axvline(ymin=0,ymax=1,x=axisAcenter+0.5,color='b',linewidth=2)\n\t ax.axhline(xmin=0,xmax=1,y=axisBcenter+0.5,color='r',linewidth=2)\n\t ax.set_xlim([-.5,dimx-.5])\n\t ax.set_ylim([-.5,dimy-.5])\n\t ax.set_xlabel('X')\n\t ax.set_ylabel('Y')\n\t ax.format_coord = format_coord \n\t \n\t ax2 = fig.add_subplot(subplotsDimensions+2)\n\t ax2.set_title('Smoothed Intensity Profile')\n\t ax2.plot(axisB,'-r')\n\t ax2.plot(axisB_orig,'-r', alpha=0.33)\n\t ax2.axvline(x=extremumC,ymin=0,ymax=1,color='r',linestyle=':',linewidth=1)\n\t ax2.axvline(x=extremumD,ymin=0,ymax=1,color='r',linestyle=':',linewidth=1)\n\t ax2.axvline(x=axisBcenter,ymin=0,ymax=1,color='r',linewidth=2)\n\t ax2.set_xlabel('X')\n\t ax2.set_ylabel('Counts')\n\t\n\t ax3 = fig.add_subplot(subplotsDimensions+3)\n\t ax3.plot(axisA,'-b')\n\t ax3.plot(axisA_orig,'-b', alpha=0.33)\n\t ax3.set_title('Smoothed Intensity Profile')\n\t ax3.axvline(x=extremumA,ymin=0,ymax=1,color='b',linestyle=':',linewidth=1)\n\t ax3.axvline(x=extremumB,ymin=0,ymax=1,color='b',linestyle=':',linewidth=1)\n\t ax3.axvline(x=axisAcenter,ymin=0,ymax=1,color='b',linewidth=2)\n\t ax3.set_xlabel('Y')\n\t ax3.set_ylabel('Counts')\n\t plt.draw()\n\t return [xCenter,yCenter,averageRadius, False]\n except Exception: ## If an error occurs:\n print \"An error has occured in oscaar.trackSmooth(), \\n\\treturning inital (x,y) estimate\"\n return [est_x, est_y, 1.0, True]", "metadata": "root.trackSmooth", "header": "['module', '___EOS___']", "index": 58 } ]
[ { "span": "import pyfits", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 13 }, { "span": "from scipy import ndimage, optimize", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 35 }, { "span": "from time import sleep", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 22 }, { "span": "import shutil", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 13 }, { "span": "from glob import glob", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 21 }, { "span": "from re import split", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 20 }, { "span": "import cPickle", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 }, { "span": "from shutil import copy", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 23 }, { "span": "import os", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "osc", "aar", " ", "v2", ".0", " ", "\\", "10", ";", " ", " ", " ", "Modul", "e", " ", "for", " ", "differential", " ", "photom", "etry", "\\", "10", ";", " ", " ", " ", "Dev", "elope", "d", " ", "by", " ", "Bre", "tt", " ", "Mor", "ris", ",", " ", "2011", "-", "2013", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "linalg_", "as_", "LA_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyfits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "import_", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "cm_", "as_", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "ndimage_", ",_", "optimize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glob_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "re_", "import_", "split_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shutil_", "import_", "copy_", "\\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\\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_", "quadratic", "Fit_", "(_", "derivative_", ",_", "ext_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "an", " ", "extre", "mum", " ", "in", " ", "the", " ", "data", " ", "and", " ", "use", " ", "it", " ", "and", " ", "the", " ", "points", " ", "on", " ", "eit", "her", " ", "side", ",", " ", "fit", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "quadratic", " ", "function", " ", "to", " ", "the", " ", "three", " ", "points", ",", " ", "and", " ", "return", " ", "the", " ", "x", "-", "position", " ", "of", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "ape", "x", " ", "of", " ", "the", " ", "best", "-", "fit", " ", "para", "bol", "a", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "by", " ", "osc", "aar", ".", "track", "Smooth", "()", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "deriv", "ative", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", "The", " ", "first", " ", "deriv", "ative", " ", "of", " ", "the", " ", "series", " ", "of", " ", "points", ",", " ", "usual", "ly", " ", "calculated", " ", "by", " ", "np", ".", "diff", "()", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "ext", " ", ":", " ", "string", " ", "\\", "10", ";", " ", " ", " ", " ", "Extr", "emu", "m", " ", "to", " ", "look", " ", "find", ".", " ", "Ma", "y", " ", "be", " ", "eit", "her", " ", "\"", "max", "\"", " ", "or", " ", "\"", "min", "\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "extre", "mum", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "(", "non", "-", "integ", "er", ")", " ", "index", " ", "where", " ", "the", " ", "extre", "mum", " ", "was", " ", "found", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "Of", "Fit_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "Der", "_", "=_", "len_", "(_", "derivative_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ext_", "==_", "\"", "max", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind", "Extr", "ema", "_", "=_", "np_", "._", "argmax_", "(_", "derivative_", "[_", ":_", "len", "Der", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ext_", "==_", "\"", "min", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind", "Extr", "ema", "_", "=_", "np_", "._", "argmin_", "(_", "derivative_", "[_", "len", "Der", "_", ":_", "]_", ")_", "+_", "len", "Der", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fit", "Part_", "=_", "derivative_", "[_", "ind", "Extr", "ema", "_", "-_", "range", "Of", "Fit_", ":_", "ind", "Extr", "ema", "_", "+_", "range", "Of", "Fit_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "fit", "Part_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack", "Polynomial", "s_", "=_", "np_", "._", "zeros_", "(_", "[_", "3_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "fit", "Part_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack", "Polynomial", "s_", "[_", "i_", ",_", ":_", "]_", "=_", "[_", "i_", "**_", "2_", ",_", "i_", ",_", "1.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "estimate", "d", "Coeff", "s_", "=_", "np_", "._", "dot_", "(_", "LA_", "._", "inv_", "(_", "stack", "Polynomial", "s_", ")_", ",_", "fit", "Part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "fit_", "=_", "-_", "estimate", "d", "Coeff", "s_", "[_", "1_", "]_", "/_", "(_", "2.0_", "*_", "estimate", "d", "Coeff", "s_", "[_", "0_", "]_", ")_", "#", "d\\u", "fit", " ", "=", " ", "-", "b", "\\u", "fit", "/(", "2", ".*", "a", "\\u", "fit", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extre", "mum", "_", "=_", "d\\u", "fit_", "+_", "ind", "Extr", "ema", "_", "-_", "range", "Of", "Fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extre", "mum", "_", "=_", "ind", "Extr", "ema", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "extre", "mum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "Smooth", "_", "(_", "image_", ",_", "est", "\\u", "x_", ",_", "est", "\\u", "y_", ",_", "smoothing", "Const_", ",_", "plott", "ing", "Thin", "gs_", ",_", "pre", "Cro", "pped", "_", "=_", "False_", ",_", "zoom_", "=_", "20.0_", ",_", "plots_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "for", " ", "track", "ing", " ", "stellar", " ", "centroid", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", " ", "\\", "10", ";", " ", " ", " ", " ", "image", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "FIT", "S", " ", "image", " ", "read", " ", "in", " ", "by", " ", "Py", "FIT", "S", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "est", "\\u", "x", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Ini", "tal", " ", "estimate", " ", "for", " ", "the", " ", "x", "-", "centroid", " ", "of", " ", "the", " ", "star", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "est", "\\u", "y", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Ini", "tal", " ", "estimate", " ", "for", " ", "the", " ", "y", "-", "centroid", " ", "of", " ", "the", " ", "star", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "smoothing", "Const", "ant", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Control", "s", " ", "the", " ", "degr", "ee", " ", "to", " ", "whi", "ch", " ", "the", " ", "raw", " ", "stellar", " ", "intensity", " ", "profile", " ", "will", " ", "be", " ", "smoothed", " ", "by", " ", "a", " ", "Gaussian", " ", "filter", " ", "(", "0", " ", "=", " ", "no", " ", "smoothing", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "pre", "Cro", "pped", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "pre", "Cro", "pped", "=", "Fal", "se", ",", " ", "image", " ", "is", " ", "assume", "d", " ", "to", " ", "be", " ", "a", " ", "raw", " ", "image", ",", " ", "if", " ", "pre", "Cro", "pped", "=", "Tru", "e", ",", " ", "image", " ", "is", " ", "assume", "d", " ", "to", " ", "be", " ", "only", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "porti", "on", " ", "of", " ", "the", " ", "image", " ", "near", " ", "the", " ", "star", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "zoom", " ", ":", " ", "int", " ", "or", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Ho", "w", " ", "many", " ", "pixel", "s", " ", "in", " ", "each", " ", "direction", " ", "awa", "y", " ", "from", " ", "the", " ", "estimate", "d", " ", "centroid", " ", "to", " ", "consider", " ", "whe", "n", " ", "track", "ing", " ", "the", " ", "centroid", ".", " ", "Be", " ", "\\", "10", ";", " ", " ", " ", " ", "sure", " ", "to", " ", "choose", " ", "a", " ", "large", " ", "eno", "ugh", " ", "zoom", " ", "value", " ", "the", " ", "stellar", " ", "centroid", " ", "in", " ", "the", " ", "next", " ", "exposure", " ", "will", " ", "fit", " ", "within", " ", "the", " ", "zoom", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "plots", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "plots", "=", "Tru", "e", ",", " ", "display", " ", "stellar", " ", "intensity", " ", "profile", " ", "in", " ", "two", " ", "axes", " ", "and", " ", "the", " ", "centroid", " ", "solut", "ion", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", "Return", "s", "\\", "10", ";", " ", "-------", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "x", "Center", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", " ", "The", " ", "best", "-", "fit", " ", "x", "-", "centroid", " ", "of", " ", "the", " ", "star", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "y", "Center", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", " ", "The", " ", "best", "-", "fit", " ", "y", "-", "centroid", " ", "of", " ", "the", " ", "star", "\\", "10", ";", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "averag", "e", "Rad", "ius", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", " ", "Average", " ", "radi", "us", " ", "of", " ", "the", " ", "SMO", "OTH", "ED", " ", "star", " ", "in", " ", "pixel", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "error", "Fla", "g", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", " ", "Boo", "lean", " ", "correspond", "ing", " ", "to", " ", "whe", "ther", " ", "or", " ", "not", " ", "any", " ", "error", " ", "occure", "d", " ", "whe", "n", " ", "runn", "ing", " ", "osc", "aar", ".", "track", "Smooth", "()", ".", " ", "If", " ", "an", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "error", " ", "occure", "d", ",", " ", "the", " ", "flag", " ", "is", " ", "Tru", "e", ";", " ", "other", "wis", "e", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", "Core", " ", "developer", ":", " ", "Bre", "tt", " ", "Mor", "ris", "\\", "10", ";", " ", "Modifica", "tion", "s", " ", "by", ":", " ", "Lu", "uk", " ", "Vis", "ser", ",", " ", "2", "-1", "2", "-", "2013", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "If", " ", "you", " ", "have", " ", "an", " ", "interpolated", " ", "grid", " ", "as", " ", "input", ",", " ", "small", " ", "inputs", " ", "for", " ", "smoothing", "Const", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "won", "'", "t", " ", "have", " ", "any", " ", "effect", ".", " ", "Thu", "s", " ", "it", " ", "has", " ", "to", " ", "be", " ", "increase", "d", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "zoom", " ", "factor", " ", "you", " ", "used", " ", "to", " ", "sub", "-", "pixel", " ", "interpolat", "e", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "e", " ", "see", "ms", " ", "to", " ", "give", " ", "nice", " ", "smoothing", " ", "results", " ", "if", " ", "frame", " ", "is", " ", "alr", "ead", "y", " ", "cut", " ", "out", ",", " ", "you", " ", "can", " ", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "pre", "Cro", "pped", " ", "to", " ", "Tru", "e", ",", " ", "so", " ", "the", " ", "script", " ", "won", "'", "t", " ", "cut", " ", "a", " ", "frame", " ", "out", " ", "again", ".", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "if_", "plots_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "[_", "fig_", ",_", "subplot", "s", "Dimensions_", ",_", "phot", "Subp", "lots", "Offset_", "]_", "=_", "plott", "ing", "Thin", "gs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pre", "Cro", "pped", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "zoom_", "=_", "image_", "._", "shape_", "[_", "0_", "]_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "est", "\\u", "x_", ",_", "est", "\\u", "y_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "image_", "##", " ", "Assume", " ", "image", " ", "is", " ", "pre", "-", "cropped", " ", "image", " ", "of", " ", "the", " ", "star_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "smoothing", "Const", " ", "*=", " ", "zoom", "/", "20", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "target_", "=_", "image_", "[_", "est", "\\u", "x_", "-_", "zoom_", ":_", "est", "\\u", "x_", "+_", "zoom_", ",_", "est", "\\u", "y_", "-_", "zoom_", ":_", "est", "\\u", "y_", "+_", "zoom_", "]_", "##", " ", "Cro", "p", " ", "image", " ", "of", " ", "just", " ", "the", " ", "target", " ", "star_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Save", " ", "original", " ", "(", "uns", "moo", "the", "d", ")", " ", "data", " ", "for", " ", "plott", "ing", " ", "pur", "poss", "es_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "plots_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "target", "\\u", "orig_", "=_", "target_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "A", "\\u", "orig_", "=_", "np_", "._", "sum_", "(_", "target_", ",_", "axis_", "=_", "0_", ")_", "##", " ", "Tak", "e", " ", "the", " ", "sums", " ", "of", " ", "all", " ", "values", " ", "in", " ", "each", " ", "column", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "B", "\\u", "orig_", "=_", "np_", "._", "sum_", "(_", "target_", ",_", "axis_", "=_", "1_", ")_", "##", " ", "then", " ", "repeat", " ", "for", " ", "each", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target_", "=_", "ndimage_", "._", "gauss", "ian", "\\u", "filter_", "(_", "target_", ",_", "sigma_", "=_", "smoothing", "Const_", ",_", "order_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Sum", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "A_", "=_", "np_", "._", "sum_", "(_", "target_", ",_", "axis_", "=_", "0_", ")_", "##", " ", "Tak", "e", " ", "the", " ", "sums", " ", "of", " ", "all", " ", "values", " ", "in", " ", "each", " ", "column", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "B_", "=_", "np_", "._", "sum_", "(_", "target_", ",_", "axis_", "=_", "1_", ")_", "##", " ", "then", " ", "repeat", " ", "for", " ", "each", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "AD", "eri", "v_", "=_", "np_", "._", "diff_", "(_", "axis", "A_", ")_", "##", " ", "Fin", "d", " ", "the", " ", "difference", "s", " ", "bet", "ween", " ", "each", " ", "pixel", " ", "intensity", " ", "and_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "BD", "eri", "v_", "=_", "np_", "._", "diff_", "(_", "axis", "B_", ")_", "##", " ", "the", " ", "neighbor", "ing", " ", "pixel", " ", "(", "deriv", "ative", " ", "of", " ", "intensity", " ", "profile", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "len", "axis", "AD", "eri", "v_", "=_", "len_", "(_", "axis", "AD", "eri", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "axis", "AD", "eri", "v", "\\u", "2_", "=_", "len", "axis", "AD", "eri", "v_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "axis", "BD", "eri", "v_", "=_", "len_", "(_", "axis", "BD", "eri", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "axis", "BD", "eri", "v", "\\u", "2_", "=_", "len", "axis", "BD", "eri", "v_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deriv", "Min", "Ai", "nd_", "=_", "np_", "._", "where_", "(_", "axis", "AD", "eri", "v_", "==_", "min_", "(_", "axis", "AD", "eri", "v_", "[_", "len", "axis", "AD", "eri", "v", "\\u", "2_", ":_", "len", "axis", "AD", "eri", "v_", "]_", ")_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "##", " ", "Mini", "mum", " ", "in", " ", "the", " ", "derivative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "Min", "Bind_", "=_", "np_", "._", "where_", "(_", "axis", "BD", "eri", "v_", "==_", "min_", "(_", "axis", "BD", "eri", "v_", "[_", "len", "axis", "BD", "eri", "v", "\\u", "2_", ":_", "len", "axis", "BD", "eri", "v_", "]_", ")_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "##", " ", "of", " ", "the", " ", "intensity", " ", "plot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deriv", "Max", "Ai", "nd_", "=_", "np_", "._", "where_", "(_", "axis", "AD", "eri", "v_", "==_", "max_", "(_", "axis", "AD", "eri", "v_", "[_", "0_", ":_", "len", "axis", "AD", "eri", "v", "\\u", "2_", "]_", ")_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "##", " ", "Maxim", "um", " ", "in", " ", "the", " ", "derivative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "Max", "Bind_", "=_", "np_", "._", "where_", "(_", "axis", "BD", "eri", "v_", "==_", "max_", "(_", "axis", "BD", "eri", "v_", "[_", "0_", ":_", "len", "axis", "BD", "eri", "v", "\\u", "2_", "]_", ")_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "##", " ", "of", " ", "the", " ", "intensity", " ", "plot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extre", "mum", "A_", "=_", "quadratic", "Fit_", "(_", "axis", "AD", "eri", "v_", ",_", "ext_", "=_", "\"", "max", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extre", "mum", "B_", "=_", "quadratic", "Fit_", "(_", "axis", "AD", "eri", "v_", ",_", "ext_", "=_", "\"", "min", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extre", "mum", "C_", "=_", "quadratic", "Fit_", "(_", "axis", "BD", "eri", "v_", ",_", "ext_", "=_", "\"", "max", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extre", "mum", "D_", "=_", "quadratic", "Fit_", "(_", "axis", "BD", "eri", "v_", ",_", "ext_", "=_", "\"", "min", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "averag", "e", "Radius_", "=_", "(_", "abs_", "(_", "deriv", "Min", "Ai", "nd_", "-_", "deriv", "Max", "Ai", "nd_", ")_", "+_", "abs_", "(_", "deriv", "Min", "Bind_", "-_", "deriv", "Max", "Bind_", ")_", ")_", "/_", "4._", "##", " ", "Average", " ", "diam", "eter", " ", "/", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "Ace", "nter", "_", "=_", "(_", "extre", "mum", "A_", "+_", "extre", "mum", "B_", ")_", "/_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "Bc", "enter_", "=_", "(_", "extre", "mum", "C_", "+_", "extre", "mum", "D_", ")_", "/_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "Center_", "=_", "est", "\\u", "x_", "-_", "zoom_", "+_", "axis", "Bc", "enter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "Center_", "=_", "est", "\\u", "y_", "-_", "zoom_", "+_", "axis", "Ace", "nter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "plots_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "plt_", "._", "clf_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "plt", ".", "clf", "(", "fig", ")_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "format\\u", "coord_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "'''", "Function", " ", "to", " ", "als", "o", " ", "give", " ", "data", " ", "value", " ", "on", " ", "mouse", " ", "over", " ", "with", " ", "ims", "how", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "int_", "(_", "x_", "+_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "int_", "(_", "y_", "+_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "return_", "'", "x", "=", "%", "1.4", "f", ",", " ", "y", "=", "%", "1.4", "f", ",", " ", "z", "=", "%", "1.4", "f", "'_", "%_", "(_", "x_", ",_", "y_", ",_", "target_", "[_", "row_", ",_", "col_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "return_", "'", "x", "=", "%", "1.4", "f", ",", " ", "y", "=", "%", "1.4", "f", "'_", "%_", "(_", "x_", ",_", "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_", "dim", "x_", ",_", "dim", "y_", "=_", "target_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "med_", "=_", "np_", "._", "median_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dsi", "g_", "=_", "np_", "._", "std_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "subplot", "s", "Dimensions_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "imshow_", "(_", "target", "\\u", "orig_", ",_", "cmap_", "=_", "cm_", "._", "gray_", ",_", "interpolation_", "=_", "\"", "near", "est", "\"_", ",_", "vmin_", "=_", "med_", "-_", "0.5_", "*_", "dsi", "g_", ",_", "vmax_", "=_", "med_", "+_", "2_", "*_", "dsi", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "'", "Star", " ", "Center", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "axvline_", "(_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "x_", "=_", "axis", "Ace", "nter", "_", "+_", "0.5_", ",_", "color_", "=_", "'", "b", "'_", ",_", "linewidth_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "axh", "line_", "(_", "xmin_", "=_", "0_", ",_", "xmax_", "=_", "1_", ",_", "y_", "=_", "axis", "Bc", "enter_", "+_", "0.5_", ",_", "color_", "=_", "'", "r", "'_", ",_", "linewidth_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "[_", "-_", ".5_", ",_", "dim", "x_", "-_", ".5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "[_", "-_", ".5_", ",_", "dim", "y_", "-_", ".5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "'", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "'", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "format\\u", "coord_", "=_", "format\\u", "coord_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax2_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "subplot", "s", "Dimensions_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "set\\u", "title_", "(_", "'", "Smooth", "ed", " ", "Inten", "sity", " ", "Profil", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "plot_", "(_", "axis", "B_", ",_", "'-", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "plot_", "(_", "axis", "B", "\\u", "orig_", ",_", "'-", "r", "'_", ",_", "alpha_", "=_", "0.33", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "axvline_", "(_", "x_", "=_", "extre", "mum", "C_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "r", "'_", ",_", "linestyle_", "=_", "':'_", ",_", "linewidth_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "axvline_", "(_", "x_", "=_", "extre", "mum", "D_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "r", "'_", ",_", "linestyle_", "=_", "':'_", ",_", "linewidth_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "axvline_", "(_", "x_", "=_", "axis", "Bc", "enter_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "r", "'_", ",_", "linewidth_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "set\\u", "xlabel_", "(_", "'", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "set\\u", "ylabel_", "(_", "'", "Count", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax3_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "subplot", "s", "Dimensions_", "+_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "plot_", "(_", "axis", "A_", ",_", "'-", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "plot_", "(_", "axis", "A", "\\u", "orig_", ",_", "'-", "b", "'_", ",_", "alpha_", "=_", "0.33", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "set\\u", "title_", "(_", "'", "Smooth", "ed", " ", "Inten", "sity", " ", "Profil", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "axvline_", "(_", "x_", "=_", "extre", "mum", "A_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "b", "'_", ",_", "linestyle_", "=_", "':'_", ",_", "linewidth_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "axvline_", "(_", "x_", "=_", "extre", "mum", "B_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "b", "'_", ",_", "linestyle_", "=_", "':'_", ",_", "linewidth_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "axvline_", "(_", "x_", "=_", "axis", "Ace", "nter", "_", ",_", "ymin_", "=_", "0_", ",_", "ymax_", "=_", "1_", ",_", "color_", "=_", "'", "b", "'_", ",_", "linewidth_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "set\\u", "xlabel_", "(_", "'", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "set\\u", "ylabel_", "(_", "'", "Count", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "x", "Center_", ",_", "y", "Center_", ",_", "averag", "e", "Radius_", ",_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "##", " ", "If", " ", "an", " ", "error", " ", "occur", "s", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "An", " ", "error", " ", "has", " ", "occure", "d", " ", "in", " ", "osc", "aar", ".", "track", "Smooth", "()", ",", " ", "\\\\", "n", "\\\\", "tre", "turn", "ing", " ", "init", "al", " ", "(", "x", ",", "y", ")", " ", "estimate", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "est", "\\u", "x_", ",_", "est", "\\u", "y_", ",_", "1.0_", ",_", "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, 0, 1, 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, 0, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 1, 2, 0, 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,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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 ]
Testing equality to None
ivanvza/arpy/arpy.py
[ { "content": "def main():\n try:\n if user.CURRENT_USER_ID <> 0:\n unprivileged_user_print(user.CURRENT_USER_NAME)\n\n if dns_sniff_gource:\n print(bcolours.OKBLUE + '[INFO] For a live gource feed run this command in parallel with this one:' + bcolours.WARNING + '\\n\\ntail -f ' + random_filename + 'parsed_nmap | tee /dev/stderr | gource -log-format custom -a 1 --file-idle-time 0 -\\n\\n' + bcolours.ENDC)\n\n #This check is to see if anything but gource parser is set\n if (not dns_sniff_gource) or (dns_sniff or sniff_pkts):\n print banner()\n #check if we actually have some info\n if target == None or gateway == None and interface == None:\n options.print_help()\n return\n\n if dns_sniff:\n print(bcolours.OKBLUE + '\\n [Info] Starting DNS Sniffer...\\n' + bcolours.ENDC)\n\n elif sniff_pkts:\n print(bcolours.OKBLUE + '\\n [Info] Starting Sniffer...\\n' + bcolours.ENDC)\n\n if dns_sniff_gource or dns_sniff or sniff_pkts:\n setup_ipv_forwarding()\n print (bcolours.OKBLUE + '[Info] Filter: ' + filter_parser() + bcolours.ENDC)\n while True:\n start_poisen(target, interface, filter_parser())\n else:\n options.print_help()\n\n except KeyboardInterrupt:\n print(bcolours.WARNING + ' [Warning] Stopping...' + bcolours.ENDC)\n sys.exit(3)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 172 } ]
[ { "span": "target == None ", "start_line": 184, "start_column": 15, "end_line": 184, "end_column": 29 }, { "span": "gateway == None ", "start_line": 184, "start_column": 33, "end_line": 184, "end_column": 48 }, { "span": "interface == None:", "start_line": 184, "start_column": 53, "end_line": 184, "end_column": 70 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "._", "CURREN", "T", "\\u", "USER", "\\u", "ID_", "<_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unpr", "ivi", "leg", "ed", "\\u", "user", "\\u", "print_", "(_", "user_", "._", "CURREN", "T", "\\u", "USER", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dns", "\\u", "sniff", "\\u", "gou", "rce", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bco", "lou", "rs_", "._", "OK", "BLUE_", "+_", "'[", "INFO", "]", " ", "For", " ", "a", " ", "live", " ", "gou", "rce", " ", "feed", " ", "run", " ", "this", " ", "command", " ", "in", " ", "parall", "el", " ", "with", " ", "this", " ", "one", ":'_", "+_", "bco", "lou", "rs_", "._", "WARNING_", "+_", "'\\\\", "n", "\\\\", "nta", "il", " ", "-", "f", " ", "'_", "+_", "random", "\\u", "filename_", "+_", "'", "parsed", "\\u", "nmap", " ", "|", " ", "tee", " ", "/", "dev", "/", "std", "err", " ", "|", " ", "gou", "rce", " ", "-", "log", "-", "format", " ", "custom", " ", "-", "a", " ", "1", " ", "--", "file", "-", "idle", "-", "time", " ", "0", " ", "-\\\\", "n", "\\\\", "n", "'_", "+_", "bco", "lou", "rs_", "._", "ENDC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Thi", "s", " ", "check", " ", "is", " ", "to", " ", "see", " ", "if", " ", "anyt", "hing", " ", "but", " ", "gou", "rce", " ", "parser", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "dns", "\\u", "sniff", "\\u", "gou", "rce", "_", ")_", "or_", "(_", "dns", "\\u", "sniff", "_", "or_", "sniff", "\\u", "pkts", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "banner_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "we", " ", "actual", "ly", " ", "have", " ", "some", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "target_", "==_", "None_", "or_", "gateway_", "==_", "None_", "and_", "interface_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "print", "\\u", "help_", "(_", ")_", "\\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_", "dns", "\\u", "sniff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bco", "lou", "rs_", "._", "OK", "BLUE_", "+_", "'\\\\", "n", " ", " ", "[", "Info", "]", " ", "Start", "ing", " ", "DNS", " ", "Sni", "ffer", "...", "\\\\", "n", "'_", "+_", "bco", "lou", "rs_", "._", "ENDC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sniff", "\\u", "pkts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bco", "lou", "rs_", "._", "OK", "BLUE_", "+_", "'\\\\", "n", " ", " ", "[", "Info", "]", " ", "Start", "ing", " ", "Sni", "ffer", "...", "\\\\", "n", "'_", "+_", "bco", "lou", "rs_", "._", "ENDC_", ")_", "\\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_", "dns", "\\u", "sniff", "\\u", "gou", "rce", "_", "or_", "dns", "\\u", "sniff", "_", "or_", "sniff", "\\u", "pkts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "ipv", "\\u", "forward", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bco", "lou", "rs_", "._", "OK", "BLUE_", "+_", "'[", "Info", "]", " ", "Filter", ":", " ", "'_", "+_", "filter", "\\u", "parser_", "(_", ")_", "+_", "bco", "lou", "rs_", "._", "ENDC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "pois", "en_", "(_", "target_", ",_", "interface_", ",_", "filter", "\\u", "parser_", "(_", ")_", ")_", "\\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 ", " _", "options_", "._", "print", "\\u", "help_", "(_", ")_", "\\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_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bco", "lou", "rs_", "._", "WARNING_", "+_", "'", " ", " ", "[", "Warn", "ing", "]", " ", "Stopp", "ing", "...'_", "+_", "bco", "lou", "rs_", "._", "ENDC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "3_", ")_", "\\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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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 ]
Except block handles 'BaseException'
msempere/redis_structures/redis_structures/structures/deque.py
[ { "content": " def back_push(self, item):\n try:\n self.redis.lpush(self.name, self._dumps(item))\n return True\n except:\n return False", "metadata": "root.Deque.back_push", "header": "['class', 'Deque', '(', 'Base', ')', ':', '___EOS___']", "index": 11 }, { "content": " def front_push(self, item):\n try:\n self.redis.rpush(self.name, self._dumps(item))\n return True\n except:\n return False", "metadata": "root.Deque.front_push", "header": "['class', 'Deque', '(', 'Base', ')', ':', '___EOS___']", "index": 18 }, { "content": " def addAll(self, collection=[], back=True):\n assert type(collection) == list\n with self.redis.pipeline() as pipe:\n for item in collection:\n try:\n if back:\n pipe.lpush(self.name, self._dumps(item))\n else:\n pipe.rpush(self.name, self._dumps(item))\n except:\n continue\n pipe.execute()", "metadata": "root.Deque.addAll", "header": "['class', 'Deque', '(', 'Base', ')', ':', '___EOS___']", "index": 25 } ]
[ { "span": "except:", "start_line": 15, "start_column": 8, "end_line": 15, "end_column": 15 }, { "span": "except:", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 15 }, { "span": "except:", "start_line": 34, "start_column": 16, "end_line": 34, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Deq", "ue_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "\\u", "push_", "(_", "self_", ",_", "item_", ")_", ":_", "\\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_", "._", "redis_", "._", "lp", "ush_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "dumps_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deq", "ue_", "(_", "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_", "front", "\\u", "push_", "(_", "self_", ",_", "item_", ")_", ":_", "\\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_", "._", "redis_", "._", "rp", "ush_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "dumps_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deq", "ue_", "(_", "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", "All_", "(_", "self_", ",_", "collection_", "=_", "[_", "]_", ",_", "back_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "type_", "(_", "collection_", ")_", "==_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "redis_", "._", "pipeline_", "(_", ")_", "as_", "pipe_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "collection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "back_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pipe_", "._", "lp", "ush_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "dumps_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pipe_", "._", "rp", "ush_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "dumps_", "(_", "item_", ")_", ")_", "\\u\\u\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
kuri65536/python-for-android/python-modules/twisted/twisted/conch/checkers.py
[ { "content": " def checkKey(self, credentials):\n \"\"\"\n Retrieve files containing authorized keys and check against user\n credentials.\n \"\"\"\n uid, gid = os.geteuid(), os.getegid()\n ouid, ogid = pwd.getpwnam(credentials.username)[2:4]\n for filepath in self.getAuthorizedKeysFiles(credentials):\n if not filepath.exists():\n continue\n try:\n lines = filepath.open()\n except IOError, e:\n if e.errno == errno.EACCES:\n lines = runAsEffectiveUser(ouid, ogid, filepath.open)\n else:\n raise\n for l in lines:\n l2 = l.split()\n if len(l2) < 2:\n continue\n try:\n if base64.decodestring(l2[1]) == credentials.blob:\n return True\n except binascii.Error:\n continue\n return False", "metadata": "root.SSHPublicKeyDatabase.checkKey", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 154 } ]
[ { "span": "uid,", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 11 }, { "span": "gid ", "start_line": 159, "start_column": 13, "end_line": 159, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Key_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "files", " ", "contain", "ing", " ", "authoriz", "ed", " ", "keys", " ", "and", " ", "check", " ", "against", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "cred", "ential", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", ",_", "gid_", "=_", "os_", "._", "gete", "uid_", "(_", ")_", ",_", "os_", "._", "gete", "gid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ou", "id_", ",_", "ogi", "d_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "credentials_", "._", "username_", ")_", "[_", "2_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filepath_", "in_", "self_", "._", "get", "Authorized", "Keys", "Files_", "(_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "filepath_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "filepath_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "EAC", "CES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "=_", "run", "As", "Effe", "ctive", "User_", "(_", "ou", "id_", ",_", "ogi", "d_", ",_", "filepath_", "._", "open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l2_", "=_", "l_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "l2_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "base64_", "._", "decode", "string_", "(_", "l2_", "[_", "1_", "]_", ")_", "==_", "credentials_", "._", "blob_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "binascii_", "._", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
sassoftware/conary/conary/web/webauth.py
[ { "content": "def getAuth(req):\n if hasattr(req, 'headers_in'):\n # mod_python\n headers_in = req.headers_in\n remote_ip = req.connection.remote_ip\n else:\n # webob\n headers_in = req.headers\n remote_ip = req.remote_addr\n\n if not 'Authorization' in headers_in:\n authToken = ['anonymous', 'anonymous']\n else:\n info = headers_in['Authorization'].split(' ', 1)\n if len(info) != 2 or info[0] != \"Basic\":\n return None\n\n try:\n authString = base64.decodestring(info[1])\n except:\n return None\n\n authToken = authString.split(\":\", 1)\n if len(authToken) != 2:\n # No password\n authToken.append(util.ProtectedString(''))\n else:\n authToken[1] = util.ProtectedString(authToken[1])\n\n try:\n entitlementList = parseEntitlement(\n headers_in.get('X-Conary-Entitlement', ''))\n except:\n return None\n\n authToken.append(entitlementList)\n authToken.append(remote_ip)\n return authToken", "metadata": "root.getAuth", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "except:", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 15 }, { "span": "except:", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Auth_", "(_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "req_", ",_", "'", "header", "s", "\\u", "in", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mod", "\\u", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "s", "\\u", "in_", "=_", "req_", "._", "header", "s", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "ip_", "=_", "req_", "._", "connection_", "._", "remote", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "webob_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "s", "\\u", "in_", "=_", "req_", "._", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "ip_", "=_", "req_", "._", "remote", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "Authoriz", "ation", "'_", "in_", "header", "s", "\\u", "in_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "Token_", "=_", "[_", "'", "anonym", "ous", "'_", ",_", "'", "anonym", "ous", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "header", "s", "\\u", "in_", "[_", "'", "Authoriz", "ation", "'_", "]_", "._", "split_", "(_", "'", " ", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "info_", ")_", "!=_", "2_", "or_", "info_", "[_", "0_", "]_", "!=_", "\"", "Basic", "\"_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "String_", "=_", "base64_", "._", "decode", "string_", "(_", "info_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "auth", "Token_", "=_", "auth", "String_", "._", "split_", "(_", "\":\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "auth", "Token_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "Token_", "._", "append_", "(_", "util_", "._", "Protect", "ed", "String_", "(_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "Token_", "[_", "1_", "]_", "=_", "util_", "._", "Protect", "ed", "String_", "(_", "auth", "Token_", "[_", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entit", "lement", "List_", "=_", "parse", "Entit", "lement", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "header", "s", "\\u", "in_", "._", "get_", "(_", "'", "X", "-", "Con", "ary", "-", "Entit", "lement", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "auth", "Token_", "._", "append_", "(_", "entit", "lement", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "Token_", "._", "append_", "(_", "remote", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "auth", "Token_", "\\u\\u\\uNEWLINE\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/queries/tests.py
[ { "content": " def test_ticket15316_filter_false(self):\n c1 = SimpleCategory.objects.create(name=\"category1\")\n c2 = SpecialCategory.objects.create(name=\"named category1\",\n special_name=\"special1\")\n c3 = SpecialCategory.objects.create(name=\"named category2\",\n special_name=\"special2\")\n\n ci1 = CategoryItem.objects.create(category=c1)\n ci2 = CategoryItem.objects.create(category=c2)\n ci3 = CategoryItem.objects.create(category=c3)\n\n qs = CategoryItem.objects.filter(category__specialcategory__isnull=False)\n self.assertEqual(qs.count(), 2)\n self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)", "metadata": "root.Queries4Tests.test_ticket15316_filter_false", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1109 }, { "content": " def test_ticket15316_exclude_false(self):\n c1 = SimpleCategory.objects.create(name=\"category1\")\n c2 = SpecialCategory.objects.create(name=\"named category1\",\n special_name=\"special1\")\n c3 = SpecialCategory.objects.create(name=\"named category2\",\n special_name=\"special2\")\n\n ci1 = CategoryItem.objects.create(category=c1)\n ci2 = CategoryItem.objects.create(category=c2)\n ci3 = CategoryItem.objects.create(category=c3)\n\n qs = CategoryItem.objects.exclude(category__specialcategory__isnull=False)\n self.assertEqual(qs.count(), 1)\n self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)", "metadata": "root.Queries4Tests.test_ticket15316_exclude_false", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1124 }, { "content": " def test_ticket15316_filter_true(self):\n c1 = SimpleCategory.objects.create(name=\"category1\")\n c2 = SpecialCategory.objects.create(name=\"named category1\",\n special_name=\"special1\")\n c3 = SpecialCategory.objects.create(name=\"named category2\",\n special_name=\"special2\")\n\n ci1 = CategoryItem.objects.create(category=c1)\n ci2 = CategoryItem.objects.create(category=c2)\n ci3 = CategoryItem.objects.create(category=c3)\n\n qs = CategoryItem.objects.filter(category__specialcategory__isnull=True)\n self.assertEqual(qs.count(), 1)\n self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)", "metadata": "root.Queries4Tests.test_ticket15316_filter_true", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1139 }, { "content": " def test_ticket15316_exclude_true(self):\n c1 = SimpleCategory.objects.create(name=\"category1\")\n c2 = SpecialCategory.objects.create(name=\"named category1\",\n special_name=\"special1\")\n c3 = SpecialCategory.objects.create(name=\"named category2\",\n special_name=\"special2\")\n\n ci1 = CategoryItem.objects.create(category=c1)\n ci2 = CategoryItem.objects.create(category=c2)\n ci3 = CategoryItem.objects.create(category=c3)\n\n qs = CategoryItem.objects.exclude(category__specialcategory__isnull=True)\n self.assertEqual(qs.count(), 2)\n self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)", "metadata": "root.Queries4Tests.test_ticket15316_exclude_true", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1154 }, { "content": " def test_ticket15316_one2one_filter_false(self):\n c = SimpleCategory.objects.create(name=\"cat\")\n c0 = SimpleCategory.objects.create(name=\"cat0\")\n c1 = SimpleCategory.objects.create(name=\"category1\")\n\n c2 = OneToOneCategory.objects.create(category = c1, new_name=\"new1\")\n c3 = OneToOneCategory.objects.create(category = c0, new_name=\"new2\")\n\n ci1 = CategoryItem.objects.create(category=c)\n ci2 = CategoryItem.objects.create(category=c0)\n ci3 = CategoryItem.objects.create(category=c1)\n\n qs = CategoryItem.objects.filter(category__onetoonecategory__isnull=False)\n self.assertEqual(qs.count(), 2)\n self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)", "metadata": "root.Queries4Tests.test_ticket15316_one2one_filter_false", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1169 }, { "content": " def test_ticket15316_one2one_exclude_false(self):\n c = SimpleCategory.objects.create(name=\"cat\")\n c0 = SimpleCategory.objects.create(name=\"cat0\")\n c1 = SimpleCategory.objects.create(name=\"category1\")\n\n c2 = OneToOneCategory.objects.create(category = c1, new_name=\"new1\")\n c3 = OneToOneCategory.objects.create(category = c0, new_name=\"new2\")\n\n ci1 = CategoryItem.objects.create(category=c)\n ci2 = CategoryItem.objects.create(category=c0)\n ci3 = CategoryItem.objects.create(category=c1)\n\n qs = CategoryItem.objects.exclude(category__onetoonecategory__isnull=False)\n self.assertEqual(qs.count(), 1)\n self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)", "metadata": "root.Queries4Tests.test_ticket15316_one2one_exclude_false", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1185 }, { "content": " def test_ticket15316_one2one_filter_true(self):\n c = SimpleCategory.objects.create(name=\"cat\")\n c0 = SimpleCategory.objects.create(name=\"cat0\")\n c1 = SimpleCategory.objects.create(name=\"category1\")\n\n c2 = OneToOneCategory.objects.create(category = c1, new_name=\"new1\")\n c3 = OneToOneCategory.objects.create(category = c0, new_name=\"new2\")\n\n ci1 = CategoryItem.objects.create(category=c)\n ci2 = CategoryItem.objects.create(category=c0)\n ci3 = CategoryItem.objects.create(category=c1)\n\n qs = CategoryItem.objects.filter(category__onetoonecategory__isnull=True)\n self.assertEqual(qs.count(), 1)\n self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)", "metadata": "root.Queries4Tests.test_ticket15316_one2one_filter_true", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1201 }, { "content": " def test_ticket15316_one2one_exclude_true(self):\n c = SimpleCategory.objects.create(name=\"cat\")\n c0 = SimpleCategory.objects.create(name=\"cat0\")\n c1 = SimpleCategory.objects.create(name=\"category1\")\n\n c2 = OneToOneCategory.objects.create(category = c1, new_name=\"new1\")\n c3 = OneToOneCategory.objects.create(category = c0, new_name=\"new2\")\n\n ci1 = CategoryItem.objects.create(category=c)\n ci2 = CategoryItem.objects.create(category=c0)\n ci3 = CategoryItem.objects.create(category=c1)\n\n qs = CategoryItem.objects.exclude(category__onetoonecategory__isnull=True)\n self.assertEqual(qs.count(), 2)\n self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)", "metadata": "root.Queries4Tests.test_ticket15316_one2one_exclude_true", "header": "['class', 'Queries4Tests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1217 }, { "content": " def setUp(self):\n generic = NamedCategory.objects.create(name=\"Generic\")\n t1 = Tag.objects.create(name='t1', category=generic)\n t2 = Tag.objects.create(name='t2', parent=t1, category=generic)\n t3 = Tag.objects.create(name='t3', parent=t1)\n t4 = Tag.objects.create(name='t4', parent=t3)\n t5 = Tag.objects.create(name='t5', parent=t3)\n n1 = Note.objects.create(note='n1', misc='foo', id=1)\n ann1 = Annotation.objects.create(name='a1', tag=t1)\n ann1.notes.add(n1)\n ann2 = Annotation.objects.create(name='a2', tag=t4)", "metadata": "root.Queries6Tests.setUp", "header": "['class', 'Queries6Tests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1439 }, { "content": " def setUp(self):\n n1 = Note.objects.create(note='n1', misc='foo', id=1)", "metadata": "root.RawQueriesTests.setUp", "header": "['class', 'RawQueriesTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1548 }, { "content": " def setUp(self):\n generic = NamedCategory.objects.create(name=\"Generic\")\n t1 = Tag.objects.create(name='t1', category=generic)\n t2 = Tag.objects.create(name='t2', parent=t1, category=generic)\n t3 = Tag.objects.create(name='t3', parent=t1)\n t4 = Tag.objects.create(name='t4', parent=t3)\n t5 = Tag.objects.create(name='t5', parent=t3)", "metadata": "root.ConditionalTests.setUp", "header": "['class', 'ConditionalTests', '(', 'BaseQuerysetTest', ')', ':', '___EOS___']", "index": 1832 } ]
[ { "span": "ci1 ", "start_line": 1116, "start_column": 8, "end_line": 1116, "end_column": 11 }, { "span": "ci2 ", "start_line": 1132, "start_column": 8, "end_line": 1132, "end_column": 11 }, { "span": "ci3 ", "start_line": 1133, "start_column": 8, "end_line": 1133, "end_column": 11 }, { "span": "ci2 ", "start_line": 1147, "start_column": 8, "end_line": 1147, "end_column": 11 }, { "span": "ci3 ", "start_line": 1148, "start_column": 8, "end_line": 1148, "end_column": 11 }, { "span": "ci1 ", "start_line": 1161, "start_column": 8, "end_line": 1161, "end_column": 11 }, { "span": "c2 ", "start_line": 1174, "start_column": 8, "end_line": 1174, "end_column": 10 }, { "span": "c3 ", "start_line": 1175, "start_column": 8, "end_line": 1175, "end_column": 10 }, { "span": "ci1 ", "start_line": 1177, "start_column": 8, "end_line": 1177, "end_column": 11 }, { "span": "c2 ", "start_line": 1190, "start_column": 8, "end_line": 1190, "end_column": 10 }, { "span": "c3 ", "start_line": 1191, "start_column": 8, "end_line": 1191, "end_column": 10 }, { "span": "ci2 ", "start_line": 1194, "start_column": 8, "end_line": 1194, "end_column": 11 }, { "span": "ci3 ", "start_line": 1195, "start_column": 8, "end_line": 1195, "end_column": 11 }, { "span": "c2 ", "start_line": 1206, "start_column": 8, "end_line": 1206, "end_column": 10 }, { "span": "c3 ", "start_line": 1207, "start_column": 8, "end_line": 1207, "end_column": 10 }, { "span": "ci2 ", "start_line": 1210, "start_column": 8, "end_line": 1210, "end_column": 11 }, { "span": "ci3 ", "start_line": 1211, "start_column": 8, "end_line": 1211, "end_column": 11 }, { "span": "c2 ", "start_line": 1222, "start_column": 8, "end_line": 1222, "end_column": 10 }, { "span": "c3 ", "start_line": 1223, "start_column": 8, "end_line": 1223, "end_column": 10 }, { "span": "ci1 ", "start_line": 1225, "start_column": 8, "end_line": 1225, "end_column": 11 }, { "span": "t2 ", "start_line": 1442, "start_column": 8, "end_line": 1442, "end_column": 10 }, { "span": "t5 ", "start_line": 1445, "start_column": 8, "end_line": 1445, "end_column": 10 }, { "span": "ann2 ", "start_line": 1449, "start_column": 8, "end_line": 1449, "end_column": 12 }, { "span": "n1 ", "start_line": 1549, "start_column": 8, "end_line": 1549, "end_column": 10 }, { "span": "t2 ", "start_line": 1835, "start_column": 8, "end_line": 1835, "end_column": 10 }, { "span": "t4 ", "start_line": 1837, "start_column": 8, "end_line": 1837, "end_column": 10 }, { "span": "t5 ", "start_line": 1838, "start_column": 8, "end_line": 1838, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "filter", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "filter_", "(_", "category", "\\u\\u", "special", "category", "\\u\\u", "isnull_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "2_", "._", "pk_", ",_", "ci", "3_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "exclu", "de", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "exclude_", "(_", "category", "\\u\\u", "special", "category", "\\u\\u", "isnull_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "1_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "filter", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "filter_", "(_", "category", "\\u\\u", "special", "category", "\\u\\u", "isnull_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "1_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "exclu", "de", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "Special", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "named", " ", "category", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "special", "\\u", "name_", "=_", "\"", "special", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "exclude_", "(_", "category", "\\u\\u", "special", "category", "\\u\\u", "isnull_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "2_", "._", "pk_", ",_", "ci", "3_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "one", "2o", "ne", "\\u", "filter", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "filter_", "(_", "category", "\\u\\u", "onet", "oon", "eca", "teg", "ory", "\\u\\u", "isnull_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "2_", "._", "pk_", ",_", "ci", "3_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "one", "2o", "ne", "\\u", "exclu", "de", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "exclude_", "(_", "category", "\\u\\u", "onet", "oon", "eca", "teg", "ory", "\\u\\u", "isnull_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "1_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "one", "2o", "ne", "\\u", "filter", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "filter_", "(_", "category", "\\u\\u", "onet", "oon", "eca", "teg", "ory", "\\u\\u", "isnull_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "1_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "4", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tick", "et", "153", "16", "\\u", "one", "2o", "ne", "\\u", "exclu", "de", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "cat", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "Simple", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "category", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "One", "To", "One", "Category_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ",_", "new", "\\u", "name_", "=_", "\"", "new", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ci", "1_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "2_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ci", "3_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Cate", "gory", "Item_", "._", "objects_", "._", "exclude_", "(_", "category", "\\u\\u", "onet", "oon", "eca", "teg", "ory", "\\u\\u", "isnull_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qs_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "qs_", ",_", "[_", "ci", "2_", "._", "pk_", ",_", "ci", "3_", "._", "pk_", "]_", ",_", "lambda_", "x_", ":_", "x_", "._", "pk_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Querie", "s", "6", "Tests_", "(_", "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 ", " _", "generic_", "=_", "Name", "d", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Gene", "ric", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t1", "'_", ",_", "category_", "=_", "generic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t2", "'_", ",_", "parent_", "=_", "t1_", ",_", "category_", "=_", "generic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t3", "'_", ",_", "parent_", "=_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t", "4", "'_", ",_", "parent_", "=_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t5", "'_", ",_", "parent_", "=_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Note_", "._", "objects_", "._", "create_", "(_", "note_", "=_", "'", "n1", "'_", ",_", "misc_", "=_", "'", "foo", "'_", ",_", "id_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "1_", "=_", "Annotation_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "a1", "'_", ",_", "tag_", "=_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "1_", "._", "notes_", "._", "add_", "(_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "2_", "=_", "Annotation_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "a2", "'_", ",_", "tag_", "=_", "t4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ra", "w", "Querie", "s", "Tests_", "(_", "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 ", " _", "n1_", "=_", "Note_", "._", "objects_", "._", "create_", "(_", "note_", "=_", "'", "n1", "'_", ",_", "misc_", "=_", "'", "foo", "'_", ",_", "id_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cond", "itional", "Tests_", "(_", "Base", "Query", "set", "Test_", ")_", ":_", "\\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 ", " _", "generic_", "=_", "Name", "d", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Gene", "ric", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t1", "'_", ",_", "category_", "=_", "generic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t2", "'_", ",_", "parent_", "=_", "t1_", ",_", "category_", "=_", "generic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t3", "'_", ",_", "parent_", "=_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t", "4", "'_", ",_", "parent_", "=_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Tag_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "t5", "'_", ",_", "parent_", "=_", "t3_", ")_", "\\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, 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, 4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, 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 ]
Unused import
VisTrails/VisTrails/vistrails/db/services/vistrail.py
[ { "content": "###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: contact@vistrails.org\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## 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 HOLDER OR\n## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\nfrom __future__ import division\n\nfrom vistrails.db.domain import DBWorkflow, DBAdd, DBDelete, DBAction, DBAbstraction, \\\n DBModule, DBConnection, DBPort, DBFunction, DBParameter, DBGroup\nfrom vistrails.db.services.action_chain import getActionChain, getCurrentOperationDict, \\\n getCurrentOperations, simplify_ops\nfrom vistrails.db import VistrailsDBException\n\nimport copy\nimport datetime\nimport getpass\n\nimport unittest\nimport vistrails.core.system\nfrom itertools import chain\n\n\n\n\n\n\n\n\n\n################################################################################\n# Analogy methods\n\n\n\n\n\n\n \n################################################################################\n# Diff methods\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n################################################################################\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def update_id_scope(vistrail):\n if hasattr(vistrail, 'update_id_scope'):\n vistrail.update_id_scope()\n else:\n for action in vistrail.db_actions:\n vistrail.idScope.updateBeginId('action', action.db_id+1)\n if action.db_session is not None:\n vistrail.idScope.updateBeginId('session', action.db_session + 1)\n for operation in action.db_operations:\n vistrail.idScope.updateBeginId('operation', operation.db_id+1)\n if operation.vtType == 'add' or operation.vtType == 'change':\n # update ids of data\n vistrail.idScope.updateBeginId(operation.db_what, \n getNewObjId(operation)+1)\n if operation.db_data is None:\n if operation.vtType == 'change':\n operation.db_objectId = operation.db_oldObjId\n vistrail.db_add_object(operation.db_data)\n for annotation in action.db_annotations:\n vistrail.idScope.updateBeginId('annotation', annotation.db_id+1)", "metadata": "root.update_id_scope", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def materializeWorkflow(vistrail, version):\n # construct path up through tree and perform each action\n if vistrail.db_has_action_with_id(version):\n workflow = DBWorkflow()\n #for action in getActionChain(vistrail, version):\n # oldPerformAction(action, workflow)\n performActions(getActionChain(vistrail, version), \n workflow)\n workflow.db_id = version\n workflow.db_vistrailId = vistrail.db_id\n return workflow\n elif version == 0:\n return DBWorkflow()\n else:\n raise VistrailsDBException(\"invalid workflow version %s\" % version)", "metadata": "root.materializeWorkflow", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def performAction(action, workflow):\n if action.actionType == 'add':\n for operation in action.db_operations:\n workflow.db_add_object(operation.db_data, \n operation.db_parentObjType,\n operation.db_parentObjId)\n elif action.actionType == 'change':\n for operation in action.db_operations:\n workflow.db_change_object(operation.db_data,\n operation.db_parentObjType,\n operation.db_parentObjId)\n elif action.actionType == 'delete':\n for operation in action.operations:\n workflow.db_delete_object(operation.db_objectId,\n operation.db_what,\n operation.db_parentObjType,\n operation.db_parentObjId)\n else:\n msg = \"Unrecognized action type '%s'\" % action.db_actionType\n raise TypeError(msg)", "metadata": "root.performAction", "header": "['module', '___EOS___']", "index": 88 }, { "content": "def performDeletes(deleteOps, workflow):\n for operation in deleteOps:\n workflow.db_delete_object(getOldObjId(operation), operation.db_what,\n operation.db_parentObjType,\n operation.db_parentObjId)", "metadata": "root.performDeletes", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def performAdds(addOps, workflow):\n for operation in addOps:\n# print \"operation %d: %s %s\" % (operation.db_id, operation.vtType,\n# operation.db_what)\n# print \" to: %s %s\" % (operation.db_parentObjType, \n# operation.db_parentObjId)\n workflow.db_add_object(operation.db_data,\n operation.db_parentObjType,\n operation.db_parentObjId)", "metadata": "root.performAdds", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def performActions(actions, workflow):\n # get the current actions and run addObject on the workflow\n # note that delete actions have been removed and\n # a change after an add is effectively an add if the add is discarded\n performAdds(getCurrentOperations(actions), workflow)", "metadata": "root.performActions", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def synchronize(old_vistrail, new_vistrail, current_action_id):\n id_remap = {}\n for action in new_vistrail.db_actions:\n if action.is_new:\n new_action = action.do_copy(True, old_vistrail.idScope, id_remap)\n old_vistrail.db_add_action(new_action)\n else:\n # it must exist in the old vistrail, too\n old_action = old_vistrail.db_actions_id_index[action.db_id]\n # use knowledge that we replace old notes...\n for annotation in action.db_deleted_annotations:\n if old_action.db_has_annotation_with_id(annotation.db_id):\n old_action.db_delete_annotation(annotation)\n else:\n # FIXME conflict!\n # we know that the annotation that was there isn't anymore\n #print 'possible notes conflict'\n if old_action.db_has_annotation_with_key('notes'):\n old_annotation = \\\n old_action.db_get_annotation_by_key('notes')\n old_action.db_delete_annotation(old_annotation)\n else:\n # we don't have to do anything\n pass\n for annotation in action.db_annotations:\n if annotation.is_new:\n new_annotation = annotation.do_copy(True, \n old_vistrail.idScope,\n id_remap)\n old_action.db_add_annotation(new_annotation)\n\n for tag in new_vistrail.db_deleted_tags:\n if old_vistrail.db_has_tag_with_id(tag.db_id):\n old_vistrail.db_delete_tag(tag)\n else:\n # FIXME conflict!\n # we know the tag that was there isn't anymore\n #print 'possible tag conflict'\n # we don't have to do anything here, though\n pass\n\n for tag in new_vistrail.db_tags:\n if tag.is_new:\n new_tag = tag.do_copy(False)\n # remap id\n try:\n new_tag.db_id = id_remap[(DBAction.vtType, new_tag.db_id)]\n except KeyError:\n pass\n try:\n old_tag = old_vistrail.db_tags_name_index[new_tag.db_name]\n except KeyError:\n # FIXME conflict!\n #print \"tag conflict--name already used\"\n old_vistrail.db_delete_tag(old_tag)\n try:\n old_tag = old_vistrail.db_tags_id_index[new_tag.db_id]\n except KeyError:\n #print 'possible tag conflict -- WILL NOT GET HERE!'\n old_vistrail.db_delete_tag(old_tag)\n old_vistrail.db_add_tag(new_tag)\n\n new_action_id = \\\n id_remap.get((DBAction.vtType, current_action_id), current_action_id)\n old_vistrail.db_currentVersion = new_action_id\n return new_action_id", "metadata": "root.synchronize", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def merge(sb, next_sb, app='', interactive = False, tmp_dir = '', next_tmp_dir = ''):\n \"\"\" def merge(sb: SaveBundle, next_sb: SaveBundle, app: str,\n interactive: bool, tmp_dir: str, next_tmp_dir: str) -> None\n Merges two save bundles that has been annotated with checkout\n information from a database.\n All changes from next_sb are appended onto sb. The changes in sb can\n then be uploaded to the database and use as the new working copy.\n first sb is the old one from db, last vt is the new one.\n if interactive is gui.merge_gui.MergeGui then the tmp_dir's must be set.\n \"\"\"\n vt = sb.vistrail\n next_vt = next_sb.vistrail\n merge_gui = interactive\n MergeGUI = merge_gui.MergeGUI if merge_gui else False\n skip = 0\n\n # right now we just replace mashups and subworkflows\n sb.mashups = list(next_sb.mashups)\n sb.abstractions = list(next_sb.abstractions)\n\n id_remap = {}\n\n checkout_key = \"__checkout_version_\"\n action_key = checkout_key + app\n annotation_key = action_key + '_annotationhash'\n action_annotation_key = action_key + '_actionannotationhash'\n\n # find the highest common checkin id\n checkinId = 0\n if len(app) and next_vt.db_has_annotation_with_key(action_key):\n co = next_vt.db_get_annotation_by_key(action_key)\n #print \"found checkin id annotation\"\n checkinId = int(co._db_value)\n else:\n #print \"calculating checkin id\"\n # create unique identifiers for all actions\n actions = []\n actionDict = {}\n for action in vt.db_actions:\n unique = action._db_user + str(action._db_date)\n copy_no = 0\n while (unique + str(copy_no)) in actionDict:\n copy_no += 1\n unique = unique + str(copy_no)\n actions.append(unique)\n actionDict[unique] = action\n actionNexts = []\n actionDictNext = {}\n for action in next_vt.db_actions:\n unique = action._db_user + str(action._db_date)\n copy_no = 0\n while (unique + str(copy_no)) in actionDictNext:\n copy_no += 1\n unique = unique + str(copy_no)\n actionNexts.append(unique)\n actionDictNext[unique] = action\n\n # find last checkin action (only works for centralized syncs)\n while checkinId < len(actions) and checkinId < len(actionNexts) and \\\n actions[checkinId] == actionNexts[checkinId]:\n checkinId += 1\n if checkinId > 0:\n checkinId = actionDict[actions[checkinId-1]].db_id\n #print \"checkinId:\", checkinId\n\n # delete previous checkout annotations in vt\n deletekeys = [action_key,annotation_key,action_annotation_key]\n for key in deletekeys:\n while vt.db_has_annotation_with_key(key):\n a = vt.db_get_annotation_by_key(key)\n vt.db_delete_annotation(a)\n\n # check if someone else have changed the annotations\n mergeAnnotations = True\n if len(app) and next_vt.db_has_annotation_with_key(annotation_key):\n #print \"found annotationhash\"\n co = next_vt.db_get_annotation_by_key(annotation_key)\n old_hash = co._db_value\n mergeAnnotations = (old_hash != vt.hashAnnotations())\n #print \"merge annotations:\", mergeAnnotations\n\n # check if someone else have changed the action annotations\n mergeActionAnnotations = True\n if len(app) and next_vt.db_has_annotation_with_key(action_annotation_key):\n #print \"found actionannotationhash\"\n co = next_vt.db_get_annotation_by_key(action_annotation_key)\n old_hash = co._db_value\n mergeActionAnnotations = (old_hash != vt.hashActionAnnotations())\n #print \"merge actionannotations:\", mergeActionAnnotations\n\n ################## merge actions ######################\n for action in next_vt.db_actions:\n # check for identical actions\n if action._db_id > checkinId:\n new_action = action.do_copy(True, vt.idScope, id_remap)\n vt.db_add_action(new_action)\n\n ################## merge annotations ##################\n if not mergeAnnotations:\n # delete removed annotations\n for annotation in [a for a in vt.db_annotations]:\n if not next_vt.db_has_annotation_with_id(annotation.db_id):\n # delete it\n vt.db_delete_annotation(annotation)\n # add new and update changed annotations\n for annotation in next_vt.db_annotations:\n if not vt.db_has_annotation_with_id(annotation.db_id):\n # new annotation\n new_annotation = annotation.do_copy(True, vt.idScope, id_remap)\n vt.db_add_annotation(new_annotation)\n else:\n old_annotation = vt.db_get_annotation_by_id(annotation.db_id)\n if old_annotation.db_key != annotation.db_key:\n # key changed\n old_annotation.db_key = annotation.db_key\n if old_annotation.db_value != annotation.db_value:\n # value changed\n old_annotation.db_value = annotation.db_value\n else:\n annotations = {}\n # create dict with keys and values\n for annotation in vt.db_annotations:\n if annotation.db_key not in annotations:\n annotations[annotation.db_key] = []\n if annotation.db_value not in annotations[annotation.db_key]:\n annotations[annotation.db_key].append(annotation.db_value)\n # add nonexisting key-value pairs\n for annotation in next_vt.db_annotations:\n if annotation.db_key not in annotations or \\\n annotation.db_value not in annotations[annotation.db_key]:\n new_annotation = annotation.do_copy(True, vt.idScope, id_remap)\n vt.db_add_annotation(new_annotation)\n\n ################# merge action annotations ############\n if not mergeActionAnnotations:\n # delete removed action annotations\n for annotation in [a for a in vt.db_actionAnnotations]:\n if not next_vt.db_has_actionAnnotation_with_id(annotation.db_id):\n # delete it\n vt.db_delete_actionAnnotation(annotation)\n if annotation.db_key == '__thumb__' and len(sb.thumbnails) > 0:\n # remove thumb\n thumb = '/'.join(sb.thumbnails[0].split(\n '/')[:-1]) + '/' + annotation.db_value\n if thumb in sb.thumbnails:\n sb.thumbnails.remove(thumb)\n\n # add new and update changed annotations\n for annotation in next_vt.db_actionAnnotations:\n if not vt.db_has_actionAnnotation_with_id(annotation.db_id):\n # new actionAnnotation\n annotation = annotation.do_copy(True, vt.idScope, id_remap)\n vt.db_add_actionAnnotation(annotation)\n if annotation.db_key == '__thumb__' and \\\n len(next_sb.thumbnails) > 0:\n # add thumb\n thumb = '/'.join(next_sb.thumbnails[0].split(\n '/')[:-1])+'/'+ annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n else:\n old_annotation = \\\n vt.db_get_actionAnnotation_by_id(annotation.db_id)\n if old_annotation.db_value != annotation.db_value:\n # value changed\n if annotation.db_key == '__thumb__' and \\\n len(sb.thumbnails) > 0:\n # remove thumb\n thumb = '/'.join(sb.thumbnails[0].split(\n '/')[:-1]) + '/' + old_annotation.db_value\n if thumb in sb.thumbnails:\n sb.thumbnails.remove(thumb)\n if annotation.db_key == '__thumb__' and \\\n len(next_sb.thumbnails) > 0:\n # add thumb\n thumb = '/'.join(next_sb.thumbnails[0].split(\n '/')[:-1])+'/'+ annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n old_annotation.db_value = annotation.db_value\n old_annotation.db_date = annotation.db_date\n old_annotation.db_user = annotation.db_user\n else:\n # construct old action index (oas)\n oas = {}\n for a in vt.db_actionAnnotations:\n if not a.db_action_id in oas:\n oas[a.db_action_id] = {}\n if not a.db_key in oas[a.db_action_id]:\n oas[a.db_action_id][a.db_key] = []\n oas[a.db_action_id][a.db_key].append(a)\n # merge per action\n for new_annotation in next_vt.db_actionAnnotations:\n # keep both upgrades but update action id in new\n if new_annotation.db_key == '__upgrade__':\n value = int(new_annotation.db_value)\n if ('action', value) in id_remap:\n new_annotation.db_value = str(id_remap[('action', value)])\n annotation = new_annotation.do_copy(True, vt.idScope, id_remap)\n vt.db_add_actionAnnotation(annotation)\n elif new_annotation.db_action_id <= checkinId and \\\n new_annotation.db_key in oas[new_annotation.db_action_id]:\n old_action = oas[new_annotation.db_action_id]\n # we have a conflict\n # tags should be merged (the user need to resolve)\n if new_annotation.db_key == '__tag__':\n # there is only one\n old_annotation = old_action[new_annotation.db_key][0]\n if old_annotation.db_value != new_annotation.db_value:\n value = old_annotation.db_value + \" or \" + \\\n new_annotation.db_value\n if interactive:\n if skip == 1:\n pass\n elif skip == 2:\n old_annotation.db_value=new_annotation.db_value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n else:\n v, value = MergeGUI.resolveTags(\n old_annotation, new_annotation, value)\n if v == merge_gui.CHOICE_OTHER_ALL:\n skip = 1\n elif v == merge_gui.CHOICE_OTHER:\n pass\n elif v == merge_gui.CHOICE_RESOLVED:\n #print \"Tag resolved:\", value\n old_annotation.db_value = value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n pass\n elif v == merge_gui.CHOICE_OWN:\n old_annotation.db_value = \\\n new_annotation.db_value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n elif v == merge_gui.CHOICE_OWN_ALL:\n old_annotation.db_value = \\\n new_annotation.db_value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n skip = 2\n else:\n old_annotation.db_value = value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n # notes should be merged (the user need to resolve)\n elif new_annotation.db_key == '__notes__':\n # there is only one\n old_annotation = old_action[new_annotation.db_key][0]\n if new_annotation.db_value != old_annotation.db_value:\n value = (\"#### conflicting versions! ####<br/>\" + \n \"## Other version at %s by %s:%s<br/>\" +\n \"## Your version at %s by %s:%s\") % \\\n (str(old_annotation.db_date), old_annotation.db_user,\n old_annotation.db_value, str(new_annotation.db_date),\n new_annotation.db_user, new_annotation.db_value)\n if interactive:\n if skip == 1:\n pass\n elif skip == 2:\n old_annotation.db_value=new_annotation.db_value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n else:\n v, value = MergeGUI.resolveNotes(\n old_annotation, new_annotation, value)\n if v == merge_gui.CHOICE_OTHER_ALL:\n skip = 1\n elif v == merge_gui.CHOICE_OTHER:\n pass\n elif v == merge_gui.CHOICE_RESOLVED:\n #print \"Note resolved:\", value\n old_annotation.db_value = value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n pass\n elif v == merge_gui.CHOICE_OWN:\n old_annotation.db_value = \\\n new_annotation.db_value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n elif v == merge_gui.CHOICE_OWN_ALL:\n old_annotation.db_value = \\\n new_annotation.db_value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n skip = 2\n else:\n old_annotation.db_value = value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n\n # thumbs should be updated (we loose the other update)\n elif new_annotation.db_key == '__thumb__': \n # there is only one\n old_annotation = old_action[new_annotation.db_key][0]\n if new_annotation.db_value != old_annotation.db_value:\n if interactive:\n if skip == 1:\n pass\n elif skip == 2:\n thumb = '/'.join(sb.thumbnails[0].split(\n '/')[:-1])+'/'+ old_annotation.db_value\n if thumb in sb.thumbnails:\n sb.thumbnails.remove(thumb)\n old_annotation.db_value=new_annotation.db_value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n thumb = '/'.join(next_sb.thumbnails[0].split(\n '/')[:-1])+'/'+ new_annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n else:\n v = MergeGUI.resolveThumbs(old_annotation,\n new_annotation, tmp_dir, next_tmp_dir)\n if v == merge_gui.CHOICE_OTHER_ALL:\n skip = 1\n elif v == merge_gui.CHOICE_OTHER:\n pass\n elif v in (merge_gui.CHOICE_OWN,\n merge_gui.CHOICE_OWN_ALL):\n thumb = '/'.join(sb.thumbnails[0].split(\n '/')[:-1])+'/'+ old_annotation.db_value\n if thumb in sb.thumbnails:\n sb.thumbnails.remove(thumb)\n old_annotation.db_value = \\\n new_annotation.db_value\n old_annotation.db_date = \\\n new_annotation.db_date\n old_annotation.db_user = \\\n new_annotation.db_user\n thumb='/'.join(next_sb.thumbnails[0].split(\n '/')[:-1])+'/'+ new_annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n if v == merge_gui.CHOICE_OWN_ALL:\n skip = 2\n else:\n thumb = '/'.join(sb.thumbnails[0].split(\n '/')[:-1])+'/'+ old_annotation.db_value\n if thumb in sb.thumbnails:\n sb.thumbnails.remove(thumb)\n old_annotation.db_value = new_annotation.db_value\n old_annotation.db_date = new_annotation.db_date\n old_annotation.db_user = new_annotation.db_user\n thumb = '/'.join(next_sb.thumbnails[0].split(\n '/')[:-1])+'/'+ new_annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n elif new_annotation.db_key == '__prune__': # keep old\n pass\n # others should be appended if not already there\n else:\n values = []\n for old_annotation in old_action[new_annotation.db_key]:\n values.append(old_annotation.db_value)\n if new_annotation.db_value not in values:\n annotation = new_annotation.do_copy(True, vt.idScope, \\\n id_remap)\n vt.db_add_actionAnnotation(annotation)\n else:\n annotation = new_annotation.do_copy(True, vt.idScope, id_remap)\n vt.db_add_actionAnnotation(annotation)\n if annotation.db_key == '__thumb__':\n thumb = '/'.join(next_sb.thumbnails[0].split('/')[:-1]) + \\\n '/' + annotation.db_value\n if thumb not in sb.thumbnails:\n sb.thumbnails.append(thumb)\n # make this a valid checked out version\n if len(app):\n vt.update_checkout_version(app)", "metadata": "root.merge", "header": "['module', '___EOS___']", "index": 198 }, { "content": "def find_data(what, id, op_dict):\n try:\n return op_dict[(what, id)].db_data\n except KeyError:\n msg = 'cannot find data (%s, %s)' % (what, id)\n raise KeyError(msg)", "metadata": "root.find_data", "header": "['module', '___EOS___']", "index": 586 }, { "content": "def invertOperations(op_dict, adds, deletes, do_copy=False):\n inverse_ops = [] \n deletes.reverse()\n for op in deletes:\n data = find_data(op.db_what, getOldObjId(op), op_dict)\n if do_copy:\n data = copy.copy(data)\n inv_op = DBAdd(id=-1,\n what=op.db_what,\n objectId=getOldObjId(op),\n parentObjId=op.db_parentObjId,\n parentObjType=op.db_parentObjType,\n data=data\n )\n inverse_ops.append(inv_op)\n adds.reverse()\n for op in adds:\n inv_op = DBDelete(id=-1,\n what=op.db_what,\n objectId=getNewObjId(op),\n parentObjId=op.db_parentObjId,\n parentObjType=op.db_parentObjType,\n )\n inverse_ops.append(inv_op)\n return inverse_ops", "metadata": "root.invertOperations", "header": "['module', '___EOS___']", "index": 593 }, { "content": "def normalOperations(adds, deletes, do_copy=False):\n new_ops = []\n for op in deletes:\n new_op = DBDelete(id=-1,\n what=op.db_what,\n objectId=getOldObjId(op),\n parentObjId=op.db_parentObjId,\n parentObjType=op.db_parentObjType,\n )\n new_ops.append(new_op)\n for op in adds:\n data = op.db_data\n if do_copy:\n data = copy.copy(op.db_data)\n new_op = DBAdd(id=-1,\n what=op.db_what,\n objectId=getNewObjId(op),\n parentObjId=op.db_parentObjId,\n parentObjType=op.db_parentObjType,\n data=data)\n new_ops.append(new_op)\n return new_ops ", "metadata": "root.normalOperations", "header": "['module', '___EOS___']", "index": 619 }, { "content": "def getPathAsAction(vistrail, v1, v2, do_copy=False):\n sharedRoot = getSharedRoot(vistrail, [v1, v2])\n sharedActionChain = getActionChain(vistrail, sharedRoot)\n sharedOperationDict = getCurrentOperationDict(sharedActionChain)\n v1Actions = getActionChain(vistrail, v1, sharedRoot)\n v2Actions = getActionChain(vistrail, v2, sharedRoot)\n (v1AddDict, v1DeleteDict) = getOperationDiff(v1Actions, \n sharedOperationDict)\n (v2AddDict, v2DeleteDict) = getOperationDiff(v2Actions,\n sharedOperationDict)\n \n # need to invert one of them (v1)\n v1Adds = v1AddDict.values()\n v1Adds.sort(key=lambda x: x.db_id) # faster than sort(lambda x, y: cmp(x.db_id, y.db_id))\n v1Deletes = v1DeleteDict.values()\n v1Deletes.sort(key=lambda x: x.db_id) # faster than sort(lambda x, y: cmp(x.db_id, y.db_id))\n v1InverseOps = \\\n invertOperations(sharedOperationDict, v1Adds, v1Deletes, do_copy)\n \n # need to normalize ops of the other (v2)\n v2Adds = v2AddDict.values()\n v2Adds.sort(key=lambda x: x.db_id) # faster than sort(lambda x, y: cmp(x.db_id, y.db_id))\n v2Deletes = v2DeleteDict.values()\n v2Deletes.sort(key=lambda x: x.db_id) # faster than sort(lambda x, y: cmp(x.db_id, y.db_id))\n v2Ops = normalOperations(v2Adds, v2Deletes, do_copy)\n\n allOps = v1InverseOps + v2Ops\n simplifiedOps = simplify_ops(allOps)\n return DBAction(id=-1, \n operations=simplifiedOps,\n )", "metadata": "root.getPathAsAction", "header": "['module', '___EOS___']", "index": 642 }, { "content": "def addAndFixActions(startDict, actions):\n curDict = copy.copy(startDict)\n # print curDict\n for action in actions:\n# print \"fixing action:\", action.db_id\n new_ops = []\n for op in action.db_operations:\n# print \"op:\", op.vtType, op.db_what, getOldObjId(op)\n# print \" \", op.db_parentObjType, op.db_parentObjId\n if op.vtType == 'add':\n if op.db_parentObjId is None or \\\n curDict.has_key((op.db_parentObjType, \n op.db_parentObjId)):\n curDict[(op.db_what, op.db_objectId)] = op\n new_ops.append(op) \n elif op.vtType == 'change':\n if curDict.has_key((op.db_what, op.db_oldObjId)) and \\\n (op.db_parentObjId is None or \\\n curDict.has_key((op.db_parentObjType, \n op.db_parentObjId))):\n del curDict[(op.db_what, op.db_oldObjId)]\n curDict[(op.db_what, op.db_newObjId)] = op\n new_ops.append(op)\n elif op.vtType == 'delete':\n if (op.db_parentObjId is None or\n curDict.has_key((op.db_parentObjType, \n op.db_parentObjId))) and \\\n curDict.has_key((op.db_what, op.db_objectId)):\n del curDict[(op.db_what, op.db_objectId)]\n new_ops.append(op)\n action.db_operations = new_ops\n return curDict", "metadata": "root.addAndFixActions", "header": "['module', '___EOS___']", "index": 674 }, { "content": "def fixActions(vistrail, v, actions):\n startingChain = getActionChain(vistrail, v)\n startingDict = getCurrentOperationDict(startingChain)\n addAndFixActions(startingDict, actions)", "metadata": "root.fixActions", "header": "['module', '___EOS___']", "index": 707 }, { "content": "def getSharedRoot(vistrail, versions):\n # base case is 0\n current = copy.copy(versions)\n while 0 not in current:\n maxId = max(current)\n if current.count(maxId) == len(current):\n return maxId\n else:\n newId = vistrail.db_get_action_by_id(maxId).db_prevId\n for i, v in enumerate(current):\n if v == maxId:\n current[i] = newId\n return 0", "metadata": "root.getSharedRoot", "header": "['module', '___EOS___']", "index": 715 }, { "content": "def getOperationDiff(actions, operationDict):\n addDict = {}\n deleteDict = {}\n for action in actions:\n# print 'action: %d' % action.db_id\n for operation in action.db_operations:\n if operation.vtType == 'add':\n# print \"add: %s %s\" % (operation.db_what, \n# operation.db_objectId)\n addDict[(operation.db_what, \n operation.db_objectId)] = operation\n elif operation.vtType == 'delete':\n# print \"del: %s %s\" % (operation.db_what, \n# operation.db_objectId)\n if operationDict.has_key((operation.db_what,\n operation.db_objectId)):\n deleteDict[(operation.db_what,\n operation.db_objectId)] = operation\n# del operationDict[(operation.db_what, \n# operation.db_objectId)]\n elif addDict.has_key((operation.db_what,\n operation.db_objectId)):\n del addDict[(operation.db_what,\n operation.db_objectId)]\n else:\n pass\n elif operation.vtType == 'change':\n# print \"chg: %s %s %s\" % (operation.db_what, \n# operation.db_oldObjId,\n# operation.db_newObjId)\n if operationDict.has_key((operation.db_what,\n operation.db_oldObjId)):\n deleteDict[(operation.db_what,\n operation.db_oldObjId)] = operation\n# del operationDict[(operation.db_what, \n# operation.db_oldObjId)]\n elif addDict.has_key((operation.db_what,\n operation.db_oldObjId)):\n del addDict[(operation.db_what, operation.db_oldObjId)]\n\n addDict[(operation.db_what,\n operation.db_newObjId)] = operation\n else:\n msg = \"Unrecognized operation '%s'\" % operation.vtType\n raise TypeError(msg)\n\n return (addDict, deleteDict)", "metadata": "root.getOperationDiff", "header": "['module', '___EOS___']", "index": 729 }, { "content": "def updateOperationDict(operationDict, deleteOps, addOps):\n for operation in deleteOps:\n if operationDict.has_key((operation.db_what, getOldObjId(operation))):\n del operationDict[(operation.db_what, getOldObjId(operation))]\n else:\n msg = \"Illegal operation: \" + operation\n for operation in addOps:\n operationDict[(operation.db_what, getNewObjId(operation))] = operation\n return operationDict", "metadata": "root.updateOperationDict", "header": "['module', '___EOS___']", "index": 777 }, { "content": "def getObjects(actions):\n objects = {}\n for action in actions:\n for operation in action.db_operations:\n if not objects.has_key(operation.db_what):\n objects[operation.db_what] = []\n object = copy.copy(operation.db_data)\n objects[operation.db_what].append(object)\n return objects", "metadata": "root.getObjects", "header": "['module', '___EOS___']", "index": 787 }, { "content": "def getVersionDifferences(vistrail, versions):\n sharedRoot = getSharedRoot(vistrail, versions)\n sharedActionChain = getActionChain(vistrail, sharedRoot)\n sharedOperationDict = getCurrentOperationDict(sharedActionChain)\n\n vOnlySorted = []\n for v in versions:\n vActions = getActionChain(vistrail, v, sharedRoot)\n (vAddDict, vDeleteDict) = getOperationDiff(vActions, \n sharedOperationDict)\n vOnlyAdds = vAddDict.values()\n vOnlyAdds.sort(key=lambda x: x.db_id)\n vOnlyDeletes = vDeleteDict.values()\n vOnlyDeletes.sort(key=lambda x: x.db_id)\n vOpDict = copy.copy(sharedOperationDict)\n updateOperationDict(vOpDict, vOnlyDeletes, vOnlyAdds)\n vOps = vOpDict.values()\n vOps.sort(key=lambda x: x.db_id)\n vOnlySorted.append((vOnlyAdds, vOnlyDeletes, vOps))\n\n sharedOps = sharedOperationDict.values()\n sharedOps.sort(key=lambda x: x.db_id)\n\n return (sharedOps, vOnlySorted)", "metadata": "root.getVersionDifferences", "header": "['module', '___EOS___']", "index": 797 }, { "content": "def heuristicModuleMatch(m1, m2):\n \"\"\"takes two modules and returns 1 if exact match,\n 0 if module names match, -1 if no match\n \n \"\"\"\n if m1.db_name == m2.db_name and m1.db_namespace == m2.db_namespace and \\\n m1.db_package == m2.db_package:\n if m1.vtType == 'group':\n # check if we have __desc__ annotation\n m1_desc = None\n m2_desc = None\n if '__desc__' in m1.db_annotations_key_index:\n m1_desc = m1.db_annotations_key_index['__desc__']\n if '__desc__' in m2.db_annotations_key_index:\n m2_desc = m2.db_annotations_key_index['__desc__']\n if not (m1_desc and m2_desc and m1_desc == m2_desc):\n # if desc's don't exactly match, return 0\n # else continue and check functions\n # FIXME: maybe we should check functions here\n return 0\n \n m1_functions = copy.copy(m1.db_get_functions())\n m2_functions = copy.copy(m2.db_get_functions())\n if len(m1_functions) != len(m2_functions):\n return 0\n for f1 in m1_functions[:]:\n match = None\n for f2 in m2_functions:\n isMatch = heuristicFunctionMatch(f1, f2)\n if isMatch == 1:\n match = f2\n break\n if match is not None:\n m1_functions.remove(f1)\n m2_functions.remove(f2)\n else:\n return 0\n \n m1_cparams = copy.copy(m1.db_get_controlParameters())\n m2_cparams = copy.copy(m2.db_get_controlParameters())\n if len(m1_cparams) != len(m2_cparams):\n return 0\n for cp1 in m1_cparams[:]:\n match = None\n for cp2 in m2_cparams:\n isMatch = heuristicControlParameterMatch(cp1, cp2)\n if isMatch == 1:\n match = cp2\n break\n if match is not None:\n m1_cparams.remove(cp1)\n m2_cparams.remove(cp2)\n else:\n return 0\n \n m1_annots = copy.copy(m1.db_get_annotations())\n m2_annots = copy.copy(m2.db_get_annotations())\n if len(m1_annots) != len(m2_annots):\n return 0\n for a1 in m1_annots[:]:\n match = None\n for a2 in m2_annots:\n isMatch = heuristicAnnotationMatch(a1, a2)\n if isMatch == 1:\n match = a2\n break\n if match is not None:\n m1_annots.remove(a1)\n m2_annots.remove(a2)\n else:\n return 0\n\n if len(m1_functions) == len(m2_functions) == \\\n len(m1_cparams ) == len(m2_cparams ) == \\\n len(m1_annots ) == len(m2_annots ) == 0:\n return 1\n else:\n return 0\n return -1", "metadata": "root.heuristicModuleMatch", "header": "['module', '___EOS___']", "index": 822 }, { "content": "def heuristicFunctionMatch(f1, f2):\n \"\"\"takes two functions and returns 1 if exact match,\n 0 if function names match, -1 if no match\n\n \"\"\"\n if f1.db_name == f2.db_name:\n f1_parameters = copy.copy(f1.db_get_parameters())\n f2_parameters = copy.copy(f2.db_get_parameters())\n if len(f1_parameters) != len(f2_parameters):\n return 0\n for p1 in f1_parameters[:]:\n match = None\n for p2 in f2_parameters:\n isMatch = heuristicParameterMatch(p1, p2)\n if isMatch == 1:\n match = p2\n break\n if match is not None:\n f1_parameters.remove(p1)\n f2_parameters.remove(match)\n else:\n return 0\n if len(f1_parameters) == len(f2_parameters) == 0:\n return 1\n else:\n return 0\n return -1", "metadata": "root.heuristicFunctionMatch", "header": "['module', '___EOS___']", "index": 902 }, { "content": "def heuristicParameterMatch(p1, p2):\n \"\"\"takes two parameters and returns 1 if exact match,\n 0 if partial match (types match), -1 if no match\n\n \"\"\"\n if p1.db_type == p2.db_type and p1.db_pos == p2.db_pos:\n if p1.db_val == p2.db_val:\n return 1\n else:\n return 0\n return -1", "metadata": "root.heuristicParameterMatch", "header": "['module', '___EOS___']", "index": 930 }, { "content": "def heuristicControlParameterMatch(cp1, cp2):\n \"\"\"takes two control parameters and returns 1 if exact match,\n 0 if partial match (types match), -1 if no match\n\n \"\"\"\n if cp1.db_name == cp2.db_name:\n if cp1.db_value == cp2.db_value:\n return 1\n else:\n return 0\n return -1", "metadata": "root.heuristicControlParameterMatch", "header": "['module', '___EOS___']", "index": 942 }, { "content": "def heuristicAnnotationMatch(a1, a2):\n \"\"\"takes two annotations and returns 1 if exact match,\n 0 if partial match (types match), -1 if no match\n\n \"\"\"\n if a1.db_key == a2.db_key:\n if a1.db_value == a2.db_value:\n return 1\n else:\n return 0\n return -1", "metadata": "root.heuristicAnnotationMatch", "header": "['module', '___EOS___']", "index": 954 }, { "content": "def heuristicConnectionMatch(c1, c2):\n \"\"\"takes two connections and returns 1 if exact match,\n 0 if partial match (currently undefined), -1 if no match\n\n \"\"\"\n c1_ports = copy.copy(c1.db_get_ports())\n c2_ports = copy.copy(c2.db_get_ports())\n for p1 in c1_ports[:]:\n match = None\n for p2 in c2_ports:\n isMatch = heuristicPortMatch(p1, p2)\n if isMatch == 1:\n match = p2\n break\n elif isMatch == 0:\n match = p2\n if match is not None:\n c1_ports.remove(p1)\n c2_ports.remove(match)\n else:\n return -1\n if len(c1_ports) == len(c2_ports) == 0:\n return 1\n return -1", "metadata": "root.heuristicConnectionMatch", "header": "['module', '___EOS___']", "index": 966 }, { "content": "def heuristicPortMatch(p1, p2):\n \"\"\"takes two ports and returns 1 if exact match,\n 0 if partial match, -1 if no match\n \n \"\"\"\n if p1.db_moduleId == p2.db_moduleId:\n return 1\n elif p1.db_type == p2.db_type and \\\n p1.db_moduleName == p2.db_moduleName and \\\n p1.sig == p2.sig:\n return 0\n return -1", "metadata": "root.heuristicPortMatch", "header": "['module', '___EOS___']", "index": 991 }, { "content": "def function_sig(function):\n return (function.db_name,\n [(param.db_type, param.db_val)\n for param in function.db_get_parameters()])", "metadata": "root.function_sig", "header": "['module', '___EOS___']", "index": 1004 }, { "content": "def getParamChanges(m1, m2, same_vt=True, heuristic_match=True):\n paramChanges = []\n # need to check to see if any children of m1 and m2 are affected\n m1_functions = m1.db_get_functions()\n m2_functions = m2.db_get_functions()\n m1_unmatched = []\n m2_unmatched = []\n if same_vt:\n for f1 in m1_functions:\n # see if m2 has f1, too\n f2 = m2.db_get_function(f1.db_id)\n if f2 is None: \n m1_unmatched.append(f1)\n else:\n # function is same, check if parameters have changed\n if heuristic_match:\n matchValue = heuristicFunctionMatch(f1, f2)\n if matchValue != 1:\n paramChanges.append((function_sig(f1), \n function_sig(f2)))\n else:\n paramChanges.append((function_sig(f1), function_sig(f2)))\n for f2 in m2_functions:\n # see if m1 has f2, too\n if m1.db_get_function(f2.db_id) is None:\n m2_unmatched.append(f2)\n else:\n m1_unmatched.extend(m1_functions)\n m2_unmatched.extend(m2_functions)\n\n# functionMatch = True\n# f1_params = f1.db_get_parameters()\n# f2_params = f2.db_get_parameters()\n# for p1 in f1_params:\n# if f2.db_get_parameter(p1.db_id) is None:\n# functionMatch = False\n# m1_unmatched.append(f1)\n# break\n# for p2 in f2_params:\n# if f1.db_get_parameter(p2.db_id) is None:\n# functionMatch = False\n# m2_unmatched.append(f2)\n# break\n# if functionMatch:\n\n if len(m1_unmatched) + len(m2_unmatched) > 0:\n if heuristic_match and len(m1_unmatched) > 0 and len(m2_unmatched) > 0:\n # do heuristic matches\n for f1 in m1_unmatched[:]:\n matched = False\n matchValue = 0\n for f2 in m2_unmatched:\n matchValue = heuristicFunctionMatch(f1, f2)\n if matchValue == 1:\n # best match so quit\n matched = f1\n break\n elif matchValue == 0:\n # match, but not exact so continue to look\n matched = f1\n if matched:\n if matchValue != 1:\n paramChanges.append((function_sig(f1), \n function_sig(f2)))\n m1_unmatched.remove(f1)\n m2_unmatched.remove(f2)\n\n for f in m1_unmatched:\n paramChanges.append((function_sig(f), (None, None)))\n for f in m2_unmatched:\n paramChanges.append(((None, None), function_sig(f)))\n \n return paramChanges", "metadata": "root.getParamChanges", "header": "['module', '___EOS___']", "index": 1009 }, { "content": "def getCParamChanges(m1, m2, same_vt=True, heuristic_match=True):\n cparamChanges = []\n # need to check to see if any children of m1 and m2 are affected\n m1_cparams = m1.db_get_controlParameters()\n m2_cparams = m2.db_get_controlParameters()\n m1_unmatched = []\n m2_unmatched = []\n if same_vt:\n for cp1 in m1_cparams:\n # see if m2 has f1, too\n cp2 = m2.db_get_controlParameter(cp1.db_id)\n if cp2 is None: \n m1_unmatched.append(cp1)\n else:\n # cparam is same, check if it has changed\n if heuristic_match:\n matchValue = heuristicControlParameterMatch(cp1, cp2)\n if matchValue != 1:\n cparamChanges.append(((cp1.db_name,cp1.db_value), \n (cp2.db_name,cp2.db_value)))\n else:\n cparamChanges.append(((cp1.db_name,cp1.db_value), \n (cp2.db_name,cp2.db_value)))\n for cp2 in m2_cparams:\n # see if m1 has f2, too\n if m1.db_get_controlParameter(cp2.db_id) is None:\n m2_unmatched.append(cp2)\n else:\n m1_unmatched.extend(m1_cparams)\n m2_unmatched.extend(m2_cparams)\n\n# functionMatch = True\n# f1_params = f1.db_get_parameters()\n# f2_params = f2.db_get_parameters()\n# for p1 in f1_params:\n# if f2.db_get_parameter(p1.db_id) is None:\n# functionMatch = False\n# m1_unmatched.append(f1)\n# break\n# for p2 in f2_params:\n# if f1.db_get_parameter(p2.db_id) is None:\n# functionMatch = False\n# m2_unmatched.append(f2)\n# break\n# if functionMatch:\n\n if len(m1_unmatched) + len(m2_unmatched) > 0:\n if heuristic_match and len(m1_unmatched) > 0 and len(m2_unmatched) > 0:\n # do heuristic matches\n for cp1 in m1_unmatched[:]:\n matched = False\n matchValue = 0\n for cp2 in m2_unmatched:\n matchValue = heuristicControlParameterMatch(cp1, cp2)\n if matchValue == 1:\n # best match so quit\n matched = cp1\n break\n elif matchValue == 0:\n # match, but not exact so continue to look\n matched = cp1\n if matched:\n if matchValue != 1:\n cparamChanges.append(((cp1.db_name,cp1.db_value), \n (cp2.db_name,cp2.db_value)))\n m1_unmatched.remove(cp1)\n m2_unmatched.remove(cp2)\n\n for cp in m1_unmatched:\n cparamChanges.append(((cp.db_name,cp.db_value), (None, None)))\n for cp in m2_unmatched:\n cparamChanges.append(((None, None), (cp.db_name,cp.db_value)))\n return cparamChanges", "metadata": "root.getCParamChanges", "header": "['module', '___EOS___']", "index": 1083 }, { "content": "def getAnnotationChanges(m1, m2, same_vt=True, heuristic_match=True):\n annotChanges = []\n # need to check to see if any children of m1 and m2 are affected\n m1_annots = m1.db_get_annotations()\n m2_annots = m2.db_get_annotations()\n m1_unmatched = []\n m2_unmatched = []\n if same_vt:\n for a1 in m1_annots:\n # see if m2 has f1, too\n a2 = m2.db_get_annotation(a1.db_id)\n if a2 is None: \n m1_unmatched.append(a1)\n else:\n # cparam is same, check if it has changed\n if heuristic_match:\n matchValue = heuristicAnnotationMatch(a1, a2)\n if matchValue != 1:\n annotChanges.append(((a1.db_key,a1.db_value), \n (a2.db_key,a2.db_value)))\n else:\n annotChanges.append(((a1.db_key,a1.db_value), \n (a2.db_key,a2.db_value)))\n for a2 in m2_annots:\n # see if m1 has f2, too\n if m1.db_get_annotation(a2.db_id) is None:\n m2_unmatched.append(a2)\n else:\n m1_unmatched.extend(m1_annots)\n m2_unmatched.extend(m2_annots)\n\n# functionMatch = True\n# f1_params = f1.db_get_parameters()\n# f2_params = f2.db_get_parameters()\n# for p1 in f1_params:\n# if f2.db_get_parameter(p1.db_id) is None:\n# functionMatch = False\n# m1_unmatched.append(f1)\n# break\n# for p2 in f2_params:\n# if f1.db_get_parameter(p2.db_id) is None:\n# functionMatch = False\n# m2_unmatched.append(f2)\n# break\n# if functionMatch:\n\n if len(m1_unmatched) + len(m2_unmatched) > 0:\n if heuristic_match and len(m1_unmatched) > 0 and len(m2_unmatched) > 0:\n # do heuristic matches\n for a1 in m1_unmatched[:]:\n matched = False\n matchValue = 0\n for a2 in m2_unmatched:\n matchValue = heuristicAnnotationMatch(a1, a2)\n if matchValue == 1:\n # best match so quit\n matched = a1\n break\n elif matchValue == 0:\n # match, but not exact so continue to look\n matched = a1\n if matched:\n if matchValue != 1:\n annotChanges.append(((a1.db_key,a1.db_value), \n (a2.db_key,a2.db_value)))\n m1_unmatched.remove(a1)\n m2_unmatched.remove(a2)\n\n for cp in m1_unmatched:\n annotChanges.append(((cp.db_key,cp.db_value), (None, None)))\n for cp in m2_unmatched:\n annotChanges.append(((None, None), (cp.db_key,cp.db_value)))\n \n return annotChanges", "metadata": "root.getAnnotationChanges", "header": "['module', '___EOS___']", "index": 1157 }, { "content": "def getOldObjId(operation):\n if operation.vtType == 'change':\n return operation.db_oldObjId\n return operation.db_objectId", "metadata": "root.getOldObjId", "header": "['module', '___EOS___']", "index": 1232 }, { "content": "def getNewObjId(operation):\n if operation.vtType == 'change':\n return operation.db_newObjId\n return operation.db_objectId", "metadata": "root.getNewObjId", "header": "['module', '___EOS___']", "index": 1237 }, { "content": "def setOldObjId(operation, id):\n if operation.vtType == 'change':\n operation.db_oldObjId = id\n else:\n operation.db_objectId = id", "metadata": "root.setOldObjId", "header": "['module', '___EOS___']", "index": 1242 }, { "content": "def setNewObjId(operation, id):\n if operation.vtType == 'change':\n operation.db_newObjId = id\n else:\n operation.db_objectId = id", "metadata": "root.setNewObjId", "header": "['module', '___EOS___']", "index": 1248 }, { "content": "def getWorkflowDiffCommon(vistrail, v1, v2, heuristic_match=True):\n (sharedOps, vOnlyOps) = \\\n getVersionDifferences(vistrail, [v1, v2])\n\n sharedWorkflow = DBWorkflow()\n performAdds(sharedOps, sharedWorkflow)\n\n # FIXME better to do additional ops (and do deletes) or do this?\n v1Workflow = DBWorkflow()\n v1Ops = vOnlyOps[0][2]\n performAdds(v1Ops, v1Workflow)\n\n v2Workflow = DBWorkflow()\n v2Ops = vOnlyOps[1][2]\n performAdds(v2Ops, v2Workflow)\n\n # FIXME connections do not check their ports\n sharedModuleIds = []\n sharedConnectionIds = []\n sharedFunctionIds = {}\n sharedCParameterIds = {}\n sharedAnnotationIds = {}\n for op in sharedOps:\n if op.what == 'module' or op.what == 'abstraction' or \\\n op.what == 'group':\n sharedModuleIds.append(getNewObjId(op))\n elif op.what == 'connection':\n sharedConnectionIds.append(getNewObjId(op))\n elif op.what == 'function':\n sharedFunctionIds[getNewObjId(op)] = op.db_parentObjId\n elif op.what == 'controlParameter':\n sharedCParameterIds[getNewObjId(op)] = op.db_parentObjId\n elif op.what == 'annotation':\n sharedAnnotationIds[getNewObjId(op)] = op.db_parentObjId\n \n vOnlyModules = []\n vOnlyConnections = []\n paramChgModules = {}\n cparamChgModules = {}\n annotChgModules = {}\n for (vAdds, vDeletes, _) in vOnlyOps:\n moduleDeleteIds = []\n connectionDeleteIds = []\n for op in vDeletes:\n if op.what == 'module' or op.what == 'abstraction' or \\\n op.what == 'group':\n moduleDeleteIds.append(getOldObjId(op))\n if getOldObjId(op) in sharedModuleIds:\n sharedModuleIds.remove(getOldObjId(op))\n if paramChgModules.has_key(getOldObjId(op)):\n del paramChgModules[getOldObjId(op)]\n if cparamChgModules.has_key(getOldObjId(op)):\n del cparamChgModules[getOldObjId(op)]\n if annotChgModules.has_key(getOldObjId(op)):\n del annotChgModules[getOldObjId(op)]\n elif op.what == 'function' and \\\n (op.db_parentObjType == 'module' or \n op.db_parentObjType == 'abstraction' or \n op.db_parentObjType == 'group') and \\\n op.db_parentObjId in sharedModuleIds:\n # have a function change\n paramChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif op.what == 'parameter' and op.db_parentObjType == 'function' \\\n and sharedFunctionIds.has_key(op.db_parentObjId):\n # have a parameter change\n moduleId = sharedFunctionIds[op.db_parentObjId]\n if moduleId in sharedModuleIds:\n paramChgModules[moduleId] = None\n sharedModuleIds.remove(moduleId)\n elif op.what == 'controlParameter' and \\\n (op.db_parentObjType == 'module' or \n op.db_parentObjType == 'abstraction' or \n op.db_parentObjType == 'group') and \\\n op.db_parentObjId in sharedCParameterIds and \\\n op.db_parentObjId in sharedModuleIds:\n # have a control parameter change\n cparamChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif op.what == 'annotation' and \\\n (op.db_parentObjType == 'module' or \n op.db_parentObjType == 'abstraction' or \n op.db_parentObjType == 'group') and \\\n op.db_parentObjId in sharedAnnotationIds and \\\n op.db_parentObjId in sharedModuleIds:\n # have an annotation change\n annotChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif op.what == 'connection':\n connectionDeleteIds.append(getOldObjId(op))\n if getOldObjId(op) in sharedConnectionIds:\n sharedConnectionIds.remove(getOldObjId(op))\n\n moduleAddIds = []\n connectionAddIds = []\n for op in vAdds:\n if op.what == 'module' or op.what == 'abstraction' or \\\n op.what == 'group':\n moduleAddIds.append(getNewObjId(op))\n elif (op.what == 'function' and\n (op.db_parentObjType == 'module' or\n op.db_parentObjType == 'abstraction' or\n op.db_parentObjType == 'group') and\n op.db_parentObjId in sharedModuleIds):\n # have a function change\n paramChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif op.what == 'parameter' and op.db_parentObjType == 'function' \\\n and sharedFunctionIds.has_key(op.db_parentObjId):\n # have a parameter change\n moduleId = sharedFunctionIds[op.db_parentObjId]\n if moduleId in sharedModuleIds:\n paramChgModules[moduleId] = None\n sharedModuleIds.remove(moduleId)\n elif (op.what == 'controlParameter' and\n (op.db_parentObjType == 'module' or\n op.db_parentObjType == 'abstraction' or\n op.db_parentObjType == 'group') and\n op.db_parentObjId in sharedCParameterIds and\n op.db_parentObjId in sharedModuleIds):\n # have a control parameter change\n cparamChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif (op.what == 'annotation' and\n (op.db_parentObjType == 'module' or\n op.db_parentObjType == 'abstraction' or\n op.db_parentObjType == 'group') and\n op.db_parentObjId in sharedAnnotationIds and\n op.db_parentObjId in sharedModuleIds):\n # have an annotation change\n annotChgModules[op.db_parentObjId] = None\n sharedModuleIds.remove(op.db_parentObjId)\n elif op.what == 'connection':\n connectionAddIds.append(getOldObjId(op))\n\n vOnlyModules.append((moduleAddIds, moduleDeleteIds))\n vOnlyConnections.append((connectionAddIds, connectionDeleteIds))\n\n sharedModulePairs = [(id, id) for id in sharedModuleIds]\n v1Only = vOnlyModules[0][0]\n v2Only = vOnlyModules[1][0]\n for id in vOnlyModules[1][1]:\n if id not in vOnlyModules[0][1]:\n v1Only.append(id)\n for id in vOnlyModules[0][1]:\n if id not in vOnlyModules[1][1]:\n v2Only.append(id)\n\n sharedConnectionPairs = [(id, id) for id in sharedConnectionIds]\n c1Only = vOnlyConnections[0][0]\n c2Only = vOnlyConnections[1][0]\n for id in vOnlyConnections[1][1]:\n if id not in vOnlyConnections[0][1]:\n c1Only.append(id)\n for id in vOnlyConnections[0][1]:\n if id not in vOnlyConnections[1][1]:\n c2Only.append(id)\n\n paramChgModulePairs = [(id, id) for id in paramChgModules.keys()]\n cparamChgModulePairs = [(id, id) for id in cparamChgModules.keys()]\n annotChgModulePairs = [(id, id) for id in annotChgModules.keys()]\n # print \"^^^^ SHARED MODULE PAIRS:\", sharedModulePairs\n c1Only, c2Only, heuristicConnectionPairs = [], [], []\n \n if heuristic_match:\n (heuristicModulePairs, heuristicConnectionPairs, v1Only, v2Only, \\\n c1Only, c2Only) = do_heuristic_diff(v1Workflow, v2Workflow, \\\n v1Only, v2Only, \\\n c1Only, c2Only)\n paramChgModulePairs.extend(heuristicModulePairs)\n cparamChgModulePairs.extend(heuristicModulePairs)\n annotChgModulePairs.extend(heuristicModulePairs)\n allChgModulePairs = list(set(chain(paramChgModulePairs,\n cparamChgModulePairs,\n annotChgModulePairs)))\n\n (heuristicModulePairs, paramChanges, cparam_changes, annot_changes) = \\\n check_params_diff(v1Workflow, v2Workflow, allChgModulePairs, \n True, heuristic_match)\n\n return (v1Workflow, v2Workflow, \n sharedModulePairs, heuristicModulePairs, v1Only, v2Only, \n paramChanges, cparam_changes, annot_changes,\n sharedConnectionPairs, heuristicConnectionPairs, \n c1Only, c2Only)", "metadata": "root.getWorkflowDiffCommon", "header": "['module', '___EOS___']", "index": 1254 }, { "content": "def do_heuristic_diff(v1Workflow, v2Workflow, v1_modules, v2_modules, \n v1_connections, v2_connections): \n # add heuristic matches\n heuristicModulePairs = []\n heuristicConnectionPairs = []\n \n v1Only = copy.copy(v1_modules)\n v2Only = copy.copy(v2_modules)\n c1Only = copy.copy(v1_connections)\n c2Only = copy.copy(v2_connections)\n\n # we now check all heuristic pairs for parameter changes\n # match modules\n # for (m1_id, m2_id) in paramChgModulePairs[:]:\n # m1 = v1Workflow.db_get_module(m1_id)\n # m2 = v2Workflow.db_get_module(m2_id)\n # if heuristicModuleMatch(m1, m2) == 1:\n # # paramChgModulePairs.remove((m1_id, m2_id))\n # # heuristicModulePairs.append((m1_id, m2_id))\n # pass\n\n for m1_id in v1Only[:]:\n m1 = v1Workflow.db_get_module(m1_id)\n match = None\n for m2_id in v2Only:\n m2 = v2Workflow.db_get_module(m2_id)\n isMatch = heuristicModuleMatch(m1, m2)\n if isMatch == 1:\n match = (m1_id, m2_id)\n break\n elif isMatch == 0:\n match = (m1_id, m2_id)\n if match is not None:\n v1Only.remove(match[0])\n v2Only.remove(match[1])\n # we now check all heuristic pairs for parameter changes\n heuristicModulePairs.append(match)\n\n # match connections\n for c1_id in c1Only[:]:\n c1 = v1Workflow.db_get_connection(c1_id)\n match = None\n for c2_id in c2Only:\n c2 = v2Workflow.db_get_connection(c2_id)\n isMatch = heuristicConnectionMatch(c1, c2)\n if isMatch == 1:\n match = (c1_id, c2_id)\n break\n elif isMatch == 0:\n match = (c1_id, c2_id)\n if match is not None:\n # don't have port changes yet\n c1Only.remove(match[0])\n c2Only.remove(match[1])\n heuristicConnectionPairs.append(match)\n\n return (heuristicModulePairs, heuristicConnectionPairs, v1Only, v2Only,\n c1Only, c2Only)", "metadata": "root.do_heuristic_diff", "header": "['module', '___EOS___']", "index": 1440 }, { "content": "def check_params_diff(v1Workflow, v2Workflow, paramChgModulePairs, \n same_vt=True, heuristic_match=True):\n matched = []\n paramChanges = []\n cparamChanges = []\n annotChanges = []\n # print \"^^^^ PARAM CHG PAIRS:\", paramChgModulePairs\n for (m1_id, m2_id) in paramChgModulePairs:\n m1 = v1Workflow.db_get_module(m1_id)\n m2 = v2Workflow.db_get_module(m2_id)\n moduleParamChanges = getParamChanges(m1, m2, same_vt, heuristic_match)\n if len(moduleParamChanges) > 0:\n paramChanges.append(((m1_id, m2_id), moduleParamChanges))\n moduleCParamChanges = getCParamChanges(m1, m2, same_vt,\n heuristic_match)\n if len(moduleCParamChanges) > 0:\n cparamChanges.append(((m1_id, m2_id), moduleCParamChanges))\n moduleAnnotChanges = getAnnotationChanges(m1, m2, same_vt,\n heuristic_match)\n if len(moduleAnnotChanges) > 0:\n annotChanges.append(((m1_id, m2_id), moduleAnnotChanges))\n if len(moduleParamChanges) == len(moduleCParamChanges) == \\\n len(moduleAnnotChanges) == 0:\n # heuristicModulePairs.append((m1_id, m2_id))\n matched.append((m1_id, m2_id))\n return (matched, paramChanges, cparamChanges, annotChanges)", "metadata": "root.check_params_diff", "header": "['module', '___EOS___']", "index": 1499 }, { "content": "def getWorkflowDiff(vt_pair_1, vt_pair_2, heuristic_match=True):\n (vistrail_1, v_1) = vt_pair_1\n (vistrail_2, v_2) = vt_pair_2\n \n if vistrail_1 == vistrail_2:\n return getWorkflowDiffCommon(vistrail_1, v_1, v_2, heuristic_match)\n \n workflow_1 = materializeWorkflow(vistrail_1, v_1)\n workflow_2 = materializeWorkflow(vistrail_2, v_2)\n modules_1 = workflow_1.db_modules_id_index.keys()\n modules_2 = workflow_2.db_modules_id_index.keys()\n conns_1 = workflow_1.db_connections_id_index.keys()\n conns_2 = workflow_2.db_connections_id_index.keys()\n\n if heuristic_match:\n (m_matches, c_matches, modules_1, modules_2, conns_1, conns_2) = \\\n do_heuristic_diff(workflow_1, workflow_2, modules_1, modules_2, \\\n conns_1, conns_2)\n (m_matches, param_changes, cparam_changes, annot_changes) = \\\n check_params_diff(workflow_1, workflow_2,\n m_matches, False,\n heuristic_match)\n return (workflow_1, workflow_2, [], m_matches, modules_1, modules_2,\n param_changes, cparam_changes, annot_changes, [], c_matches, conns_1, conns_2)\n\n return (workflow_1, workflow_2, [], [], modules_1, modules_2, [], [], [], [], [], \n conns_1, conns_2)", "metadata": "root.getWorkflowDiff", "header": "['module', '___EOS___']", "index": 1526 }, { "content": "class TestDBVistrailService(unittest.TestCase):\n\n", "metadata": "root.TestDBVistrailService", "header": "['module', '___EOS___']", "index": 1557 }, { "content": " def test_parameter_heuristic(self):\n from vistrails.core.vistrail.module_param import ModuleParam\n \n param1 = ModuleParam(id=0, pos=0, type='String', val='abc')\n param2 = ModuleParam(id=1, pos=0, type='String', val='abc')\n param3 = ModuleParam(id=2, pos=1, type='Float', val='1.0')\n param4 = ModuleParam(id=3, pos=0, type='String', val='def')\n param5 = ModuleParam(id=4, pos=1, type='String', val='abc')\n\n # test basic equality\n assert heuristicParameterMatch(param1, param2) == 1\n # test basic inequality\n assert heuristicParameterMatch(param1, param3) == -1\n # test partial match\n assert heuristicParameterMatch(param1, param4) == 0\n # test position inequality\n assert heuristicParameterMatch(param1, param5) == -1", "metadata": "root.TestDBVistrailService.test_parameter_heuristic", "header": "['class', 'TestDBVistrailService', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1558 }, { "content": " def test_function_heuristic(self):\n from vistrails.core.vistrail.module_param import ModuleParam\n from vistrails.core.vistrail.module_function import ModuleFunction\n \n param1 = ModuleParam(id=0, pos=0, type='String', val='abc')\n param2 = ModuleParam(id=1, pos=1, type='Float', val='1.0')\n param3 = ModuleParam(id=2, pos=0, type='String', val='abc')\n param4 = ModuleParam(id=3, pos=1, type='Float', val='1.0')\n param5 = ModuleParam(id=4, pos=0, type='String', val='abc')\n param6 = ModuleParam(id=5, pos=1, type='Float', val='2.0')\n\n function1 = ModuleFunction(name='f1', parameters=[param1, param2])\n function2 = ModuleFunction(name='f1', parameters=[param3, param4])\n function3 = ModuleFunction(name='f1', parameters=[param5, param6])\n function4 = ModuleFunction(name='f2', parameters=[param1, param2])\n function5 = ModuleFunction(name='f1', parameters=[param1])\n\n # test basic equality\n assert heuristicFunctionMatch(function1, function2) == 1\n # test partial match\n assert heuristicFunctionMatch(function1, function3) == 0\n # test basic inequality\n assert heuristicFunctionMatch(function1, function4) == -1\n # test length inequality\n assert heuristicFunctionMatch(function1, function5) == 0", "metadata": "root.TestDBVistrailService.test_function_heuristic", "header": "['class', 'TestDBVistrailService', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1576 }, { "content": " def test_module_heuristic(self):\n from vistrails.core.vistrail.module_param import ModuleParam\n from vistrails.core.vistrail.module_function import ModuleFunction\n from vistrails.core.vistrail.module import Module\n\n param1 = ModuleParam(id=0, pos=0, type='String', val='abc')\n param2 = ModuleParam(id=1, pos=1, type='Float', val='1.0')\n param3 = ModuleParam(id=2, pos=0, type='String', val='abc')\n param4 = ModuleParam(id=3, pos=1, type='Float', val='1.0')\n param5 = ModuleParam(id=4, pos=0, type='Integer', val='2')\n param6 = ModuleParam(id=5, pos=0, type='Integer', val='2')\n\n function1 = ModuleFunction(name='f1', parameters=[param1, param2])\n function2 = ModuleFunction(name='f1', parameters=[param3, param4])\n function3 = ModuleFunction(name='f2', parameters=[param5])\n function4 = ModuleFunction(name='f2', parameters=[param6])\n function5 = ModuleFunction(name='f1', parameters=[param2, param4])\n function6 = ModuleFunction(name='f2', parameters=[param5])\n\n module1 = Module(name='m1', functions=[function1, function3])\n module2 = Module(name='m1', functions=[function2, function4])\n module3 = Module(name='m2', functions=[function1, function2])\n module4 = Module(name='m1', functions=[function5])\n module5 = Module(name='m1', functions=[function5, function6])\n\n # test basic equality\n assert heuristicModuleMatch(module1, module2) == 1\n # test basic inequality\n assert heuristicModuleMatch(module1, module3) == -1\n # test length inequality\n assert heuristicModuleMatch(module1, module4) == 0\n # test parameter change inequality\n assert heuristicModuleMatch(module1, module5) == 0", "metadata": "root.TestDBVistrailService.test_module_heuristic", "header": "['class', 'TestDBVistrailService', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1602 } ]
[ { "span": "from vistrails.db.domain import DBWorkflow, DBAdd, DBDelete, DBAction, DBAbstraction, \\\n DBModule, DBConnection, DBPort, DBFunction, DBParameter, DBGroup", "start_line": 37, "start_column": 0, "end_line": 38, "end_column": 68 }, { "span": "import datetime", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 15 }, { "span": "import getpass", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 14 }, { "span": "import vistrails.core.system", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", "-", "2016", ",", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2014", ",", " ", "NY", "U", "-", "Poly", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2011", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Conta", "ct", ":", " ", "contact", "@", "vist", "rail", "s", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\"", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\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", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "domain_", "import_", "DB", "Workflow_", ",_", "DBA", "dd_", ",_", "DB", "Delete_", ",_", "DBA", "ction_", ",_", "DBA", "bst", "ract", "ion_", ",_", "DB", "Module_", ",_", "DB", "Connection_", ",_", "DB", "Port_", ",_", "DB", "Function_", ",_", "DB", "Parameter_", ",_", "DBG", "roup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "services_", "._", "action", "\\u", "chain_", "import_", "get", "Action", "Chain_", ",_", "get", "Curr", "ent", "Opera", "tion", "Dict_", ",_", "get", "Curr", "ent", "Operations_", ",_", "simplify", "\\u", "ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "import_", "Vis", "trail", "s", "DB", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vist", "rail", "s_", "._", "core_", "._", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Ana", "log", "y", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Diff", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update", "\\u", "id", "\\u", "scope_", "(_", "vist", "rail", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "vist", "rail", "_", ",_", "'", "update", "\\u", "id", "\\u", "scope", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "._", "update", "\\u", "id", "\\u", "scope_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "action_", "in_", "vist", "rail", "_", "._", "db", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "._", "id", "Scope_", "._", "update", "Begin", "Id_", "(_", "'", "action", "'_", ",_", "action_", "._", "db", "\\u", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "._", "db", "\\u", "session_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "._", "id", "Scope_", "._", "update", "Begin", "Id_", "(_", "'", "session", "'_", ",_", "action_", "._", "db", "\\u", "session_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "operation_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "._", "id", "Scope_", "._", "update", "Begin", "Id_", "(_", "'", "operati", "on", "'_", ",_", "operation_", "._", "db", "\\u", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "add", "'_", "or_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "ids", " ", "of", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "vist", "rail", "_", "._", "id", "Scope_", "._", "update", "Begin", "Id_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "New", "Obj", "Id_", "(_", "operation_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "operation_", "._", "db", "\\u", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "operation_", "._", "db", "\\u", "object", "Id_", "=_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vist", "rail", "_", "._", "db", "\\u", "add", "\\u", "object_", "(_", "operation_", "._", "db", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "annotation_", "in_", "action_", "._", "db", "\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "._", "id", "Scope_", "._", "update", "Begin", "Id_", "(_", "'", "annot", "ation", "'_", ",_", "annotation_", "._", "db", "\\u", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "material", "ize", "Workflow_", "(_", "vist", "rail", "_", ",_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "path", " ", "up", " ", "through", " ", "tree", " ", "and", " ", "perform", " ", "each", " ", "action_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vist", "rail", "_", "._", "db", "\\u", "has", "\\u", "action", "\\u", "with", "\\u", "id_", "(_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "=_", "DB", "Workflow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "action", " ", "in", " ", "get", "Action", "Chain", "(", "vist", "rail", ",", " ", "version", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "old", "Perform", "Action", "(", "action", ",", " ", "workf", "low", ")_", "\\u\\u\\uNL\\u\\u\\u_", "perform", "Actions_", "(_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "version_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workflow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "db", "\\u", "id_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workflow_", "._", "db", "\\u", "vist", "rail", "Id_", "=_", "vist", "rail", "_", "._", "db", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "workflow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "version_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "DB", "Workflow_", "(_", ")_", "\\u\\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_", "Vis", "trail", "s", "DB", "Exception_", "(_", "\"", "invalid", " ", "workf", "low", " ", "version", " ", "%", "s", "\"_", "%_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "Action_", "(_", "action_", ",_", "workflow_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "action", "Type_", "==_", "'", "add", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "._", "db", "\\u", "add", "\\u", "object_", "(_", "operation_", "._", "db", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "._", "action", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "._", "db", "\\u", "change", "\\u", "object_", "(_", "operation_", "._", "db", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "._", "action", "Type_", "==_", "'", "delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "action_", "._", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "._", "db", "\\u", "delete", "\\u", "object_", "(_", "operation_", "._", "db", "\\u", "object", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Unre", "cogni", "zed", " ", "action", " ", "type", " ", "'%", "s", "'\"_", "%_", "action_", "._", "db", "\\u", "action", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "Delete", "s_", "(_", "delete", "Ops_", ",_", "workflow_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "delete", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "._", "db", "\\u", "delete", "\\u", "object_", "(_", "get", "Old", "Obj", "Id_", "(_", "operation_", ")_", ",_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "Add", "s_", "(_", "add", "Ops_", ",_", "workflow_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "add", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "operati", "on", " ", "%", "d", ":", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "operati", "on", ".", "db", "\\u", "id", ",", " ", "operati", "on", ".", "vt", "Type", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "what", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", " ", " ", " ", " ", "to", ":", " ", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "operati", "on", ".", "db", "\\u", "parent", "Obj", "Type", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "parent", "Obj", "Id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workflow_", "._", "db", "\\u", "add", "\\u", "object_", "(_", "operation_", "._", "db", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "Actions_", "(_", "actions_", ",_", "workflow_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "current", " ", "action", "s", " ", "and", " ", "run", " ", "add", "Object", " ", "on", " ", "the", " ", "workflow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "delete", " ", "action", "s", " ", "have", " ", "bee", "n", " ", "remove", "d", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "change", " ", "after", " ", "an", " ", "add", " ", "is", " ", "effective", "ly", " ", "an", " ", "add", " ", "if", " ", "the", " ", "add", " ", "is", " ", "discard", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perform", "Add", "s_", "(_", "get", "Curr", "ent", "Operations_", "(_", "actions_", ")_", ",_", "workflow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "synchronize", "_", "(_", "old", "\\u", "vist", "rail", "_", ",_", "new", "\\u", "vist", "rail", "_", ",_", "current", "\\u", "action", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "\\u", "remap", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "new", "\\u", "vist", "rail", "_", "._", "db", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "is", "\\u", "new_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "action_", "=_", "action_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "old", "\\u", "vist", "rail", "_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "add", "\\u", "action_", "(_", "new", "\\u", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "must", " ", "exist", " ", "in", " ", "the", " ", "old", " ", "vist", "rail", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "action_", "=_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "action", "s", "\\u", "id", "\\u", "index_", "[_", "action_", "._", "db", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "knowledge", " ", "tha", "t", " ", "we", " ", "replace", " ", "old", " ", "note", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "annotation_", "in_", "action_", "._", "db", "\\u", "delete", "d\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "action_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "action_", "._", "db", "\\u", "delete", "\\u", "annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "confl", "ict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "know", " ", "tha", "t", " ", "the", " ", "annot", "ation", " ", "tha", "t", " ", "was", " ", "there", " ", "isn", "'", "t", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "possib", "le", " ", "note", "s", " ", "confl", "ict", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "old", "\\u", "action_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "'", "note", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "=_", "old", "\\u", "action_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "'", "note", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "action_", "._", "db", "\\u", "delete", "\\u", "annotation_", "(_", "old", "\\u", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to", " ", "do", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "annotation_", "in_", "action_", "._", "db", "\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "annotation_", "._", "is", "\\u", "new_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "annotation_", "=_", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "vist", "rail", "_", "._", "id", "Scope_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "action_", "._", "db", "\\u", "add", "\\u", "annotation_", "(_", "new", "\\u", "annotation_", ")_", "\\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_", "for_", "tag_", "in_", "new", "\\u", "vist", "rail", "_", "._", "db", "\\u", "delete", "d\\u", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "has", "\\u", "tag", "\\u", "with", "\\u", "id_", "(_", "tag_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "delete", "\\u", "tag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "confl", "ict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "know", " ", "the", " ", "tag", " ", "tha", "t", " ", "was", " ", "there", " ", "isn", "'", "t", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "possib", "le", " ", "tag", " ", "confl", "ict", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to", " ", "do", " ", "anyt", "hing", " ", "here", ",", " ", "tho", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tag_", "in_", "new", "\\u", "vist", "rail", "_", "._", "db", "\\u", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "._", "is", "\\u", "new_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "tag_", "=_", "tag_", "._", "do", "\\u", "copy_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remap", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "tag_", "._", "db", "\\u", "id_", "=_", "id", "\\u", "remap", "_", "[_", "(_", "DBA", "ction_", "._", "vt", "Type_", ",_", "new", "\\u", "tag_", "._", "db", "\\u", "id_", ")_", "]_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "tag_", "=_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "tags", "\\u", "name", "\\u", "index_", "[_", "new", "\\u", "tag_", "._", "db", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "confl", "ict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "tag", " ", "confl", "ict", "--", "name", " ", "alr", "ead", "y", " ", "used", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "delete", "\\u", "tag_", "(_", "old", "\\u", "tag_", ")_", "\\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 ", " _", "old", "\\u", "tag_", "=_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "tags", "\\u", "id", "\\u", "index_", "[_", "new", "\\u", "tag_", "._", "db", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "possib", "le", " ", "tag", " ", "confl", "ict", " ", "--", " ", "WIL", "L", " ", "NOT", " ", "GET", " ", "HER", "E", "!'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "delete", "\\u", "tag_", "(_", "old", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "add", "\\u", "tag_", "(_", "new", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "action", "\\u", "id_", "=_", "id", "\\u", "remap", "_", "._", "get_", "(_", "(_", "DBA", "ction_", "._", "vt", "Type_", ",_", "current", "\\u", "action", "\\u", "id_", ")_", ",_", "current", "\\u", "action", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "vist", "rail", "_", "._", "db", "\\u", "current", "Version_", "=_", "new", "\\u", "action", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "\\u", "action", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "sb_", ",_", "next", "\\u", "sb_", ",_", "app_", "=_", "''_", ",_", "interactive_", "=_", "False_", ",_", "tmp", "\\u", "dir_", "=_", "''_", ",_", "next", "\\u", "tmp", "\\u", "dir_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "def", " ", "merge", "(", "sb", ":", " ", "Save", "Bun", "dle", ",", " ", "next", "\\u", "sb", ":", " ", "Save", "Bun", "dle", ",", " ", "app", ":", " ", "str", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "interactive", ":", " ", "bool", ",", " ", "tmp", "\\u", "dir", ":", " ", "str", ",", " ", "next", "\\u", "tmp", "\\u", "dir", ":", " ", "str", ")", " ", "->", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Merge", "s", " ", "two", " ", "save", " ", "bundle", "s", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "annotated", " ", "with", " ", "check", "out", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "from", " ", "a", " ", "databa", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "change", "s", " ", "from", " ", "next", "\\u", "sb", " ", "are", " ", "append", "ed", " ", "onto", " ", "sb", ".", " ", "The", " ", "change", "s", " ", "in", " ", "sb", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "be", " ", "uploade", "d", " ", "to", " ", "the", " ", "databa", "se", " ", "and", " ", "use", " ", "as", " ", "the", " ", "new", " ", "working", " ", "copy", ".", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "sb", " ", "is", " ", "the", " ", "old", " ", "one", " ", "from", " ", "db", ",", " ", "last", " ", "vt", " ", "is", " ", "the", " ", "new", " ", "one", ".", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "interactive", " ", "is", " ", "gui", ".", "merge", "\\u", "gui", ".", "Merge", "Gui", " ", "then", " ", "the", " ", "tmp", "\\u", "dir", "'", "s", " ", "must", " ", "be", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "=_", "sb_", "._", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "vt_", "=_", "next", "\\u", "sb_", "._", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "\\u", "gui_", "=_", "interactive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Merge", "GUI_", "=_", "merge", "\\u", "gui_", "._", "Merge", "GUI_", "if_", "merge", "\\u", "gui_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "right", " ", "now", " ", "we", " ", "just", " ", "replace", " ", "mas", "hu", "ps", " ", "and", " ", "subw", "ork", "flows_", "\\u\\u\\uNL\\u\\u\\u_", "sb_", "._", "mas", "hu", "ps_", "=_", "list_", "(_", "next", "\\u", "sb_", "._", "mas", "hu", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb_", "._", "abstract", "ions_", "=_", "list_", "(_", "next", "\\u", "sb_", "._", "abstract", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u", "remap", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "out", "\\u", "key_", "=_", "\"\\u\\u", "check", "out", "\\u", "version", "\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "key_", "=_", "check", "out", "\\u", "key_", "+_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "annot", "ation", "\\u", "key_", "=_", "action", "\\u", "key_", "+_", "'\\u", "annot", "ation", "hash", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "annot", "ation", "\\u", "key_", "=_", "action", "\\u", "key_", "+_", "'\\u", "action", "annot", "ation", "hash", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "high", "est", " ", "common", " ", "checkin", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "checkin", "Id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "app_", ")_", "and_", "next", "\\u", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "action", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "co_", "=_", "next", "\\u", "vt_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "action", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "found", " ", "checkin", " ", "id", " ", "annot", "ation", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "checkin", "Id_", "=_", "int_", "(_", "co_", "._", "\\u", "db", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "calculati", "ng", " ", "checkin", " ", "id", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "unique", " ", "identifi", "ers", " ", "for", " ", "all", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "vt_", "._", "db", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique_", "=_", "action_", "._", "\\u", "db", "\\u", "user_", "+_", "str_", "(_", "action_", "._", "\\u", "db", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "no_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "unique_", "+_", "str_", "(_", "copy", "\\u", "no_", ")_", ")_", "in_", "action", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "no_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unique_", "=_", "unique_", "+_", "str_", "(_", "copy", "\\u", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "._", "append_", "(_", "unique_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Dict_", "[_", "unique_", "]_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action", "Ne", "xt", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Dict", "Next_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique_", "=_", "action_", "._", "\\u", "db", "\\u", "user_", "+_", "str_", "(_", "action_", "._", "\\u", "db", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "no_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "unique_", "+_", "str_", "(_", "copy", "\\u", "no_", ")_", ")_", "in_", "action", "Dict", "Next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "no_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unique_", "=_", "unique_", "+_", "str_", "(_", "copy", "\\u", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Ne", "xt", "s_", "._", "append_", "(_", "unique_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "Dict", "Next_", "[_", "unique_", "]_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "last", " ", "checkin", " ", "action", " ", "(", "only", " ", "works", " ", "for", " ", "centrali", "zed", " ", "sync", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "checkin", "Id_", "<_", "len_", "(_", "actions_", ")_", "and_", "checkin", "Id_", "<_", "len_", "(_", "action", "Ne", "xt", "s_", ")_", "and_", "actions_", "[_", "checkin", "Id_", "]_", "==_", "action", "Ne", "xt", "s_", "[_", "checkin", "Id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checkin", "Id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "checkin", "Id_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checkin", "Id_", "=_", "action", "Dict_", "[_", "actions_", "[_", "checkin", "Id_", "-_", "1_", "]_", "]_", "._", "db", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "checkin", "Id", ":\"", ",", " ", "checkin", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "previ", "ous", " ", "check", "out", " ", "annot", "ation", "s", " ", "in", " ", "vt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "keys_", "=_", "[_", "action", "\\u", "key_", ",_", "annot", "ation", "\\u", "key_", ",_", "action", "\\u", "annot", "ation", "\\u", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "delete", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "vt_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "delete", "\\u", "annotation_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "some", "one", " ", "else", " ", "have", " ", "change", "d", " ", "the", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merge", "Annotations", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "app_", ")_", "and_", "next", "\\u", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "annot", "ation", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "found", " ", "annot", "ation", "hash", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "co_", "=_", "next", "\\u", "vt_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "annot", "ation", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "hash_", "=_", "co_", "._", "\\u", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "Annotations", "_", "=_", "(_", "old", "\\u", "hash_", "!=_", "vt_", "._", "hash", "Annotations", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "merge", " ", "annot", "ation", "s", ":\"", ",", " ", "merge", "Annotations", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "some", "one", " ", "else", " ", "have", " ", "change", "d", " ", "the", " ", "action", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merge", "Action", "Annotations", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "app_", ")_", "and_", "next", "\\u", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "action", "\\u", "annot", "ation", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "found", " ", "action", "annot", "ation", "hash", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "co_", "=_", "next", "\\u", "vt_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "action", "\\u", "annot", "ation", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "hash_", "=_", "co_", "._", "\\u", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "Action", "Annotations", "_", "=_", "(_", "old", "\\u", "hash_", "!=_", "vt_", "._", "hash", "Action", "Annotations", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "merge", " ", "action", "annot", "ation", "s", ":\"", ",", " ", "merge", "Action", "Annotations", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "#", " ", "merge", " ", "action", "s", " ", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "identi", "cal", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "\\u", "db", "\\u", "id_", ">_", "checkin", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "action_", "=_", "action_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "action_", "(_", "new", "\\u", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "#", " ", "merge", " ", "annot", "ation", "s", " ", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "merge", "Annotations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "remove", "d", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "annotation_", "in_", "[_", "a_", "for_", "a_", "in_", "vt_", "._", "db", "\\u", "annotations_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "next", "\\u", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vt_", "._", "db", "\\u", "delete", "\\u", "annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "and", " ", "update", " ", "change", "d", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "annotation_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "vt_", "._", "db", "\\u", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "new", " ", "annotation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "annotation_", "=_", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "annotation_", "(_", "new", "\\u", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "annotation_", "=_", "vt_", "._", "db", "\\u", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "annotation_", "._", "db", "\\u", "key_", "!=_", "annotation_", "._", "db", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "key", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "annotation_", "._", "db", "\\u", "key_", "=_", "annotation_", "._", "db", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "!=_", "annotation_", "._", "db", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "value", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "annotation_", "._", "db", "\\u", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annotations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "dict", " ", "with", " ", "keys", " ", "and", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "annotation_", "in_", "vt_", "._", "db", "\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "annotation_", "._", "db", "\\u", "key_", "not_", "in_", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annotations_", "[_", "annotation_", "._", "db", "\\u", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "annotation_", "._", "db", "\\u", "value_", "not_", "in_", "annotations_", "[_", "annotation_", "._", "db", "\\u", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annotations_", "[_", "annotation_", "._", "db", "\\u", "key_", "]_", "._", "append_", "(_", "annotation_", "._", "db", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "nonexist", "ing", " ", "key", "-", "value", " ", "pairs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "annotation_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "annotation_", "._", "db", "\\u", "key_", "not_", "in_", "annotations_", "or_", "annotation_", "._", "db", "\\u", "value_", "not_", "in_", "annotations_", "[_", "annotation_", "._", "db", "\\u", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "annotation_", "=_", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "annotation_", "(_", "new", "\\u", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", " ", "merge", " ", "action", " ", "annot", "ation", "s", " ", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "merge", "Action", "Annotations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "remove", "d", " ", "action", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "annotation_", "in_", "[_", "a_", "for_", "a_", "in_", "vt_", "._", "db", "\\u", "action", "Annotations", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "next", "\\u", "vt_", "._", "db", "\\u", "has", "\\u", "action", "Annot", "ation", "\\u", "with", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vt_", "._", "db", "\\u", "delete", "\\u", "action", "Annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", "and_", "len_", "(_", "sb_", "._", "thumbnail", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "thumb_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "remove_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "and", " ", "update", " ", "change", "d", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "annotation_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "action", "Annotations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "vt_", "._", "db", "\\u", "has", "\\u", "action", "Annot", "ation", "\\u", "with", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "new", " ", "action", "Annotation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annotation_", "=_", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "action", "Annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", "and_", "len_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "thumb_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\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 ", " _", "old", "\\u", "annotation_", "=_", "vt_", "._", "db", "\\u", "get", "\\u", "action", "Annot", "ation", "\\u", "by", "\\u", "id_", "(_", "annotation_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "!=_", "annotation_", "._", "db", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "value", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", "and_", "len_", "(_", "sb_", "._", "thumbnail", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "thumb_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thumb_", "=_", "'/'_", "._", "join_", "(_", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "remove_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", "and_", "len_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "thumb_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "old", " ", "action", " ", "index", " ", "(", "oas", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oas", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "vt_", "._", "db", "\\u", "action", "Annotations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "a_", "._", "db", "\\u", "action", "\\u", "id_", "in_", "oas", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oas", "_", "[_", "a_", "._", "db", "\\u", "action", "\\u", "id_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "a_", "._", "db", "\\u", "key_", "in_", "oas", "_", "[_", "a_", "._", "db", "\\u", "action", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oas", "_", "[_", "a_", "._", "db", "\\u", "action", "\\u", "id_", "]_", "[_", "a_", "._", "db", "\\u", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oas", "_", "[_", "a_", "._", "db", "\\u", "action", "\\u", "id_", "]_", "[_", "a_", "._", "db", "\\u", "key_", "]_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "merge", " ", "per", " ", "action_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "new", "\\u", "annotation_", "in_", "next", "\\u", "vt_", "._", "db", "\\u", "action", "Annotations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "keep", " ", "bot", "h", " ", "upgrade", "s", " ", "but", " ", "update", " ", "action", " ", "id", " ", "in", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "upgrade", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "action", "'_", ",_", "value_", ")_", "in_", "id", "\\u", "remap", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "str_", "(_", "id", "\\u", "remap", "_", "[_", "(_", "'", "action", "'_", ",_", "value_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "annotation_", "=_", "new", "\\u", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "action", "Annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "new", "\\u", "annotation_", "._", "db", "\\u", "action", "\\u", "id_", "<=_", "checkin", "Id_", "and_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "in_", "oas", "_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "action", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "action_", "=_", "oas", "_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "action", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "a", " ", "conflict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tags", " ", "shou", "ld", " ", "be", " ", "merge", "d", " ", "(", "the", " ", "user", " ", "need", " ", "to", " ", "resolve", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "tag", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "only", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "annotation_", "=_", "old", "\\u", "action_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "!=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "+_", "\"", " ", "or", " ", "\"_", "+_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "skip_", "==_", "1_", ":_", "\\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_", "skip_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", ",_", "value_", "=_", "Merge", "GUI_", "._", "resolve", "Tags_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "annotation_", ",_", "new", "\\u", "annotation_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "_", ":_", "\\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_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "RESOL", "VED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Ta", "g", " ", "resolve", "d", ":\"", ",", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", "s", " ", "shou", "ld", " ", "be", " ", "merge", "d", " ", "(", "the", " ", "user", " ", "need", " ", "to", " ", "resolve", ")_", "\\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_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "note", "s", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "only", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "annotation_", "=_", "old", "\\u", "action_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "!=_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "(_", "\"###", "#", " ", "conflicting", " ", "version", "s", "!", " ", "###", "#", "<", "br", "/>\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"##", " ", "Ot", "her", " ", "version", " ", "at", " ", "%", "s", " ", "by", " ", "%", "s", ":", "%", "s", "<", "br", "/>\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"##", " ", "You", "r", " ", "version", " ", "at", " ", "%", "s", " ", "by", " ", "%", "s", ":", "%", "s", "\"_", ")_", "%_", "(_", "str_", "(_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", ")_", ",_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", ",_", "str_", "(_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", ",_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "skip_", "==_", "1_", ":_", "\\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_", "skip_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", ",_", "value_", "=_", "Merge", "GUI_", "._", "resolve", "Notes_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "annotation_", ",_", "new", "\\u", "annotation_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "_", ":_", "\\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_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "RESOL", "VED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Not", "e", " ", "resolve", "d", ":\"", ",", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thumbs", " ", "shou", "ld", " ", "be", " ", "update", "d", " ", "(", "we", " ", "loose", " ", "the", " ", "other", " ", "update", ")_", "\\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_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "only", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "annotation_", "=_", "old", "\\u", "action_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "!=_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "skip_", "==_", "1_", ":_", "\\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_", "skip_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thumb_", "=_", "'/'_", "._", "join_", "(_", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "remove_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\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 ", " ", " _", "v_", "=_", "Merge", "GUI_", "._", "resolve", "Thumb", "s_", "(_", "old", "\\u", "annotation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "annotation_", ",_", "tmp", "\\u", "dir_", ",_", "next", "\\u", "tmp", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OTHER", "_", ":_", "\\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_", "v_", "in_", "(_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "\\u", "ALL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thumb_", "=_", "'/'_", "._", "join_", "(_", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "remove_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "v_", "==_", "merge", "\\u", "gui_", "._", "CHOICE", "\\u", "OWN", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "skip_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thumb_", "=_", "'/'_", "._", "join_", "(_", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "remove_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "date_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "annotation_", "._", "db", "\\u", "user_", "=_", "new", "\\u", "annotation_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\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_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "prune", "\\u\\u'_", ":_", "#", " ", "keep", " ", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "s", " ", "shou", "ld", " ", "be", " ", "append", "ed", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "there", "_", "\\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 ", " ", "_", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "\\u", "annotation_", "in_", "old", "\\u", "action_", "[_", "new", "\\u", "annotation_", "._", "db", "\\u", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "._", "append_", "(_", "old", "\\u", "annotation_", "._", "db", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "annotation_", "._", "db", "\\u", "value_", "not_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "annotation_", "=_", "new", "\\u", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "action", "Annotation_", "(_", "annotation_", ")_", "\\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 ", " _", "annotation_", "=_", "new", "\\u", "annotation_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "vt_", "._", "id", "Scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "db", "\\u", "add", "\\u", "action", "Annotation_", "(_", "annotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "annotation_", "._", "db", "\\u", "key_", "==_", "'\\u", "\\u", "thumb", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "thumb_", "=_", "'/'_", "._", "join_", "(_", "next", "\\u", "sb_", "._", "thumbnail", "s_", "[_", "0_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "'/'_", "+_", "annotation_", "._", "db", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb_", "not_", "in_", "sb_", "._", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sb_", "._", "thumbnail", "s_", "._", "append_", "(_", "thumb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "this", " ", "a", " ", "valid", " ", "checke", "d", " ", "out", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vt_", "._", "update", "\\u", "check", "out", "\\u", "version_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "data_", "(_", "what_", ",_", "id_", ",_", "op", "\\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 ", " _", "return_", "op", "\\u", "dict_", "[_", "(_", "what_", ",_", "id_", ")_", "]_", "._", "db", "\\u", "data_", "\\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 ", " _", "msg_", "=_", "'", "cann", "ot", " ", "find", " ", "data", " ", "(%", "s", ",", " ", "%", "s", ")'_", "%_", "(_", "what_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Key", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "invert", "Operations_", "(_", "op", "\\u", "dict_", ",_", "adds", "_", ",_", "delete", "s_", ",_", "do", "\\u", "copy_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv", "erse", "\\u", "ops_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "s_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "delete", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "find", "\\u", "data_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ",_", "op", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "do", "\\u", "copy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "copy_", "._", "copy_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inv", "\\u", "op_", "=_", "DBA", "dd_", "(_", "id_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "what_", "=_", "op_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Id_", "=_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Id_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Type_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inv", "erse", "\\u", "ops_", "._", "append_", "(_", "inv", "\\u", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adds", "_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "adds", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv", "\\u", "op_", "=_", "DB", "Delete_", "(_", "id_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "what_", "=_", "op_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Id_", "=_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Id_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Type_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inv", "erse", "\\u", "ops_", "._", "append_", "(_", "inv", "\\u", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inv", "erse", "\\u", "ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "normal", "Operations_", "(_", "adds", "_", ",_", "delete", "s_", ",_", "do", "\\u", "copy_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "ops_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "delete", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "op_", "=_", "DB", "Delete_", "(_", "id_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "what_", "=_", "op_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Id_", "=_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Id_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Type_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ops_", "._", "append_", "(_", "new", "\\u", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "op_", "in_", "adds", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "op_", "._", "db", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "do", "\\u", "copy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "copy_", "._", "copy_", "(_", "op_", "._", "db", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "op_", "=_", "DBA", "dd_", "(_", "id_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "what_", "=_", "op_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Id_", "=_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Id_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Obj", "Type_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ops_", "._", "append_", "(_", "new", "\\u", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "ops_", "\\u\\u\\uNEWLINE\\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", "Path", "As", "Action_", "(_", "vist", "rail", "_", ",_", "v1_", ",_", "v2_", ",_", "do", "\\u", "copy_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Root_", "=_", "get", "Share", "d", "Root_", "(_", "vist", "rail", "_", ",_", "[_", "v1_", ",_", "v2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Action", "Chain_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "shared", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Opera", "tion", "Dict_", "=_", "get", "Curr", "ent", "Opera", "tion", "Dict_", "(_", "shared", "Action", "Chain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Actions_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "v1_", ",_", "shared", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Actions_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "v2_", ",_", "shared", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v1", "Add", "Dict_", ",_", "v1", "Delete", "Dict_", ")_", "=_", "get", "Opera", "tion", "Diff_", "(_", "v1", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Opera", "tion", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v2", "Add", "Dict_", ",_", "v2", "Delete", "Dict_", ")_", "=_", "get", "Opera", "tion", "Diff_", "(_", "v2", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Opera", "tion", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "invert", " ", "one", " ", "of", " ", "them", " ", "(", "v1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "v1", "Add", "s_", "=_", "v1", "Add", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Add", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "#", " ", "faste", "r", " ", "than", " ", "sort", "(", "lambda", " ", "x", ",", " ", "y", ":", " ", "cmp", "(", "x", ".", "db", "\\u", "id", ",", " ", "y", ".", "db", "\\u", "id", "))", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Delete", "s_", "=_", "v1", "Delete", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Delete", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "#", " ", "faste", "r", " ", "than", " ", "sort", "(", "lambda", " ", "x", ",", " ", "y", ":", " ", "cmp", "(", "x", ".", "db", "\\u", "id", ",", " ", "y", ".", "db", "\\u", "id", "))", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Inv", "erse", "Ops_", "=_", "invert", "Operations_", "(_", "shared", "Opera", "tion", "Dict_", ",_", "v1", "Add", "s_", ",_", "v1", "Delete", "s_", ",_", "do", "\\u", "copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "normali", "ze", " ", "ops", " ", "of", " ", "the", " ", "other", " ", "(", "v2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "v2", "Add", "s_", "=_", "v2", "Add", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Add", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "#", " ", "faste", "r", " ", "than", " ", "sort", "(", "lambda", " ", "x", ",", " ", "y", ":", " ", "cmp", "(", "x", ".", "db", "\\u", "id", ",", " ", "y", ".", "db", "\\u", "id", "))", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Delete", "s_", "=_", "v2", "Delete", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Delete", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "#", " ", "faste", "r", " ", "than", " ", "sort", "(", "lambda", " ", "x", ",", " ", "y", ":", " ", "cmp", "(", "x", ".", "db", "\\u", "id", ",", " ", "y", ".", "db", "\\u", "id", "))", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Ops_", "=_", "normal", "Operations_", "(_", "v2", "Add", "s_", ",_", "v2", "Delete", "s_", ",_", "do", "\\u", "copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "Ops_", "=_", "v1", "Inv", "erse", "Ops_", "+_", "v2", "Ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simplified", "Ops_", "=_", "simplify", "\\u", "ops_", "(_", "all", "Ops_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "DBA", "ction_", "(_", "id_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "simplified", "Ops_", ",_", "\\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_", "add", "And", "Fix", "Actions_", "(_", "start", "Dict_", ",_", "actions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "Dict_", "=_", "copy_", "._", "copy_", "(_", "start", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "cur", "Dict_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "fix", "ing", " ", "action", ":\"", ",", " ", "action", ".", "db", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "ops_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "op", ":\"", ",", " ", "op", ".", "vt", "Type", ",", " ", "op", ".", "db", "\\u", "what", ",", " ", "get", "Old", "Obj", "Id", "(", "op", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", " ", " ", " ", "\",", " ", "op", ".", "db", "\\u", "parent", "Obj", "Type", ",", " ", "op", ".", "db", "\\u", "parent", "Obj", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "._", "vt", "Type_", "==_", "'", "add", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "is_", "None_", "or_", "cur", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cur", "Dict_", "[_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "object", "Id_", ")_", "]_", "=_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ops_", "._", "append_", "(_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cur", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", ")_", "and_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "is_", "None_", "or_", "cur", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "cur", "Dict_", "[_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "Dict_", "[_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "new", "Obj", "Id_", ")_", "]_", "=_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ops_", "._", "append_", "(_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "vt", "Type_", "==_", "'", "delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "is_", "None_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", ")_", ")_", "and_", "cur", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "object", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "cur", "Dict_", "[_", "(_", "op_", "._", "db", "\\u", "what_", ",_", "op_", "._", "db", "\\u", "object", "Id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ops_", "._", "append_", "(_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", "._", "db", "\\u", "operations_", "=_", "new", "\\u", "ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cur", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fix", "Actions_", "(_", "vist", "rail", "_", ",_", "v_", ",_", "actions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "startin", "g", "Chain_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "Dict_", "=_", "get", "Curr", "ent", "Opera", "tion", "Dict_", "(_", "startin", "g", "Chain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "And", "Fix", "Actions_", "(_", "startin", "g", "Dict_", ",_", "actions_", ")_", "\\u\\u\\uNEWLINE\\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", "Share", "d", "Root_", "(_", "vist", "rail", "_", ",_", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "base", " ", "case", " ", "is", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "=_", "copy_", "._", "copy_", "(_", "versions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "0_", "not_", "in_", "current_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Id_", "=_", "max_", "(_", "current_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current_", "._", "count_", "(_", "max", "Id_", ")_", "==_", "len_", "(_", "current_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max", "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 ", " _", "new", "Id_", "=_", "vist", "rail", "_", "._", "db", "\\u", "get", "\\u", "action", "\\u", "by", "\\u", "id_", "(_", "max", "Id_", ")_", "._", "db", "\\u", "prev", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "current_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "==_", "max", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current_", "[_", "i_", "]_", "=_", "new", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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", "Opera", "tion", "Diff_", "(_", "actions_", ",_", "operati", "on", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "'", "action", ":", " ", "%", "d", "'", " ", "%", " ", "action", ".", "db", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "add", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "add", ":", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "operati", "on", ".", "db", "\\u", "what", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "operati", "on", ".", "db", "\\u", "object", "Id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "object", "Id_", ")_", "]_", "=_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "operation_", "._", "vt", "Type_", "==_", "'", "delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "del", ":", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "operati", "on", ".", "db", "\\u", "what", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "operati", "on", ".", "db", "\\u", "object", "Id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operati", "on", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "object", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "delete", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "object", "Id_", ")_", "]_", "=_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "del", " ", "operati", "on", "Dict", "[(", "operati", "on", ".", "db", "\\u", "what", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "object", "Id", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "add", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "object", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "add", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "object", "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 ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "chg", ":", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "operati", "on", ".", "db", "\\u", "what", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "old", "Obj", "Id", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "new", "Obj", "Id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operati", "on", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "delete", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", "]_", "=_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "del", " ", "operati", "on", "Dict", "[(", "operati", "on", ".", "db", "\\u", "what", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "operati", "on", ".", "db", "\\u", "old", "Obj", "Id", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "add", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "add", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "._", "db", "\\u", "new", "Obj", "Id_", ")_", "]_", "=_", "operation_", "\\u\\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_", "=_", "\"", "Unre", "cogni", "zed", " ", "operati", "on", " ", "'%", "s", "'\"_", "%_", "operation_", "._", "vt", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "add", "Dict_", ",_", "delete", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Opera", "tion", "Dict_", "(_", "operati", "on", "Dict_", ",_", "delete", "Ops_", ",_", "add", "Ops_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "delete", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operati", "on", "Dict_", "._", "has", "\\u", "key_", "(_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "get", "Old", "Obj", "Id_", "(_", "operation_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "operati", "on", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "get", "Old", "Obj", "Id_", "(_", "operation_", ")_", ")_", "]_", "\\u\\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_", "=_", "\"", "Il", "lega", "l", " ", "operati", "on", ":", " ", "\"_", "+_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "operation_", "in_", "add", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operati", "on", "Dict_", "[_", "(_", "operation_", "._", "db", "\\u", "what_", ",_", "get", "New", "Obj", "Id_", "(_", "operation_", ")_", ")_", "]_", "=_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "operati", "on", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Objects_", "(_", "actions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "operation_", "in_", "action_", "._", "db", "\\u", "operations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "objects_", "._", "has", "\\u", "key_", "(_", "operation_", "._", "db", "\\u", "what_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "[_", "operation_", "._", "db", "\\u", "what_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "=_", "copy_", "._", "copy_", "(_", "operation_", "._", "db", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "[_", "operation_", "._", "db", "\\u", "what_", "]_", "._", "append_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "objects_", "\\u\\u\\uNEWLINE\\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", "Version", "Difference", "s_", "(_", "vist", "rail", "_", ",_", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Root_", "=_", "get", "Share", "d", "Root_", "(_", "vist", "rail", "_", ",_", "versions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Action", "Chain_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "shared", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Opera", "tion", "Dict_", "=_", "get", "Curr", "ent", "Opera", "tion", "Dict_", "(_", "shared", "Action", "Chain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "On", "ly", "Sorte", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "versions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v", "Actions_", "=_", "get", "Action", "Chain_", "(_", "vist", "rail", "_", ",_", "v_", ",_", "shared", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v", "Add", "Dict_", ",_", "v", "Delete", "Dict_", ")_", "=_", "get", "Opera", "tion", "Diff_", "(_", "v", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Opera", "tion", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Add", "s_", "=_", "v", "Add", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Add", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Delete", "s_", "=_", "v", "Delete", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Delete", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "Op", "Dict_", "=_", "copy_", "._", "copy_", "(_", "shared", "Opera", "tion", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Opera", "tion", "Dict_", "(_", "v", "Op", "Dict_", ",_", "v", "On", "ly", "Delete", "s_", ",_", "v", "On", "ly", "Add", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "Ops_", "=_", "v", "Op", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "Ops_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Sorte", "d_", "._", "append_", "(_", "(_", "v", "On", "ly", "Add", "s_", ",_", "v", "On", "ly", "Delete", "s_", ",_", "v", "Ops_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shared", "Ops_", "=_", "shared", "Opera", "tion", "Dict_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Ops_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "shared", "Ops_", ",_", "v", "On", "ly", "Sorte", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Modul", "e", "Match_", "(_", "m1_", ",_", "m2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "module", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "module", " ", "names", " ", "match", ",", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m1_", "._", "db", "\\u", "name_", "==_", "m2_", "._", "db", "\\u", "name_", "and_", "m1_", "._", "db", "\\u", "namespace_", "==_", "m2_", "._", "db", "\\u", "namespace_", "and_", "m1_", "._", "db", "\\u", "package_", "==_", "m2_", "._", "db", "\\u", "package_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m1_", "._", "vt", "Type_", "==_", "'", "group", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "we", " ", "have", " ", "\\u\\u", "desc", "\\u\\u", " ", "annotation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "desc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "desc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\u", "\\u", "desc", "\\u\\u'_", "in_", "m1_", "._", "db", "\\u", "annotations\\u", "key", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "desc_", "=_", "m1_", "._", "db", "\\u", "annotations\\u", "key", "\\u", "index_", "[_", "'\\u", "\\u", "desc", "\\u\\u'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "\\u", "desc", "\\u\\u'_", "in_", "m2_", "._", "db", "\\u", "annotations\\u", "key", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2", "\\u", "desc_", "=_", "m2_", "._", "db", "\\u", "annotations\\u", "key", "\\u", "index_", "[_", "'\\u", "\\u", "desc", "\\u\\u'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "m1", "\\u", "desc_", "and_", "m2", "\\u", "desc_", "and_", "m1", "\\u", "desc_", "==_", "m2", "\\u", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "desc", "'", "s", " ", "don", "'", "t", " ", "exact", "ly", " ", "match", ",", " ", "return", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "continue", " ", "and", " ", "check", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "may", "be", " ", "we", " ", "shou", "ld", " ", "check", " ", "function", "s", " ", "here_", "\\u\\u\\uNL\\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_", "m1", "\\u", "functions_", "=_", "copy_", "._", "copy_", "(_", "m1_", "._", "db", "\\u", "get", "\\u", "functions_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "functions_", "=_", "copy_", "._", "copy_", "(_", "m2_", "._", "db", "\\u", "get", "\\u", "functions_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "functions_", ")_", "!=_", "len_", "(_", "m2", "\\u", "functions_", ")_", ":_", "\\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_", "f1_", "in_", "m1", "\\u", "functions_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f2_", "in_", "m2", "\\u", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Match_", "=_", "heuristic", "Function", "Match_", "(_", "f1_", ",_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "f2_", "\\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_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "functions_", "._", "remove_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "functions_", "._", "remove_", "(_", "f2_", ")_", "\\u\\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_", "m1", "\\u", "cpa", "rams_", "=_", "copy_", "._", "copy_", "(_", "m1_", "._", "db", "\\u", "get", "\\u", "control", "Parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "cpa", "rams_", "=_", "copy_", "._", "copy_", "(_", "m2_", "._", "db", "\\u", "get", "\\u", "control", "Parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "cpa", "rams_", ")_", "!=_", "len_", "(_", "m2", "\\u", "cpa", "rams_", ")_", ":_", "\\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_", "cp", "1_", "in_", "m1", "\\u", "cpa", "rams_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cp", "2_", "in_", "m2", "\\u", "cpa", "rams_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Match_", "=_", "heuristic", "Control", "Parameter", "Match_", "(_", "cp", "1_", ",_", "cp", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "cp", "2_", "\\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_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "cpa", "rams_", "._", "remove_", "(_", "cp", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "cpa", "rams_", "._", "remove_", "(_", "cp", "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 ", " _", "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_", "m1", "\\u", "annot", "s_", "=_", "copy_", "._", "copy_", "(_", "m1_", "._", "db", "\\u", "get", "\\u", "annotations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "annot", "s_", "=_", "copy_", "._", "copy_", "(_", "m2_", "._", "db", "\\u", "get", "\\u", "annotations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "annot", "s_", ")_", "!=_", "len_", "(_", "m2", "\\u", "annot", "s_", ")_", ":_", "\\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_", "a1_", "in_", "m1", "\\u", "annot", "s_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a2_", "in_", "m2", "\\u", "annot", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Match_", "=_", "heuristic", "Annot", "ation", "Match_", "(_", "a1_", ",_", "a2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "a2_", "\\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_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "annot", "s_", "._", "remove_", "(_", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "annot", "s_", "._", "remove_", "(_", "a2_", ")_", "\\u\\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_", "len_", "(_", "m1", "\\u", "functions_", ")_", "==_", "len_", "(_", "m2", "\\u", "functions_", ")_", "==_", "len_", "(_", "m1", "\\u", "cpa", "rams_", ")_", "==_", "len_", "(_", "m2", "\\u", "cpa", "rams_", ")_", "==_", "len_", "(_", "m1", "\\u", "annot", "s_", ")_", "==_", "len_", "(_", "m2", "\\u", "annot", "s_", ")_", "==_", "0_", ":_", "\\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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Function", "Match_", "(_", "f1_", ",_", "f2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "function", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "function", " ", "names", " ", "match", ",", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f1_", "._", "db", "\\u", "name_", "==_", "f2_", "._", "db", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f1", "\\u", "parameters_", "=_", "copy_", "._", "copy_", "(_", "f1_", "._", "db", "\\u", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2", "\\u", "parameters_", "=_", "copy_", "._", "copy_", "(_", "f2_", "._", "db", "\\u", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "f1", "\\u", "parameters_", ")_", "!=_", "len_", "(_", "f2", "\\u", "parameters_", ")_", ":_", "\\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_", "p1_", "in_", "f1", "\\u", "parameters_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p2_", "in_", "f2", "\\u", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Match_", "=_", "heuristic", "Parameter", "Match_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "p2_", "\\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_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f1", "\\u", "parameters_", "._", "remove_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2", "\\u", "parameters_", "._", "remove_", "(_", "match_", ")_", "\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "f1", "\\u", "parameters_", ")_", "==_", "len_", "(_", "f2", "\\u", "parameters_", ")_", "==_", "0_", ":_", "\\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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Parameter", "Match_", "(_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "parameter", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "partial", " ", "match", " ", "(", "types", " ", "match", "),", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p1_", "._", "db", "\\u", "type_", "==_", "p2_", "._", "db", "\\u", "type_", "and_", "p1_", "._", "db", "\\u", "pos_", "==_", "p2_", "._", "db", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p1_", "._", "db", "\\u", "val_", "==_", "p2_", "._", "db", "\\u", "val_", ":_", "\\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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Control", "Parameter", "Match_", "(_", "cp", "1_", ",_", "cp", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "control", " ", "parameter", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "partial", " ", "match", " ", "(", "types", " ", "match", "),", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cp", "1_", "._", "db", "\\u", "name_", "==_", "cp", "2_", "._", "db", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cp", "1_", "._", "db", "\\u", "value_", "==_", "cp", "2_", "._", "db", "\\u", "value_", ":_", "\\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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Annot", "ation", "Match_", "(_", "a1_", ",_", "a2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "annot", "ation", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "partial", " ", "match", " ", "(", "types", " ", "match", "),", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a1_", "._", "db", "\\u", "key_", "==_", "a2_", "._", "db", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a1_", "._", "db", "\\u", "value_", "==_", "a2_", "._", "db", "\\u", "value_", ":_", "\\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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Connect", "ion", "Match_", "(_", "c1_", ",_", "c2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "connections", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "partial", " ", "match", " ", "(", "currentl", "y", " ", "undefined", "),", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1", "\\u", "ports_", "=_", "copy_", "._", "copy_", "(_", "c1_", "._", "db", "\\u", "get", "\\u", "ports_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2", "\\u", "ports_", "=_", "copy_", "._", "copy_", "(_", "c2_", "._", "db", "\\u", "get", "\\u", "ports_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p1_", "in_", "c1", "\\u", "ports_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p2_", "in_", "c2", "\\u", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Match_", "=_", "heuristic", "Port", "Match_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "p2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Match_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "p2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1", "\\u", "ports_", "._", "remove_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2", "\\u", "ports_", "._", "remove_", "(_", "match_", ")_", "\\u\\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_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "c1", "\\u", "ports_", ")_", "==_", "len_", "(_", "c2", "\\u", "ports_", ")_", "==_", "0_", ":_", "\\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_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heuristic", "Port", "Match_", "(_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "take", "s", " ", "two", " ", "port", "s", " ", "and", " ", "return", "s", " ", "1", " ", "if", " ", "exact", " ", "match", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "partial", " ", "match", ",", " ", "-1", " ", "if", " ", "no", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p1_", "._", "db", "\\u", "module", "Id_", "==_", "p2_", "._", "db", "\\u", "module", "Id_", ":_", "\\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_", "elif_", "p1_", "._", "db", "\\u", "type_", "==_", "p2_", "._", "db", "\\u", "type_", "and_", "p1_", "._", "db", "\\u", "module", "Name_", "==_", "p2_", "._", "db", "\\u", "module", "Name_", "and_", "p1_", "._", "sig_", "==_", "p2_", "._", "sig_", ":_", "\\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_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "function", "\\u", "sig_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "function_", "._", "db", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "param_", "._", "db", "\\u", "type_", ",_", "param_", "._", "db", "\\u", "val_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "param_", "in_", "function_", "._", "db", "\\u", "get", "\\u", "parameters_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Param", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", "=_", "True_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "check", " ", "to", " ", "see", " ", "if", " ", "any", " ", "child", "ren", " ", "of", " ", "m1", " ", "and", " ", "m2", " ", "are", " ", "affect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "m1", "\\u", "functions_", "=_", "m1_", "._", "db", "\\u", "get", "\\u", "functions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "functions_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "functions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same", "\\u", "vt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f1_", "in_", "m1", "\\u", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m2", " ", "has", " ", "f1", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f2_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "function_", "(_", "f1_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "unmatched", "_", "._", "append_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "function", " ", "is", " ", "same", ",", " ", "check", " ", "if", " ", "parameter", "s", " ", "have", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Function", "Match_", "(_", "f1_", ",_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param", "Changes_", "._", "append_", "(_", "(_", "function", "\\u", "sig_", "(_", "f1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "sig_", "(_", "f2_", ")_", ")_", ")_", "\\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 ", " ", "_", "param", "Changes_", "._", "append_", "(_", "(_", "function", "\\u", "sig_", "(_", "f1_", ")_", ",_", "function", "\\u", "sig_", "(_", "f2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f2_", "in_", "m2", "\\u", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m1", " ", "has", " ", "f2", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m1_", "._", "db", "\\u", "get", "\\u", "function_", "(_", "f2_", "._", "db", "\\u", "id_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2", "\\u", "unmatched", "_", "._", "append_", "(_", "f2_", ")_", "\\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 ", " _", "m1", "\\u", "unmatched", "_", "._", "extend_", "(_", "m1", "\\u", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "extend_", "(_", "m2", "\\u", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "function", "Match", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f1", "\\u", "params", " ", "=", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f2", "\\u", "params", " ", "=", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p1", " ", "in", " ", "f1", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p1", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m1", "\\u", "unmatched", ".", "append", "(", "f1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p2", " ", "in", " ", "f2", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p2", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m2", "\\u", "unmatched", ".", "append", "(", "f2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "function", "Match", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", "+_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", "and_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", ">_", "0_", "and_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "heuristic", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f1_", "in_", "m1", "\\u", "unmatched", "_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "Value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f2_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Function", "Match_", "(_", "f1_", ",_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "best", " ", "match", " ", "so", " ", "quit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "f1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match", "Value_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "match", ",", " ", "but", " ", "not", " ", "exact", " ", "so", " ", "continue", " ", "to", " ", "look", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "f1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "matched_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param", "Changes_", "._", "append_", "(_", "(_", "function", "\\u", "sig_", "(_", "f1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "sig_", "(_", "f2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "._", "remove_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "remove_", "(_", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "m1", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Changes_", "._", "append_", "(_", "(_", "function", "\\u", "sig_", "(_", "f_", ")_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Changes_", "._", "append_", "(_", "(_", "(_", "None_", ",_", "None_", ")_", ",_", "function", "\\u", "sig_", "(_", "f_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "param", "Changes_", "\\u\\u\\uNEWLINE\\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", "CP", "aram", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", "=_", "True_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "check", " ", "to", " ", "see", " ", "if", " ", "any", " ", "child", "ren", " ", "of", " ", "m1", " ", "and", " ", "m2", " ", "are", " ", "affect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "m1", "\\u", "cpa", "rams_", "=_", "m1_", "._", "db", "\\u", "get", "\\u", "control", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "cpa", "rams_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "control", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same", "\\u", "vt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cp", "1_", "in_", "m1", "\\u", "cpa", "rams_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m2", " ", "has", " ", "f1", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp", "2_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "control", "Parameter_", "(_", "cp", "1_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cp", "2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "unmatched", "_", "._", "append_", "(_", "cp", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cpa", "ram", " ", "is", " ", "same", ",", " ", "check", " ", "if", " ", "it", " ", "has", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Control", "Parameter", "Match_", "(_", "cp", "1_", ",_", "cp", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "cp", "1_", "._", "db", "\\u", "name_", ",_", "cp", "1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cp", "2_", "._", "db", "\\u", "name_", ",_", "cp", "2_", "._", "db", "\\u", "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 ", " ", "_", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "cp", "1_", "._", "db", "\\u", "name_", ",_", "cp", "1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cp", "2_", "._", "db", "\\u", "name_", ",_", "cp", "2_", "._", "db", "\\u", "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_", "for_", "cp", "2_", "in_", "m2", "\\u", "cpa", "rams_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m1", " ", "has", " ", "f2", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m1_", "._", "db", "\\u", "get", "\\u", "control", "Parameter_", "(_", "cp", "2_", "._", "db", "\\u", "id_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2", "\\u", "unmatched", "_", "._", "append_", "(_", "cp", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "unmatched", "_", "._", "extend_", "(_", "m1", "\\u", "cpa", "rams_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "extend_", "(_", "m2", "\\u", "cpa", "rams_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "function", "Match", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f1", "\\u", "params", " ", "=", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f2", "\\u", "params", " ", "=", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p1", " ", "in", " ", "f1", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p1", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m1", "\\u", "unmatched", ".", "append", "(", "f1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p2", " ", "in", " ", "f2", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p2", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m2", "\\u", "unmatched", ".", "append", "(", "f2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "function", "Match", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", "+_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", "and_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", ">_", "0_", "and_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "heuristic", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cp", "1_", "in_", "m1", "\\u", "unmatched", "_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "Value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cp", "2_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Control", "Parameter", "Match_", "(_", "cp", "1_", ",_", "cp", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "best", " ", "match", " ", "so", " ", "quit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "cp", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match", "Value_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "match", ",", " ", "but", " ", "not", " ", "exact", " ", "so", " ", "continue", " ", "to", " ", "look", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "cp", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "matched_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "cp", "1_", "._", "db", "\\u", "name_", ",_", "cp", "1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cp", "2_", "._", "db", "\\u", "name_", ",_", "cp", "2_", "._", "db", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "._", "remove_", "(_", "cp", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "remove_", "(_", "cp", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cp_", "in_", "m1", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "cp_", "._", "db", "\\u", "name_", ",_", "cp_", "._", "db", "\\u", "value_", ")_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cp_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "None_", ",_", "None_", ")_", ",_", "(_", "cp_", "._", "db", "\\u", "name_", ",_", "cp_", "._", "db", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cpa", "ram", "Changes_", "\\u\\u\\uNEWLINE\\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", "Annot", "ation", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", "=_", "True_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "check", " ", "to", " ", "see", " ", "if", " ", "any", " ", "child", "ren", " ", "of", " ", "m1", " ", "and", " ", "m2", " ", "are", " ", "affect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "m1", "\\u", "annot", "s_", "=_", "m1_", "._", "db", "\\u", "get", "\\u", "annotations_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "annot", "s_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "annotations_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "same", "\\u", "vt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a1_", "in_", "m1", "\\u", "annot", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m2", " ", "has", " ", "f1", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a2_", "=_", "m2_", "._", "db", "\\u", "get", "\\u", "annotation_", "(_", "a1_", "._", "db", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1", "\\u", "unmatched", "_", "._", "append_", "(_", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cpa", "ram", " ", "is", " ", "same", ",", " ", "check", " ", "if", " ", "it", " ", "has", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Annot", "ation", "Match_", "(_", "a1_", ",_", "a2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "a1_", "._", "db", "\\u", "key_", ",_", "a1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "a2_", "._", "db", "\\u", "key_", ",_", "a2_", "._", "db", "\\u", "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 ", " ", "_", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "a1_", "._", "db", "\\u", "key_", ",_", "a1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "a2_", "._", "db", "\\u", "key_", ",_", "a2_", "._", "db", "\\u", "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_", "for_", "a2_", "in_", "m2", "\\u", "annot", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "m1", " ", "has", " ", "f2", ",", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m1_", "._", "db", "\\u", "get", "\\u", "annotation_", "(_", "a2_", "._", "db", "\\u", "id_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2", "\\u", "unmatched", "_", "._", "append_", "(_", "a2_", ")_", "\\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 ", " _", "m1", "\\u", "unmatched", "_", "._", "extend_", "(_", "m1", "\\u", "annot", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "extend_", "(_", "m2", "\\u", "annot", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "function", "Match", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f1", "\\u", "params", " ", "=", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "f2", "\\u", "params", " ", "=", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p1", " ", "in", " ", "f1", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f2", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p1", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m1", "\\u", "unmatched", ".", "append", "(", "f1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "p2", " ", "in", " ", "f2", "\\u", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "f1", ".", "db", "\\u", "get", "\\u", "parameter", "(", "p2", ".", "db", "\\u", "id", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "function", "Match", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "m2", "\\u", "unmatched", ".", "append", "(", "f2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "function", "Match", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", "+_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "heuristic", "\\u", "match_", "and_", "len_", "(_", "m1", "\\u", "unmatched", "_", ")_", ">_", "0_", "and_", "len_", "(_", "m2", "\\u", "unmatched", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "heuristic", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a1_", "in_", "m1", "\\u", "unmatched", "_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "Value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a2_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match", "Value_", "=_", "heuristic", "Annot", "ation", "Match_", "(_", "a1_", ",_", "a2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "Value_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "best", " ", "match", " ", "so", " ", "quit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "a1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match", "Value_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "match", ",", " ", "but", " ", "not", " ", "exact", " ", "so", " ", "continue", " ", "to", " ", "look", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "matched_", "=_", "a1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "matched_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "match", "Value_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "a1_", "._", "db", "\\u", "key_", ",_", "a1_", "._", "db", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "a2_", "._", "db", "\\u", "key_", ",_", "a2_", "._", "db", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m1", "\\u", "unmatched", "_", "._", "remove_", "(_", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "\\u", "unmatched", "_", "._", "remove_", "(_", "a2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cp_", "in_", "m1", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "cp_", "._", "db", "\\u", "key_", ",_", "cp_", "._", "db", "\\u", "value_", ")_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cp_", "in_", "m2", "\\u", "unmatched", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "None_", ",_", "None_", ")_", ",_", "(_", "cp_", "._", "db", "\\u", "key_", ",_", "cp_", "._", "db", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "annot", "Changes_", "\\u\\u\\uNEWLINE\\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", "Old", "Obj", "Id_", "(_", "operation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "operation_", "._", "db", "\\u", "object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "New", "Obj", "Id_", "(_", "operation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "operation_", "._", "db", "\\u", "new", "Obj", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "operation_", "._", "db", "\\u", "object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Old", "Obj", "Id_", "(_", "operation_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operation_", "._", "db", "\\u", "old", "Obj", "Id_", "=_", "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 ", " _", "operation_", "._", "db", "\\u", "object", "Id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "New", "Obj", "Id_", "(_", "operation_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "operation_", "._", "vt", "Type_", "==_", "'", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operation_", "._", "db", "\\u", "new", "Obj", "Id_", "=_", "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 ", " _", "operation_", "._", "db", "\\u", "object", "Id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Work", "flow", "Diff", "Common_", "(_", "vist", "rail", "_", ",_", "v1_", ",_", "v2_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "shared", "Ops_", ",_", "v", "On", "ly", "Ops_", ")_", "=_", "get", "Version", "Difference", "s_", "(_", "vist", "rail", "_", ",_", "[_", "v1_", ",_", "v2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Workflow_", "=_", "DB", "Workflow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perform", "Add", "s_", "(_", "shared", "Ops_", ",_", "shared", "Workflow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "bett", "er", " ", "to", " ", "do", " ", "addition", "al", " ", "ops", " ", "(", "and", " ", "do", " ", "delete", "s", ")", " ", "or", " ", "do", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "v1", "Workflow_", "=_", "DB", "Workflow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Ops_", "=_", "v", "On", "ly", "Ops_", "[_", "0_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perform", "Add", "s_", "(_", "v1", "Ops_", ",_", "v1", "Workflow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v2", "Workflow_", "=_", "DB", "Workflow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Ops_", "=_", "v", "On", "ly", "Ops_", "[_", "1_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perform", "Add", "s_", "(_", "v2", "Ops_", ",_", "v2", "Workflow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "connections", " ", "do", " ", "not", " ", "check", " ", "thei", "r", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Connect", "ion", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Function", "Ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "CP", "aram", "eter", "Ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Annot", "ation", "Ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "shared", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "._", "what_", "==_", "'", "module", "'_", "or_", "op_", "._", "what_", "==_", "'", "abstract", "ion", "'_", "or_", "op_", "._", "what_", "==_", "'", "group", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Modul", "e", "Ids_", "._", "append_", "(_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "connecti", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Connect", "ion", "Ids_", "._", "append_", "(_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "function", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Function", "Ids_", "[_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", "]_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "control", "Parameter", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "CP", "aram", "eter", "Ids_", "[_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", "]_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "annot", "ation", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shared", "Annot", "ation", "Ids_", "[_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", "]_", "=_", "op_", "._", "db", "\\u", "parent", "Obj", "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_", "v", "On", "ly", "Modules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Connections_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "Ch", "g", "Modules_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "ram", "Ch", "g", "Modules_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "annot", "Ch", "g", "Modules_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "v", "Add", "s_", ",_", "v", "Delete", "s_", ",_", "\\u_", ")_", "in_", "v", "On", "ly", "Ops_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Delete", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connecti", "on", "Delete", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "v", "Delete", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "._", "what_", "==_", "'", "module", "'_", "or_", "op_", "._", "what_", "==_", "'", "abstract", "ion", "'_", "or_", "op_", "._", "what_", "==_", "'", "group", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Delete", "Ids_", "._", "append_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "param", "Ch", "g", "Modules_", "._", "has", "\\u", "key_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "param", "Ch", "g", "Modules_", "[_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cpa", "ram", "Ch", "g", "Modules_", "._", "has", "\\u", "key_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "cpa", "ram", "Ch", "g", "Modules_", "[_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "annot", "Ch", "g", "Modules_", "._", "has", "\\u", "key_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "annot", "Ch", "g", "Modules_", "[_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "function", "'_", "and_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "function", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "parameter", "'_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "function", "'_", "and_", "shared", "Function", "Ids_", "._", "has", "\\u", "key_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "parameter", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Id_", "=_", "shared", "Function", "Ids_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "module", "Id_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param", "Ch", "g", "Modules_", "[_", "module", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "module", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "control", "Parameter", "'_", "and_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "CP", "aram", "eter", "Ids_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "control", " ", "parameter", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "annot", "ation", "'_", "and_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Annot", "ation", "Ids_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "an", " ", "annot", "ation", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "connecti", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connecti", "on", "Delete", "Ids_", "._", "append_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", "in_", "shared", "Connect", "ion", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "shared", "Connect", "ion", "Ids_", "._", "remove_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\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_", "module", "Add", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connecti", "on", "Add", "Ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", "in_", "v", "Add", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "._", "what_", "==_", "'", "module", "'_", "or_", "op_", "._", "what_", "==_", "'", "abstract", "ion", "'_", "or_", "op_", "._", "what_", "==_", "'", "group", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Add", "Ids_", "._", "append_", "(_", "get", "New", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "op_", "._", "what_", "==_", "'", "function", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "function", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "parameter", "'_", "and_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "function", "'_", "and_", "shared", "Function", "Ids_", "._", "has", "\\u", "key_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "parameter", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Id_", "=_", "shared", "Function", "Ids_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "module", "Id_", "in_", "shared", "Modul", "e", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param", "Ch", "g", "Modules_", "[_", "module", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "module", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "op_", "._", "what_", "==_", "'", "control", "Parameter", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "CP", "aram", "eter", "Ids_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "control", " ", "parameter", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "op_", "._", "what_", "==_", "'", "annot", "ation", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "module", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "abstract", "ion", "'_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Type_", "==_", "'", "group", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Annot", "ation", "Ids_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "in_", "shared", "Modul", "e", "Ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "have", " ", "an", " ", "annot", "ation", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Ch", "g", "Modules_", "[_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared", "Modul", "e", "Ids_", "._", "remove_", "(_", "op_", "._", "db", "\\u", "parent", "Obj", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "what_", "==_", "'", "connecti", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connecti", "on", "Add", "Ids_", "._", "append_", "(_", "get", "Old", "Obj", "Id_", "(_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v", "On", "ly", "Modules_", "._", "append_", "(_", "(_", "module", "Add", "Ids_", ",_", "module", "Delete", "Ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "On", "ly", "Connections_", "._", "append_", "(_", "(_", "connecti", "on", "Add", "Ids_", ",_", "connecti", "on", "Delete", "Ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shared", "Modul", "e", "Pairs_", "=_", "[_", "(_", "id_", ",_", "id_", ")_", "for_", "id_", "in_", "shared", "Modul", "e", "Ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1", "Only_", "=_", "v", "On", "ly", "Modules_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Only_", "=_", "v", "On", "ly", "Modules_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "v", "On", "ly", "Modules_", "[_", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "not_", "in_", "v", "On", "ly", "Modules_", "[_", "0_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1", "Only_", "._", "append_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "id_", "in_", "v", "On", "ly", "Modules_", "[_", "0_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "not_", "in_", "v", "On", "ly", "Modules_", "[_", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v2", "Only_", "._", "append_", "(_", "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_", "shared", "Connect", "ion", "Pairs_", "=_", "[_", "(_", "id_", ",_", "id_", ")_", "for_", "id_", "in_", "shared", "Connect", "ion", "Ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1", "Only_", "=_", "v", "On", "ly", "Connections_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2", "Only_", "=_", "v", "On", "ly", "Connections_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "v", "On", "ly", "Connections_", "[_", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "not_", "in_", "v", "On", "ly", "Connections_", "[_", "0_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1", "Only_", "._", "append_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "id_", "in_", "v", "On", "ly", "Connections_", "[_", "0_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "not_", "in_", "v", "On", "ly", "Connections_", "[_", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c2", "Only_", "._", "append_", "(_", "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_", "param", "Ch", "g", "Modul", "e", "Pairs_", "=_", "[_", "(_", "id_", ",_", "id_", ")_", "for_", "id_", "in_", "param", "Ch", "g", "Modules_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "ram", "Ch", "g", "Modul", "e", "Pairs_", "=_", "[_", "(_", "id_", ",_", "id_", ")_", "for_", "id_", "in_", "cpa", "ram", "Ch", "g", "Modules_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "annot", "Ch", "g", "Modul", "e", "Pairs_", "=_", "[_", "(_", "id_", ",_", "id_", ")_", "for_", "id_", "in_", "annot", "Ch", "g", "Modules_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "^", "^", "^", "^", " ", "SHARED", " ", "MODUL", "E", " ", "PAIR", "S", ":\"", ",", " ", "shared", "Modul", "e", "Pairs_", "\\u\\u\\uNL\\u\\u\\u_", "c1", "Only_", ",_", "c2", "Only_", ",_", "heuristic", "Connect", "ion", "Pairs_", "=_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "heuristic", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "heuristic", "Modul", "e", "Pairs_", ",_", "heuristic", "Connect", "ion", "Pairs_", ",_", "v1", "Only_", ",_", "v2", "Only_", ",_", "c1", "Only_", ",_", "c2", "Only_", ")_", "=_", "do", "\\u", "heuristic", "\\u", "diff_", "(_", "v1", "Workflow_", ",_", "v2", "Workflow_", ",_", "v1", "Only_", ",_", "v2", "Only_", ",_", "c1", "Only_", ",_", "c2", "Only_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "Ch", "g", "Modul", "e", "Pairs_", "._", "extend_", "(_", "heuristic", "Modul", "e", "Pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "ram", "Ch", "g", "Modul", "e", "Pairs_", "._", "extend_", "(_", "heuristic", "Modul", "e", "Pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "annot", "Ch", "g", "Modul", "e", "Pairs_", "._", "extend_", "(_", "heuristic", "Modul", "e", "Pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "Ch", "g", "Modul", "e", "Pairs_", "=_", "list_", "(_", "set_", "(_", "chain_", "(_", "param", "Ch", "g", "Modul", "e", "Pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpa", "ram", "Ch", "g", "Modul", "e", "Pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "annot", "Ch", "g", "Modul", "e", "Pairs_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "heuristic", "Modul", "e", "Pairs_", ",_", "param", "Changes_", ",_", "cpa", "ram", "\\u", "changes_", ",_", "annot", "\\u", "changes_", ")_", "=_", "check", "\\u", "params", "\\u", "diff_", "(_", "v1", "Workflow_", ",_", "v2", "Workflow_", ",_", "all", "Ch", "g", "Modul", "e", "Pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "v1", "Workflow_", ",_", "v2", "Workflow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Modul", "e", "Pairs_", ",_", "heuristic", "Modul", "e", "Pairs_", ",_", "v1", "Only_", ",_", "v2", "Only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "Changes_", ",_", "cpa", "ram", "\\u", "changes_", ",_", "annot", "\\u", "changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "Connect", "ion", "Pairs_", ",_", "heuristic", "Connect", "ion", "Pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c1", "Only_", ",_", "c2", "Only_", ")_", "\\u\\u\\uNEWLINE\\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", "heuristic", "\\u", "diff_", "(_", "v1", "Workflow_", ",_", "v2", "Workflow_", ",_", "v1", "\\u", "modules_", ",_", "v2", "\\u", "modules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v1", "\\u", "connections_", ",_", "v2", "\\u", "connections_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "heuristic", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "heuristic", "Modul", "e", "Pairs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heuristic", "Connect", "ion", "Pairs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v1", "Only_", "=_", "copy_", "._", "copy_", "(_", "v1", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Only_", "=_", "copy_", "._", "copy_", "(_", "v2", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1", "Only_", "=_", "copy_", "._", "copy_", "(_", "v1", "\\u", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2", "Only_", "=_", "copy_", "._", "copy_", "(_", "v2", "\\u", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "now", " ", "check", " ", "all", " ", "heuristic", " ", "pair", "s", " ", "for", " ", "parameter", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "match", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "(", "m1", "\\u", "id", ",", " ", "m2", "\\u", "id", ")", " ", "in", " ", "param", "Ch", "g", "Modul", "e", "Pair", "s", "[:", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "m1", " ", "=", " ", "v1", "Work", "flow", ".", "db", "\\u", "get", "\\u", "module", "(", "m1", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "m2", " ", "=", " ", "v2", "Work", "flow", ".", "db", "\\u", "get", "\\u", "module", "(", "m2", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "heuristic", "Modul", "e", "Match", "(", "m1", ",", " ", "m2", ")", " ", "==", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "param", "Ch", "g", "Modul", "e", "Pair", "s", ".", "remove", "((", "m1", "\\u", "id", ",", " ", "m2", "\\u", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "heuristic", "Modul", "e", "Pair", "s", ".", "append", "((", "m1", "\\u", "id", ",", " ", "m2", "\\u", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m1", "\\u", "id_", "in_", "v1", "Only_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "v1", "Workflow_", "._", "db", "\\u", "get", "\\u", "module_", "(_", "m1", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m2", "\\u", "id_", "in_", "v2", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2_", "=_", "v2", "Workflow_", "._", "db", "\\u", "get", "\\u", "module_", "(_", "m2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Match_", "=_", "heuristic", "Modul", "e", "Match_", "(_", "m1_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Match_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1", "Only_", "._", "remove_", "(_", "match_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2", "Only_", "._", "remove_", "(_", "match_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "now", " ", "check", " ", "all", " ", "heuristic", " ", "pair", "s", " ", "for", " ", "parameter", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "heuristic", "Modul", "e", "Pairs_", "._", "append_", "(_", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "match", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c1", "\\u", "id_", "in_", "c1", "Only_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "v1", "Workflow_", "._", "db", "\\u", "get", "\\u", "connection_", "(_", "c1", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c2", "\\u", "id_", "in_", "c2", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c2_", "=_", "v2", "Workflow_", "._", "db", "\\u", "get", "\\u", "connection_", "(_", "c2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Match_", "=_", "heuristic", "Connect", "ion", "Match_", "(_", "c1_", ",_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Match_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "(_", "c1", "\\u", "id_", ",_", "c2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Match_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "(_", "c1", "\\u", "id_", ",_", "c2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "have", " ", "port", " ", "change", "s", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1", "Only_", "._", "remove_", "(_", "match_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2", "Only_", "._", "remove_", "(_", "match_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heuristic", "Connect", "ion", "Pairs_", "._", "append_", "(_", "match_", ")_", "\\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_", "(_", "heuristic", "Modul", "e", "Pairs_", ",_", "heuristic", "Connect", "ion", "Pairs_", ",_", "v1", "Only_", ",_", "v2", "Only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c1", "Only_", ",_", "c2", "Only_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "params", "\\u", "diff_", "(_", "v1", "Workflow_", ",_", "v2", "Workflow_", ",_", "param", "Ch", "g", "Modul", "e", "Pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "same", "\\u", "vt_", "=_", "True_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "ram", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "annot", "Changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "^", "^", "^", "^", " ", "PARAM", " ", "CH", "G", " ", "PAIR", "S", ":\"", ",", " ", "param", "Ch", "g", "Modul", "e", "Pairs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", "in_", "param", "Ch", "g", "Modul", "e", "Pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "v1", "Workflow_", "._", "db", "\\u", "get", "\\u", "module_", "(_", "m1", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "v2", "Workflow_", "._", "db", "\\u", "get", "\\u", "module_", "(_", "m2", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "Param", "Changes_", "=_", "get", "Param", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", ",_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "module", "Param", "Changes_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "Changes_", "._", "append_", "(_", "(_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", ",_", "module", "Param", "Changes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "CP", "aram", "Changes_", "=_", "get", "CP", "aram", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "module", "CP", "aram", "Changes_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpa", "ram", "Changes_", "._", "append_", "(_", "(_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", ",_", "module", "CP", "aram", "Changes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "Annot", "Changes_", "=_", "get", "Annot", "ation", "Changes_", "(_", "m1_", ",_", "m2_", ",_", "same", "\\u", "vt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "module", "Annot", "Changes_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "Changes_", "._", "append_", "(_", "(_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", ",_", "module", "Annot", "Changes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "module", "Param", "Changes_", ")_", "==_", "len_", "(_", "module", "CP", "aram", "Changes_", ")_", "==_", "len_", "(_", "module", "Annot", "Changes_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "heuristic", "Modul", "e", "Pair", "s", ".", "append", "((", "m1", "\\u", "id", ",", " ", "m2", "\\u", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", "._", "append_", "(_", "(_", "m1", "\\u", "id_", ",_", "m2", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "matched_", ",_", "param", "Changes_", ",_", "cpa", "ram", "Changes_", ",_", "annot", "Changes_", ")_", "\\u\\u\\uNEWLINE\\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", "Work", "flow", "Diff_", "(_", "vt", "\\u", "pair", "\\u", "1_", ",_", "vt", "\\u", "pair", "\\u", "2_", ",_", "heuristic", "\\u", "match_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "vist", "rail", "\\u", "1_", ",_", "v", "\\u", "1_", ")_", "=_", "vt", "\\u", "pair", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "vist", "rail", "\\u", "2_", ",_", "v", "\\u", "2_", ")_", "=_", "vt", "\\u", "pair", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "vist", "rail", "\\u", "1_", "==_", "vist", "rail", "\\u", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "Work", "flow", "Diff", "Common_", "(_", "vist", "rail", "\\u", "1_", ",_", "v", "\\u", "1_", ",_", "v", "\\u", "2_", ",_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "workf", "low", "\\u", "1_", "=_", "material", "ize", "Workflow_", "(_", "vist", "rail", "\\u", "1_", ",_", "v", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workf", "low", "\\u", "2_", "=_", "material", "ize", "Workflow_", "(_", "vist", "rail", "\\u", "2_", ",_", "v", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "s", "\\u", "1_", "=_", "workf", "low", "\\u", "1_", "._", "db", "\\u", "module", "s", "\\u", "id", "\\u", "index_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "s", "\\u", "2_", "=_", "workf", "low", "\\u", "2_", "._", "db", "\\u", "module", "s", "\\u", "id", "\\u", "index_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn", "s", "\\u", "1_", "=_", "workf", "low", "\\u", "1_", "._", "db", "\\u", "connections", "\\u", "id", "\\u", "index_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn", "s", "\\u", "2_", "=_", "workf", "low", "\\u", "2_", "._", "db", "\\u", "connections", "\\u", "id", "\\u", "index_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "heuristic", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "m", "\\u", "matches_", ",_", "c\\u", "matches_", ",_", "module", "s", "\\u", "1_", ",_", "module", "s", "\\u", "2_", ",_", "conn", "s", "\\u", "1_", ",_", "conn", "s", "\\u", "2_", ")_", "=_", "do", "\\u", "heuristic", "\\u", "diff_", "(_", "workf", "low", "\\u", "1_", ",_", "workf", "low", "\\u", "2_", ",_", "module", "s", "\\u", "1_", ",_", "module", "s", "\\u", "2_", ",_", "conn", "s", "\\u", "1_", ",_", "conn", "s", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "m", "\\u", "matches_", ",_", "param", "\\u", "changes_", ",_", "cpa", "ram", "\\u", "changes_", ",_", "annot", "\\u", "changes_", ")_", "=_", "check", "\\u", "params", "\\u", "diff_", "(_", "workf", "low", "\\u", "1_", ",_", "workf", "low", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m", "\\u", "matches_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heuristic", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "workf", "low", "\\u", "1_", ",_", "workf", "low", "\\u", "2_", ",_", "[_", "]_", ",_", "m", "\\u", "matches_", ",_", "module", "s", "\\u", "1_", ",_", "module", "s", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "changes_", ",_", "cpa", "ram", "\\u", "changes_", ",_", "annot", "\\u", "changes_", ",_", "[_", "]_", ",_", "c\\u", "matches_", ",_", "conn", "s", "\\u", "1_", ",_", "conn", "s", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "workf", "low", "\\u", "1_", ",_", "workf", "low", "\\u", "2_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "module", "s", "\\u", "1_", ",_", "module", "s", "\\u", "2_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "s", "\\u", "1_", ",_", "conn", "s", "\\u", "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_", "class_", "Test", "DB", "Vis", "trail", "Service_", "(_", "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_", "[SEP]_", "class_", "Test", "DB", "Vis", "trail", "Service_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "parameter", "\\u", "heuristic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module", "\\u", "param_", "import_", "Modul", "e", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param1_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "0_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "2_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "1_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "3_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "2_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "4_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "3_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "def", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "5_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "4_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Parameter", "Match_", "(_", "param1_", ",_", "param", "2_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Parameter", "Match_", "(_", "param1_", ",_", "param", "3_", ")_", "==_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "partial", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Parameter", "Match_", "(_", "param1_", ",_", "param", "4_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "position", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Parameter", "Match_", "(_", "param1_", ",_", "param", "5_", ")_", "==_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DB", "Vis", "trail", "Service_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "function", "\\u", "heuristic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module", "\\u", "param_", "import_", "Modul", "e", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module", "\\u", "function_", "import_", "Modul", "e", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param1_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "0_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "2_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "1_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "3_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "2_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "4_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "3_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "5_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "4_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "6_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "5_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "2.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "1_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param1_", ",_", "param", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "2_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param", "3_", ",_", "param", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "3_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param", "5_", ",_", "param", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "4_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f2", "'_", ",_", "parameters_", "=_", "[_", "param1_", ",_", "param", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "5_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Function", "Match_", "(_", "function", "1_", ",_", "function", "2_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "partial", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Function", "Match_", "(_", "function", "1_", ",_", "function", "3_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Function", "Match_", "(_", "function", "1_", ",_", "function", "4_", ")_", "==_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "length", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Function", "Match_", "(_", "function", "1_", ",_", "function", "5_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DB", "Vis", "trail", "Service_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "module", "\\u", "heuristic", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module", "\\u", "param_", "import_", "Modul", "e", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module", "\\u", "function_", "import_", "Modul", "e", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "module_", "import_", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param1_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "0_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "2_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "1_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "3_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "2_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "String", "'_", ",_", "val_", "=_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "4_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "3_", ",_", "pos_", "=_", "1_", ",_", "type_", "=_", "'", "Float", "'_", ",_", "val_", "=_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "5_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "4_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "Integer", "'_", ",_", "val_", "=_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "6_", "=_", "Modul", "e", "Param_", "(_", "id_", "=_", "5_", ",_", "pos_", "=_", "0_", ",_", "type_", "=_", "'", "Integer", "'_", ",_", "val_", "=_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "1_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param1_", ",_", "param", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "2_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param", "3_", ",_", "param", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "3_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f2", "'_", ",_", "parameters_", "=_", "[_", "param", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "4_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f2", "'_", ",_", "parameters_", "=_", "[_", "param", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "5_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f1", "'_", ",_", "parameters_", "=_", "[_", "param", "2_", ",_", "param", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "6_", "=_", "Modul", "e", "Function_", "(_", "name_", "=_", "'", "f2", "'_", ",_", "parameters_", "=_", "[_", "param", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module", "1_", "=_", "Module_", "(_", "name_", "=_", "'", "m1", "'_", ",_", "functions_", "=_", "[_", "function", "1_", ",_", "function", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "2_", "=_", "Module_", "(_", "name_", "=_", "'", "m1", "'_", ",_", "functions_", "=_", "[_", "function", "2_", ",_", "function", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "3_", "=_", "Module_", "(_", "name_", "=_", "'", "m2", "'_", ",_", "functions_", "=_", "[_", "function", "1_", ",_", "function", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "4_", "=_", "Module_", "(_", "name_", "=_", "'", "m1", "'_", ",_", "functions_", "=_", "[_", "function", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "5_", "=_", "Module_", "(_", "name_", "=_", "'", "m1", "'_", ",_", "functions_", "=_", "[_", "function", "5_", ",_", "function", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Modul", "e", "Match_", "(_", "module", "1_", ",_", "module", "2_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "basic", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Modul", "e", "Match_", "(_", "module", "1_", ",_", "module", "3_", ")_", "==_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "length", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Modul", "e", "Match_", "(_", "module", "1_", ",_", "module", "4_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "parameter", " ", "change", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "heuristic", "Modul", "e", "Match_", "(_", "module", "1_", ",_", "module", "5_", ")_", "==_", "0_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
numba/numba/numba/tests/test_dispatcher.py
[ { "content": " def test_lock(self):\n \"\"\"\n Test that (lazy) compiling from several threads at once doesn't\n produce errors (see issue #908).\n \"\"\"\n errors = []\n\n @jit\n def foo(x):\n return x + 1\n\n def wrapper():\n try:\n self.assertEqual(foo(1), 2)\n except BaseException as e:\n errors.append(e)\n\n threads = [threading.Thread(target=wrapper) for i in range(16)]\n for t in threads:\n t.start()\n for t in threads:\n t.join()\n self.assertFalse(errors)", "metadata": "root.TestDispatcher.test_lock", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "except BaseException as e:", "start_line": 136, "start_column": 12, "end_line": 136, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "(", "lazy", ")", " ", "compil", "ing", " ", "from", " ", "sever", "al", " ", "thread", "s", " ", "at", " ", "onc", "e", " ", "doe", "sn", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "produce", " ", "error", "s", " ", "(", "see", " ", "issue", " ", "#", "908", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wrapper_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "threads_", "=_", "[_", "threading_", "._", "Thread_", "(_", "target_", "=_", "wrapper_", ")_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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 ]
Except block handles 'BaseException'
django-denorm/django-denorm/denorm/db/base.py
[ { "content": " def __init__(self, subject, time, event, actions, content_type, using=None, skip=None):\n self.subject = subject\n self.time = time\n self.event = event\n self.content_type = content_type\n self.content_type_field = None\n self.actions = []\n self.append(actions)\n self.using = using\n\n if self.using:\n self.connection = connections[self.using]\n else:\n self.connection = connection\n\n try:\n from django.contrib.contenttypes.fields import GenericRelation\n except ImportError:\n from django.contrib.contenttypes.generic import GenericRelation\n\n if isinstance(subject, models.ManyToManyField):\n self.model = None\n self.db_table = subject.m2m_db_table()\n self.fields = [(subject.m2m_column_name(), ''), (subject.m2m_reverse_name(), '')]\n\n elif isinstance(subject, GenericRelation):\n self.model = None\n self.db_table = remote_field_model(subject)._meta.db_table\n self.fields = [(k.attname, k.db_type(connection=self.connection)) for k, v in get_fields_with_model(remote_field_model(subject), remote_field_model(subject)._meta) if not v]\n self.content_type_field = subject.content_type_field_name + '_id'\n\n elif isinstance(subject, models.ForeignKey):\n self.model = subject.model\n self.db_table = self.model._meta.db_table\n skip = skip or () + getattr(self.model, 'denorm_always_skip', ())\n self.fields = [(k.attname, k.db_type(connection=self.connection)) for k, v in get_fields_with_model(subject.model, self.model._meta) if not v and k.attname not in skip]\n\n elif hasattr(subject, \"_meta\"):\n self.model = subject\n self.db_table = self.model._meta.db_table\n # FIXME: need to check get_parent_list and add triggers to those\n # The below will only check the fields on *this* model, not parents\n skip = skip or () + getattr(self.model, 'denorm_always_skip', ())\n self.fields = []\n try:\n from django.db.models.fields.related import ForeignObjectRel\n except:\n from django.db.models.related import RelatedObject as ForeignObjectRel\n for k, v in get_fields_with_model(subject, self.model._meta):\n if isinstance(k, ForeignObjectRel):\n pass\n else:\n if not v and k.attname not in skip:\n self.fields.append((k.attname, k.db_type(connection=self.connection)))\n\n else:\n raise NotImplementedError", "metadata": "root.Trigger.__init__", "header": "['class', 'Trigger', '(', 'object', ')', ':', '___EOS___']", "index": 68 } ]
[ { "span": "except:", "start_line": 114, "start_column": 12, "end_line": 114, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Trigger_", "(_", "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_", ",_", "subject_", ",_", "time_", ",_", "event_", ",_", "actions_", ",_", "content", "\\u", "type_", ",_", "using_", "=_", "None_", ",_", "skip_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "subject_", "=_", "subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time_", "=_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "event_", "=_", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "type_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "type", "\\u", "field_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append_", "(_", "actions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "using_", "=_", "using_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "using_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "connections_", "[_", "self_", "._", "using_", "]_", "\\u\\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_", "._", "connection_", "=_", "connection_", "\\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_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "fields_", "import_", "Gene", "ric", "Relation_", "\\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_", "._", "contrib_", "._", "contenttype", "s_", "._", "generic_", "import_", "Gene", "ric", "Relation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "subject_", ",_", "models_", "._", "Many", "To", "Many", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "table_", "=_", "subject_", "._", "m2", "m", "\\u", "db", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "=_", "[_", "(_", "subject_", "._", "m2", "m", "\\u", "column", "\\u", "name_", "(_", ")_", ",_", "''_", ")_", ",_", "(_", "subject_", "._", "m2", "m", "\\u", "reverse", "\\u", "name_", "(_", ")_", ",_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "subject_", ",_", "Gene", "ric", "Relation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "table_", "=_", "remote", "\\u", "field", "\\u", "model_", "(_", "subject_", ")_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "=_", "[_", "(_", "k_", "._", "attn", "ame_", ",_", "k_", "._", "db", "\\u", "type_", "(_", "connection_", "=_", "self_", "._", "connection_", ")_", ")_", "for_", "k_", ",_", "v_", "in_", "get", "\\u", "fields", "\\u", "with", "\\u", "model_", "(_", "remote", "\\u", "field", "\\u", "model_", "(_", "subject_", ")_", ",_", "remote", "\\u", "field", "\\u", "model_", "(_", "subject_", ")_", "._", "\\u", "meta_", ")_", "if_", "not_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "type", "\\u", "field_", "=_", "subject_", "._", "content", "\\u", "type", "\\u", "field", "\\u", "name_", "+_", "'\\u", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "subject_", ",_", "models_", "._", "Fore", "ign", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "subject_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "table_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "skip_", "or_", "(_", ")_", "+_", "getattr_", "(_", "self_", "._", "model_", ",_", "'", "deno", "rm", "\\u", "alw", "ay", "s", "\\u", "skip", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "=_", "[_", "(_", "k_", "._", "attn", "ame_", ",_", "k_", "._", "db", "\\u", "type_", "(_", "connection_", "=_", "self_", "._", "connection_", ")_", ")_", "for_", "k_", ",_", "v_", "in_", "get", "\\u", "fields", "\\u", "with", "\\u", "model_", "(_", "subject_", "._", "model_", ",_", "self_", "._", "model_", "._", "\\u", "meta_", ")_", "if_", "not_", "v_", "and_", "k_", "._", "attn", "ame_", "not_", "in_", "skip_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "subject_", ",_", "\"\\u", "meta", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "table_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "need", " ", "to", " ", "check", " ", "get", "\\u", "parent", "\\u", "list", " ", "and", " ", "add", " ", "trigger", "s", " ", "to", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "belo", "w", " ", "will", " ", "only", " ", "check", " ", "the", " ", "fields", " ", "on", " ", "*", "this", "*", " ", "model", ",", " ", "not", " ", "parents_", "\\u\\u\\uNL\\u\\u\\u_", "skip_", "=_", "skip_", "or_", "(_", ")_", "+_", "getattr_", "(_", "self_", "._", "model_", ",_", "'", "deno", "rm", "\\u", "alw", "ay", "s", "\\u", "skip", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "related_", "import_", "Fore", "ign", "Object", "Rel", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "models_", "._", "related_", "import_", "Rela", "ted", "Object_", "as_", "Fore", "ign", "Object", "Rel", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "get", "\\u", "fields", "\\u", "with", "\\u", "model_", "(_", "subject_", ",_", "self_", "._", "model_", "._", "\\u", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "k_", ",_", "Fore", "ign", "Object", "Rel", "_", ")_", ":_", "\\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 ", " ", "_", "if_", "not_", "v_", "and_", "k_", "._", "attn", "ame_", "not_", "in_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "fields_", "._", "append_", "(_", "(_", "k_", "._", "attn", "ame_", ",_", "k_", "._", "db", "\\u", "type_", "(_", "connection_", "=_", "self_", "._", "connection_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\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,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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 ]
Unused local variable
fredrik-johansson/mpmath/mpmath/libmp/libmpc.py
[ { "content": "def mpc_nthroot(z, n, prec, rnd=round_fast):\n \"\"\"\n Complex n-th root.\n\n Use Newton method as in the real case when it is faster,\n otherwise use z**(1/n)\n \"\"\"\n a, b = z\n if a[0] == 0 and b == fzero:\n re = mpf_nthroot(a, n, prec, rnd)\n return (re, fzero)\n if n < 2:\n if n == 0:\n return mpc_one\n if n == 1:\n return mpc_pos((a, b), prec, rnd)\n if n == -1:\n return mpc_div(mpc_one, (a, b), prec, rnd)\n inverse = mpc_nthroot((a, b), -n, prec+5, reciprocal_rnd[rnd])\n return mpc_div(mpc_one, inverse, prec, rnd)\n if n <= 20:\n prec2 = int(1.2 * (prec + 10))\n asign, aman, aexp, abc = a\n bsign, bman, bexp, bbc = b\n pf = mpc_abs((a,b), prec)\n if pf[-2] + pf[-1] > -10 and pf[-2] + pf[-1] < prec:\n af = to_fixed(a, prec2)\n bf = to_fixed(b, prec2)\n re, im = mpc_nthroot_fixed(af, bf, n, prec2)\n extra = 10\n re = from_man_exp(re, -prec2-extra, prec2, rnd)\n im = from_man_exp(im, -prec2-extra, prec2, rnd)\n return re, im\n fn = from_int(n)\n prec2 = prec+10 + 10\n nth = mpf_rdiv_int(1, fn, prec2)\n re, im = mpc_pow((a, b), (nth, fzero), prec2, rnd)\n re = normalize(re[0], re[1], re[2], re[3], prec, rnd)\n im = normalize(im[0], im[1], im[2], im[3], prec, rnd)\n return re, im", "metadata": "root.mpc_nthroot", "header": "['module', '___EOS___']", "index": 369 }, { "content": "def mpc_tan(z, prec, rnd=round_fast):\n \"\"\"Complex tangent. Computed as tan(a+bi) = sin(2a)/M + sinh(2b)/M*i\n where M = cos(2a) + cosh(2b).\"\"\"\n a, b = z\n asign, aman, aexp, abc = a\n bsign, bman, bexp, bbc = b\n if b == fzero: return mpf_tan(a, prec, rnd), fzero\n if a == fzero: return fzero, mpf_tanh(b, prec, rnd)\n wp = prec + 15\n a = mpf_shift(a, 1)\n b = mpf_shift(b, 1)\n c, s = mpf_cos_sin(a, wp)\n ch, sh = mpf_cosh_sinh(b, wp)\n # TODO: handle cancellation when c ~= -1 and ch ~= 1\n mag = mpf_add(c, ch, wp)\n re = mpf_div(s, mag, prec, rnd)\n im = mpf_div(sh, mag, prec, rnd)\n return re, im", "metadata": "root.mpc_tan", "header": "['module', '___EOS___']", "index": 484 } ]
[ { "span": "asign,", "start_line": 391, "start_column": 8, "end_line": 391, "end_column": 13 }, { "span": "aman,", "start_line": 391, "start_column": 15, "end_line": 391, "end_column": 19 }, { "span": "aexp,", "start_line": 391, "start_column": 21, "end_line": 391, "end_column": 25 }, { "span": "abc ", "start_line": 391, "start_column": 27, "end_line": 391, "end_column": 30 }, { "span": "bsign,", "start_line": 392, "start_column": 8, "end_line": 392, "end_column": 13 }, { "span": "bman,", "start_line": 392, "start_column": 15, "end_line": 392, "end_column": 19 }, { "span": "bexp,", "start_line": 392, "start_column": 21, "end_line": 392, "end_column": 25 }, { "span": "bbc ", "start_line": 392, "start_column": 27, "end_line": 392, "end_column": 30 }, { "span": "asign,", "start_line": 488, "start_column": 4, "end_line": 488, "end_column": 9 }, { "span": "aman,", "start_line": 488, "start_column": 11, "end_line": 488, "end_column": 15 }, { "span": "aexp,", "start_line": 488, "start_column": 17, "end_line": 488, "end_column": 21 }, { "span": "abc ", "start_line": 488, "start_column": 23, "end_line": 488, "end_column": 26 }, { "span": "bsign,", "start_line": 489, "start_column": 4, "end_line": 489, "end_column": 9 }, { "span": "bman,", "start_line": 489, "start_column": 11, "end_line": 489, "end_column": 15 }, { "span": "bexp,", "start_line": 489, "start_column": 17, "end_line": 489, "end_column": 21 }, { "span": "bbc ", "start_line": 489, "start_column": 23, "end_line": 489, "end_column": 26 } ]
[]
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_", "mpc", "\\u", "nthr", "oot_", "(_", "z_", ",_", "n_", ",_", "prec_", ",_", "rnd_", "=_", "round", "\\u", "fast_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Comple", "x", " ", "n", "-", "th", " ", "root", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "New", "ton", " ", "method", " ", "as", " ", "in", " ", "the", " ", "real", " ", "case", " ", "whe", "n", " ", "it", " ", "is", " ", "faste", "r", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", " ", "use", " ", "z", "**", "(", "1", "/", "n", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", ",_", "b_", "=_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "[_", "0_", "]_", "==_", "0_", "and_", "b_", "==_", "fz", "ero", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "re_", "=_", "mpf", "\\u", "nthr", "oot_", "(_", "a_", ",_", "n_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "re_", ",_", "fz", "ero", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mpc", "\\u", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mpc", "\\u", "pos_", "(_", "(_", "a_", ",_", "b_", ")_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mpc", "\\u", "div_", "(_", "mpc", "\\u", "one_", ",_", "(_", "a_", ",_", "b_", ")_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inverse_", "=_", "mpc", "\\u", "nthr", "oot_", "(_", "(_", "a_", ",_", "b_", ")_", ",_", "-_", "n_", ",_", "prec_", "+_", "5_", ",_", "reciproc", "al", "\\u", "rnd_", "[_", "rnd_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mpc", "\\u", "div_", "(_", "mpc", "\\u", "one_", ",_", "inverse_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "<=_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prec", "2_", "=_", "int_", "(_", "1.2_", "*_", "(_", "prec_", "+_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asi", "gn_", ",_", "ama", "n_", ",_", "ae", "xp_", ",_", "abc_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bsi", "gn_", ",_", "bma", "n_", ",_", "be", "xp_", ",_", "bb", "c_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf_", "=_", "mpc", "\\u", "abs_", "(_", "(_", "a_", ",_", "b_", ")_", ",_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pf_", "[_", "-_", "2_", "]_", "+_", "pf_", "[_", "-_", "1_", "]_", ">_", "-_", "10_", "and_", "pf_", "[_", "-_", "2_", "]_", "+_", "pf_", "[_", "-_", "1_", "]_", "<_", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "af_", "=_", "to", "\\u", "fixed_", "(_", "a_", ",_", "prec", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf_", "=_", "to", "\\u", "fixed_", "(_", "b_", ",_", "prec", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re_", ",_", "im_", "=_", "mpc", "\\u", "nthr", "oot", "\\u", "fixed_", "(_", "af_", ",_", "bf_", ",_", "n_", ",_", "prec", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re_", "=_", "from", "\\u", "man", "\\u", "exp_", "(_", "re_", ",_", "-_", "prec", "2_", "-_", "extra_", ",_", "prec", "2_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "from", "\\u", "man", "\\u", "exp_", "(_", "im_", ",_", "-_", "prec", "2_", "-_", "extra_", ",_", "prec", "2_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", ",_", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fn_", "=_", "from", "\\u", "int_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prec", "2_", "=_", "prec_", "+_", "10_", "+_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nth_", "=_", "mpf", "\\u", "rdi", "v", "\\u", "int_", "(_", "1_", ",_", "fn_", ",_", "prec", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re_", ",_", "im_", "=_", "mpc", "\\u", "pow_", "(_", "(_", "a_", ",_", "b_", ")_", ",_", "(_", "nth_", ",_", "fz", "ero", "_", ")_", ",_", "prec", "2_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re_", "=_", "normalize_", "(_", "re_", "[_", "0_", "]_", ",_", "re_", "[_", "1_", "]_", ",_", "re_", "[_", "2_", "]_", ",_", "re_", "[_", "3_", "]_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "normalize_", "(_", "im_", "[_", "0_", "]_", ",_", "im_", "[_", "1_", "]_", ",_", "im_", "[_", "2_", "]_", ",_", "im_", "[_", "3_", "]_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", ",_", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mpc", "\\u", "tan_", "(_", "z_", ",_", "prec_", ",_", "rnd_", "=_", "round", "\\u", "fast_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Comple", "x", " ", "tangent", ".", " ", "Computed", " ", "as", " ", "tan", "(", "a", "+", "bi", ")", " ", "=", " ", "sin", "(", "2a", ")/", "M", " ", "+", " ", "sinh", "(", "2b", ")/", "M", "*", "i", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "M", " ", "=", " ", "cos", "(", "2a", ")", " ", "+", " ", "cos", "h", "(", "2b", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", ",_", "b_", "=_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asi", "gn_", ",_", "ama", "n_", ",_", "ae", "xp_", ",_", "abc_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bsi", "gn_", ",_", "bma", "n_", ",_", "be", "xp_", ",_", "bb", "c_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "fz", "ero", "_", ":_", "return_", "mpf", "\\u", "tan_", "(_", "a_", ",_", "prec_", ",_", "rnd_", ")_", ",_", "fz", "ero", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "fz", "ero", "_", ":_", "return_", "fz", "ero", "_", ",_", "mpf", "\\u", "tanh_", "(_", "b_", ",_", "prec_", ",_", "rnd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp_", "=_", "prec_", "+_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "mpf", "\\u", "shift_", "(_", "a_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "mpf", "\\u", "shift_", "(_", "b_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "s_", "=_", "mpf", "\\u", "cos", "\\u", "sin_", "(_", "a_", ",_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", ",_", "sh_", "=_", "mpf", "\\u", "cos", "h", "\\u", "sinh", "_", "(_", "b_", ",_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "handle", " ", "cancellat", "ion", " ", "whe", "n", " ", "c", " ", "~=", " ", " ", "-1", " ", "and", " ", "ch", " ", "~=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "mag_", "=_", "mpf", "\\u", "add_", "(_", "c_", ",_", "ch_", ",_", "wp_", ")_", "\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\n cv2.namedWindow('derivatives')\n\n rn = get_renderer()\n\n tracked = {\n 'sph0': rn.vc.components[0],\n 'sph1': rn.vc.components[1],\n 'sph2': rn.vc.components[2],\n 'sph3': rn.vc.components[3],\n 'k0': rn.camera.k[0],\n 'k1': rn.camera.k[1],\n 'k2': rn.camera.k[2]\n }\n\n cnst = 1000\n for k in sorted(tracked.keys()):\n v = tracked[k]\n cv2.createTrackbar(k, 'image', 0,cnst, nothing)\n\n old_tracked = tracked\n cv2.setTrackbarPos('sph0', 'image', 800)\n while(1):\n cv2.imshow('image',rn.r)\n k = cv2.waitKey(1) & 0xFF\n if k == 27:\n break\n \n for k, v in tracked.items():\n v[:] = np.array(cv2.getTrackbarPos(k, 'image')).astype(np.float32)*4/cnst\n if tracked[k].r[0] != old_tracked[k].r[0]:\n drim = rn.dr_wrt(v).reshape(rn.shape)\n mn = np.mean(drim)\n drim /= np.max(np.abs(drim.ravel()))*2.\n drim += .5\n # drim = drim - np.min(drim)\n # drim = drim / np.max(drim)\n cv2.imshow('derivatives', drim)\n \n cv2.waitKey(1)\n old_tracked = deepcopy(tracked)\n # while True: \n # for k_change in sorted(tracked.keys()):\n # if k_change == 'sph0':\n # continue\n # for t in np.arange(0, np.pi, .05):\n # cv2.setTrackbarPos(k_change, 'image', int(np.sin(t)*1000))\n # cv2.imshow('image',rn.r)\n # k = cv2.waitKey(1) & 0xFF\n # if k == 27:\n # break\n # \n # for k, v in tracked.items():\n # v[:] = np.array(cv2.getTrackbarPos(k, 'image')).astype(np.float32)*4/cnst\n # if tracked[k].r[0] != old_tracked[k].r[0]:\n # drim = rn.dr_wrt(v).reshape(rn.shape)\n # mn = np.mean(drim)\n # drim /= np.max(np.abs(drim.ravel()))*2.\n # drim += .5\n # # drim = drim - np.min(drim)\n # # drim = drim / np.max(drim)\n # cv2.imshow('derivatives', drim)\n # \n # \n # print rn.vc.components\n # \n # cv2.waitKey(1)\n # old_tracked = deepcopy(tracked)\n\n cv2.destroyAllWindows()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 29 } ]
[ { "span": "img ", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 7 }, { "span": "v ", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 9 }, { "span": "mn ", "start_line": 64, "start_column": 16, "end_line": 64, "end_column": 18 } ]
[]
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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "black", " ", "image", ",", " ", "a", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "np_", "._", "zeros_", "(_", "(_", "300_", ",_", "512_", ",_", "3_", ")_", ",_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "named", "Window_", "(_", "'", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "named", "Window_", "(_", "'", "derivatives", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rn_", "=_", "get", "\\u", "renderer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tracked", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "0", "'_", ":_", "rn_", "._", "vc_", "._", "components_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "1", "'_", ":_", "rn_", "._", "vc_", "._", "components_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "2", "'_", ":_", "rn_", "._", "vc_", "._", "components_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "3", "'_", ":_", "rn_", "._", "vc_", "._", "components_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "k", "0", "'_", ":_", "rn_", "._", "camera_", "._", "k_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "k", "1", "'_", ":_", "rn_", "._", "camera_", "._", "k_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "k2", "'_", ":_", "rn_", "._", "camera_", "._", "k_", "[_", "2_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cns", "t_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "sorted_", "(_", "tracked", "_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "tracked", "_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "create", "Track", "bar_", "(_", "k_", ",_", "'", "image", "'_", ",_", "0_", ",_", "cns", "t_", ",_", "nothing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "tracked", "_", "=_", "tracked", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "set", "Track", "bar", "Pos_", "(_", "'", "sph", "0", "'_", ",_", "'", "image", "'_", ",_", "800_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cv2_", "._", "imshow_", "(_", "'", "image", "'_", ",_", "rn_", "._", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "cv2_", "._", "wait", "Key_", "(_", "1_", ")_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "==_", "27_", ":_", "\\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_", "for_", "k_", ",_", "v_", "in_", "tracked", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "[_", ":_", "]_", "=_", "np_", "._", "array_", "(_", "cv2_", "._", "get", "Track", "bar", "Pos_", "(_", "k_", ",_", "'", "image", "'_", ")_", ")_", "._", "astype_", "(_", "np_", "._", "float32_", ")_", "*_", "4_", "/_", "cns", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tracked", "_", "[_", "k_", "]_", "._", "r_", "[_", "0_", "]_", "!=_", "old", "\\u", "tracked", "_", "[_", "k_", "]_", "._", "r_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dri", "m_", "=_", "rn_", "._", "dr", "\\u", "wrt", "_", "(_", "v_", ")_", "._", "reshape_", "(_", "rn_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mn_", "=_", "np_", "._", "mean_", "(_", "dri", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dri", "m_", "/=_", "np_", "._", "max_", "(_", "np_", "._", "abs_", "(_", "dri", "m_", "._", "ravel_", "(_", ")_", ")_", ")_", "*_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dri", "m_", "+=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dri", "m", " ", "=", " ", "dri", "m", " ", "-", " ", "np", ".", "min", "(", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dri", "m", " ", "=", " ", "dri", "m", " ", "/", " ", "np", ".", "max", "(", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "derivatives", "'_", ",_", "dri", "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_", "cv2_", "._", "wait", "Key_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "tracked", "_", "=_", "deepcopy_", "(_", "tracked", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "whi", "le", " ", "Tru", "e", ":", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "k", "\\u", "change", " ", "in", " ", "sorte", "d", "(", "tracked", ".", "keys", "())", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "k", "\\u", "change", " ", "==", " ", "'", "sph", "0", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "t", " ", "in", " ", "np", ".", "aran", "ge", "(", "0", ",", " ", "np", ".", "pi", ",", " ", ".0", "5", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "cv", "2", ".", "set", "Track", "bar", "Pos", "(", "k", "\\u", "change", ",", " ", "'", "image", "',", " ", "int", "(", "np", ".", "sin", "(", "t", ")*", "1000", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "cv", "2", ".", "ims", "how", "('", "image", "',", "rn", ".", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "k", " ", "=", " ", "cv", "2", ".", "wait", "Key", "(", "1", ")", " ", "&", " ", "0xFF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "k", " ", "==", " ", "2", "7", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "k", ",", " ", "v", " ", "in", " ", "tracked", ".", "items", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "v", "[:", "]", " ", "=", " ", "np", ".", "array", "(", "cv", "2", ".", "get", "Track", "bar", "Pos", "(", "k", ",", " ", "'", "image", "'))", ".", "ast", "ype", "(", "np", ".", "float", "32", ")*", "4", "/", "cns", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "tracked", "[", "k", "].", "r", "[", "0", "]", " ", "!=", " ", "old", "\\u", "tracked", "[", "k", "].", "r", "[", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "dri", "m", " ", "=", " ", "rn", ".", "dr", "\\u", "wrt", "(", "v", ").", "reshape", "(", "rn", ".", "shape", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "mn", " ", "=", " ", "np", ".", "mean", "(", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "dri", "m", " ", "/", "=", " ", "np", ".", "max", "(", "np", ".", "abs", "(", "dri", "m", ".", "rave", "l", "())", ")*", "2._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "dri", "m", " ", "+=", " ", ".5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "dri", "m", " ", "=", " ", "dri", "m", " ", "-", " ", "np", ".", "min", "(", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "dri", "m", " ", "=", " ", "dri", "m", " ", "/", " ", "np", ".", "max", "(", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "cv", "2", ".", "ims", "how", "('", "derivatives", "',", " ", "dri", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "rn", ".", "vc", ".", "components_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "cv", "2", ".", "wait", "Key", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "old", "\\u", "tracked", " ", "=", " ", "deepc", "opy", "(", "tracked", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cv2_", "._", "destroy", "All", "Windows_", "(_", ")_", "\\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, 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,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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 ]
Unused local variable
mbrukman/cloud-launcher/src/cloud_launcher.py
[ { "content": " def _ExecuteBatchRequest(self, requests):\n \"\"\"Executes the given |requests| in batches.\n\n Documentation:\n * https://developers.google.com/api-client-library/python/guide/batch\n\n Args:\n requests: list of (request_id, request) pairs\n \"\"\"\n def _BatchHttpRequestCallback(request_id, response, exception):\n if exception is not None:\n print 'Error: %s' % exception\n else:\n self._PrintJsonResponse(request_id, response)\n\n batch = None\n num_batch_requests = 0\n MAX_BATCH_SIZE = 1000 # documented at the URL above\n\n for request_id, request in requests:\n if batch is None:\n batch = http.BatchHttpRequest(\n callback=_BatchHttpRequestCallback)\n batch.add(request, request_id=request_id)\n num_batch_requests += 1\n if num_batch_requests == MAX_BATCH_SIZE:\n batch.execute(http=self.__auth_http)\n batch = None\n num_batch_requests = 0\n\n # Execute the left-over requests in the batch if there are any.\n if batch is not None:\n batch.execute(http=self.__auth_http)\n batch = None", "metadata": "root.GceHandler._ExecuteBatchRequest", "header": "['class', 'GceHandler', '(', 'object', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "batch ", "start_line": 155, "start_column": 12, "end_line": 155, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Gc", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Execut", "e", "Bat", "ch", "Request_", "(_", "self_", ",_", "requests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "es", " ", "the", " ", "give", "n", " ", "|", "request", "s", "|", " ", "in", " ", "batche", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Document", "ation", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "https", "://", "developer", "s", ".", "google", ".", "com", "/", "api", "-", "client", "-", "librar", "y", "/", "python", "/", "guide", "/", "batch", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "request", "s", ":", " ", "list", " ", "of", " ", "(", "request", "\\u", "id", ",", " ", "request", ")", " ", "pair", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Bat", "ch", "Http", "Request", "Callback_", "(_", "request", "\\u", "id_", ",_", "response_", ",_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exception_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Error", ":", " ", "%", "s", "'_", "%_", "exception_", "\\u\\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", "Print", "Js", "on", "Response_", "(_", "request", "\\u", "id_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "batch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "batch", "\\u", "requests_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "BATCH", "\\u", "SIZE_", "=_", "1000_", "#", " ", "documente", "d", " ", "at", " ", "the", " ", "URL", " ", "above_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "request", "\\u", "id_", ",_", "request_", "in_", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "batch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "=_", "http_", "._", "Bat", "ch", "Http", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "\\u", "Bat", "ch", "Http", "Request", "Callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "batch_", "._", "add_", "(_", "request_", ",_", "request", "\\u", "id_", "=_", "request", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "batch", "\\u", "requests_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "batch", "\\u", "requests_", "==_", "MAX", "\\u", "BATCH", "\\u", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "._", "execute_", "(_", "http_", "=_", "self_", "._", "\\u\\u", "auth", "\\u", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "batch", "\\u", "requests_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "e", " ", "the", " ", "left", "-", "over", " ", "request", "s", " ", "in", " ", "the", " ", "batch", " ", "if", " ", "there", " ", "are", " ", "any", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "batch_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "._", "execute_", "(_", "http_", "=_", "self_", "._", "\\u\\u", "auth", "\\u", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch_", "=_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2 ]
Unused import
openaddresses/machine/openaddr/compat.py
[ { "content": "import sys\nimport io\n\nPY2 = (sys.version_info[0] == 2)\n\nif PY2:\n import unicodecsv, subprocess32, uritemplate\n unicodecsv.field_size_limit(sys.maxsize)\n \n check_output = subprocess32.check_output\n CalledProcessError = subprocess32.CalledProcessError\n \n csvIO = io.BytesIO\n \n \n \n \n \n \n \n from future import standard_library\n standard_library.install_aliases()\n\nelse:\n import csv, subprocess\n from uritemplate import expand as expand_uri\n standard_library = None\n \n check_output = subprocess.check_output\n CalledProcessError = subprocess.CalledProcessError\n \n csvIO = io.StringIO\n \n \n \n \n \n\ntry:\n import cairo\nexcept ImportError:\n # http://stackoverflow.com/questions/11491268/install-pycairo-in-virtualenv\n import cairocffi as cairo\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def csvreader(file, encoding=None, **kwargs):\n ''' Pass encoding to unicodecsv\n '''\n if encoding is not None:\n kwargs['encoding'] = encoding\n \n if 'delimiter' in kwargs:\n kwargs['delimiter'] = str(kwargs['delimiter'])\n\n return unicodecsv.reader(file, **kwargs)", "metadata": "root.csvreader", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def csvwriter(file, encoding=None, **kwargs):\n ''' Pass encoding to unicodecsv\n '''\n if encoding is not None:\n kwargs['encoding'] = encoding\n\n return unicodecsv.writer(file, **kwargs)", "metadata": "root.csvwriter", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def csvDictReader(file, encoding=None, delimiter=None, **kwargs):\n ''' Pass encoding to unicodecsv\n '''\n # Python2 unicodecsv requires this be not unicode\n if delimiter is not None:\n kwargs['delimiter'] = delimiter.encode('ascii')\n \n if encoding is not None:\n kwargs['encoding'] = encoding\n\n return unicodecsv.DictReader(file, **kwargs)", "metadata": "root.csvDictReader", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def csvDictWriter(file, fieldnames, encoding=None, delimiter=None, **kwargs):\n ''' Pass encoding to unicodecsv\n '''\n # Python2 unicodecsv requires this be not unicode\n if delimiter is not None:\n kwargs['delimiter'] = delimiter.encode('ascii')\n \n if encoding is not None:\n kwargs['encoding'] = encoding\n\n return unicodecsv.DictWriter(file, fieldnames, **kwargs)", "metadata": "root.csvDictWriter", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def csvopen(filename, mode='r', encoding=None):\n ''' Discard encoding\n '''\n return io.FileIO(filename, mode=mode)", "metadata": "root.csvopen", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def expand_uri(template, args):\n '''\n '''\n new_args = {k: v for (k, v) in args.items() if not hasattr(v, 'encode')}\n new_args.update({k: v.encode('utf8') for (k, v) in args.items() if hasattr(v, 'encode')})\n \n return uritemplate.expand(template, new_args)", "metadata": "root.expand_uri", "header": "['module', '___EOS___']", "index": 62 }, { "content": " def csvreader(file, encoding=None, **kwargs):\n ''' Discard encoding\n '''\n if 'delimiter' in kwargs:\n kwargs['delimiter'] = str(kwargs['delimiter'])\n\n return csv.reader(file, **kwargs)", "metadata": "root.csvreader", "header": "['module', '___EOS___']", "index": 83 }, { "content": " def csvwriter(file, encoding=None, **kwargs):\n ''' Discard encoding\n '''\n return csv.writer(file, **kwargs)", "metadata": "root.csvwriter", "header": "['module', '___EOS___']", "index": 91 }, { "content": " def csvDictReader(file, encoding=None, **kwargs):\n ''' Discard encoding\n '''\n return csv.DictReader(file, **kwargs)", "metadata": "root.csvDictReader", "header": "['module', '___EOS___']", "index": 96 }, { "content": " def csvDictWriter(file, fieldnames, encoding=None, **kwargs):\n ''' Discard encoding\n '''\n return csv.DictWriter(file, fieldnames, **kwargs)", "metadata": "root.csvDictWriter", "header": "['module', '___EOS___']", "index": 101 }, { "content": " def csvopen(filename, mode='r', encoding=None):\n ''' Pass encoding to io.open\n '''\n return io.open(filename, mode=mode, encoding=encoding)", "metadata": "root.csvopen", "header": "['module', '___EOS___']", "index": 106 } ]
[ { "span": "from uritemplate import expand as expand_uri", "start_line": 75, "start_column": 4, "end_line": 75, "end_column": 48 }, { "span": "import cairo", "start_line": 112, "start_column": 4, "end_line": 112, "end_column": 16 }, { "span": "import cairocffi as cairo", "start_line": 115, "start_column": 4, "end_line": 115, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PY", "2_", "=_", "(_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unicode", "csv_", ",_", "subproc", "ess", "32_", ",_", "uri", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unicode", "csv_", "._", "field", "\\u", "size", "\\u", "limit_", "(_", "sys_", "._", "maxsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "output_", "=_", "subproc", "ess", "32_", "._", "check", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Call", "ed", "Process", "Error_", "=_", "subproc", "ess", "32_", "._", "Call", "ed", "Process", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "IO_", "=_", "io_", "._", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "future_", "import_", "standard", "\\u", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "library_", "._", "install", "\\u", "aliases_", "(_", ")_", "\\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 ", " _", "import_", "csv_", ",_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "uri", "template_", "import_", "expand_", "as_", "expand", "\\u", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "library_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "output_", "=_", "subprocess_", "._", "check", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Call", "ed", "Process", "Error_", "=_", "subprocess_", "._", "Call", "ed", "Process", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "IO_", "=_", "io_", "._", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cairo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "114", "912", "6", "8", "/", "install", "-", "pyca", "iro", "-", "in", "-", "virtualenv", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cairo", "cff", "i_", "as_", "cairo_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "csv", "reader_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pass", " ", "encoding", " ", "to", " ", "unicode", "csv", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "encoding", "'_", "]_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "delimiter", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "delimiter", "'_", "]_", "=_", "str_", "(_", "kwargs_", "[_", "'", "delimiter", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unicode", "csv_", "._", "reader_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "writer_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pass", " ", "encoding", " ", "to", " ", "unicode", "csv", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "encoding", "'_", "]_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unicode", "csv_", "._", "writer_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "Dict", "Reader_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "delimiter_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pass", " ", "encoding", " ", "to", " ", "unicode", "csv", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on2", " ", "unicode", "csv", " ", "require", "s", " ", "this", " ", "be", " ", "not", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delimiter_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "delimiter", "'_", "]_", "=_", "delimiter_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "encoding_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "encoding", "'_", "]_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unicode", "csv_", "._", "Dict", "Reader_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "Dict", "Writer_", "(_", "file_", ",_", "fieldnames_", ",_", "encoding_", "=_", "None_", ",_", "delimiter_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pass", " ", "encoding", " ", "to", " ", "unicode", "csv", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on2", " ", "unicode", "csv", " ", "require", "s", " ", "this", " ", "be", " ", "not", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delimiter_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "delimiter", "'_", "]_", "=_", "delimiter_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "encoding_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "encoding", "'_", "]_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unicode", "csv_", "._", "Dict", "Writer_", "(_", "file_", ",_", "fieldnames_", ",_", "**_", "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_", "def_", "csv", "open_", "(_", "filename_", ",_", "mode_", "=_", "'", "r", "'_", ",_", "encoding_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Discard", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "io_", "._", "File", "IO_", "(_", "filename_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "uri_", "(_", "template_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "args_", "=_", "{_", "k_", ":_", "v_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "args_", "._", "items_", "(_", ")_", "if_", "not_", "hasattr_", "(_", "v_", ",_", "'", "encode", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "args_", "._", "update_", "(_", "{_", "k_", ":_", "v_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "args_", "._", "items_", "(_", ")_", "if_", "hasattr_", "(_", "v_", ",_", "'", "encode", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "uri", "template_", "._", "expand_", "(_", "template_", ",_", "new", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "csv", "reader_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Discard", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "delimiter", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "delimiter", "'_", "]_", "=_", "str_", "(_", "kwargs_", "[_", "'", "delimiter", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "csv_", "._", "reader_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "writer_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Discard", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "csv_", "._", "writer_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "Dict", "Reader_", "(_", "file_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Discard", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "csv_", "._", "Dict", "Reader_", "(_", "file_", ",_", "**_", "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_", "def_", "csv", "Dict", "Writer_", "(_", "file_", ",_", "fieldnames_", ",_", "encoding_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Discard", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "csv_", "._", "Dict", "Writer_", "(_", "file_", ",_", "fieldnames_", ",_", "**_", "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_", "def_", "csv", "open_", "(_", "filename_", ",_", "mode_", "=_", "'", "r", "'_", ",_", "encoding_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pass", " ", "encoding", " ", "to", " ", "io", ".", "open", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "io_", "._", "open_", "(_", "filename_", ",_", "mode_", "=_", "mode_", ",_", "encoding_", "=_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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, 0, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
anandology/pyjamas/examples/libtest/BuiltinTest.py
[ { "content": " def testHex(self):\n self.assertEqual(hex(23), '0x17')\n try:\n h = hex(23.2)\n self.fail(\"No hex() argument error raised\")\n except TypeError, why:\n self.assertEqual(why.args[0], \"hex() argument can't be converted to hex\")", "metadata": "root.BuiltinTest.testHex", "header": "['class', 'BuiltinTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 167 }, { "content": " def testOct(self):\n self.assertEqual(oct(23), '027')\n try:\n o = oct(23.2)\n self.fail(\"No oct() argument error raised\")\n except TypeError, why:\n self.assertEqual(str(why), \"oct() argument can't be converted to oct\")", "metadata": "root.BuiltinTest.testOct", "header": "['class', 'BuiltinTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 175 }, { "content": " def testLocals(self):\n v1 = 1\n v2 = 2\n\n local_vars = locals()\n self.assertEqual(len(local_vars), 3)\n self.assertEqual(local_vars['v1'], 1)\n\n def fn1():\n a = 1\n def fn2():\n b = 1\n c = locals()\n return c\n return fn2()\n\n local_vars = fn1()\n self.assertEqual(local_vars, {'b': 1})\n \n def fn2():\n lx = 3\n def g():\n li = lx\n return locals()\n return g()\n self.assertEqual(fn2(), {'li':3, 'lx':3}, \"locals() bugs: #589\")\n\n def fn3():\n lx = 3\n def g():\n def lh():\n li = lx\n return locals()\n return locals(), lh()\n return g()\n outer_locals, inner_locals = fn3()\n self.assertEqual(inner_locals, {'li':3, 'lx':3}, \"locals() bugs: #589\")\n keys = outer_locals.keys()\n keys.sort()\n self.assertEqual(keys, ['lh', 'lx'], \"locals() bugs: #589\")\n\n def fn4(x):\n class X:\n x = 12\n def fn4(self):\n return x\n locals()\n return X\n self.assertEqual(fn4(1).x, 12)\n\n args = {'test1': 5, 'test2': 'hello'}\n la = LocalsTest()\n argsreturn = la.testkwargs(**args)\n args['self'] = la\n self.assertEqual(args, argsreturn)\n\n del args['self']\n argsreturn = la.testargs(**args)\n args['self'] = la\n self.assertEqual(args, argsreturn)\n\n t = ColourThing()\n t.rgb = 1\n self.assertEqual(t.rgb, 1)\n\n args = foo(0, 1, 2, 3, 4)\n self.assertEqual(args, {'_some': 0, '_additional': 5,\n '_of': 3, '_list': 2,\n '_long': 1, '_arguments': 4})", "metadata": "root.BuiltinTest.testLocals", "header": "['class', 'BuiltinTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 300 } ]
[ { "span": "h ", "start_line": 170, "start_column": 12, "end_line": 170, "end_column": 13 }, { "span": "o ", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 13 }, { "span": "a ", "start_line": 309, "start_column": 12, "end_line": 309, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Bu", "ilt", "in", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Hex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "hex_", "(_", "23_", ")_", ",_", "'", "0x17", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "hex_", "(_", "23.", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "No", " ", "hex", "()", " ", "argu", "ment", " ", "error", " ", "raise", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "why_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "why_", "._", "args_", "[_", "0_", "]_", ",_", "\"", "hex", "()", " ", "argu", "ment", " ", "can", "'", "t", " ", "be", " ", "convert", "ed", " ", "to", " ", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bu", "ilt", "in", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Oct", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "oct", "_", "(_", "23_", ")_", ",_", "'", "027", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "=_", "oct", "_", "(_", "23.", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "No", " ", "oct", "()", " ", "argu", "ment", " ", "error", " ", "raise", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "why_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "why_", ")_", ",_", "\"", "oct", "()", " ", "argu", "ment", " ", "can", "'", "t", " ", "be", " ", "convert", "ed", " ", "to", " ", "oct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bu", "ilt", "in", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Local", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "vars_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "local", "\\u", "vars_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "local", "\\u", "vars_", "[_", "'", "v1", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fn", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "\\u", "vars_", "=_", "fn", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "local", "\\u", "vars_", ",_", "{_", "'", "b", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lx_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "g_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "li_", "=_", "lx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "g_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "2_", "(_", ")_", ",_", "{_", "'", "li", "'_", ":_", "3_", ",_", "'", "lx", "'_", ":_", "3_", "}_", ",_", "\"", "locals", "()", " ", "bug", "s", ":", " ", "#", "589", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lx_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "g_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "lh", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "li_", "=_", "lx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "locals_", "(_", ")_", ",_", "lh", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "g_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outer", "\\u", "locals_", ",_", "inner", "\\u", "locals_", "=_", "fn", "3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inner", "\\u", "locals_", ",_", "{_", "'", "li", "'_", ":_", "3_", ",_", "'", "lx", "'_", ":_", "3_", "}_", ",_", "\"", "locals", "()", " ", "bug", "s", ":", " ", "#", "589", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "outer", "\\u", "locals_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keys_", ",_", "[_", "'", "lh", "'_", ",_", "'", "lx", "'_", "]_", ",_", "\"", "locals", "()", " ", "bug", "s", ":", " ", "#", "589", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn", "4_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "X_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "4_", "(_", "1_", ")_", "._", "x_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "{_", "'", "test", "1", "'_", ":_", "5_", ",_", "'", "test", "2", "'_", ":_", "'", "hell", "o", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "la_", "=_", "Local", "s", "Test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "return_", "=_", "la_", "._", "test", "kwargs_", "(_", "**_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "self", "'_", "]_", "=_", "la_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "args_", ",_", "args", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "args_", "[_", "'", "self", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "return_", "=_", "la_", "._", "testa", "rgs_", "(_", "**_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "self", "'_", "]_", "=_", "la_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "args_", ",_", "args", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Colo", "ur", "Thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "rgb_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "rgb_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "foo_", "(_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "args_", ",_", "{_", "'\\u", "some", "'_", ":_", "0_", ",_", "'\\u", "addition", "al", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "of", "'_", ":_", "3_", ",_", "'\\u", "list", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "long", "'_", ":_", "1_", ",_", "'\\u", "argu", "ment", "s", "'_", ":_", "4_", "}_", ")_", "\\u\\u\\uN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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
flask-admin/flask-admin/flask_admin/tests/geoa/test_basic.py
[ { "content": "def test_mapbox_fix_point_coordinates():\n app, db, admin = setup()\n app.config['MAPBOX_FIX_COORDINATES_ORDER'] = True\n GeoModel = create_models(db)\n db.create_all()\n GeoModel.query.delete()\n db.session.commit()\n\n view = ModelView(GeoModel, db.session)\n admin.add_view(view)\n\n # Make some test clients\n client = app.test_client()\n\n rv = client.post('/admin/geomodel/new/', data={\n \"name\": \"test1\",\n \"point\": '{\"type\": \"Point\", \"coordinates\": [125.8, 10.0]}',\n \"line\": '{\"type\": \"LineString\", \"coordinates\": [[50.2345, 94.2], [50.21, 94.87]]}',\n \"polygon\": '{\"type\": \"Polygon\", \"coordinates\": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}',\n \"multi\": '{\"type\": \"MultiPoint\", \"coordinates\": [[100.0, 0.0], [101.0, 1.0]]}',\n })\n\n model = db.session.query(GeoModel).first()\n # Notice how the coordinates are reversed here, i.e. longitude first which\n # is the way it's stored in PostGIS columns.\n eq_(list(to_shape(model.point).coords), [(10.0, 125.8)])\n eq_(list(to_shape(model.line).coords), [(94.2, 50.2345), (94.87, 50.21)])\n eq_(list(to_shape(model.polygon).exterior.coords),\n [(0.0, 100.0), (0.0, 101.0), (1.0, 101.0), (1.0, 100.0), (0.0, 100.0)])\n eq_(list(to_shape(model.multi).geoms[0].coords), [(0.0, 100.0)])\n eq_(list(to_shape(model.multi).geoms[1].coords), [(1.0, 101.0)])\n\n rv = client.get('/admin/geomodel/')\n eq_(rv.status_code, 200)\n\n html = rv.data.decode('utf-8')\n pattern = r'(.|\\n)+({.*\"type\": ?\"Point\".*})</textarea>(.|\\n)+'\n group = re.match(pattern, html).group(2)\n p = json.loads(group)\n\n # Reversed order again, so that it's parsed correctly by leaflet\n eq_(p['coordinates'][0], 10.0)\n eq_(p['coordinates'][1], 125.8)", "metadata": "root.test_mapbox_fix_point_coordinates", "header": "['module', '___EOS___']", "index": 125 } ]
[ { "span": "rv ", "start_line": 139, "start_column": 4, "end_line": 139, "end_column": 6 } ]
[ { "span": "rv ", "start_line": 157, "start_column": 4, "end_line": 157, "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_", "test\\u", "map", "box", "\\u", "fix", "\\u", "point", "\\u", "coordinates_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", ",_", "db_", ",_", "admin_", "=_", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "MAP", "BO", "X", "\\u", "FIX", "\\u", "COORD", "INA", "TES", "\\u", "ORDE", "R", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Geo", "Model_", "=_", "create", "\\u", "models_", "(_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Geo", "Model_", "._", "query_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "Model", "View_", "(_", "Geo", "Model_", ",_", "db_", "._", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "add", "\\u", "view_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "some", " ", "test", " ", "clients_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "app_", "._", "test\\u", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rv_", "=_", "client_", "._", "post_", "(_", "'/", "admin", "/", "geom", "odel", "/", "new", "/'_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "test", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "point", "\"_", ":_", "'{", "\"", "type", "\":", " ", "\"", "Point", "\",", " ", "\"", "coordinate", "s", "\":", " ", "[", "125", ".8", ",", " ", "10.", "0", "]}", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "line", "\"_", ":_", "'{", "\"", "type", "\":", " ", "\"", "Line", "String", "\",", " ", "\"", "coordinate", "s", "\":", " ", "[[", "50.", "2345", ",", " ", "94.", "2", "],", " ", "[", "50.", "21", ",", " ", "94.", "87", "]]", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "poly", "gon", "\"_", ":_", "'{", "\"", "type", "\":", " ", "\"", "Polygon", "\",", " ", "\"", "coordinate", "s", "\":", " ", "[[", "[", "100", ".0", ",", " ", "0.", "0", "],", " ", "[", "101.", "0", ",", " ", "0.", "0", "],", " ", "[", "101.", "0", ",", " ", "1.0", "],", " ", "[", "100", ".0", ",", " ", "1.0", "],", " ", "[", "100", ".0", ",", " ", "0.", "0", "]]]", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "multi", "\"_", ":_", "'{", "\"", "type", "\":", " ", "\"", "Multi", "Point", "\",", " ", "\"", "coordinate", "s", "\":", " ", "[[", "100", ".0", ",", " ", "0.", "0", "],", " ", "[", "101.", "0", ",", " ", "1.0", "]]", "}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "db_", "._", "session_", "._", "query_", "(_", "Geo", "Model_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Noti", "ce", " ", "how", " ", "the", " ", "coordinate", "s", " ", "are", " ", "reverse", "d", " ", "here", ",", " ", "i", ".", "e", ".", " ", "longitude", " ", "first", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "way", " ", "it", "'", "s", " ", "store", "d", " ", "in", " ", "Post", "GI", "S", " ", "column", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "list_", "(_", "to", "\\u", "shape_", "(_", "model_", "._", "point_", ")_", "._", "coords_", ")_", ",_", "[_", "(_", "10.0_", ",_", "125", ".8_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "list_", "(_", "to", "\\u", "shape_", "(_", "model_", "._", "line_", ")_", "._", "coords_", ")_", ",_", "[_", "(_", "94.", "2_", ",_", "50.", "2345", "_", ")_", ",_", "(_", "94.", "87_", ",_", "50.", "21_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "list_", "(_", "to", "\\u", "shape_", "(_", "model_", "._", "polygon_", ")_", "._", "exteri", "or_", "._", "coords_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "0.0_", ",_", "100.0_", ")_", ",_", "(_", "0.0_", ",_", "101.", "0_", ")_", ",_", "(_", "1.0_", ",_", "101.", "0_", ")_", ",_", "(_", "1.0_", ",_", "100.0_", ")_", ",_", "(_", "0.0_", ",_", "100.0_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "list_", "(_", "to", "\\u", "shape_", "(_", "model_", "._", "multi_", ")_", "._", "geom", "s_", "[_", "0_", "]_", "._", "coords_", ")_", ",_", "[_", "(_", "0.0_", ",_", "100.0_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "list_", "(_", "to", "\\u", "shape_", "(_", "model_", "._", "multi_", ")_", "._", "geom", "s_", "[_", "1_", "]_", "._", "coords_", ")_", ",_", "[_", "(_", "1.0_", ",_", "101.", "0_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rv_", "=_", "client_", "._", "get_", "(_", "'/", "admin", "/", "geom", "odel", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "rv_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "rv_", "._", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "r", "'(", ".|", "\\\\", "n", ")+", "({", ".*", "\"", "type", "\":", " ", "?\"", "Point", "\".*", "})", "</", "text", "area", ">(.", "|\\\\", "n", ")+", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "re_", "._", "match_", "(_", "pattern_", ",_", "html_", ")_", "._", "group_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "json_", "._", "loads_", "(_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Revers", "ed", " ", "order", " ", "again", ",", " ", "so", " ", "tha", "t", " ", "it", "'", "s", " ", "parsed", " ", "correct", "ly", " ", "by", " ", "leaf", "let_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "p_", "[_", "'", "coordinate", "s", "'_", "]_", "[_", "0_", "]_", ",_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "p_", "[_", "'", "coordinate", "s", "'_", "]_", "[_", "1_", "]_", ",_", "125", ".8_", ")_" ]
[ 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, 0, 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, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
coreemu/core/daemon/core/phys/pnodes.py
[ { "content": "#\n# CORE\n# Copyright (c)2011-2012 the Boeing Company.\n# See the LICENSE file included in this distribution.\n#\n# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>\n#\n''' PhysicalNode class for including real systems in the emulated network.\n'''\nimport os, threading, subprocess\n\nfrom core.misc.ipaddr import *\nfrom core.misc.utils import *\nfrom core.constants import *\nfrom core.api import coreapi\nfrom core.coreobj import PyCoreNode, PyCoreNetIf\nfrom core.emane.nodes import EmaneNode\nif os.uname()[0] == \"Linux\":\n from core.netns.vnet import LxBrNet\n from core.netns.vif import GreTap\nelif os.uname()[0] == \"FreeBSD\":\n from core.bsd.vnet import NetgraphNet\n\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PhysicalNode(PyCoreNode):\n \n \n\n\n\n\n \n \n \n\n \n\n\n \n\n\n \n \n\n\n\n", "metadata": "root.PhysicalNode", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self, session, objid = None, name = None,\n nodedir = None, verbose = False, start = True):\n PyCoreNode.__init__(self, session, objid, name, verbose=verbose,\n start=start)\n self.nodedir = nodedir\n self.up = start\n self.lock = threading.RLock()\n self._mounts = []\n if start:\n self.startup()", "metadata": "root.PhysicalNode.__init__", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 25 }, { "content": " def boot(self):\n self.session.services.bootnodeservices(self)", "metadata": "root.PhysicalNode.boot", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 36 }, { "content": " def validate(self):\n self.session.services.validatenodeservices(self)", "metadata": "root.PhysicalNode.validate", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 39 }, { "content": " def startup(self):\n self.lock.acquire()\n try:\n self.makenodedir()\n #self.privatedir(\"/var/run\")\n #self.privatedir(\"/var/log\")\n except OSError, e:\n self.exception(coreapi.CORE_EXCP_LEVEL_ERROR,\n \"PhysicalNode.startup()\", e)\n finally:\n self.lock.release()", "metadata": "root.PhysicalNode.startup", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 42 }, { "content": " def shutdown(self):\n if not self.up:\n return\n self.lock.acquire()\n while self._mounts:\n source, target = self._mounts.pop(-1)\n self.umount(target)\n for netif in self.netifs():\n netif.shutdown()\n self.rmnodedir()\n self.lock.release()", "metadata": "root.PhysicalNode.shutdown", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 54 }, { "content": " def termcmdstring(self, sh = \"/bin/sh\"):\n ''' The broker will add the appropriate SSH command to open a terminal\n on this physical node.\n '''\n return sh", "metadata": "root.PhysicalNode.termcmdstring", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 67 }, { "content": " def cmd(self, args, wait = True):\n ''' run a command on the physical node\n '''\n os.chdir(self.nodedir)\n try:\n if wait:\n # os.spawnlp(os.P_WAIT, args)\n subprocess.call(args)\n else:\n # os.spawnlp(os.P_NOWAIT, args)\n subprocess.Popen(args)\n except CalledProcessError, e:\n self.warn(\"cmd exited with status %s: %s\" % (e, str(args)))", "metadata": "root.PhysicalNode.cmd", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 73 }, { "content": " def cmdresult(self, args):\n ''' run a command on the physical node and get the result\n '''\n os.chdir(self.nodedir)\n # in Python 2.7 we can use subprocess.check_output() here\n tmp = subprocess.Popen(args, stdin = open(os.devnull, 'r'),\n stdout = subprocess.PIPE,\n stderr = subprocess.STDOUT)\n result, err = tmp.communicate() # err will always be None\n status = tmp.wait()\n return (status, result)", "metadata": "root.PhysicalNode.cmdresult", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 87 }, { "content": " def shcmd(self, cmdstr, sh = \"/bin/sh\"):\n return self.cmd([sh, \"-c\", cmdstr])", "metadata": "root.PhysicalNode.shcmd", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 99 }, { "content": " def sethwaddr(self, ifindex, addr):\n ''' same as SimpleLxcNode.sethwaddr()\n '''\n self._netif[ifindex].sethwaddr(addr)\n ifname = self.ifname(ifindex)\n if self.up:\n (status, result) = self.cmdresult([IP_BIN, \"link\", \"set\", \"dev\",\n ifname, \"address\", str(addr)])\n if status:\n self.exception(coreapi.CORE_EXCP_LEVEL_ERROR,\n \"PhysicalNode.sethwaddr()\",\n \"error setting MAC address %s\" % str(addr))", "metadata": "root.PhysicalNode.sethwaddr", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 102 }, { "content": " def addaddr(self, ifindex, addr):\n ''' same as SimpleLxcNode.addaddr()\n '''\n if self.up:\n self.cmd([IP_BIN, \"addr\", \"add\", str(addr),\n \"dev\", self.ifname(ifindex)])\n self._netif[ifindex].addaddr(addr)", "metadata": "root.PhysicalNode.addaddr", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 115 }, { "content": " def deladdr(self, ifindex, addr):\n ''' same as SimpleLxcNode.deladdr()\n '''\n try:\n self._netif[ifindex].deladdr(addr)\n except ValueError:\n self.warn(\"trying to delete unknown address: %s\" % addr)\n if self.up:\n self.cmd([IP_BIN, \"addr\", \"del\", str(addr),\n \"dev\", self.ifname(ifindex)])", "metadata": "root.PhysicalNode.deladdr", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 123 }, { "content": " def adoptnetif(self, netif, ifindex, hwaddr, addrlist):\n ''' The broker builds a GreTap tunnel device to this physical node.\n When a link message is received linking this node to another part of\n the emulation, no new interface is created; instead, adopt the\n GreTap netif as the node interface.\n '''\n netif.name = \"gt%d\" % ifindex\n netif.node = self\n self.addnetif(netif, ifindex)\n # use a more reasonable name, e.g. \"gt0\" instead of \"gt.56286.150\"\n if self.up:\n self.cmd([IP_BIN, \"link\", \"set\", \"dev\", netif.localname, \"down\"])\n self.cmd([IP_BIN, \"link\", \"set\", netif.localname, \"name\", netif.name])\n netif.localname = netif.name\n if hwaddr:\n self.sethwaddr(ifindex, hwaddr)\n for addr in maketuple(addrlist):\n self.addaddr(ifindex, addr)\n if self.up:\n self.cmd([IP_BIN, \"link\", \"set\", \"dev\", netif.localname, \"up\"])", "metadata": "root.PhysicalNode.adoptnetif", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 134 }, { "content": " def linkconfig(self, netif, bw = None, delay = None,\n loss = None, duplicate = None, jitter = None, netif2 = None):\n ''' Apply tc queing disciplines using LxBrNet.linkconfig()\n '''\n if os.uname()[0] == \"Linux\":\n netcls = LxBrNet\n elif os.uname()[0] == \"FreeBSD\":\n netcls = NetgraphNet\n else:\n raise NotImplementedError, \"unsupported platform\"\n # borrow the tc qdisc commands from LxBrNet.linkconfig()\n tmp = netcls(session=self.session, start=False)\n tmp.up = True\n tmp.linkconfig(netif, bw=bw, delay=delay, loss=loss,\n duplicate=duplicate, jitter=jitter, netif2=netif2)\n del tmp", "metadata": "root.PhysicalNode.linkconfig", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 155 }, { "content": " def newifindex(self):\n self.lock.acquire()\n try:\n while self.ifindex in self._netif:\n self.ifindex += 1\n ifindex = self.ifindex\n self.ifindex += 1\n return ifindex\n finally:\n self.lock.release()", "metadata": "root.PhysicalNode.newifindex", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 172 }, { "content": " def newnetif(self, net = None, addrlist = [], hwaddr = None,\n ifindex = None, ifname = None):\n if self.up and net is None:\n raise NotImplementedError\n if ifindex is None:\n ifindex = self.newifindex()\n\n if self.up:\n # this is reached when this node is linked to a network node\n # tunnel to net not built yet, so build it now and adopt it\n gt = self.session.broker.addnettunnel(net.objid)\n if gt is None or len(gt) != 1:\n self.session.warn(\"Error building tunnel from PhysicalNode.\"\n \"newnetif()\")\n gt = gt[0]\n net.detach(gt)\n self.adoptnetif(gt, ifindex, hwaddr, addrlist)\n return ifindex\n \n # this is reached when configuring services (self.up=False)\n if ifname is None:\n ifname = \"gt%d\" % ifindex\n netif = GreTap(node = self, name = ifname, session = self.session,\n start = False)\n self.adoptnetif(netif, ifindex, hwaddr, addrlist)\n return ifindex", "metadata": "root.PhysicalNode.newnetif", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 183 }, { "content": " def privatedir(self, path):\n if path[0] != \"/\":\n raise ValueError, \"path not fully qualified: \" + path\n hostpath = os.path.join(self.nodedir,\n os.path.normpath(path).strip('/').replace('/', '.'))\n try:\n os.mkdir(hostpath)\n except OSError:\n pass\n except Exception, e:\n raise Exception, e\n self.mount(hostpath, path)", "metadata": "root.PhysicalNode.privatedir", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 211 }, { "content": " def mount(self, source, target):\n source = os.path.abspath(source)\n self.info(\"mounting %s at %s\" % (source, target))\n try:\n os.makedirs(target)\n except OSError:\n pass\n try:\n self.cmd([MOUNT_BIN, \"--bind\", source, target])\n self._mounts.append((source, target))\n except:\n self.warn(\"mounting failed for %s at %s\" % (source, target))", "metadata": "root.PhysicalNode.mount", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 224 }, { "content": " def umount(self, target):\n self.info(\"unmounting '%s'\" % target)\n try:\n self.cmd([UMOUNT_BIN, \"-l\", target])\n except:\n self.warn(\"unmounting failed for %s\" % target)", "metadata": "root.PhysicalNode.umount", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 237 }, { "content": " def opennodefile(self, filename, mode = \"w\"):\n dirname, basename = os.path.split(filename)\n if not basename:\n raise ValueError, \"no basename for filename: \" + filename\n if dirname and dirname[0] == \"/\":\n dirname = dirname[1:]\n dirname = dirname.replace(\"/\", \".\")\n dirname = os.path.join(self.nodedir, dirname)\n if not os.path.isdir(dirname):\n os.makedirs(dirname, mode = 0755)\n hostfilename = os.path.join(dirname, basename)\n return open(hostfilename, mode)", "metadata": "root.PhysicalNode.opennodefile", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 244 }, { "content": " def nodefile(self, filename, contents, mode = 0644):\n f = self.opennodefile(filename, \"w\")\n f.write(contents)\n os.chmod(f.name, mode)\n f.close()\n self.info(\"created nodefile: '%s'; mode: 0%o\" % (f.name, mode))", "metadata": "root.PhysicalNode.nodefile", "header": "['class', 'PhysicalNode', '(', 'PyCoreNode', ')', ':', '___EOS___']", "index": 257 } ]
[ { "span": "from core.coreobj import PyCoreNode, PyCoreNetIf", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 48 }, { "span": "from core.emane.nodes import EmaneNode", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CORE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", "2011", "-", "2012", " ", "the", " ", "Bo", "ein", "g", " ", "Compa", "ny", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "LICENSE", " ", "file", " ", "include", "d", " ", "in", " ", "this", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "author", ":", " ", "Je", "ff", " ", "Ah", "ren", "hol", "z", " ", "<", "je", "ff", "rey", ".", "m", ".", "ah", "ren", "hol", "z", "@", "bo", "ein", "g", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", " ", "Phys", "ical", "Node", " ", "class", " ", "for", " ", "inclu", "ding", " ", "real", " ", "system", "s", " ", "in", " ", "the", " ", "emulate", "d", " ", "network", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "threading_", ",_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "misc_", "._", "ipaddr_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "misc_", "._", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "api_", "import_", "core", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "core", "obj_", "import_", "Py", "Core", "Node_", ",_", "Py", "Core", "Net", "If_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "eman", "e_", "._", "nodes_", "import_", "Ema", "ne", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", "==_", "\"", "Lin", "ux", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core_", "._", "netn", "s_", "._", "vne", "t_", "import_", "Lx", "Br", "Net_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "netn", "s_", "._", "vif_", "import_", "Gre", "Tap", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", "==_", "\"", "Free", "BS", "D", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core_", "._", "bsd", "_", "._", "vne", "t_", "import_", "Net", "graph", "Net_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\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u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\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_", ",_", "session_", ",_", "obji", "d_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "dir_", "=_", "None_", ",_", "verbose_", "=_", "False_", ",_", "start_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Py", "Core", "Node_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "name_", ",_", "verbose_", "=_", "verbose_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node", "dir_", "=_", "node", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "threading_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mounts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "startup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "boot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "services_", "._", "boot", "nodes", "ervice", "s_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "services_", "._", "validat", "eno", "deser", "vice", "s_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "make", "node", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "private", "dir", "(\"", "/", "var", "/", "run", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "private", "dir", "(\"", "/", "var", "/", "log", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exception_", "(_", "core", "api_", "._", "CORE", "\\u", "EXC", "P", "\\u", "LE", "VEL", "\\u", "ERROR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Phys", "ical", "Node", ".", "start", "up", "()\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "mounts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", ",_", "target_", "=_", "self_", "._", "\\u", "mounts_", "._", "pop_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "umount", "_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neti", "f_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rm", "node", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "term", "cmds", "tring_", "(_", "self_", ",_", "sh_", "=_", "\"/", "bin", "/", "sh", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "The", " ", "broker", " ", "will", " ", "add", " ", "the", " ", "appropr", "iate", " ", "SSH", " ", "command", " ", "to", " ", "open", " ", "a", " ", "termina", "l", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "this", " ", "physical", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmd_", "(_", "self_", ",_", "args_", ",_", "wait_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "run", " ", "a", " ", "command", " ", "on", " ", "the", " ", "physical", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "node", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "os", ".", "spawn", "lp", "(", "os", ".", "P", "\\u", "WAIT", ",", " ", "args", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "call_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "os", ".", "spawn", "lp", "(", "os", ".", "P", "\\u", "NOW", "AI", "T", ",", " ", "args", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "Popen_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Call", "ed", "Process", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warn_", "(_", "\"", "cmd", " ", "exit", "ed", " ", "with", " ", "status", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "e_", ",_", "str_", "(_", "args_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmd", "result_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "run", " ", "a", " ", "command", " ", "on", " ", "the", " ", "physical", " ", "node", " ", "and", " ", "get", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "node", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "Pyth", "on", " ", "2.7", " ", "we", " ", "can", " ", "use", " ", "subproc", "ess", ".", "check", "\\u", "output", "()", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "stdin_", "=_", "open_", "(_", "os_", "._", "devnull_", ",_", "'", "r", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "err_", "=_", "tmp_", "._", "communicate_", "(_", ")_", "#", " ", "err", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "tmp_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "status_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sh", "cmd_", "(_", "self_", ",_", "cmds", "tr_", ",_", "sh_", "=_", "\"/", "bin", "/", "sh", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "cmd_", "(_", "[_", "sh_", ",_", "\"-", "c", "\"_", ",_", "cmds", "tr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "hwa", "ddr_", "(_", "self_", ",_", "ifi", "ndex_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "same", " ", "as", " ", "Simple", "Lx", "c", "Node", ".", "set", "hwa", "ddr", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "f_", "[_", "ifi", "ndex_", "]_", "._", "set", "hwa", "ddr_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifname_", "=_", "self_", "._", "ifname_", "(_", "ifi", "ndex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "status_", ",_", "result_", ")_", "=_", "self_", "._", "cmd", "result_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "link", "\"_", ",_", "\"", "set", "\"_", ",_", "\"", "dev", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ifname_", ",_", "\"", "address", "\"_", ",_", "str_", "(_", "addr_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exception_", "(_", "core", "api_", "._", "CORE", "\\u", "EXC", "P", "\\u", "LE", "VEL", "\\u", "ERROR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Phys", "ical", "Node", ".", "set", "hwa", "ddr", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "error", " ", "setti", "ng", " ", "MAC", " ", "address", " ", "%", "s", "\"_", "%_", "str_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "addr_", "(_", "self_", ",_", "ifi", "ndex_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "same", " ", "as", " ", "Simple", "Lx", "c", "Node", ".", "add", "addr", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "addr", "\"_", ",_", "\"", "add", "\"_", ",_", "str_", "(_", "addr_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dev", "\"_", ",_", "self_", "._", "ifname_", "(_", "ifi", "ndex_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "neti", "f_", "[_", "ifi", "ndex_", "]_", "._", "add", "addr_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dela", "ddr_", "(_", "self_", ",_", "ifi", "ndex_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "same", " ", "as", " ", "Simple", "Lx", "c", "Node", ".", "dela", "ddr", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "neti", "f_", "[_", "ifi", "ndex_", "]_", "._", "dela", "ddr_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warn_", "(_", "\"", "try", "ing", " ", "to", " ", "delete", " ", "unknown", " ", "address", ":", " ", "%", "s", "\"_", "%_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "addr", "\"_", ",_", "\"", "del", "\"_", ",_", "str_", "(_", "addr_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dev", "\"_", ",_", "self_", "._", "ifname_", "(_", "ifi", "ndex_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "adopt", "neti", "f_", "(_", "self_", ",_", "neti", "f_", ",_", "ifi", "ndex_", ",_", "hwa", "ddr_", ",_", "addr", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "The", " ", "broker", " ", "builds", " ", "a", " ", "Gre", "Tap", " ", "tunnel", " ", "device", " ", "to", " ", "this", " ", "physical", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "link", " ", "message", " ", "is", " ", "receive", "d", " ", "linking", " ", "this", " ", "node", " ", "to", " ", "anot", "her", " ", "part", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "emulation", ",", " ", "no", " ", "new", " ", "interface", " ", "is", " ", "created", ";", " ", "inst", "ead", ",", " ", "adopt", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Gre", "Tap", " ", "neti", "f", " ", "as", " ", "the", " ", "node", " ", "interface", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neti", "f_", "._", "name_", "=_", "\"", "gt", "%", "d", "\"_", "%_", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neti", "f_", "._", "node_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addn", "eti", "f_", "(_", "neti", "f_", ",_", "ifi", "ndex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "a", " ", "more", " ", "reason", "able", " ", "name", ",", " ", "e", ".", "g", ".", " ", "\"", "gt", "0", "\"", " ", "inst", "ead", " ", "of", " ", "\"", "gt", ".5", "628", "6.1", "50", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "link", "\"_", ",_", "\"", "set", "\"_", ",_", "\"", "dev", "\"_", ",_", "neti", "f_", "._", "local", "name_", ",_", "\"", "down", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "link", "\"_", ",_", "\"", "set", "\"_", ",_", "neti", "f_", "._", "local", "name_", ",_", "\"", "name", "\"_", ",_", "neti", "f_", "._", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neti", "f_", "._", "local", "name_", "=_", "neti", "f_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hwa", "ddr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "hwa", "ddr_", "(_", "ifi", "ndex_", ",_", "hwa", "ddr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "addr_", "in_", "maket", "uple_", "(_", "addr", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "addr_", "(_", "ifi", "ndex_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "IP", "\\u", "BIN", "_", ",_", "\"", "link", "\"_", ",_", "\"", "set", "\"_", ",_", "\"", "dev", "\"_", ",_", "neti", "f_", "._", "local", "name_", ",_", "\"", "up", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link", "config_", "(_", "self_", ",_", "neti", "f_", ",_", "bw_", "=_", "None_", ",_", "delay_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss_", "=_", "None_", ",_", "duplicate_", "=_", "None_", ",_", "jitter_", "=_", "None_", ",_", "neti", "f2_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Apply", " ", "tc", " ", "que", "ing", " ", "disciplin", "es", " ", "usi", "ng", " ", "Lx", "Br", "Net", ".", "link", "config", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", "==_", "\"", "Lin", "ux", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "netc", "ls_", "=_", "Lx", "Br", "Net_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", "==_", "\"", "Free", "BS", "D", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "netc", "ls_", "=_", "Net", "graph", "Net_", "\\u\\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_", ",_", "\"", "unsup", "porte", "d", " ", "platform", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "borrow", " ", "the", " ", "tc", " ", "qd", "isc", " ", "command", "s", " ", "from", " ", "Lx", "Br", "Net", ".", "link", "config", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "netc", "ls_", "(_", "session_", "=_", "self_", "._", "session_", ",_", "start_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "up_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "link", "config_", "(_", "neti", "f_", ",_", "bw_", "=_", "bw_", ",_", "delay_", "=_", "delay_", ",_", "loss_", "=_", "loss_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duplicate_", "=_", "duplicate_", ",_", "jitter_", "=_", "jitter_", ",_", "neti", "f2_", "=_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "newi", "finde", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "ifi", "ndex_", "in_", "self_", "._", "\\u", "neti", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ifi", "ndex_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifi", "ndex_", "=_", "self_", "._", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ifi", "ndex_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "newn", "eti", "f_", "(_", "self_", ",_", "net_", "=_", "None_", ",_", "addr", "list_", "=_", "[_", "]_", ",_", "hwa", "ddr_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ifi", "ndex_", "=_", "None_", ",_", "ifname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "up_", "and_", "net_", "is_", "None_", ":_", "\\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_", "if_", "ifi", "ndex_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ifi", "ndex_", "=_", "self_", "._", "newi", "finde", "x_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "reache", "d", " ", "whe", "n", " ", "this", " ", "node", " ", "is", " ", "linked", " ", "to", " ", "a", " ", "network", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tunnel", " ", "to", " ", "net", " ", "not", " ", "bui", "lt", " ", "ye", "t", ",", " ", "so", " ", "build", " ", "it", " ", "now", " ", "and", " ", "adopt", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gt_", "=_", "self_", "._", "session_", "._", "broker_", "._", "addn", "ett", "unne", "l_", "(_", "net_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gt_", "is_", "None_", "or_", "len_", "(_", "gt_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Error", " ", "buildi", "ng", " ", "tunnel", " ", "from", " ", "Phys", "ical", "Node", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "newn", "eti", "f", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gt_", "=_", "gt_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net_", "._", "detach_", "(_", "gt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "adopt", "neti", "f_", "(_", "gt_", ",_", "ifi", "ndex_", ",_", "hwa", "ddr_", ",_", "addr", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "reache", "d", " ", "whe", "n", " ", "configur", "ing", " ", "service", "s", " ", "(", "self", ".", "up", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ifname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ifname_", "=_", "\"", "gt", "%", "d", "\"_", "%_", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neti", "f_", "=_", "Gre", "Tap", "_", "(_", "node_", "=_", "self_", ",_", "name_", "=_", "ifname_", ",_", "session_", "=_", "self_", "._", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "adopt", "neti", "f_", "(_", "neti", "f_", ",_", "ifi", "ndex_", ",_", "hwa", "ddr_", ",_", "addr", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ifi", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "private", "dir_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "[_", "0_", "]_", "!=_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "\"", "path", " ", "not", " ", "full", "y", " ", "qualified", ":", " ", "\"_", "+_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostp", "ath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "node", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "normpath_", "(_", "path_", ")_", "._", "strip_", "(_", "'/'_", ")_", "._", "replace_", "(_", "'/'_", ",_", "'.'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "hostp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", ",_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "mount_", "(_", "hostp", "ath_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mount_", "(_", "self_", ",_", "source_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "mount", "ing", " ", "%", "s", " ", "at", " ", "%", "s", "\"_", "%_", "(_", "source_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "MOUNT", "\\u", "BIN", "_", ",_", "\"--", "bind", "\"_", ",_", "source_", ",_", "target_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mounts_", "._", "append_", "(_", "(_", "source_", ",_", "target_", ")_", ")_", "\\u\\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_", "._", "warn_", "(_", "\"", "mount", "ing", " ", "fail", "ed", " ", "for", " ", "%", "s", " ", "at", " ", "%", "s", "\"_", "%_", "(_", "source_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "umount", "_", "(_", "self_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "unmo", "unti", "ng", " ", "'%", "s", "'\"_", "%_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "[_", "UM", "OUN", "T", "\\u", "BIN", "_", ",_", "\"-", "l", "\"_", ",_", "target_", "]_", ")_", "\\u\\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_", "._", "warn_", "(_", "\"", "unmo", "unti", "ng", " ", "fail", "ed", " ", "for", " ", "%", "s", "\"_", "%_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "node", "file_", "(_", "self_", ",_", "filename_", ",_", "mode_", "=_", "\"", "w", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dirname_", ",_", "basename_", "=_", "os_", "._", "path_", "._", "split_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "basename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "\"", "no", " ", "basen", "ame", " ", "for", " ", "filename", ":", " ", "\"_", "+_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dirname_", "and_", "dirname_", "[_", "0_", "]_", "==_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dirname_", "=_", "dirname_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dirname_", "=_", "dirname_", "._", "replace_", "(_", "\"/\"_", ",_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "node", "dir_", ",_", "dirname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "dirname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "dirname_", ",_", "mode_", "=_", "0_", "755", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dirname_", ",_", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "open_", "(_", "host", "filename_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phys", "ical", "Node_", "(_", "Py", "Core", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "node", "file_", "(_", "self_", ",_", "filename_", ",_", "contents_", ",_", "mode_", "=_", "0_", "644", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "self_", "._", "open", "node", "file_", "(_", "filename_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "f_", "._", "name_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "created", " ", "node", "file", ":", " ", "'%", "s", "';", " ", "mode", ":", " ", "0", "%", "o", "\"_", "%_", "(_", "f_", "._", "name_", ",_", "mode_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
GoogleCloudPlatform/gcloud-python/gcloud/datastore/test_key.py
[ { "content": " def test_ctor_parent(self):\n _PARENT_KIND = 'KIND1'\n _PARENT_ID = 1234\n _PARENT_PROJECT = 'PROJECT-ALT'\n _PARENT_NAMESPACE = 'NAMESPACE'\n _CHILD_KIND = 'KIND2'\n _CHILD_ID = 2345\n _PATH = [\n {'kind': _PARENT_KIND, 'id': _PARENT_ID},\n {'kind': _CHILD_KIND, 'id': _CHILD_ID},\n ]\n parent_key = self._makeOne(_PARENT_KIND, _PARENT_ID,\n project=_PARENT_PROJECT,\n namespace=_PARENT_NAMESPACE)\n key = self._makeOne(_CHILD_KIND, _CHILD_ID, parent=parent_key)\n self.assertEqual(key.project, parent_key.project)\n self.assertEqual(key.namespace, parent_key.namespace)\n self.assertEqual(key.kind, _CHILD_KIND)\n self.assertEqual(key.path, _PATH)\n self.assertTrue(key.parent is parent_key)", "metadata": "root.TestKey.test_ctor_parent", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test__clone_with_parent(self):\n _PROJECT = 'PROJECT-ALT'\n _NAMESPACE = 'NAMESPACE'\n _KIND1 = 'PARENT'\n _KIND2 = 'KIND'\n _ID1 = 1234\n _ID2 = 2345\n _PATH = [{'kind': _KIND1, 'id': _ID1}, {'kind': _KIND2, 'id': _ID2}]\n\n parent = self._makeOne(_KIND1, _ID1, namespace=_NAMESPACE,\n project=_PROJECT)\n key = self._makeOne(_KIND2, _ID2, parent=parent)\n self.assertTrue(key.parent is parent)\n clone = key._clone()\n self.assertTrue(clone.parent is key.parent)\n self.assertEqual(clone.project, _PROJECT)\n self.assertEqual(clone.namespace, _NAMESPACE)\n self.assertEqual(clone.path, _PATH)", "metadata": "root.TestKey.test__clone_with_parent", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 128 }, { "content": " def test___eq_____ne___w_non_key(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _NAME = 'one'\n key = self._makeOne(_KIND, _NAME, project=_PROJECT)\n self.assertFalse(key == object())\n self.assertTrue(key != object())", "metadata": "root.TestKey.test___eq_____ne___w_non_key", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": " def test___eq_____ne___two_incomplete_keys_same_kind(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n key1 = self._makeOne(_KIND, project=_PROJECT)\n key2 = self._makeOne(_KIND, project=_PROJECT)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___two_incomplete_keys_same_kind", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 155 }, { "content": " def test___eq_____ne___incomplete_key_w_complete_key_same_kind(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _ID = 1234\n key1 = self._makeOne(_KIND, project=_PROJECT)\n key2 = self._makeOne(_KIND, _ID, project=_PROJECT)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___incomplete_key_w_complete_key_same_kind", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def test___eq_____ne___complete_key_w_incomplete_key_same_kind(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _ID = 1234\n key1 = self._makeOne(_KIND, _ID, project=_PROJECT)\n key2 = self._makeOne(_KIND, project=_PROJECT)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___complete_key_w_incomplete_key_same_kind", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 172 }, { "content": " def test___eq_____ne___same_kind_different_ids(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _ID1 = 1234\n _ID2 = 2345\n key1 = self._makeOne(_KIND, _ID1, project=_PROJECT)\n key2 = self._makeOne(_KIND, _ID2, project=_PROJECT)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_different_ids", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 181 }, { "content": " def test___eq_____ne___same_kind_and_id(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _ID = 1234\n key1 = self._makeOne(_KIND, _ID, project=_PROJECT)\n key2 = self._makeOne(_KIND, _ID, project=_PROJECT)\n self.assertTrue(key1 == key2)\n self.assertFalse(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_id", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test___eq_____ne___same_kind_and_id_different_project(self):\n _PROJECT1 = 'PROJECT1'\n _PROJECT2 = 'PROJECT2'\n _KIND = 'KIND'\n _ID = 1234\n key1 = self._makeOne(_KIND, _ID, project=_PROJECT1)\n key2 = self._makeOne(_KIND, _ID, project=_PROJECT2)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_id_different_project", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test___eq_____ne___same_kind_and_id_different_namespace(self):\n _PROJECT = 'PROJECT'\n _NAMESPACE1 = 'NAMESPACE1'\n _NAMESPACE2 = 'NAMESPACE2'\n _KIND = 'KIND'\n _ID = 1234\n key1 = self._makeOne(_KIND, _ID, project=_PROJECT,\n namespace=_NAMESPACE1)\n key2 = self._makeOne(_KIND, _ID, project=_PROJECT,\n namespace=_NAMESPACE2)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_id_different_namespace", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test___eq_____ne___same_kind_different_names(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _NAME1 = 'one'\n _NAME2 = 'two'\n key1 = self._makeOne(_KIND, _NAME1, project=_PROJECT)\n key2 = self._makeOne(_KIND, _NAME2, project=_PROJECT)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_different_names", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 223 }, { "content": " def test___eq_____ne___same_kind_and_name(self):\n _PROJECT = 'PROJECT'\n _KIND = 'KIND'\n _NAME = 'one'\n key1 = self._makeOne(_KIND, _NAME, project=_PROJECT)\n key2 = self._makeOne(_KIND, _NAME, project=_PROJECT)\n self.assertTrue(key1 == key2)\n self.assertFalse(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_name", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test___eq_____ne___same_kind_and_name_different_project(self):\n _PROJECT1 = 'PROJECT1'\n _PROJECT2 = 'PROJECT2'\n _KIND = 'KIND'\n _NAME = 'one'\n key1 = self._makeOne(_KIND, _NAME, project=_PROJECT1)\n key2 = self._makeOne(_KIND, _NAME, project=_PROJECT2)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_name_different_project", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 242 }, { "content": " def test___eq_____ne___same_kind_and_name_different_namespace(self):\n _PROJECT = 'PROJECT'\n _NAMESPACE1 = 'NAMESPACE1'\n _NAMESPACE2 = 'NAMESPACE2'\n _KIND = 'KIND'\n _NAME = 'one'\n key1 = self._makeOne(_KIND, _NAME, project=_PROJECT,\n namespace=_NAMESPACE1)\n key2 = self._makeOne(_KIND, _NAME, project=_PROJECT,\n namespace=_NAMESPACE2)\n self.assertFalse(key1 == key2)\n self.assertTrue(key1 != key2)", "metadata": "root.TestKey.test___eq_____ne___same_kind_and_name_different_namespace", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_completed_key_on_partial_w_id(self):\n key = self._makeOne('KIND', project=self._DEFAULT_PROJECT)\n _ID = 1234\n new_key = key.completed_key(_ID)\n self.assertFalse(key is new_key)\n self.assertEqual(new_key.id, _ID)\n self.assertEqual(new_key.name, None)", "metadata": "root.TestKey.test_completed_key_on_partial_w_id", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 290 }, { "content": " def test_completed_key_on_partial_w_name(self):\n key = self._makeOne('KIND', project=self._DEFAULT_PROJECT)\n _NAME = 'NAME'\n new_key = key.completed_key(_NAME)\n self.assertFalse(key is new_key)\n self.assertEqual(new_key.id, None)\n self.assertEqual(new_key.name, _NAME)", "metadata": "root.TestKey.test_completed_key_on_partial_w_name", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def test_parent_multiple_calls(self):\n _PARENT_KIND = 'KIND1'\n _PARENT_ID = 1234\n _PARENT_PATH = [{'kind': _PARENT_KIND, 'id': _PARENT_ID}]\n key = self._makeOne(_PARENT_KIND, _PARENT_ID, 'KIND2',\n project=self._DEFAULT_PROJECT)\n parent = key.parent\n self.assertEqual(parent.path, _PARENT_PATH)\n new_parent = key.parent\n self.assertTrue(parent is new_parent)", "metadata": "root.TestKey.test_parent_multiple_calls", "header": "['class', 'TestKey', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 421 } ]
[ { "span": "self.assertTrue(key.parent is parent_key)", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 49 }, { "span": "self.assertTrue(key.parent is parent)", "start_line": 140, "start_column": 8, "end_line": 140, "end_column": 45 }, { "span": "self.assertTrue(clone.parent is key.parent)", "start_line": 142, "start_column": 8, "end_line": 142, "end_column": 51 }, { "span": "self.assertFalse(key == object())", "start_line": 152, "start_column": 8, "end_line": 152, "end_column": 41 }, { "span": "self.assertTrue(key != object())", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 40 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 169, "start_column": 8, "end_line": 169, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 178, "start_column": 8, "end_line": 178, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 188, "start_column": 8, "end_line": 188, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 189, "start_column": 8, "end_line": 189, "end_column": 37 }, { "span": "self.assertTrue(key1 == key2)", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 37 }, { "span": "self.assertFalse(key1 != key2)", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 38 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 220, "start_column": 8, "end_line": 220, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 230, "start_column": 8, "end_line": 230, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 37 }, { "span": "self.assertTrue(key1 == key2)", "start_line": 239, "start_column": 8, "end_line": 239, "end_column": 37 }, { "span": "self.assertFalse(key1 != key2)", "start_line": 240, "start_column": 8, "end_line": 240, "end_column": 38 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 249, "start_column": 8, "end_line": 249, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 37 }, { "span": "self.assertFalse(key1 == key2)", "start_line": 262, "start_column": 8, "end_line": 262, "end_column": 38 }, { "span": "self.assertTrue(key1 != key2)", "start_line": 263, "start_column": 8, "end_line": 263, "end_column": 37 }, { "span": "self.assertFalse(key is new_key)", "start_line": 294, "start_column": 8, "end_line": 294, "end_column": 40 }, { "span": "self.assertFalse(key is new_key)", "start_line": 302, "start_column": 8, "end_line": 302, "end_column": 40 }, { "span": "self.assertTrue(parent is new_parent)", "start_line": 430, "start_column": 8, "end_line": 430, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ctor", "\\u", "parent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PARENT", "\\u", "KIND", "_", "=_", "'", "KIND", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PARENT", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PARENT", "\\u", "PROJECT_", "=_", "'", "PROJECT", "-", "ALT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PARENT", "\\u", "NAMESPACE_", "=_", "'", "NAMESPACE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "CHILD", "\\u", "KIND", "_", "=_", "'", "KIND", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "CHILD", "\\u", "ID_", "=_", "2345", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PATH_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "kind", "'_", ":_", "\\u", "PARENT", "\\u", "KIND", "_", ",_", "'", "id", "'_", ":_", "\\u", "PARENT", "\\u", "ID_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "kind", "'_", ":_", "\\u", "CHILD", "\\u", "KIND", "_", ",_", "'", "id", "'_", ":_", "\\u", "CHILD", "\\u", "ID_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "PARENT", "\\u", "KIND", "_", ",_", "\\u", "PARENT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "\\u", "PARENT", "\\u", "PROJECT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "\\u", "PARENT", "\\u", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "CHILD", "\\u", "KIND", "_", ",_", "\\u", "CHILD", "\\u", "ID_", ",_", "parent_", "=_", "parent", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key_", "._", "project_", ",_", "parent", "\\u", "key_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key_", "._", "namespace_", ",_", "parent", "\\u", "key_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key_", "._", "kind_", ",_", "\\u", "CHILD", "\\u", "KIND", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key_", "._", "path_", ",_", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key_", "._", "parent_", "is_", "parent", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "clone", "\\u", "with", "\\u", "parent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "-", "ALT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAMESPACE_", "=_", "'", "NAMESPACE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "1_", "=_", "'", "PARENT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "2_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID", "1_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID", "2_", "=_", "2345", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PATH_", "=_", "[_", "{_", "'", "kind", "'_", ":_", "\\u", "KIND", "1_", ",_", "'", "id", "'_", ":_", "\\u", "ID", "1_", "}_", ",_", "{_", "'", "kind", "'_", ":_", "\\u", "KIND", "2_", ",_", "'", "id", "'_", ":_", "\\u", "ID", "2_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "1_", ",_", "\\u", "ID", "1_", ",_", "namespace_", "=_", "\\u", "NAMESPACE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "2_", ",_", "\\u", "ID", "2_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key_", "._", "parent_", "is_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clone_", "=_", "key_", "._", "\\u", "clone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "clone_", "._", "parent_", "is_", "key_", "._", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "clone_", "._", "project_", ",_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "clone_", "._", "namespace_", ",_", "\\u", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "clone_", "._", "path_", ",_", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "w", "\\u", "non", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME_", "=_", "'", "one", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key_", "==_", "object_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key_", "!=_", "object_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "two", "\\u", "incomplete", "\\u", "keys", "\\u", "same", "\\u", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "incomplete", "\\u", "key", "\\u", "w", "\\u", "complete", "\\u", "key", "\\u", "same", "\\u", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "complete", "\\u", "key", "\\u", "w", "\\u", "incomplete", "\\u", "key", "\\u", "same", "\\u", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "different", "\\u", "ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID", "1_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID", "2_", "=_", "2345", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID", "1_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID", "2_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "id", "\\u", "different", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT", "1_", "=_", "'", "PROJECT", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROJECT", "2_", "=_", "'", "PROJECT", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "id", "\\u", "different", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAMESPACE", "1_", "=_", "'", "NAMESPACE", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAMESPACE", "2_", "=_", "'", "NAMESPACE", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "\\u", "NAMESPACE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "ID_", ",_", "project_", "=_", "\\u", "PROJECT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "\\u", "NAMESPACE", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "different", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME", "1_", "=_", "'", "one", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME", "2_", "=_", "'", "two", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME", "1_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME", "2_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME_", "=_", "'", "one", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "name", "\\u", "different", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT", "1_", "=_", "'", "PROJECT", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROJECT", "2_", "=_", "'", "PROJECT", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME_", "=_", "'", "one", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u\\u", "eq", "\\u\\u\\u\\u\\u", "ne", "\\u\\u\\u", "same", "\\u", "kind", "\\u", "and", "\\u", "name", "\\u", "different", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PROJECT_", "=_", "'", "PROJECT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAMESPACE", "1_", "=_", "'", "NAMESPACE", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAMESPACE", "2_", "=_", "'", "NAMESPACE", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "KIND", "_", "=_", "'", "KIND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME_", "=_", "'", "one", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key1_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "\\u", "NAMESPACE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "KIND", "_", ",_", "\\u", "NAME_", ",_", "project_", "=_", "\\u", "PROJECT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "\\u", "NAMESPACE", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key1_", "==_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "key1_", "!=_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "complete", "d\\u", "key", "\\u", "on", "\\u", "partial", "\\u", "w", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "'", "KIND", "'_", ",_", "project_", "=_", "self_", "._", "\\u", "DEF", "AUL", "T", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "key_", "=_", "key_", "._", "complete", "d\\u", "key_", "(_", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key_", "is_", "new", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "id_", ",_", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "complete", "d\\u", "key", "\\u", "on", "\\u", "partial", "\\u", "w", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "'", "KIND", "'_", ",_", "project_", "=_", "self_", "._", "\\u", "DEF", "AUL", "T", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NAME_", "=_", "'", "NAME", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "key_", "=_", "key_", "._", "complete", "d\\u", "key_", "(_", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "key_", "is_", "new", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "name_", ",_", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Key_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "parent", "\\u", "multiple", "\\u", "calls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PARENT", "\\u", "KIND", "_", "=_", "'", "KIND", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PARENT", "\\u", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PARENT", "\\u", "PATH_", "=_", "[_", "{_", "'", "kind", "'_", ":_", "\\u", "PARENT", "\\u", "KIND", "_", ",_", "'", "id", "'_", ":_", "\\u", "PARENT", "\\u", "ID_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "\\u", "PARENT", "\\u", "KIND", "_", ",_", "\\u", "PARENT", "\\u", "ID_", ",_", "'", "KIND", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "self_", "._", "\\u", "DEF", "AUL", "T", "\\u", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "key_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "parent_", "._", "path_", ",_", "\\u", "PARENT", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "parent_", "=_", "key_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "is_", "new", "\\u", "parent_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
rsms/smisk/lib/smisk/test/live/key_value_store_example/__init__.py
[ { "content": " def test_0_simple_response(self):\n client = self.connection()\n rsp = client.request('GET', '/', headers=[\n ('Accept','*/*'),\n ('Accept-Charset','utf-8'),\n ])\n payload = eval(rsp.body)\n #print payload\n self.assertTrue('entries' in payload)\n self.assertEquals(len(payload['entries']), 0)\n client.disconnect()", "metadata": "root.KVSExample.test_0_simple_response", "header": "['class', 'KVSExample', '(', 'LiveTestCase', ')', ':', '___EOS___']", "index": 6 }, { "content": " def _test_put_get_delete(self, reconnect):\n orig_payload = {'value': {'a': u'Aaa', 'b': u'Bee', 'j': u'Jey'}}\n orig_payload_s = repr(orig_payload)\n send_payload_headers = [\n ('Content-type', 'text/x-python'),\n ('Content-length', str(len(orig_payload_s)))\n ]\n \n client = self.connection()\n \n rsp = client.request('PUT', '/entry/a', body=orig_payload_s, headers=send_payload_headers)\n rsp.read() # finish response\n try:\n self.assertTrue(rsp.is_ok, rsp.status)\n except:\n print >> sys.stderr, rsp.body\n raise\n \n client = reconnect(client)\n rsp = client.request('GET', '/entry/a')\n self.assertTrue(rsp.is_ok)\n rsp_payload = eval(rsp.body)\n print rsp_payload\n self.assertTrue('value' in rsp_payload)\n value = rsp_payload['value']\n self.assertEquals(rsp_payload['value']['a'], orig_payload['value']['a'])\n self.assertEquals(rsp_payload['value']['b'], orig_payload['value']['b'])\n self.assertEquals(rsp_payload['value']['j'], orig_payload['value']['j'])\n \n client.disconnect()", "metadata": "root.KVSExample._test_put_get_delete", "header": "['class', 'KVSExample', '(', 'LiveTestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": "def unused():\n rsp = self.client.request('GET', '/', headers=[\n ('Accept','text/html,application/xml;q=0.9,*/*;q=0.8'),\n ('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),\n ])\n \n self.assertTrue(rsp.is_ok)\n \n self.assertResponseHeaderIsSet(rsp, 'content-length')\n self.assertResponseHeaderEquals(rsp, 'content-type', 'text/html; charset=utf-8')\n self.assertResponseHeaderEquals(rsp, 'content-location', '/.html')\n \n self.assertResponseHeaderIsSet(rsp, 'vary')\n for v in rsp.header('vary'):\n self.assertTrue('Accept-Charset' in v)\n self.assertTrue('Accept' in v)\n \n self.assertNotEquals(rsp.body, '')", "metadata": "root.unused", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "self.assertTrue('entries' in payload)", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 41 }, { "span": "self.assertTrue('value' in rsp_payload)", "start_line": 57, "start_column": 4, "end_line": 57, "end_column": 43 }, { "span": "self.assertTrue('Accept-Charset' in v)", "start_line": 80, "start_column": 4, "end_line": 80, "end_column": 42 }, { "span": "self.assertTrue('Accept' in v)", "start_line": 81, "start_column": 4, "end_line": 81, "end_column": 34 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "KV", "SE", "xa", "mple", "_", "(_", "Live", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "0", "\\u", "simple", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp_", "=_", "client_", "._", "request_", "(_", "'", "GET", "'_", ",_", "'/'_", ",_", "headers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Accept", "'_", ",_", "'*/", "*'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Accept", "-", "Charset", "'_", ",_", "'", "utf", "-", "8", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "eval_", "(_", "rsp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "payload_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "entri", "es", "'_", "in_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "payload_", "[_", "'", "entri", "es", "'_", "]_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "disconnect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "KV", "SE", "xa", "mple", "_", "(_", "Live", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "put", "\\u", "get", "\\u", "delete_", "(_", "self_", ",_", "reconnect_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "\\u", "payload_", "=_", "{_", "'", "value", "'_", ":_", "{_", "'", "a", "'_", ":_", "u", "'", "Aa", "a", "'_", ",_", "'", "b", "'_", ":_", "u", "'", "Bee", "'_", ",_", "'", "j", "'_", ":_", "u", "'", "Je", "y", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "\\u", "payload", "\\u", "s_", "=_", "repr_", "(_", "orig", "\\u", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "payload", "\\u", "headers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "type", "'_", ",_", "'", "text", "/", "x", "-", "python", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "length", "'_", ",_", "str_", "(_", "len_", "(_", "orig", "\\u", "payload", "\\u", "s_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "self_", "._", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rsp_", "=_", "client_", "._", "request_", "(_", "'", "PU", "T", "'_", ",_", "'/", "entry", "/", "a", "'_", ",_", "body_", "=_", "orig", "\\u", "payload", "\\u", "s_", ",_", "headers_", "=_", "send", "\\u", "payload", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp_", "._", "read_", "(_", ")_", "#", " ", "finish", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "rsp_", "._", "is", "\\u", "ok_", ",_", "rsp_", "._", "status_", ")_", "\\u\\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_", ",_", "rsp_", "._", "body_", "\\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_", "client_", "=_", "reconnect_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp_", "=_", "client_", "._", "request_", "(_", "'", "GET", "'_", ",_", "'/", "entry", "/", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rsp_", "._", "is", "\\u", "ok_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp", "\\u", "payload_", "=_", "eval_", "(_", "rsp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "rsp", "\\u", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "value", "'_", "in_", "rsp", "\\u", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "rsp", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "rsp", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "a", "'_", "]_", ",_", "orig", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "rsp", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "b", "'_", "]_", ",_", "orig", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "b", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "rsp", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "j", "'_", "]_", ",_", "orig", "\\u", "payload_", "[_", "'", "value", "'_", "]_", "[_", "'", "j", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "disconnect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unused_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rsp_", "=_", "self_", "._", "client_", "._", "request_", "(_", "'", "GET", "'_", ",_", "'/'_", ",_", "headers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Accept", "'_", ",_", "'", "text", "/", "html", ",", "applica", "tion", "/", "xml", ";", "q", "=", "0.", "9", ",*", "/*", ";", "q", "=", "0.", "8", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Accept", "-", "Charset", "'_", ",_", "'", "ISO", "-", "8859", "-1", ",", "utf", "-", "8", ";", "q", "=", "0.", "7", ",*", ";", "q", "=", "0.", "7", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rsp_", "._", "is", "\\u", "ok_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Respons", "e", "Head", "er", "Is", "Set_", "(_", "rsp_", ",_", "'", "content", "-", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Respons", "e", "Head", "er", "Equals_", "(_", "rsp_", ",_", "'", "content", "-", "type", "'_", ",_", "'", "text", "/", "html", ";", " ", "charset", "=", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Respons", "e", "Head", "er", "Equals_", "(_", "rsp_", ",_", "'", "content", "-", "location", "'_", ",_", "'/.", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Respons", "e", "Head", "er", "Is", "Set_", "(_", "rsp_", ",_", "'", "vary", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "rsp_", "._", "header_", "(_", "'", "vary", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "Accept", "-", "Charset", "'_", "in_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Accept", "'_", "in_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
rcbops/glance-buildpackage/glance/tests/unit/test_s3_store.py
[ { "content": " def _option_required(self, key):\n conf = S3_CONF.copy()\n del conf[key]\n\n try:\n self.store = Store(test_utils.TestConfigOpts(conf))\n return self.store.add == self.store.add_disabled\n except:\n return False\n return False", "metadata": "root.TestStore._option_required", "header": "['class', 'TestStore', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 290 } ]
[ { "span": "except:", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Store_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "option", "\\u", "required_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "S", "3", "\\u", "CONF_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "conf_", "[_", "key_", "]_", "\\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_", "._", "store_", "=_", "Store_", "(_", "test\\u", "utils_", "._", "Test", "Config", "Opts_", "(_", "conf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "store_", "._", "add_", "==_", "self_", "._", "store_", "._", "add", "\\u", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Suspicious unused loop iteration variable
rackerlabs/openstack-guest-agents-unix/commands/redhat/network.py
[ { "content": "def process_interface_files(infile, interfaces):\n \"\"\"\n Write out a new files for interfaces\n \"\"\"\n\n # Enumerate all of the existing ifcfg-* files\n remove_files = set()\n for filepath in glob.glob(NETCONFIG_DIR + \"/ifcfg-*\"):\n if '.' not in filepath:\n remove_files.add(filepath)\n for filename in glob.glob(NETCONFIG_DIR + \"/route-*\"):\n if '.' not in filepath:\n remove_files.add(filepath)\n\n lo_file = os.path.join(NETCONFIG_DIR, INTERFACE_FILE % 'lo')\n if lo_file in remove_files:\n remove_files.remove(lo_file)\n\n update_files = {}\n\n ipv6 = False\n for ifname, interface in interfaces.iteritems():\n ifaces, route_data = _get_file_data(ifname, interface)\n if interface['ip6s']:\n ipv6 = True\n\n for ifname, data in ifaces:\n filepath = os.path.join(NETCONFIG_DIR, INTERFACE_FILE % ifname)\n update_files[filepath] = data\n if filepath in remove_files:\n remove_files.remove(filepath)\n\n if route_data:\n filepath = os.path.join(NETCONFIG_DIR, ROUTE_FILE % ifname)\n update_files[filepath] = route_data\n if filepath in remove_files:\n remove_files.remove(filepath)\n\n update_files[NETWORK_FILE] = _update_key_value(infile, 'NETWORKING_IPV6',\n ipv6 and 'yes' or 'no')\n\n return update_files, remove_files", "metadata": "root.process_interface_files", "header": "['module', '___EOS___']", "index": 231 } ]
[ { "span": "for filename in glob.glob(NETCONFIG_DIR + \"/route-*\"):", "start_line": 241, "start_column": 4, "end_line": 241, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "interface", "\\u", "files_", "(_", "infile_", ",_", "interfaces_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "out", " ", "a", " ", "new", " ", "files", " ", "for", " ", "interface", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enumerate", " ", "all", " ", "of", " ", "the", " ", "exist", "ing", " ", "ifc", "fg", "-*", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "\\u", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filepath_", "in_", "glob_", "._", "glob_", "(_", "NET", "CONFIG", "\\u", "DIR_", "+_", "\"/", "ifc", "fg", "-*", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "not_", "in_", "filepath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "files_", "._", "add_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", "in_", "glob_", "._", "glob_", "(_", "NET", "CONFIG", "\\u", "DIR_", "+_", "\"/", "route", "-*", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "not_", "in_", "filepath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "files_", "._", "add_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lo", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "NET", "CONFIG", "\\u", "DIR_", ",_", "INTERFACE", "\\u", "FILE_", "%_", "'", "lo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lo", "\\u", "file_", "in_", "remove", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "files_", "._", "remove_", "(_", "lo", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "\\u", "files_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipv6_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ifname_", ",_", "interface_", "in_", "interfaces_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ifaces", "_", ",_", "route", "\\u", "data_", "=_", "\\u", "get", "\\u", "file", "\\u", "data_", "(_", "ifname_", ",_", "interface_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface_", "[_", "'", "ip6", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipv6_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ifname_", ",_", "data_", "in_", "ifaces", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "NET", "CONFIG", "\\u", "DIR_", ",_", "INTERFACE", "\\u", "FILE_", "%_", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "files_", "[_", "filepath_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filepath_", "in_", "remove", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "files_", "._", "remove_", "(_", "filepath_", ")_", "\\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_", "route", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "NET", "CONFIG", "\\u", "DIR_", ",_", "ROUTE", "\\u", "FILE_", "%_", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "files_", "[_", "filepath_", "]_", "=_", "route", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filepath_", "in_", "remove", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "files_", "._", "remove_", "(_", "filepath_", ")_", "\\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_", "update", "\\u", "files_", "[_", "NET", "WORK", "\\u", "FILE_", "]_", "=_", "\\u", "update", "\\u", "key", "\\u", "value_", "(_", "infile_", ",_", "'", "NET", "WORK", "ING", "\\u", "IP", "V6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipv6_", "and_", "'", "ye", "s", "'_", "or_", "'", "no", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "update", "\\u", "files_", ",_", "remove", "\\u", "files_" ]
[ 4, 4, 4, 4, 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 ]
Unused import
vintasoftware/django-role-permissions/rolepermissions/decorators.py
[ { "content": "from __future__ import unicode_literals\n\nfrom functools import wraps\n\nfrom django.core.exceptions import PermissionDenied\n\nfrom rolepermissions.roles import RolesManager\nfrom rolepermissions.verifications import has_role, has_permission\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def has_role_decorator(role):\n def request_decorator(dispatch):\n @wraps(dispatch)\n def wrapper(request, *args, **kwargs):\n user = request.user\n if user.is_authenticated():\n if has_role(user, role):\n return dispatch(request, *args, **kwargs)\n\n raise PermissionDenied\n return wrapper\n return request_decorator", "metadata": "root.has_role_decorator", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def has_permission_decorator(permission_name):\n def request_decorator(dispatch):\n @wraps(dispatch)\n def wrapper(request, *args, **kwargs):\n user = request.user\n if user.is_authenticated():\n if has_permission(user, permission_name):\n return dispatch(request, *args, **kwargs)\n\n raise PermissionDenied\n return wrapper\n return request_decorator", "metadata": "root.has_permission_decorator", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "from rolepermissions.roles import RolesManager", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "role", "permissions_", "._", "roles_", "import_", "Ro", "les", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "role", "permissions_", "._", "verification", "s_", "import_", "has", "\\u", "role_", ",_", "has", "\\u", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "has", "\\u", "role", "\\u", "decorator_", "(_", "role_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request", "\\u", "decorator_", "(_", "dispatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "role_", "(_", "user_", ",_", "role_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "request", "\\u", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "permissi", "on", "\\u", "decorator_", "(_", "permissi", "on", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request", "\\u", "decorator_", "(_", "dispatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "permission_", "(_", "user_", ",_", "permissi", "on", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "request", "\\u", "decorator_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
heiskr/sagefy/server/framework/index.py
[ { "content": "def pull_body(environ):\n \"\"\"\n Pulls the body out of the WSGI environment.\n \"\"\"\n\n try:\n content_length = int(environ.get('CONTENT_LENGTH', 0))\n body = environ['wsgi.input'].read(content_length)\n body = body.decode()\n return json.loads(body, strict=False)\n except:\n return {}", "metadata": "root.pull_body", "header": "['module', '___EOS___']", "index": 136 } ]
[ { "span": "except:", "start_line": 146, "start_column": 4, "end_line": 146, "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_", "pull", "\\u", "body_", "(_", "environ_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pul", "ls", " ", "the", " ", "body", " ", "out", " ", "of", " ", "the", " ", "WS", "GI", " ", "environ", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "length_", "=_", "int_", "(_", "environ_", "._", "get_", "(_", "'", "CONTE", "NT", "\\u", "LENGTH", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "environ_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "._", "read_", "(_", "content", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "body_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "body_", ",_", "strict_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
spulec/moto/tests/test_ec2/test_internet_gateways.py
[ { "content": "from __future__ import unicode_literals\n# Ensure 'assert_raises' context manager support for Python 2.6\nimport tests.backport_assert_raises\nfrom nose.tools import assert_raises\n\nimport re\n\nimport boto\nfrom boto.exception import EC2ResponseError\n\nimport sure # noqa\n\nfrom moto import mock_ec2\n\n\nVPC_CIDR=\"10.0.0.0/16\"\nBAD_VPC=\"vpc-deadbeef\"\nBAD_IGW=\"igw-deadbeef\"\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": "@mock_ec2\ndef test_igw_create():\n \"\"\" internet gateway create \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n conn.get_all_internet_gateways().should.have.length_of(0)\n igw = conn.create_internet_gateway()\n conn.get_all_internet_gateways().should.have.length_of(1)\n igw.id.should.match(r'igw-[0-9a-f]+')\n\n igw = conn.get_all_internet_gateways()[0]\n igw.attachments.should.have.length_of(0)", "metadata": "root.test_igw_create", "header": "['module', '___EOS___']", "index": 19 }, { "content": "@mock_ec2\ndef test_igw_attach():\n \"\"\" internet gateway attach \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc.id)\n\n igw = conn.get_all_internet_gateways()[0]\n igw.attachments[0].vpc_id.should.be.equal(vpc.id)", "metadata": "root.test_igw_attach", "header": "['module', '___EOS___']", "index": 32 }, { "content": "@mock_ec2\ndef test_igw_attach_bad_vpc():\n \"\"\" internet gateway fail to attach w/ bad vpc \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n\n with assert_raises(EC2ResponseError) as cm:\n conn.attach_internet_gateway(igw.id, BAD_VPC)\n cm.exception.code.should.equal('InvalidVpcID.NotFound')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_attach_bad_vpc", "header": "['module', '___EOS___']", "index": 43 }, { "content": "@mock_ec2\ndef test_igw_attach_twice():\n \"\"\" internet gateway fail to attach twice \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc1 = conn.create_vpc(VPC_CIDR)\n vpc2 = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc1.id)\n\n with assert_raises(EC2ResponseError) as cm:\n conn.attach_internet_gateway(igw.id, vpc2.id)\n cm.exception.code.should.equal('Resource.AlreadyAssociated')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_attach_twice", "header": "['module', '___EOS___']", "index": 55 }, { "content": "@mock_ec2\ndef test_igw_detach():\n \"\"\" internet gateway detach\"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc.id)\n conn.detach_internet_gateway(igw.id, vpc.id)\n igw = conn.get_all_internet_gateways()[0]\n igw.attachments.should.have.length_of(0)", "metadata": "root.test_igw_detach", "header": "['module', '___EOS___']", "index": 70 }, { "content": "@mock_ec2\ndef test_igw_detach_wrong_vpc():\n \"\"\" internet gateway fail to detach w/ wrong vpc \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc1 = conn.create_vpc(VPC_CIDR)\n vpc2 = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc1.id)\n\n with assert_raises(EC2ResponseError) as cm:\n conn.detach_internet_gateway(igw.id, vpc2.id)\n cm.exception.code.should.equal('Gateway.NotAttached')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_detach_wrong_vpc", "header": "['module', '___EOS___']", "index": 81 }, { "content": "@mock_ec2\ndef test_igw_detach_invalid_vpc():\n \"\"\" internet gateway fail to detach w/ invalid vpc \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc.id)\n\n with assert_raises(EC2ResponseError) as cm:\n conn.detach_internet_gateway(igw.id, BAD_VPC)\n cm.exception.code.should.equal('Gateway.NotAttached')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_detach_invalid_vpc", "header": "['module', '___EOS___']", "index": 96 }, { "content": "@mock_ec2\ndef test_igw_detach_unattached():\n \"\"\" internet gateway fail to detach unattached \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n\n with assert_raises(EC2ResponseError) as cm:\n conn.detach_internet_gateway(igw.id, vpc.id)\n cm.exception.code.should.equal('Gateway.NotAttached')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_detach_unattached", "header": "['module', '___EOS___']", "index": 110 }, { "content": "@mock_ec2\ndef test_igw_delete():\n \"\"\" internet gateway delete\"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n vpc = conn.create_vpc(VPC_CIDR)\n conn.get_all_internet_gateways().should.have.length_of(0)\n igw = conn.create_internet_gateway()\n conn.get_all_internet_gateways().should.have.length_of(1)\n conn.delete_internet_gateway(igw.id)\n conn.get_all_internet_gateways().should.have.length_of(0)", "metadata": "root.test_igw_delete", "header": "['module', '___EOS___']", "index": 123 }, { "content": "@mock_ec2\ndef test_igw_delete_attached():\n \"\"\" internet gateway fail to delete attached \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw.id, vpc.id)\n\n with assert_raises(EC2ResponseError) as cm:\n conn.delete_internet_gateway(igw.id)\n cm.exception.code.should.equal('DependencyViolation')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_delete_attached", "header": "['module', '___EOS___']", "index": 134 }, { "content": "@mock_ec2\ndef test_igw_desribe():\n \"\"\" internet gateway fetch by id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n igw = conn.create_internet_gateway()\n igw_by_search = conn.get_all_internet_gateways([igw.id])[0]\n igw.id.should.equal(igw_by_search.id)", "metadata": "root.test_igw_desribe", "header": "['module', '___EOS___']", "index": 148 }, { "content": "@mock_ec2\ndef test_igw_desribe_bad_id():\n \"\"\" internet gateway fail to fetch by bad id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n with assert_raises(EC2ResponseError) as cm:\n conn.get_all_internet_gateways([BAD_IGW])\n cm.exception.code.should.equal('InvalidInternetGatewayID.NotFound')\n cm.exception.status.should.equal(400)\n cm.exception.request_id.should_not.be.none", "metadata": "root.test_igw_desribe_bad_id", "header": "['module', '___EOS___']", "index": 156 }, { "content": "@mock_ec2\ndef test_igw_filter_by_vpc_id():\n \"\"\" internet gateway filter by vpc id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw1.id, vpc.id)\n\n result = conn.get_all_internet_gateways(filters={\"attachment.vpc-id\": vpc.id})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_vpc_id", "header": "['module', '___EOS___']", "index": 167 }, { "content": "@mock_ec2\ndef test_igw_filter_by_tags():\n \"\"\" internet gateway filter by vpc id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n igw1.add_tag(\"tests\", \"yes\")\n\n result = conn.get_all_internet_gateways(filters={\"tag:tests\": \"yes\"})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_tags", "header": "['module', '___EOS___']", "index": 182 }, { "content": "@mock_ec2\ndef test_igw_filter_by_internet_gateway_id():\n \"\"\" internet gateway filter by internet gateway id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n\n result = conn.get_all_internet_gateways(filters={\"internet-gateway-id\": igw1.id})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_internet_gateway_id", "header": "['module', '___EOS___']", "index": 196 }, { "content": "@mock_ec2\ndef test_igw_filter_by_attachment_state():\n \"\"\" internet gateway filter by attachment state \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw1.id, vpc.id)\n\n result = conn.get_all_internet_gateways(filters={\"attachment.state\": \"available\"})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_attachment_state", "header": "['module', '___EOS___']", "index": 209 } ]
[ { "span": "import tests.backport_assert_raises", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 35 }, { "span": "import re", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "'", "assert", "\\u", "raise", "s", "'", " ", "context", " ", "manage", "r", " ", "support", " ", "for", " ", "Pyth", "on", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tests_", "._", "backp", "ort", "\\u", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "exception_", "import_", "EC", "2", "Respons", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sure", "_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "moto", "_", "import_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VP", "C", "\\u", "CIDR", "_", "=_", "\"", "10.", "0.", "0.", "0", "/", "16", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BAD", "\\u", "VP", "C_", "=_", "\"", "vpc", "-", "dead", "beef", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BAD", "\\u", "IG", "W_", "=_", "\"", "ig", "w", "-", "dead", "beef", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "create", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "._", "id_", "._", "should_", "._", "match_", "(_", "r", "'", "ig", "w", "-[", "0", "-", "9", "a", "-", "f", "]+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "._", "attachments_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "attach_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "attach", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "._", "attachments_", "[_", "0_", "]_", "._", "vpc", "\\u", "id_", "._", "should_", "._", "be_", "._", "equal_", "(_", "vpc_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "attach", "\\u", "bad", "\\u", "vpc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "attach", " ", "w", "/", " ", "bad", " ", "vpc", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "BAD", "\\u", "VP", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Inva", "lid", "Vp", "c", "ID", ".", "Not", "Foun", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "attach", "\\u", "twi", "ce_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "attach", " ", "twi", "ce", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc", "1_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc", "2_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc", "2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Reso", "urc", "e", ".", "Al", "read", "y", "Associate", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "detach_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "deta", "ch", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "deta", "ch", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "._", "attachments_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "deta", "ch", "\\u", "wrong", "\\u", "vpc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "deta", "ch", " ", "w", "/", " ", "wrong", " ", "vpc", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc", "1_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc", "2_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc", "1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "deta", "ch", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc", "2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Gat", "ewa", "y", ".", "Not", "Attache", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "deta", "ch", "\\u", "invalid", "\\u", "vpc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "deta", "ch", " ", "w", "/", " ", "invalid", " ", "vpc", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "deta", "ch", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "BAD", "\\u", "VP", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Gat", "ewa", "y", ".", "Not", "Attache", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "deta", "ch", "\\u", "unat", "tach", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "deta", "ch", " ", "unat", "tach", "ed", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "deta", "ch", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Gat", "ewa", "y", ".", "Not", "Attache", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "delete_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "delete", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "delete", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "delete", "\\u", "attache", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "delete", " ", "attache", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "delete", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Dependenc", "y", "Violation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "des", "ribe", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fetch", " ", "by", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w", "\\u", "by", "\\u", "search_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "[_", "ig", "w_", "._", "id_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w", "\\u", "by", "\\u", "search_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "des", "ribe", "\\u", "bad", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "fail", " ", "to", " ", "fetch", " ", "by", " ", "bad", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "assert", "\\u", "raises_", "(_", "EC", "2", "Respons", "e", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "[_", "BAD", "\\u", "IG", "W_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cm_", "._", "exception_", "._", "code_", "._", "should_", "._", "equal_", "(_", "'", "Inva", "lid", "Intern", "et", "Gat", "ewa", "y", "ID", ".", "Not", "Foun", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "status_", "._", "should_", "._", "equal_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "._", "exception_", "._", "request", "\\u", "id_", "._", "shou", "ld", "\\u", "not_", "._", "be_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "vpc", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "vpc", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w1_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "attach", "ment", ".", "vpc", "-", "id", "\"_", ":_", "vpc_", "._", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "tags_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "vpc", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w1_", "._", "add", "\\u", "tag_", "(_", "\"", "tests", "\"_", ",_", "\"", "ye", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "tag", ":", "tests", "\"_", ":_", "\"", "ye", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "interne", "t", "\\u", "gateway", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "interne", "t", " ", "gateway", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "interne", "t", "-", "gateway", "-", "id", "\"_", ":_", "ig", "w1_", "._", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "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_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "attach", "ment", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "attach", "ment", " ", "state", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w1_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "attach", "ment", ".", "state", "\"_", ":_", "\"", "avail", "able", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "id_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
neurodata/ndstore/ingest/mitra/mitrachannel.py
[ { "content": "# Copyright 2014 Open Connectome Project (http://openconnecto.me)\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport cStringIO\nimport urllib2\nimport sys\nimport zlib\nimport os\nimport re\n#from PIL import Image\nimport cv2\nimport Image\nimport MySQLdb\n\nimport numpy as np\n\nsys.path += [os.path.abspath('../../django')]\nimport OCP.settings\nos.environ['DJANGO_SETTINGS_MODULE'] = 'OCP.settings'\nfrom django.conf import settings\n\nimport ocpcarest\nimport zindex\nimport imagecube\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MitraIngest:\n\n\n\n\n\n\n", "metadata": "root.MitraIngest", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __init__(self, token, path, resolution, channel):\n\n self.path = path\n self.resolution = resolution\n\n [ self.db, self.proj, self.projdb ] = ocpcarest.loadDBProj ( token )\n\n (self.xcubedim, self.ycubedim, self.zcubedim) = self.proj.datasetcfg.cubedim[ resolution ]\n (self.startslice, self.endslice) = self.proj.datasetcfg.slicerange\n self.batchsz = self.zcubedim\n \n self.channel = channel\n\n self._ximgsz = self.proj.datasetcfg.imagesz[resolution][0]\n self._yimgsz = self.proj.datasetcfg.imagesz[resolution][1]\n\n self.cursor = self.db.conn.cursor()", "metadata": "root.MitraIngest.__init__", "header": "['class', 'MitraIngest', ':', '___EOS___']", "index": 39 }, { "content": " def label ( self, chanid, chanstr ):\n \"\"\" Write the channel label/string associated with the channel identifier\"\"\"\n\n sql = 'INSERT INTO channels VALUES ( \\'{}\\', {} )'.format( chanstr, chanid )\n try:\n print sql\n #self.cursor.execute ( sql )\n except MySQLdb.Error, e:\n print (\"Error updating channels table: %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n raise ", "metadata": "root.MitraIngest.label", "header": "['class', 'MitraIngest', ':', '___EOS___']", "index": 58 }, { "content": " def ingest( self ):\n\n channel = 0\n NAME = [ \"Red\", \"Green\", \"Blue\" ]\n import pdb; pdb.set_trace()\n\n # for each channel\n for x in range(self.channel):\n \n # label by RGB Channel\n self.label ( x, NAME[x] )\n \n # for each slice\n for sl in range(self.startslice,self.endslice+1,self.batchsz):\n \n imarray = np.zeros ( [self.batchsz,self._yimgsz,self._ximgsz], dtype=np.uint8 )\n\n for b in range ( self.batchsz ):\n\n if ( sl + b <= self.endslice ):\n\n # raw data\n filenm = self.path + '{:0>4}'.format(sl+b) + '.tiff'\n\n # load the image and check the dimension\n try:\n print \"Opening filename: \" + filenm\n img = Image.open(filenm, 'r')\n imgdata = np.asarray ( img )\n imarray[(sl+b-self.startslice)%self.batchsz,0:imgdata.shape[0],0:imgdata.shape[1]] = imgdata[:,:,x]\n except IOError, e:\n print e\n \n # ingset any remaining slices\n self.upload( channel, sl, imarray )", "metadata": "root.MitraIngest.ingest", "header": "['class', 'MitraIngest', ':', '___EOS___']", "index": 70 }, { "content": " def upload ( self, channel, sl, imarray ):\n \"\"\"Transfer the array to the database\"\"\"\n\n # and the limits of iteration\n xlimit = (self._ximgsz-1) / self.xcubedim + 1\n ylimit = (self._yimgsz-1) / self.ycubedim + 1\n\n for y in range(ylimit):\n for x in range(xlimit):\n\n # each batch is the last slice in a cube\n z = sl/self.zcubedim\n\n # zindex\n key = zindex.XYZMorton ( [x,y,z] )\n\n # Create a channel cube\n cube = imagecube.ImageCube8 ( [self.xcubedim, self.ycubedim, self.zcubedim] )\n\n # data for this key\n cube.data = imarray[:,y*self.ycubedim:(y+1)*self.ycubedim,x*self.xcubedim:(x+1)*self.xcubedim]\n # compress the cube\n npz = cube.toNPZ ()\n\n # add the cube to the database\n sql = \"INSERT INTO \" + self.proj.getTable(self.resolution) + \"(channel, zindex, cube) VALUES (%s, %s, %s)\"\n try:\n print sql\n #self.cursor.execute ( sql, (channel, key, npz))\n except MySQLdb.Error, e:\n print (\"Error updating data cube: %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n raise \n\n self.db.conn.commit()", "metadata": "root.MitraIngest.upload", "header": "['class', 'MitraIngest', ':', '___EOS___']", "index": 107 }, { "content": "def main():\n\n parser = argparse.ArgumentParser(description='Ingest a multi-channel tiff stack.')\n parser.add_argument('token', action=\"store\", help='Token for the project' )\n parser.add_argument('path', action=\"store\", help='Directory for the image files' )\n parser.add_argument('resolution', type=int, action=\"store\", help='Resolution of data' )\n parser.add_argument('channel', type=int, action=\"store\", help='Number of Channels' )\n\n result = parser.parse_args()\n\n mit = MitraIngest( result.token, result.path, result.resolution, result.channel )\n mit.ingest()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 143 } ]
[ { "span": "import cStringIO", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 16 }, { "span": "import urllib2", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 14 }, { "span": "import zlib", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 11 }, { "span": "import re", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 9 }, { "span": "import cv2", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 10 }, { "span": "import OCP.settings", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 19 }, { "span": "from django.conf import settings", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "PI", "L", " ", "import", " ", "Image_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cv2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "My", "SQL", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "+=_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "'../../", "django", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "OC", "P_", "._", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "OC", "P", ".", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "oc", "pca", "rest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zin", "dex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "image", "cube_", "\\u\\u\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mit", "ra", "Ing", "est_", ":_", "\\u\\u\\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_", "[SEP]_", "class_", "Mit", "ra", "Ing", "est_", ":_", "\\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_", ",_", "token_", ",_", "path_", ",_", "resolution_", ",_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolution_", "=_", "resolution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "db_", ",_", "self_", "._", "proj_", ",_", "self_", "._", "proj", "db_", "]_", "=_", "oc", "pca", "rest_", "._", "load", "DB", "Proj", "_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "xc", "ube", "dim_", ",_", "self_", "._", "yc", "ube", "dim_", ",_", "self_", "._", "zc", "ube", "dim_", ")_", "=_", "self_", "._", "proj_", "._", "dataset", "cfg_", "._", "cube", "dim_", "[_", "resolution_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "self_", "._", "starts", "lice", "_", ",_", "self_", "._", "ends", "lice", "_", ")_", "=_", "self_", "._", "proj_", "._", "dataset", "cfg_", "._", "slicer", "ange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch", "sz_", "=_", "self_", "._", "zc", "ube", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "channel_", "=_", "channel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "xim", "gs", "z_", "=_", "self_", "._", "proj_", "._", "dataset", "cfg_", "._", "images", "z_", "[_", "resolution_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yi", "mg", "sz_", "=_", "self_", "._", "proj_", "._", "dataset", "cfg_", "._", "images", "z_", "[_", "resolution_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cursor_", "=_", "self_", "._", "db_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mit", "ra", "Ing", "est_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "label_", "(_", "self_", ",_", "chan", "id_", ",_", "chans", "tr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Write", " ", "the", " ", "channel", " ", "label", "/", "string", " ", "associate", "d", " ", "with", " ", "the", " ", "channel", " ", "identifi", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "'", "INSERT", " ", "INT", "O", " ", "channel", "s", " ", "VALU", "ES", " ", "(", " ", "\\\\'{", "}\\\\'", ",", " ", "{}", " ", ")'_", "._", "format_", "(_", "chans", "tr_", ",_", "chan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cursor", ".", "execute", " ", "(", " ", "sql", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", " ", "updat", "ing", " ", "channel", "s", " ", "table", ":", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"_", "%_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mit", "ra", "Ing", "est_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ingest", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAME_", "=_", "[_", "\"", "Red", "\"_", ",_", "\"", "Green", "\"_", ",_", "\"", "Blue", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", ";_", "pdb_", "._", "set\\u", "trace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "label", " ", "by", " ", "RGB", " ", "Channel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "label_", "(_", "x_", ",_", "NAME_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sl_", "in_", "range_", "(_", "self_", "._", "starts", "lice", "_", ",_", "self_", "._", "ends", "lice", "_", "+_", "1_", ",_", "self_", "._", "batch", "sz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ima", "rray_", "=_", "np_", "._", "zeros_", "(_", "[_", "self_", "._", "batch", "sz_", ",_", "self_", "._", "\\u", "yi", "mg", "sz_", ",_", "self_", "._", "\\u", "xim", "gs", "z_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "b_", "in_", "range_", "(_", "self_", "._", "batch", "sz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "sl_", "+_", "b_", "<=_", "self_", "._", "ends", "lice", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raw", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filen", "m_", "=_", "self_", "._", "path_", "+_", "'{:", "0", ">", "4", "}'_", "._", "format_", "(_", "sl_", "+_", "b_", ")_", "+_", "'.", "tiff", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "the", " ", "image", " ", "and", " ", "check", " ", "the", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Open", "ing", " ", "filename", ":", " ", "\"_", "+_", "filen", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "Image_", "._", "open_", "(_", "filen", "m_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "data_", "=_", "np_", "._", "asarray_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ima", "rray_", "[_", "(_", "sl_", "+_", "b_", "-_", "self_", "._", "starts", "lice", "_", ")_", "%_", "self_", "._", "batch", "sz_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "img", "data_", "[_", ":_", ",_", ":_", ",_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ings", "et", " ", "any", " ", "rema", "inin", "g", " ", "slices_", "\\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_", "._", "upload_", "(_", "channel_", ",_", "sl_", ",_", "ima", "rray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mit", "ra", "Ing", "est_", ":_", "\\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_", "upload_", "(_", "self_", ",_", "channel_", ",_", "sl_", ",_", "ima", "rray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Transfer", " ", "the", " ", "array", " ", "to", " ", "the", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "limit", "s", " ", "of", " ", "iteration_", "\\u\\u\\uNL\\u\\u\\u_", "xlim", "it_", "=_", "(_", "self_", "._", "\\u", "xim", "gs", "z_", "-_", "1_", ")_", "/_", "self_", "._", "xc", "ube", "dim_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim", "it_", "=_", "(_", "self_", "._", "\\u", "yi", "mg", "sz_", "-_", "1_", ")_", "/_", "self_", "._", "yc", "ube", "dim_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "y_", "in_", "range_", "(_", "ylim", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "xlim", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "batch", " ", "is", " ", "the", " ", "last", " ", "slice", " ", "in", " ", "a", " ", "cube_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "sl_", "/_", "self_", "._", "zc", "ube", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "zin", "dex_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "zin", "dex_", "._", "XY", "ZM", "ort", "on_", "(_", "[_", "x_", ",_", "y_", ",_", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "channel", " ", "cube_", "\\u\\u\\uNL\\u\\u\\u_", "cube_", "=_", "image", "cube_", "._", "Image", "Cub", "e8", "_", "(_", "[_", "self_", "._", "xc", "ube", "dim_", ",_", "self_", "._", "yc", "ube", "dim_", ",_", "self_", "._", "zc", "ube", "dim_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", " ", "for", " ", "this", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "cube_", "._", "data_", "=_", "ima", "rray_", "[_", ":_", ",_", "y_", "*_", "self_", "._", "yc", "ube", "dim_", ":_", "(_", "y_", "+_", "1_", ")_", "*_", "self_", "._", "yc", "ube", "dim_", ",_", "x_", "*_", "self_", "._", "xc", "ube", "dim_", ":_", "(_", "x_", "+_", "1_", ")_", "*_", "self_", "._", "xc", "ube", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compress", " ", "the", " ", "cube_", "\\u\\u\\uNL\\u\\u\\u_", "np", "z_", "=_", "cube_", "._", "to", "NP", "Z_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "cube", " ", "to", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "\"_", "+_", "self_", "._", "proj_", "._", "get", "Table_", "(_", "self_", "._", "resolution_", ")_", "+_", "\"(", "channel", ",", " ", "zin", "dex", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cursor", ".", "execute", " ", "(", " ", "sql", ",", " ", "(", "channel", ",", " ", "key", ",", " ", "np", "z", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", " ", "updat", "ing", " ", "data", " ", "cube", ":", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"_", "%_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "db_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Ing", "est", " ", "a", " ", "multi", "-", "channel", " ", "tiff", " ", "stack", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "token", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Token", " ", "for", " ", "the", " ", "project", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "path", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Director", "y", " ", "for", " ", "the", " ", "image", " ", "files", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "resolu", "tion", "'_", ",_", "type_", "=_", "int_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Reso", "luti", "on", " ", "of", " ", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "channel", "'_", ",_", "type_", "=_", "int_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Number", " ", "of", " ", "Chan", "nels", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mit_", "=_", "Mit", "ra", "Ing", "est_", "(_", "result_", "._", "token_", ",_", "result_", "._", "path_", ",_", "result_", "._", "resolution_", ",_", "result_", "._", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mit_", "._", "ingest", "_", "(_", ")_", "\\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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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 ]
Variable defined multiple times
spulec/pep8ify/tests/fixtures/blank_lines/blank_lines1_in.py
[ { "content": "def a():\n pass", "metadata": "root.a", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def b():\n pass", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def b():\n pass", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def b(n):\n pass", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def a():\n pass", "metadata": "root.a", "header": "['module', '___EOS___']", "index": 45 } ]
[ { "span": "a(", "start_line": 0, "start_column": 4, "end_line": 0, "end_column": 5 }, { "span": "b(", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 5 }, { "span": "b(", "start_line": 19, "start_column": 4, "end_line": 19, "end_column": 5 }, { "span": "b(", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 5 }, { "span": "a(", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/db/user_post.py
[ { "content": "# Copyright 2012 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"UserPost relation.\n\nBy default, users have a relationship with photos that are contained\nwithin viewpoints they follow. By default, all photos contained in\nnon-public viewpoints are shown as part of the user's personal\ncollection. However, the user may want to hide certain of these photos\nfrom view. Inversely, the user may want to show public photos in his\npersonal view. This relation allows these kinds of per-user\ncustomization of photos.\n\nEach photo can be stamped with \"labels\" which describe the user-\nspecific customizations made to that photo. The name of each label\nis chosen so that \"is <name>\" makes sense.\n\n 'removed': the photo should not be shown in the user's personal\n collection, and will ultimately deleted from the\n server if no other references to it are held.\n\"\"\"\n\n__author__ = 'andy@emailscrubbed.com (Andy Kimball)'\n\nimport logging\nimport time\n\nfrom functools import partial\nfrom tornado import gen\nfrom viewfinder.backend.db import vf_schema\nfrom viewfinder.backend.db.base import DBObject\nfrom viewfinder.backend.db.range_base import DBRangeObject\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@DBObject.map_table_attributes\nclass UserPost(DBRangeObject):\n \"\"\"UserPost data object.\"\"\"\n __slots__ = []\n\n _table = DBObject._schema.GetTable(vf_schema.USER_POST)\n\n HIDDEN = 'hidden'\n", "metadata": "root.UserPost", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def IsHidden(self):\n \"\"\"Returns true if the photo has been hidden by the user so that it will not show in the\n personal library or conversation feed.\n \"\"\"\n return UserPost.HIDDEN in self.labels", "metadata": "root.UserPost.IsHidden", "header": "['class', 'UserPost', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 41 } ]
[ { "span": "import logging", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 14 }, { "span": "import time", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 11 }, { "span": "from functools import partial", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 29 }, { "span": "from tornado import gen", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "User", "Post", " ", "relation", ".", "\\", "10", ";", "\\", "10", ";", "By", " ", "default", ",", " ", "users", " ", "have", " ", "a", " ", "relation", "ship", " ", "with", " ", "photo", "s", " ", "tha", "t", " ", "are", " ", "contain", "ed", "\\", "10", ";", "within", " ", "view", "points", " ", "the", "y", " ", "follow", ".", " ", "By", " ", "default", ",", " ", "all", " ", "photo", "s", " ", "contain", "ed", " ", "in", "\\", "10", ";", "non", "-", "public", " ", "view", "points", " ", "are", " ", "shown", " ", "as", " ", "part", " ", "of", " ", "the", " ", "user", "'", "s", " ", "persona", "l", "\\", "10", ";", "collection", ".", " ", "Ho", "we", "ver", ",", " ", "the", " ", "user", " ", "may", " ", "want", " ", "to", " ", "hide", " ", "cert", "ain", " ", "of", " ", "these", " ", "photo", "s", "\\", "10", ";", "from", " ", "view", ".", " ", "Inv", "erse", "ly", ",", " ", "the", " ", "user", " ", "may", " ", "want", " ", "to", " ", "show", " ", "public", " ", "photo", "s", " ", "in", " ", "his", "\\", "10", ";", "persona", "l", " ", "view", ".", " ", "Thi", "s", " ", "relation", " ", "allow", "s", " ", "these", " ", "kinds", " ", "of", " ", "per", "-", "user", "\\", "10", ";", "customization", " ", "of", " ", "photo", "s", ".", "\\", "10", ";", "\\", "10", ";", "Ea", "ch", " ", "photo", " ", "can", " ", "be", " ", "stamp", "ed", " ", "with", " ", "\"", "labels", "\"", " ", "whi", "ch", " ", "descri", "be", " ", "the", " ", "user", "-", "\\", "10", ";", "specific", " ", "customization", "s", " ", "made", " ", "to", " ", "tha", "t", " ", "photo", ".", " ", "The", " ", "name", " ", "of", " ", "each", " ", "label", "\\", "10", ";", "is", " ", "chosen", " ", "so", " ", "tha", "t", " ", "\"", "is", " ", "<", "name", ">\"", " ", "make", "s", " ", "sense", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "'", "remove", "d", "':", " ", " ", "the", " ", "photo", " ", "shou", "ld", " ", "not", " ", "be", " ", "shown", " ", "in", " ", "the", " ", "user", "'", "s", " ", "persona", "l", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "collection", ",", " ", "and", " ", "will", " ", "ultima", "tel", "y", " ", "delete", "d", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "server", " ", "if", " ", "no", " ", "other", " ", "reference", "s", " ", "to", " ", "it", " ", "are", " ", "hel", "d", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "and", "y", "@", "email", "scrub", "bed", ".", "com", " ", "(", "And", "y", " ", "Ki", "mba", "ll", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "vf", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "base_", "import_", "DB", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "range", "\\u", "base_", "import_", "DB", "Range", "Object_", "\\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_", "@_", "DB", "Object_", "._", "map", "\\u", "table", "\\u", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "User", "Post_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "User", "Post", " ", "data", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "table_", "=_", "DB", "Object_", "._", "\\u", "schema_", "._", "Get", "Table_", "(_", "vf", "\\u", "schema_", "._", "USER", "\\u", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HIDDEN", "_", "=_", "'", "hidden", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Post_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Is", "Hidden_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "true", " ", "if", " ", "the", " ", "photo", " ", "has", " ", "bee", "n", " ", "hidden", " ", "by", " ", "the", " ", "user", " ", "so", " ", "tha", "t", " ", "it", " ", "will", " ", "not", " ", "show", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "persona", "l", " ", "librar", "y", " ", "or", " ", "conversation", " ", "feed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "User", "Post_", "._", "HIDDEN", "_", "in_", "self_", "._", "labels_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
uei/deel/deel/network/alexnet.py
[ { "content": "\t\nimport chainer.functions as F\nimport chainer.links as L\nfrom chainer import Variable\nfrom chainer.links import caffe\nfrom chainer import computational_graph as c\nfrom deel.tensor import *\nfrom deel.network import *\nimport copy\n\nfrom deel import *\nimport deel.network\nimport chainer\nimport json\nimport os\nimport multiprocessing\nimport threading\nimport time\nimport six\nimport numpy as np\nimport os.path\nfrom PIL import Image\nfrom six.moves import queue\nimport pickle\nimport hashlib\nimport datetime\nimport sys\nimport random\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AlexNet(ImageNet):\n\n\t\t\t\t\n\n\n\n\t\t\t\t\n\n", "metadata": "root.AlexNet", "header": "['module', '___EOS___']", "index": 29 }, { "content": "\tdef __init__(self, model='bvlc_alexnet.caffemodel',mean='misc/ilsvrc_2012_mean.npy',labels='misc/labels.txt',optimizer=None):\n\t\tsuper(AlexNet,self).__init__('AlexNet',in_size=227)\n\n\n\t\tself.func = LoadCaffeModel(model)\n\t\tself.labels = np.loadtxt(labels, str, delimiter=\"\\t\")\n\n\t\tif Deel.gpu >= 0:\n\t\t\tcuda.check_cuda_available()\n\n\n\t\tif Deel.gpu >= 0:\n\t\t\tcuda.get_device(self.gpu).use()\n\t\t\tself.func.to_gpu()\n\n\t\t#ImageNet.mean_image = np.load(mean)\n\t\tmean_image = np.load(mean)\n\t\tImageNet.mean_image=mean_image\n\t\t\n\t\tcropwidth = 256 - self.in_size\n\t\tstart = cropwidth // 2\n\t\tstop = start + self.in_size\n\t\tself.mean_image = mean_image[:, start:stop, start:stop].copy()\n\t\t#del self.func.layers[15:23] \n\t\t#self.outname = 'pool5'\n\n\t\tself.batchsize = 1\n\t\tself.x_batch = np.ndarray((self.batchsize, 3, self.in_size, self.in_size), dtype=np.float32)", "metadata": "root.AlexNet.__init__", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 30 }, { "content": "\tdef forward(self, x,layer='fc8'):\n\t\ty, = self.func(inputs={'data': x}, outputs=[layer], train=False)\n\t\treturn y", "metadata": "root.AlexNet.forward", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 59 }, { "content": "\tdef predict(self, x,layer='fc8'):\n\t\ty, = self.func(inputs={'data': x}, outputs=[layer], train=False)\n\t\treturn F.softmax(y)", "metadata": "root.AlexNet.predict", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 63 }, { "content": "\tdef classify(self,x=None):\n\t\tif x is None:\n\t\t\tx=Tensor.context\n\n\t\tif not isinstance(x,ImageTensor):\n\t\t\tx=self.Input(x)\n\n\t\t_x = Variable(x.value, volatile=True)\n\t\tresult = self.predict(_x)\n\t\tresult = Variable(result.data) #Unchain \n\t\tt = ChainerTensor(result)\n\t\tt.owner=self\n\t\tt.use()\n\n\t\treturn t", "metadata": "root.AlexNet.classify", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 68 }, { "content": "\tdef layerDim(self, layer='fc8'):\n\t\timage = self.Input('deel.png').value\n\t\tself.x_batch[0] = image\n\t\txp = Deel.xp\n\t\tx_data = xp.asarray(self.x_batch)\n\t\tx = chainer.Variable(x_data, volatile=True)\n\n\t\ty, = self.func(inputs={'data': x}, outputs=[layer], train=False)\n\n\t\treturn y.data.shape", "metadata": "root.AlexNet.layerDim", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 84 }, { "content": "\tdef feature(self, x,layer=u'pool5'):\n\t\tif x is None:\n\t\t\tx=Tensor.context\n\t\tif not isinstance(x,ImageTensor):\n\t\t\tx=self.Input(x)\n\n\t\timage = x.value\n\n\t\tself.x_batch[0] = image\n\t\txp = Deel.xp\n\t\tx_data = xp.asarray(self.x_batch)\n\n\t\tif Deel.gpu >= 0:\n\t\t\tx_data=cuda.to_gpu(x_data)\n\t\t\n\t\tx = chainer.Variable(x_data, volatile=True)\n\t\tscore = self.forward(x,layer=layer)\n\n\t\tif Deel.gpu >= 0:\n\t\t\tscore=cuda.to_cpu(score.data)\n\t\t\tdim = getDim(score.shape)\n\t\t\tscore = score.reshape(dim)\n\t\telse:\n\t\t\tdim = getDim(score.data.shape)\n\t\t\tscore = score.data.reshape(dim)\n\t\t\n\t\tscore = chainer.Variable(score*255.0, volatile=True)\n\n\t\tt = ChainerTensor(score)\n\t\tt.owner=self\n\t\tt.use()\n\n\n\t\treturn t", "metadata": "root.AlexNet.feature", "header": "['class', 'AlexNet', '(', 'ImageNet', ')', ':', '___EOS___']", "index": 97 } ]
[ { "span": "import chainer.links as L", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 25 }, { "span": "from chainer.links import caffe", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 31 }, { "span": "from chainer import computational_graph as c", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 44 }, { "span": "import copy", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 11 }, { "span": "import deel.network", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 19 }, { "span": "import json", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 11 }, { "span": "import os", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import multiprocessing", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 22 }, { "span": "import threading", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 16 }, { "span": "import time", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 }, { "span": "import six", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 10 }, { "span": "import os.path", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 14 }, { "span": "from PIL import Image", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 21 }, { "span": "from six.moves import queue", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 27 }, { "span": "import pickle", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 13 }, { "span": "import hashlib", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 14 }, { "span": "import datetime", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 15 }, { "span": "import sys", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 10 }, { "span": "import random", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "chainer_", "._", "functions_", "as_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "._", "links_", "as_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "import_", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "._", "links_", "import_", "caffe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "import_", "computation", "al", "\\u", "graph_", "as_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dee", "l_", "._", "tensor_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dee", "l_", "._", "network_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dee", "l_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dee", "l_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\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_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", "=_", "'", "bv", "lc", "\\u", "alex", "net", ".", "caffe", "model", "'_", ",_", "mean_", "=_", "'", "misc", "/", "il", "sv", "rc", "\\u", "2012", "\\u", "mean", ".", "npy", "'_", ",_", "labels_", "=_", "'", "misc", "/", "labels", ".", "txt", "'_", ",_", "optimizer_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "super_", "(_", "Alex", "Net_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "'", "Alex", "Net", "'_", ",_", "in", "\\u", "size_", "=_", "227_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "func_", "=_", "Load", "Ca", "ffe", "Model_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "labels_", "=_", "np_", "._", "loadtxt_", "(_", "labels_", ",_", "str_", ",_", "delimiter_", "=_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cuda_", "._", "check", "\\u", "cud", "a", "\\u", "available_", "(_", ")_", "\\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_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cuda_", "._", "get", "\\u", "device_", "(_", "self_", "._", "gpu_", ")_", "._", "use_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "to", "\\u", "gpu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Image", "Net", ".", "mean", "\\u", "image", " ", "=", " ", "np", ".", "load", "(", "mean", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "image_", "=_", "np_", "._", "load_", "(_", "mean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Image", "Net_", "._", "mean", "\\u", "image_", "=_", "mean", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "crop", "width_", "=_", "256_", "-_", "self_", "._", "in", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "crop", "width_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop_", "=_", "start_", "+_", "self_", "._", "in", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "mean", "\\u", "image_", "[_", ":_", ",_", "start_", ":_", "stop_", ",_", "start_", ":_", "stop_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "del", " ", "self", ".", "func", ".", "layer", "s", "[", "15", ":", "23", "]", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "out", "name", " ", "=", " ", "'", "pool", "5", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "batchsize", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "x", "\\u", "batch_", "=_", "np_", "._", "ndarray_", "(_", "(_", "self_", "._", "batchsize", "_", ",_", "3_", ",_", "self_", "._", "in", "\\u", "size_", ",_", "self_", "._", "in", "\\u", "size_", ")_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forward_", "(_", "self_", ",_", "x_", ",_", "layer_", "=_", "'", "fc", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "y_", ",_", "=_", "self_", "._", "func_", "(_", "inputs_", "=_", "{_", "'", "data", "'_", ":_", "x_", "}_", ",_", "outputs_", "=_", "[_", "layer_", "]_", ",_", "train_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "x_", ",_", "layer_", "=_", "'", "fc", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "y_", ",_", "=_", "self_", "._", "func_", "(_", "inputs_", "=_", "{_", "'", "data", "'_", ":_", "x_", "}_", ",_", "outputs_", "=_", "[_", "layer_", "]_", ",_", "train_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "F_", "._", "softmax_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "classify_", "(_", "self_", ",_", "x_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "Tensor_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "x_", ",_", "Image", "Tensor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "self_", "._", "Input_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "x_", "=_", "Variable_", "(_", "x_", "._", "value_", ",_", "volatile", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "predict_", "(_", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Variable_", "(_", "result_", "._", "data_", ")_", "#", "Unc", "hain", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "Chain", "er", "Tensor_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "owner_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "use_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "layer", "Dim_", "(_", "self_", ",_", "layer_", "=_", "'", "fc", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "image_", "=_", "self_", "._", "Input_", "(_", "'", "dee", "l", ".", "png", "'_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "x", "\\u", "batch_", "[_", "0_", "]_", "=_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp_", "=_", "De", "el_", "._", "xp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "data_", "=_", "xp_", "._", "asarray_", "(_", "self_", "._", "x", "\\u", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "chainer_", "._", "Variable_", "(_", "x", "\\u", "data_", ",_", "volatile", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", ",_", "=_", "self_", "._", "func_", "(_", "inputs_", "=_", "{_", "'", "data", "'_", ":_", "x_", "}_", ",_", "outputs_", "=_", "[_", "layer_", "]_", ",_", "train_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "y_", "._", "data_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alex", "Net_", "(_", "Image", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feature_", "(_", "self_", ",_", "x_", ",_", "layer_", "=_", "u", "'", "pool", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "Tensor_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "x_", ",_", "Image", "Tensor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "self_", "._", "Input_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image_", "=_", "x_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "x", "\\u", "batch_", "[_", "0_", "]_", "=_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp_", "=_", "De", "el_", "._", "xp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "data_", "=_", "xp_", "._", "asarray_", "(_", "self_", "._", "x", "\\u", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x", "\\u", "data_", "=_", "cuda_", "._", "to", "\\u", "gpu_", "(_", "x", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "chainer_", "._", "Variable_", "(_", "x", "\\u", "data_", ",_", "volatile", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "self_", "._", "forward_", "(_", "x_", ",_", "layer_", "=_", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "score_", "=_", "cuda_", "._", "to", "\\u", "cpu_", "(_", "score_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim_", "=_", "get", "Dim_", "(_", "score_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "score_", "._", "reshape_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "dim_", "=_", "get", "Dim_", "(_", "score_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "score_", "._", "data_", "._", "reshape_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "score_", "=_", "chainer_", "._", "Variable_", "(_", "score_", "*_", "255.0_", ",_", "volatile", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Chain", "er", "Tensor_", "(_", "score_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "owner_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "use_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 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 ]
Imprecise assert
nii-cloud/dodai-compute/nova/tests/api/openstack/test_extensions.py
[ { "content": " def test_invalid_extensions(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n ext_mgr = ext_midware.ext_mgr\n ext_mgr.add_extension(InvalidExtension())\n self.assertTrue('FOXNSOX' in ext_mgr.extensions)\n self.assertTrue('THIRD' not in ext_mgr.extensions)", "metadata": "root.ExtensionManagerTest.test_invalid_extensions", "header": "['class', 'ExtensionManagerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 266 } ]
[ { "span": "self.assertTrue('FOXNSOX' in ext_mgr.extensions)", "start_line": 271, "start_column": 8, "end_line": 271, "end_column": 56 }, { "span": "self.assertTrue('THIRD' not in ext_mgr.extensions)", "start_line": 272, "start_column": 8, "end_line": 272, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Ext", "ensi", "on", "Manager", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "extensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mgr_", "=_", "ext", "\\u", "mid", "ware_", "._", "ext", "\\u", "mgr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mgr_", "._", "add", "\\u", "extension_", "(_", "Inva", "lid", "Extension_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "FO", "XN", "SO", "X", "'_", "in_", "ext", "\\u", "mgr_", "._", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "THI", "RD", "'_", "not_", "in_", "ext", "\\u", "mgr_", "._", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Imprecise assert
django/django/tests/template_tests/test_origin.py
[ { "content": " def test_origin_compares_equal(self):\n a = self.engine.get_template('index.html')\n b = self.engine.get_template('index.html')\n self.assertEqual(a.origin, b.origin)\n self.assertTrue(a.origin == b.origin)\n self.assertFalse(a.origin != b.origin)", "metadata": "root.OriginTestCase.test_origin_compares_equal", "header": "['class', 'OriginTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test_origin_compares_not_equal(self):\n a = self.engine.get_template('first/test.html')\n b = self.engine.get_template('second/test.html')\n self.assertNotEqual(a.origin, b.origin)\n self.assertFalse(a.origin == b.origin)\n self.assertTrue(a.origin != b.origin)", "metadata": "root.OriginTestCase.test_origin_compares_not_equal", "header": "['class', 'OriginTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "self.assertTrue(a.origin == b.origin)", "start_line": 15, "start_column": 8, "end_line": 15, "end_column": 45 }, { "span": "self.assertFalse(a.origin != b.origin)", "start_line": 16, "start_column": 8, "end_line": 16, "end_column": 46 }, { "span": "self.assertFalse(a.origin == b.origin)", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 46 }, { "span": "self.assertTrue(a.origin != b.origin)", "start_line": 23, "start_column": 8, "end_line": 23, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Orig", "in", "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", "orig", "in", "\\u", "compare", "s", "\\u", "equal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "engine_", "._", "get", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "self_", "._", "engine_", "._", "get", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "origin_", ",_", "b_", "._", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "._", "origin_", "==_", "b_", "._", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "a_", "._", "origin_", "!=_", "b_", "._", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Orig", "in", "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", "orig", "in", "\\u", "compare", "s", "\\u", "not", "\\u", "equal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "engine_", "._", "get", "\\u", "template_", "(_", "'", "first", "/", "test", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "self_", "._", "engine_", "._", "get", "\\u", "template_", "(_", "'", "second", "/", "test", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "a_", "._", "origin_", ",_", "b_", "._", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "a_", "._", "origin_", "==_", "b_", "._", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "._", "origin_", "!=_", "b_", "._", "origin_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Nested loops with same variable
chinoogawa/fbht/mainFunc.py
[ { "content": "def massMessage(page,message):\n import random\n \n massLoginTest()\n \n if len(cookieArray) == 0:\n print 'First you must create accounts: option 1) '\n return\n \n pageID = getUserID(page)\n \n for i in range(len(cookieArray)):\n try:\n cj._cookies = cookieArray[i]\n c_user = getC_user()\n print str(c_user)+'\\n'\n \n numero = ''\n numero2 = ''\n for i in range(10):\n numero += str(random.randrange(0,10))\n for i in range(10):\n numero2 += str(random.randrange(0,10))\n \n fb_dtsg = set_dtsg()\n if (fb_dtsg == 0):\n print 'ERROR MOTHER FUCKER -_-'\n arguments = {\n 'message_batch[0][action_type]' : 'ma-type:user-generated-message',\n 'message_batch[0][author]' : 'fbid:'+c_user,\n 'message_batch[0][timestamp]' : '1401416840784',\n 'message_batch[0][timestamp_absolute]' : 'Today',\n 'message_batch[0][timestamp_relative]' : '11:27pm',\n 'message_batch[0][timestamp_time_passed]' : '0',\n 'message_batch[0][is_unread]' : 'false',\n 'message_batch[0][is_cleared]' : 'false',\n 'message_batch[0][is_forward]' : 'false',\n 'message_batch[0][is_filtered_content]' : 'false',\n 'message_batch[0][is_spoof_warning]' : 'false',\n 'message_batch[0][source]' : 'source:titan:web',\n 'message_batch[0][body]' : message,\n 'message_batch[0][has_attachment]' : 'false',\n 'message_batch[0][html_body]' : 'false',\n 'message_batch[0][specific_to_list][0]' : 'fbid:'+pageID,\n 'message_batch[0][specific_to_list][1]' : 'fbid:'+c_user,\n 'message_batch[0][force_sms]' : 'true',\n 'message_batch[0][ui_push_phase]' : 'V3',\n 'message_batch[0][status]' : '0',\n 'message_batch[0][message_id]' : '<1401416840784:'+numero+'-'+numero2+'@mail.projektitan.com>',\n '''<1401416840784:554304545-874733751@mail.projektitan.com>','''\n 'message_batch[0][client_thread_id]' : 'user:'+pageID,\n 'client' : 'mercury',\n '__user' : c_user,\n '__a' : '1',\n '__dyn' : '7n8ajEAMCBynUKt2u6aOGeExEW9ACxO4pbGA8AGGBy6C-Cu6popDFp4qu',\n '__req' : 'q',\n 'fb_dtsg' : fb_dtsg,\n 'ttstamp' : '26581697273111715585898748',\n '__rev' : '1268876'\n }\n \n datos = urlencode(arguments)\n response = br.open('https://www.facebook.com/ajax/mercury/send_messages.php',datos)\n \n if globalLogging:\n logs(response.read())\n \n except mechanize.HTTPError as e:\n print e.code\n except mechanize.URLError as e:\n print e.reason.args \n \n except:\n logs('Error en el modulo de massMessage()')\n print 'Error en el modulo de massMessage()\\n'", "metadata": "root.massMessage", "header": "['module', '___EOS___']", "index": 2587 } ]
[ { "span": "for i in range(10):", "start_line": 2606, "start_column": 12, "end_line": 2606, "end_column": 31 }, { "span": "for i in range(10):", "start_line": 2608, "start_column": 12, "end_line": 2608, "end_column": 31 } ]
[ { "span": "for i in range(len(cookieArray)):", "start_line": 2598, "start_column": 4, "end_line": 2598, "end_column": 37 } ]
1
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "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_", "mass", "Message_", "(_", "page_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mass", "Logi", "n", "Test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "cookie", "Array_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Fi", "rst", " ", "you", " ", "must", " ", "create", " ", "account", "s", ":", " ", "option", " ", "1", ")", " ", "'_", "\\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_", "page", "ID_", "=_", "get", "User", "ID_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "cookie", "Array_", ")_", ")_", ":_", "\\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 ", " _", "cj_", "._", "\\u", "cookies_", "=_", "cookie", "Array_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "user_", "=_", "get", "C", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "str_", "(_", "c\\u", "user_", ")_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numero_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numero", "2_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numero_", "+=_", "str_", "(_", "random_", "._", "randrange_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numero", "2_", "+=_", "str_", "(_", "random_", "._", "randrange_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fb", "\\u", "dt", "sg_", "=_", "set\\u", "dt", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fb", "\\u", "dt", "sg_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", " ", "MOT", "HER", " ", "FU", "CK", "ER", " ", "-\\u", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "action", "\\u", "type", "]'_", ":_", "'", "ma", "-", "type", ":", "user", "-", "generat", "ed", "-", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "author", "]'_", ":_", "'", "fb", "id", ":'_", "+_", "c\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "timestamp", "]'_", ":_", "'", "140", "141", "684", "078", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "timestamp", "\\u", "abs", "olute", "]'_", ":_", "'", "Today", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "timestamp", "\\u", "relative", "]'_", ":_", "'", "11", ":", "2", "7", "pm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "timestamp", "\\u", "time", "\\u", "pass", "ed", "]'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "is", "\\u", "unread", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "is", "\\u", "clear", "ed", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "is", "\\u", "forward", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "is", "\\u", "filter", "ed", "\\u", "content", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "is", "\\u", "spoo", "f", "\\u", "warn", "ing", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "source", "]'_", ":_", "'", "source", ":", "titan", ":", "web", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "body", "]'_", ":_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "has", "\\u", "attach", "ment", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "html", "\\u", "body", "]'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "specific", "\\u", "to", "\\u", "list", "][", "0", "]'_", ":_", "'", "fb", "id", ":'_", "+_", "page", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "specific", "\\u", "to", "\\u", "list", "][", "1", "]'_", ":_", "'", "fb", "id", ":'_", "+_", "c\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "force", "\\u", "sms", "]'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "ui", "\\u", "push", "\\u", "phase", "]'_", ":_", "'", "V3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "status", "]'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "message", "\\u", "id", "]'_", ":_", "'<", "140", "141", "684", "078", "4", ":'_", "+_", "numero_", "+_", "'-'_", "+_", "numero", "2_", "+_", "'@", "mail", ".", "proje", "kti", "tan", ".", "com", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "<", "140", "141", "684", "078", "4", ":", "554", "304", "545", "-", "874", "733", "751", "@", "mail", ".", "proje", "kti", "tan", ".", "com", ">'", ",'", "''_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "\\u", "batch", "[", "0", "][", "client", "\\u", "thread", "\\u", "id", "]'_", ":_", "'", "user", ":'_", "+_", "page", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "'_", ":_", "'", "mercur", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "user", "'_", ":_", "c\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "a", "'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "dyn", "'_", ":_", "'", "7", "n", "8a", "j", "EA", "MC", "By", "n", "UK", "t2", "u", "6a", "OG", "e", "Ex", "EW", "9", "AC", "x", "O", "4", "pb", "GA", "8", "AGG", "By", "6", "C", "-", "Cu", "6", "pop", "DF", "p4", "qu", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "req", "'_", ":_", "'", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fb", "\\u", "dt", "sg", "'_", ":_", "fb", "\\u", "dt", "sg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tts", "tamp", "'_", ":_", "'", "265", "816", "972", "731", "1171", "558", "589", "874", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "rev", "'_", ":_", "'", "126", "887", "6", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datos_", "=_", "urlencode_", "(_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "br_", "._", "open_", "(_", "'", "https", "://", "www", ".", "facebook", ".", "com", "/", "aja", "x", "/", "mercur", "y", "/", "send", "\\u", "message", "s", ".", "php", "'_", ",_", "datos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "global", "Logging_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logs_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\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_", "mechani", "ze_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "mechani", "ze_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "._", "reason_", "._", "args_", "\\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 ", " _", "logs_", "(_", "'", "Error", " ", "en", " ", "el", " ", "modulo", " ", "de", " ", "mass", "Messag", "e", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Error", " ", "en", " ", "el", " ", "modulo", " ", "de", " ", "mass", "Messag", "e", "()", "\\\\", "n", "'_", "\\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, 3, 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, 0, 1, 1, 1, 1, 1, 1, 1, 2,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