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 local variable
mardix/flask-cloudy/tests/test_cloudy.py
[ { "content": "def test_container():\n storage = app_storage()\n assert isinstance(storage.container, Container)", "metadata": "root.test_container", "header": "['module', '___EOS___']", "index": 60 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "container_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", "=_", "app", "\\u", "storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "storage_", "._", "container_", ",_", "Container_", ")_", "\\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 ]
Comparison of constants
PyHDI/Pyverilog/pyverilog/ast_code_generator/codegen.py
[ { "content": " def visit_IfStatement(self, node):\n filename = getfilename(node)\n template = self.get_template(filename)\n true_statement = '' if node.true_statement is None else self.visit(node.true_statement)\n false_statement = '' if node.false_statement is None else self.visit(node.false_statement)\n template_dict = {\n 'cond' : del_paren(self.visit(node.cond)),\n 'true_statement' : true_statement,\n 'false_statement' : false_statement,\n }\n rslt = template.render(template_dict)\n return rslt", "metadata": "root.ASTCodeGenerator.visit_IfStatement", "header": "['class', 'ASTCodeGenerator', '(', 'ConvertVisitor', ')', ':', '___EOS___']", "index": 712 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "AST", "Code", "Generator_", "(_", "Convert", "Visitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "\\u", "If", "Statement_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "getfile", "name_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "self_", "._", "get", "\\u", "template_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "true", "\\u", "statement_", "=_", "''_", "if_", "node_", "._", "true", "\\u", "statement_", "is_", "None_", "else_", "self_", "._", "visit_", "(_", "node_", "._", "true", "\\u", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fal", "se", "\\u", "statement_", "=_", "''_", "if_", "node_", "._", "fal", "se", "\\u", "statement_", "is_", "None_", "else_", "self_", "._", "visit_", "(_", "node_", "._", "fal", "se", "\\u", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cond", "'_", ":_", "del", "\\u", "paren", "_", "(_", "self_", "._", "visit_", "(_", "node_", "._", "cond_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "true", "\\u", "statem", "ent", "'_", ":_", "true", "\\u", "statement_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fal", "se", "\\u", "statem", "ent", "'_", ":_", "fal", "se", "\\u", "statement_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsl", "t_", "=_", "template_", "._", "render_", "(_", "template", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rsl", "t_", "\\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 ]
Unreachable code
girder/girder/girder/models/assetstore.py
[ { "content": " def getCurrent(self):\n \"\"\"\n Returns the current assetstore. If none exists, this will raise a 500\n exception.\n \"\"\"\n current = self.findOne({'current': True})\n if current is None:\n raise GirderException(\n 'No current assetstore is set.',\n 'girder.model.assetstore.no-current-assetstore')\n\n return current", "metadata": "root.Assetstore.getCurrent", "header": "['class', 'Assetstore', '(', 'Model', ')', ':', '___EOS___']", "index": 154 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Asset", "store_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Current_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "current", " ", "asset", "store", ".", " ", "If", " ", "none", " ", "exist", "s", ",", " ", "this", " ", "will", " ", "raise", " ", "a", " ", "500", "\\", "10", ";", " ", " ", " ", " ", "exception", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "=_", "self_", "._", "find", "One_", "(_", "{_", "'", "current", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gir", "der", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "current", " ", "asset", "store", " ", "is", " ", "set", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "girder", ".", "model", ".", "asset", "store", ".", "no", "-", "current", "-", "asset", "store", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "current_", "\\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 ]
Unused local variable
graphql-python/graphql-core/tests/core_execution/test_middleware.py
[ { "content": "def test_merge_resolver_to_untagged_target():\n a = lambda: None\n b = lambda: None\n\n tag_resolver(a, 'test')\n merge_resolver_tags(a, b)\n\n assert resolver_has_tag(b, 'test')", "metadata": "root.test_merge_resolver_to_untagged_target", "header": "['module', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge", "\\u", "resolver", "\\u", "to", "\\u", "unta", "gged", "\\u", "target_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "lambda_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "lambda_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "\\u", "resolver_", "(_", "a_", ",_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "\\u", "resolver", "\\u", "tags_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "resolver", "\\u", "has", "\\u", "tag_", "(_", "b_", ",_", "'", "test", "'_", ")_" ]
[ 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 ]
Unused import
torchbox/wagtail/wagtail/tests/snippets/apps.py
[ { "content": "from __future__ import absolute_import, unicode_literals\n\nfrom django.apps import AppConfig\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WagtailSnippetsTestsAppConfig(AppConfig):\n name = 'wagtail.tests.snippets'\n label = 'snippetstests'\n verbose_name = \"Wagtail snippets tests\"", "metadata": "root.WagtailSnippetsTestsAppConfig", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "apps_", "import_", "App", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Wa", "gta", "il", "Snippet", "s", "Test", "s", "App", "Config_", "(_", "App", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "wagtail", ".", "tests", ".", "snippet", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "'", "snippet", "ste", "sts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Wa", "gta", "il", " ", "snippet", "s", " ", "tests", "\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 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 ]
Comparison of constants
openstack/compass-core/bin/client.py
[ { "content": " def get_installing_progress(self, cluster_id):\n \"\"\"get intalling progress.\"\"\"\n action_timeout = time.time() + 60 * float(CONF.action_timeout)\n deployment_timeout = time.time() + 60 * float(\n CONF.deployment_timeout)\n\n current_time = time.time()\n deployment_failed = True\n while current_time < deployment_timeout:\n status, cluster_state = self.client.get_cluster_state(cluster_id)\n LOG.info(\n 'get cluster %s state status %s: %s',\n cluster_id, status, cluster_state\n )\n if not self.is_ok(status):\n raise RuntimeError(\"can not get cluster state\")\n\n if cluster_state['state'] in ['UNINITIALIZED', 'INITIALIZED']:\n if current_time >= action_timeout:\n deployment_failed = True\n break\n else:\n continue\n\n elif cluster_state['state'] == 'SUCCESSFUL':\n deployment_failed = False\n break\n elif cluster_state['state'] == 'ERROR':\n deployment_failed = True\n break\n\n if deployment_failed:\n raise RuntimeError(\"deploy cluster failed\")", "metadata": "root.CompassClient.get_installing_progress", "header": "['class', 'CompassClient', '(', 'object', ')', ':', '___EOS___']", "index": 924 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Compa", "ss", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "install", "ing", "\\u", "progress_", "(_", "self_", ",_", "cluster", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", " ", "inta", "llin", "g", " ", "progress", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "timeout_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "60_", "*_", "float_", "(_", "CONF_", "._", "action", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "timeout_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "60_", "*_", "float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "._", "deploy", "ment", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "current", "\\u", "time_", "<_", "deploy", "ment", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", ",_", "cluster", "\\u", "state_", "=_", "self_", "._", "client_", "._", "get", "\\u", "cluster", "\\u", "state_", "(_", "cluster", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", " ", "cluster", " ", "%", "s", " ", "state", " ", "status", " ", "%", "s", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", ",_", "status_", ",_", "cluster", "\\u", "state_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "ok_", "(_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "can", " ", "not", " ", "get", " ", "cluster", " ", "state", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cluster", "\\u", "state_", "[_", "'", "state", "'_", "]_", "in_", "[_", "'", "UNI", "NIT", "IAL", "IZED", "'_", ",_", "'", "INITIAL", "IZED", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "current", "\\u", "time_", ">=_", "action", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "deploy", "ment", "\\u", "failed_", "=_", "True_", "\\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 ", " ", "_", "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_", "elif_", "cluster", "\\u", "state_", "[_", "'", "state", "'_", "]_", "==_", "'", "SUCCESS", "FU", "L", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "failed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cluster", "\\u", "state_", "[_", "'", "state", "'_", "]_", "==_", "'", "ERROR", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_",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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 ]
Unused import
dimagi/commcare-hq/custom/ilsgateway/tests/handlers/stockout.py
[ { "content": "from datetime import datetime\n\nfrom casexml.apps.stock.models import StockTransaction\nfrom corehq.apps.commtrack.models import StockState\nfrom corehq.util.translation import localize\nfrom custom.ilsgateway.tanzania.reminders import SOH_CONFIRM, STOCKOUT_CONFIRM, STOCKOUT_HELP\nfrom custom.ilsgateway.tests.handlers.utils import ILSTestScript\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestStockout(ILSTestScript):\n", "metadata": "root.TestStockout", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test_stockout(self):\n with localize('sw'):\n response1 = unicode(SOH_CONFIRM)\n response2 = unicode(STOCKOUT_CONFIRM)\n response3 = unicode(STOCKOUT_HELP)\n\n supply_point_id = self.loc1.sql_location.supply_point_id\n\n script = \"\"\"\n 5551234 > Hmk Id 400 Dp 569 Ip 678\n 5551234 < %(soh_confirm)s\n \"\"\" % {\"soh_confirm\": response1}\n self.run_script(script)\n self.assertEqual(StockTransaction.objects.filter(case_id=self.facility_sp_id).count(), 3)\n self.assertEqual(StockState.objects.filter(case_id=self.facility_sp_id).count(), 3)\n\n script = \"\"\"\n 5551234 > hakuna\n 5551234 < {}\n \"\"\".format(response3)\n self.run_script(script)\n\n quantities = [400, 569, 678]\n for (idx, stock_transaction) in enumerate(StockTransaction.objects.all().order_by('pk')):\n self.assertEqual(stock_transaction.case_id, supply_point_id)\n self.assertEqual(stock_transaction.stock_on_hand, quantities[idx])\n now = datetime.utcnow()\n script = \"\"\"\n 5551234 > stockout id dp ip\n 5551234 < {}\n \"\"\".format(response2 % {\n \"contact_name\": self.user1.full_name,\n \"product_names\": \"id dp ip\",\n \"facility_name\": self.loc1.name\n })\n self.run_script(script)\n\n for stock_transaction in StockTransaction.objects.filter(report__date__gte=now):\n self.assertEqual(stock_transaction.case_id, supply_point_id)\n self.assertEqual(stock_transaction.stock_on_hand, 0)", "metadata": "root.TestStockout.test_stockout", "header": "['class', 'TestStockout', '(', 'ILSTestScript', ')', ':', '___EOS___']", "index": 11 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "stock_", "._", "models_", "import_", "Stock", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "comm", "track_", "._", "models_", "import_", "Stock", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "translation_", "import_", "localize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "il", "sg", "ate", "way_", "._", "tan", "zan", "ia_", "._", "reminder", "s_", "import_", "SO", "H", "\\u", "CONFIRM", "_", ",_", "STO", "CK", "OUT", "\\u", "CONFIRM", "_", ",_", "STO", "CK", "OUT", "\\u", "HELP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "il", "sg", "ate", "way_", "._", "tests_", "._", "handlers_", "._", "utils_", "import_", "IL", "ST", "est", "Script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Stock", "out_", "(_", "IL", "ST", "est", "Script_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Stock", "out_", "(_", "IL", "ST", "est", "Script_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "stock", "out_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "localize_", "(_", "'", "sw", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "1_", "=_", "unicode_", "(_", "SO", "H", "\\u", "CONFIRM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "2_", "=_", "unicode_", "(_", "STO", "CK", "OUT", "\\u", "CONFIRM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "3_", "=_", "unicode_", "(_", "STO", "CK", "OUT", "\\u", "HELP_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "supply", "\\u", "point", "\\u", "id_", "=_", "self_", "._", "loc", "1_", "._", "sql", "\\u", "location_", "._", "supply", "\\u", "point", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", ">", " ", "Hm", "k", " ", "Id", " ", "400", " ", "Dp", " ", "569", " ", "Ip", " ", "678", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", "<", " ", "%", "(", "so", "h", "\\u", "confirm", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "{_", "\"", "so", "h", "\\u", "confirm", "\"_", ":_", "response", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "script_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Stock", "Transaction_", "._", "objects_", "._", "filter_", "(_", "case", "\\u", "id_", "=_", "self_", "._", "facilit", "y", "\\u", "sp", "\\u", "id_", ")_", "._", "count_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Stock", "State_", "._", "objects_", "._", "filter_", "(_", "case", "\\u", "id_", "=_", "self_", "._", "facilit", "y", "\\u", "sp", "\\u", "id_", ")_", "._", "count_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", ">", " ", "ha", "kun", "a", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", "<", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "format_", "(_", "response", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "script_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quantities", "_", "=_", "[_", "400_", ",_", "569", "_", ",_", "678", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "idx_", ",_", "stock", "\\u", "transaction_", ")_", "in_", "enumerate_", "(_", "Stock", "Transaction_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "pk", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "stock", "\\u", "transaction_", "._", "case", "\\u", "id_", ",_", "supply", "\\u", "point", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stock", "\\u", "transaction_", "._", "stock", "\\u", "on", "\\u", "hand_", ",_", "quantities", "_", "[_", "idx_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", ">", " ", "stock", "out", " ", "id", " ", "dp", " ", "ip", "\\", "10", ";", " ", " ", " ", " ", "555", "1234", " ", "<", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "format_", "(_", "response", "2_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "contact", "\\u", "name", "\"_", ":_", "self_", "._", "user1_", "._", "full", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\\u", "names", "\"_", ":_", "\"", "id", " ", "dp", " ", "ip", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "facilit", "y", "\\u", "name", "\"_", ":_", "self_", "._", "loc", "1_", "._", "name_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "script_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "stock", "\\u", "transaction_", "in_", "Stock", "Transaction_", "._", "objects_", "._", "filter_", "(_", "report", "\\u\\u", "date", "\\u\\u", "gte_", "=_", "now_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "stock", "\\u", "transaction_", "._", "case", "\\u", "id_", ",_", "supply", "\\u", "point", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stock", "\\u", "transaction_", "._", "stock", "\\u", "on", "\\u", "hand_", ",_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
facebookarchive/react-python/react/test/jsx.py
[ { "content": "# Copyright 2013 Facebook, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom os.path import join\nfrom react import jsx\nfrom react.test import TEST_ROOT\nfrom unittest import TestCase\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestJSXTransformer(TestCase):\n\n\n\n", "metadata": "root.TestJSXTransformer", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def test_transform(self):\n jsx_path = join(TEST_ROOT, 'files/test.jsx')\n js_path = join(TEST_ROOT, 'files/test.js')\n\n with open(js_path, 'rU') as js:\n self.assertEquals(\n jsx.transform(jsx_path),\n unicode(js.read()))\n\n malformed_path = join(TEST_ROOT, 'files/malformed.jsx')\n self.assertRaises(\n jsx.TransformError,\n lambda: jsx.transform(malformed_path))", "metadata": "root.TestJSXTransformer.test_transform", "header": "['class', 'TestJSXTransformer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_transform_string(self):\n result = jsx.transform_string('<div />')\n self.assertEquals(result, 'React.createElement(\"div\", null)')", "metadata": "root.TestJSXTransformer.test_transform_string", "header": "['class', 'TestJSXTransformer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test_transform_string_harmony(self):\n result = jsx.transform_string('var {x} = y', harmony=True)\n self.assertEquals(result, 'var $__0= y,x=$__0.x')", "metadata": "root.TestJSXTransformer.test_transform_string_harmony", "header": "['class', 'TestJSXTransformer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_transform_string_strip_types(self):\n result = jsx.transform_string('var x: Number = 1', strip_types=True)\n self.assertEquals(result, 'var x = 1')", "metadata": "root.TestJSXTransformer.test_transform_string_strip_types", "header": "['class', 'TestJSXTransformer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 44 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Face", "book", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "react", "_", "import_", "js", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "react", "_", "._", "test_", "import_", "TEST", "\\u", "ROOT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "JS", "XT", "ransf", "orm", "er_", "(_", "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_", "[SEP]_", "class_", "Test", "JS", "XT", "ransf", "orm", "er_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "transform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "js", "x", "\\u", "path_", "=_", "join_", "(_", "TEST", "\\u", "ROOT_", ",_", "'", "files", "/", "test", ".", "js", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js", "\\u", "path_", "=_", "join_", "(_", "TEST", "\\u", "ROOT_", ",_", "'", "files", "/", "test", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "js", "\\u", "path_", ",_", "'", "r", "U", "'_", ")_", "as_", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "js", "x_", "._", "transform_", "(_", "js", "x", "\\u", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode_", "(_", "js_", "._", "read_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mal", "formed", "\\u", "path_", "=_", "join_", "(_", "TEST", "\\u", "ROOT_", ",_", "'", "files", "/", "mal", "formed", ".", "js", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "js", "x_", "._", "Transform", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "js", "x_", "._", "transform_", "(_", "mal", "formed", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "JS", "XT", "ransf", "orm", "er_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "transform", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "js", "x_", "._", "transform", "\\u", "string_", "(_", "'<", "div", " ", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "result_", ",_", "'", "React", ".", "create", "Element", "(\"", "div", "\",", " ", "null", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "JS", "XT", "ransf", "orm", "er_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "transform", "\\u", "string", "\\u", "harm", "ony", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "js", "x_", "._", "transform", "\\u", "string_", "(_", "'", "var", " ", "{", "x", "}", " ", "=", " ", "y", "'_", ",_", "harm", "ony", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "result_", ",_", "'", "var", " ", "$\\u", "\\u", "0", "=", " ", " ", "y", ",", "x", "=$", "\\u\\u", "0.", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "JS", "XT", "ransf", "orm", "er_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "transform", "\\u", "string", "\\u", "strip", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "js", "x_", "._", "transform", "\\u", "string_", "(_", "'", "var", " ", "x", ":", " ", "Number", " ", "=", " ", "1", "'_", ",_", "strip", "\\u", "types_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "result_", ",_", "'", "var", " ", "x", " ", " ", " ", " ", " ", "=", " ", "1", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
CollabQ/CollabQ/vendor/django/contrib/gis/tests/test_gdal_ds.py
[ { "content": " def test03a_layers(self):\n \"Testing Data Source Layers.\"\n print \"\\nBEGIN - expecting out of range feature id error; safe to ignore.\\n\"\n for source in ds_list:\n ds = DataSource(source.ds)\n\n # Incrementing through each layer, this tests DataSource.__iter__\n for layer in ds: \n # Making sure we get the number of features we expect\n self.assertEqual(len(layer), source.nfeat)\n\n # Making sure we get the number of fields we expect\n self.assertEqual(source.nfld, layer.num_fields)\n self.assertEqual(source.nfld, len(layer.fields))\n\n # Testing the layer's extent (an Envelope), and it's properties\n self.assertEqual(True, isinstance(layer.extent, Envelope))\n self.assertAlmostEqual(source.extent[0], layer.extent.min_x, 5)\n self.assertAlmostEqual(source.extent[1], layer.extent.min_y, 5)\n self.assertAlmostEqual(source.extent[2], layer.extent.max_x, 5)\n self.assertAlmostEqual(source.extent[3], layer.extent.max_y, 5)\n\n # Now checking the field names.\n flds = layer.fields\n for f in flds: self.assertEqual(True, f in source.fields)\n \n # Negative FIDs are not allowed.\n self.assertRaises(OGRIndexError, layer.__getitem__, -1)\n self.assertRaises(OGRIndexError, layer.__getitem__, 50000)\n\n if hasattr(source, 'field_values'):\n fld_names = source.field_values.keys()\n\n # Testing `Layer.get_fields` (which uses Layer.__iter__)\n for fld_name in fld_names:\n self.assertEqual(source.field_values[fld_name], layer.get_fields(fld_name))\n\n # Testing `Layer.__getitem__`.\n for i, fid in enumerate(source.fids):\n feat = layer[fid]\n self.assertEqual(fid, feat.fid)\n # Maybe this should be in the test below, but we might as well test\n # the feature values here while in this loop.\n for fld_name in fld_names:\n self.assertEqual(source.field_values[fld_name][i], feat.get(fld_name))\n print \"\\nEND - expecting out of range feature id error; safe to ignore.\"", "metadata": "root.DataSourceTest.test03a_layers", "header": "['class', 'DataSourceTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Data", "Sou", "rce", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3a", "\\u", "layers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Test", "ing", " ", "Data", " ", "Sou", "rce", " ", "Layer", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "BEGIN", " ", "-", " ", "expect", "ing", " ", "out", " ", "of", " ", "range", " ", "feature", " ", "id", " ", "error", ";", " ", "safe", " ", "to", " ", "ignore", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source_", "in_", "ds", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ds_", "=_", "Data", "Source_", "(_", "source_", "._", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increment", "ing", " ", "through", " ", "each", " ", "layer", ",", " ", "this", " ", "tests", " ", "Data", "Sou", "rce", ".\\u", "\\u", "iter\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "layer_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Maki", "ng", " ", "sure", " ", "we", " ", "get", " ", "the", " ", "number", " ", "of", " ", "features", " ", "we", " ", "expect_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "layer_", ")_", ",_", "source_", "._", "nfe", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Maki", "ng", " ", "sure", " ", "we", " ", "get", " ", "the", " ", "number", " ", "of", " ", "fields", " ", "we", " ", "expect_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "source_", "._", "nfl", "d_", ",_", "layer_", "._", "num", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "source_", "._", "nfl", "d_", ",_", "len_", "(_", "layer_", "._", "fields_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "ing", " ", "the", " ", "layer", "'", "s", " ", "extent", " ", "(", "an", " ", "Env", "elope", "),", " ", "and", " ", "it", "'", "s", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "isinstance_", "(_", "layer_", "._", "extent_", ",_", "Env", "elope", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "source_", "._", "extent_", "[_", "0_", "]_", ",_", "layer_", "._", "extent_", "._", "min", "\\u", "x_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "source_", "._", "extent_", "[_", "1_", "]_", ",_", "layer_", "._", "extent_", "._", "min", "\\u", "y_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "source_", "._", "extent_", "[_", "2_", "]_", ",_", "layer_", "._", "extent_", "._", "max", "\\u", "x_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "source_", "._", "extent_", "[_", "3_", "]_", ",_", "layer_", "._", "extent_", "._", "max", "\\u", "y_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "checking", " ", "the", " ", "field", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "fld", "s_", "=_", "layer_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "fld", "s_", ":_", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "f_", "in_", "source_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nega", "tiv", "e", " ", "FID", "s", " ", "are", " ", "not", " ", "allow", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "OGR", "Index", "Error_", ",_", "layer_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "OGR", "Index", "Error_", ",_", "layer_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "50000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "source_", ",_", "'", "field", "\\u", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fld", "\\u", "names_", "=_", "source_", "._", "field", "\\u", "values_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "ing", " ", "`", "Layer", ".", "get", "\\u", "fields", "`", " ", "(", "whi", "ch", " ", "use", "s", " ", "Layer", ".\\u", "\\u", "iter", "\\u\\u)", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fld", "\\u", "name_", "in_", "fld", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assert", "Equal_", "(_", "source_", "._", "field", "\\u", "values_", "[_", "fld", "\\u", "name_", "]_", ",_", "layer_", "._", "get", "\\u", "fields_", "(_", "fld", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "ing", " ", "`", "Layer", ".\\u", "\\u", "getitem", "\\u\\u", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "fid_", "in_", "enumerate_", "(_", "source_", "._", "fid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "feat_", "=_", "layer_", "[_", "fid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fid_", ",_", "feat_", "._", "fid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ma", "yb", "e", " ", "this", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "test", " ", "belo", "w", ",", " ", "but", " ", "we", " ", "mig", "ht", " ", "as", " ", "well", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "feature", " ", "values", " ", "here", " ", "whi", "le", " ", "in", " ", "this", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fld", "\\u", "name_", "in_", "fld", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assert", "Equal_", "(_", "source_", "._", "field", "\\u", "values_", "[_", "fld", "\\u", "name_", "]_", "[_", "i_", "]_", ",_", "feat_", "._", "get_", "(_", "fld", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "END", " ", "-", " ", "expect", "ing", " ", "out", " ", "of", " ", "range", " ", "feature", " ", "id", " ", "error", ";", " ", "safe", " ", "to", " ", "ignore", ".\"_", "\\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,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, 2, 2 ]
Testing equality to None
getsentry/rb/rb/clients.py
[ { "content": " def execute_command(self, *args):\n promises = {}\n\n hosts = self._target_hosts\n if hosts == 'all':\n hosts = self.connection_pool.cluster.hosts.keys()\n elif hosts is None:\n raise RuntimeError('Fanout client was not targeted to hosts.')\n\n for host_id in hosts:\n buf = self._get_command_buffer(host_id, args[0])\n promise = buf.enqueue_command(args[0], args[1:])\n if self.__resolve_singular_result and len(hosts) == 1:\n return promise\n promises[host_id] = promise\n\n return Promise.all(promises)", "metadata": "root.FanoutClient.execute_command", "header": "['class', 'FanoutClient', '(', 'MappingClient', ')', ':', '___EOS___']", "index": 421 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Fan", "out", "Client_", "(_", "Map", "ping", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "command_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "promise", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hosts_", "=_", "self_", "._", "\\u", "target", "\\u", "hosts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hosts_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hosts_", "=_", "self_", "._", "connecti", "on", "\\u", "pool_", "._", "cluster_", "._", "hosts_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hosts_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "Fan", "out", " ", "client", " ", "was", " ", "not", " ", "targeted", " ", "to", " ", "host", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "host", "\\u", "id_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "self_", "._", "\\u", "get", "\\u", "command", "\\u", "buffer_", "(_", "host", "\\u", "id_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "promise", "_", "=_", "buf_", "._", "enqueue", "\\u", "command_", "(_", "args_", "[_", "0_", "]_", ",_", "args_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "resolve", "\\u", "singular", "\\u", "result_", "and_", "len_", "(_", "hosts_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "promise", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "promise", "s_", "[_", "host", "\\u", "id_", "]_", "=_", "promise", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Promi", "se_", "._", "all_", "(_", "promise", "s_", ")_", "\\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 ]
First parameter of a method is not named 'self'
sympy/sympy/sympy/physics/mechanics/lagrange.py
[ { "content": " def rhs(self, inv_method=None, **kwargs):\n \"\"\"Returns equations that can be solved numerically\n\n Parameters\n ==========\n\n inv_method : str\n The specific sympy inverse matrix calculation method to use. For a\n list of valid methods, see\n :meth:`~sympy.matrices.matrices.MatrixBase.inv`\n \"\"\"\n\n if 'method' in kwargs:\n # The method kwarg is deprecated in favor of inv_method.\n SymPyDeprecationWarning(feature=\"method kwarg\",\n useinstead=\"inv_method kwarg\",\n deprecated_since_version=\"0.7.6\").warn()\n # For now accept both\n inv_method = kwargs['method']\n\n if inv_method is None:\n self._rhs = self.mass_matrix_full.LUsolve(self.forcing_full)\n else:\n self._rhs = (self.mass_matrix_full.inv(inv_method,\n try_block_diag=True) * self.forcing_full)\n return self._rhs", "metadata": "root.LagrangesMethod.rhs", "header": "['class', 'LagrangesMethod', '(', 'object', ')', ':', '___EOS___']", "index": 426 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Lag", "ranges", "Method_", "(_", "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_", "rhs_", "(_", "self_", ",_", "inv", "\\u", "method_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "equation", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "solved", " ", "numerical", "ly", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "inv", "\\u", "method", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "specific", " ", "symp", "y", " ", "inv", "erse", " ", "matrix", " ", "calculati", "on", " ", "method", " ", "to", " ", "use", ".", " ", "For", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "valid", " ", "method", "s", ",", " ", "see", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "symp", "y", ".", "matric", "es", ".", "matric", "es", ".", "Matrix", "Base", ".", "inv", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "method", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "method", " ", "kwarg", " ", "is", " ", "depre", "cated", " ", "in", " ", "fav", "or", " ", "of", " ", "inv", "\\u", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sym", "Py", "Dep", "reca", "tion", "Warning_", "(_", "feature_", "=_", "\"", "method", " ", "kwarg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "inst", "ead_", "=_", "\"", "inv", "\\u", "method", " ", "kwarg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depre", "cated", "\\u", "sinc", "e\\u", "version_", "=_", "\"", "0.", "7.6", "\"_", ")_", "._", "warn_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "now", " ", "accept", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "inv", "\\u", "method_", "=_", "kwargs_", "[_", "'", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "inv", "\\u", "method_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "rhs_", "=_", "self_", "._", "mass", "\\u", "matrix", "\\u", "full_", "._", "LU", "solve_", "(_", "self_", "._", "forcing", "\\u", "full_", ")_", "\\u\\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", "rhs_", "=_", "(_", "self_", "._", "mass", "\\u", "matrix", "\\u", "full_", "._", "inv_", "(_", "inv", "\\u", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "try", "\\u", "block", "\\u", "diag_", "=_", "True_", ")_", "*_", "self_", "._", "forcing", "\\u", "full_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "rhs_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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chineking/cola/cola/core/logs.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n'''\nCopyright (c) 2013 Qin Xuye <qin@qinxuye.me>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nCreated on 2013-5-31\n\n@author: Chine\n'''\n\nimport socket\nimport logging.handlers\nimport SocketServer\nimport struct\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n \n\n\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Log(object):\n \n \n \n ", "metadata": "root.Log", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self, name, default_level=logging.DEBUG):\n self.logger = logging.getLogger(name)\n self.logger.setLevel(default_level)\n self.formatter = logging.Formatter(\n '%(asctime)s - %(module)s.%(funcName)s.%(lineno)d - %(levelname)s - %(message)s')", "metadata": "root.Log.__init__", "header": "['class', 'Log', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " def add_stream_log(self, level=logging.DEBUG, format_=False):\n stream_handler = logging.StreamHandler()\n if format_:\n stream_handler.setFormatter(self.formatter)\n stream_handler.setLevel(level)\n self.logger.addHandler(stream_handler)", "metadata": "root.Log.add_stream_log", "header": "['class', 'Log', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def add_file_log(self, filename, level=logging.INFO):\n handler = logging.FileHandler(filename)\n handler.setFormatter(self.formatter)\n handler.setLevel(level)\n self.logger.addHandler(handler)", "metadata": "root.Log.add_file_log", "header": "['class', 'Log', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def add_remote_log(self, server, level=logging.INFO):\n if ':' in server:\n server, port = tuple(server.split(':', 1))\n port = int(port)\n else:\n port = logging.handlers.DEFAULT_TCP_LOGGING_PORT\n \n socket_handler = logging.handlers.SocketHandler(server, port)\n socket_handler.setLevel(level)\n self.logger.addHandler(socket_handler)", "metadata": "root.Log.add_remote_log", "header": "['class', 'Log', '(', 'object', ')', ':', '___EOS___']", "index": 51 }, { "content": " def get_logger(self):\n return self.logger", "metadata": "root.Log.get_logger", "header": "['class', 'Log', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": "def get_logger(name='cola', filename=None, server=None, is_master=False, \n basic_level=logging.DEBUG):\n log = Log(name, basic_level)\n log.add_stream_log(basic_level)\n \n if filename is not None:\n level = logging.INFO\n if is_master:\n level = logging.ERROR\n log.add_file_log(filename, level)\n \n if server is not None:\n log.add_remote_log(server, logging.INFO)\n \n return log.get_logger()", "metadata": "root.get_logger", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def add_log_client(logger, client):\n if ':' in client:\n client, port = tuple(client.split(':', 1))\n port = int(port)\n else:\n port = logging.handlers.DEFAULT_TCP_LOGGING_PORT\n \n socket_handler = logging.handlers.SocketHandler(client, port)\n socket_handler.setLevel(logging.INFO)\n logger.addHandler(socket_handler)\n \n return socket_handler", "metadata": "root.add_log_client", "header": "['module', '___EOS___']", "index": 81 }, { "content": "class LogRecordStreamHandler(SocketServer.StreamRequestHandler):\n \n ", "metadata": "root.LogRecordStreamHandler", "header": "['module', '___EOS___']", "index": 94 }, { "content": " def handle(self):\n self.connection.setblocking(0)\n while not self.server.abort:\n try:\n chunk = self.connection.recv(4)\n if len(chunk) < 4:\n break\n slen = struct.unpack('>L', chunk)[0]\n chunk = self.connection.recv(slen)\n while len(chunk) < slen:\n chunk = chunk + self.connection.recv(slen - len(chunk))\n obj = self.unPickle(chunk)\n record = logging.makeLogRecord(obj)\n self.handleLogRecord(record)\n except socket.error:\n return", "metadata": "root.LogRecordStreamHandler.handle", "header": "['class', 'LogRecordStreamHandler', '(', 'SocketServer', '.', 'StreamRequestHandler', ')', ':', '___EOS___']", "index": 95 }, { "content": " def unPickle(self, data):\n return pickle.loads(data)", "metadata": "root.LogRecordStreamHandler.unPickle", "header": "['class', 'LogRecordStreamHandler', '(', 'SocketServer', '.', 'StreamRequestHandler', ')', ':', '___EOS___']", "index": 112 }, { "content": " def handleLogRecord(self, record):\n if self.server.logger is not None:\n logger = self.server.logger\n else:\n logger = logging.getLogger(record.name)\n logger.handle(record)", "metadata": "root.LogRecordStreamHandler.handleLogRecord", "header": "['class', 'LogRecordStreamHandler', '(', 'SocketServer', '.', 'StreamRequestHandler', ')', ':', '___EOS___']", "index": 115 }, { "content": "class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer):\n \n allow_reuse_address = 1\n \n ", "metadata": "root.LogRecordSocketReceiver", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __init__(self, logger=None, host='localhost', \n port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,\n handler=LogRecordStreamHandler):\n SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler)\n self.abort = False\n self.timeout = 1\n self.logger = logger", "metadata": "root.LogRecordSocketReceiver.__init__", "header": "['class', 'LogRecordSocketReceiver', '(', 'SocketServer', '.', 'ThreadingTCPServer', ')', ':', '___EOS___']", "index": 126 }, { "content": " def shutdown(self):\n SocketServer.ThreadingTCPServer.shutdown(self)\n self.abort = True", "metadata": "root.LogRecordSocketReceiver.shutdown", "header": "['class', 'LogRecordSocketReceiver', '(', 'SocketServer', '.', 'ThreadingTCPServer', ')', ':', '___EOS___']", "index": 134 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Qin", " ", "Xu", "ye", " ", "<", "qin", "@", "qin", "xu", "ye", ".", "me", ">", "\\", "10", ";", "\\", "10", ";", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "\\", "10", ";", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", "\\", "10", ";", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", "\\", "10", ";", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", "\\", "10", ";", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", ".", "\\", "10", ";", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "2013", "-", "5", "-", "3", "1", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Chin", "e", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Sock", "et", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Log_", "(_", "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_", "[SEP]_", "class_", "Log_", "(_", "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_", ",_", "default", "\\u", "level_", "=_", "logging_", "._", "DEBUG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "set", "Level_", "(_", "default", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "asc", "time", ")", "s", " ", "-", " ", "%", "(", "module", ")", "s", ".", "%", "(", "func", "Name", ")", "s", ".", "%", "(", "linen", "o", ")", "d", " ", "-", " ", "%", "(", "level", "name", ")", "s", " ", "-", " ", "%", "(", "message", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "stream", "\\u", "log_", "(_", "self_", ",_", "level_", "=_", "logging_", "._", "DEBUG_", ",_", "format\\u", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "\\u", "handler_", "=_", "logging_", "._", "Stream", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format\\u", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "\\u", "handler_", "._", "set", "Formatter_", "(_", "self_", "._", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream", "\\u", "handler_", "._", "set", "Level_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "add", "Handler_", "(_", "stream", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "file", "\\u", "log_", "(_", "self_", ",_", "filename_", ",_", "level_", "=_", "logging_", "._", "INFO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "self_", "._", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Level_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "remote", "\\u", "log_", "(_", "self_", ",_", "server_", ",_", "level_", "=_", "logging_", "._", "INFO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "':'_", "in_", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", ",_", "port_", "=_", "tuple_", "(_", "server_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "int_", "(_", "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 ", " _", "port_", "=_", "logging_", "._", "handlers_", "._", "DEF", "AUL", "T", "\\u", "TC", "P", "\\u", "LOGGING", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket", "\\u", "handler_", "=_", "logging_", "._", "handlers_", "._", "Sock", "et", "Handler_", "(_", "server_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket", "\\u", "handler_", "._", "set", "Level_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "add", "Handler_", "(_", "socket", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "logger_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "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_", "def_", "get", "\\u", "logger_", "(_", "name_", "=_", "'", "cola", "'_", ",_", "filename_", "=_", "None_", ",_", "server_", "=_", "None_", ",_", "is", "\\u", "master_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "basic", "\\u", "level_", "=_", "logging_", "._", "DEBUG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "=_", "Log_", "(_", "name_", ",_", "basic", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "add", "\\u", "stream", "\\u", "log_", "(_", "basic", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "filename_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "logging_", "._", "INFO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "logging_", "._", "ERROR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "add", "\\u", "file", "\\u", "log_", "(_", "filename_", ",_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "server_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "add", "\\u", "remote", "\\u", "log_", "(_", "server_", ",_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "log_", "._", "get", "\\u", "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_", "def_", "add", "\\u", "log", "\\u", "client_", "(_", "logger_", ",_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "':'_", "in_", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", ",_", "port_", "=_", "tuple_", "(_", "client_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "int_", "(_", "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 ", " _", "port_", "=_", "logging_", "._", "handlers_", "._", "DEF", "AUL", "T", "\\u", "TC", "P", "\\u", "LOGGING", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "socket", "\\u", "handler_", "=_", "logging_", "._", "handlers_", "._", "Sock", "et", "Handler_", "(_", "client_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket", "\\u", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "add", "Handler_", "(_", "socket", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "socket", "\\u", "handler_", "\\u\\u\\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_", "Log", "Record", "Stream", "Handler_", "(_", "Sock", "et", "Server_", "._", "Stream", "Request", "Handler_", ")_", ":_", "\\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_", "Log", "Record", "Stream", "Handler_", "(_", "Sock", "et", "Server_", "._", "Stream", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "._", "setb", "locking_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "server_", "._", "abort_", ":_", "\\u\\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_", "=_", "self_", "._", "connection_", "._", "recv_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "chunk_", ")_", "<_", "4_", ":_", "\\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_", "sle", "n_", "=_", "struct_", "._", "unpack_", "(_", "'>", "L", "'_", ",_", "chunk_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "self_", "._", "connection_", "._", "recv_", "(_", "sle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "chunk_", ")_", "<_", "sle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "chunk_", "=_", "chunk_", "+_", "self_", "._", "connection_", "._", "recv_", "(_", "sle", "n_", "-_", "len_", "(_", "chunk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "self_", "._", "un", "Pickle_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record_", "=_", "logging_", "._", "make", "Log", "Record_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "Log", "Record_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Record", "Stream", "Handler_", "(_", "Sock", "et", "Server_", "._", "Stream", "Request", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "un", "Pickle_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pickle_", "._", "loads_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Record", "Stream", "Handler_", "(_", "Sock", "et", "Server_", "._", "Stream", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Log", "Record_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "server_", "._", "logger_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "self_", "._", "server_", "._", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "record_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "handle_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Record", "Sock", "et", "Receiver_", "(_", "Sock", "et", "Server_", "._", "Thread", "ing", "TC", "PS", "erver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "\\u", "reus", "e\\u", "address_", "=_", "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_", "[SEP]_", "class_", "Log", "Record", "Sock", "et", "Receiver_", "(_", "Sock", "et", "Server_", "._", "Thread", "ing", "TC", "PS", "erver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "None_", ",_", "host_", "=_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "logging_", "._", "handlers_", "._", "DEF", "AUL", "T", "\\u", "TC", "P", "\\u", "LOGGING", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Log", "Record", "Stream", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sock", "et", "Server_", "._", "Thread", "ing", "TC", "PS", "erver_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "(_", "host_", ",_", "port_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abort_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "=_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Record", "Sock", "et", "Receiver_", "(_", "Sock", "et", "Server_", "._", "Thread", "ing", "TC", "PS", "erver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sock", "et", "Server_", "._", "Thread", "ing", "TC", "PS", "erver_", "._", "shutdown_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abort_", "=_", "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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cobrateam/splinter/tests/is_element_present_nojs.py
[ { "content": " def test_is_element_present_by_text(self):\n \"should is element present by text verify if element is present\"\n self.assertTrue(self.browser.is_element_present_by_text('Complex'))", "metadata": "root.IsElementPresentNoJSTest.test_is_element_present_by_text", "header": "['class', 'IsElementPresentNoJSTest', '(', 'object', ')', ':', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Is", "Element", "Present", "No", "JS", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "is", "\\u", "element", "\\u", "presen", "t", "\\u", "by", "\\u", "text_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "shou", "ld", " ", "is", " ", "element", " ", "presen", "t", " ", "by", " ", "text", " ", "verify", " ", "if", " ", "element", " ", "is", " ", "presen", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "browser_", "._", "is", "\\u", "element", "\\u", "presen", "t", "\\u", "by", "\\u", "text_", "(_", "'", "Comple", "x", "'_", ")_", ")_", "\\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 ]
Implicit string concatenation in a list
mollyproject/mollyproject/docs/source/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# molly documentation build configuration file, created by\n# sphinx-quickstart on Tue Mar 2 20:57:21 2010.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\nimport os.path\nfrom datetime import datetime\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.append(os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage',\n 'sphinx.ext.autodoc']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.txt'\n\n# The encoding of source files.\n#source_encoding = 'utf-8'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'molly'\ncopyright = u'%d, Molly Project and contributors' % datetime.now().year\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\nsys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))\nfrom molly import __version__ as molly_version\n\n# The short X.Y version.\nversion = molly_version\n# The full version, including alpha/beta/rc tags.\nrelease = molly_version\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\n#unused_docs = []\n\n# List of directories, relative to source directory, that shouldn't be searched\n# for source files.\nexclude_trees = []\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. Major themes that come with\n# Sphinx are currently 'default' and 'sphinxdoc'.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_use_modindex = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# If nonempty, this is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = ''\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'mollydoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\n# The paper size ('letter' or 'a4').\n#latex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'molly.tex', u'molly Documentation',\n u'University of Oxford', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# Additional stuff for the LaTeX preamble.\n#latex_preamble = ''\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_use_modindex = True\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n 'http://docs.python.org/': None,\n 'http://docs.djangoproject.com/en/dev/': 'http://docs.djangoproject.com/en/dev/_objects/',\n}\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mol", "ly", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Tu", "e", " ", "Mar", " ", " ", "2", " ", "20", ":", "5", "7", ":", "21", " ", "2010", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "intersphinx", "'_", ",_", "'", "sphinx", ".", "ext", ".", "todo", "'_", ",_", "'", "sphinx", ".", "ext", ".", "covera", "ge", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "mol", "ly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'%", "d", ",", " ", "Mol", "ly", " ", "Project", " ", "and", " ", "contributor", "s", "'_", "%_", "datetime_", "._", "now_", "(_", ")_", "._", "year_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'..'_", ",_", "'..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mol", "ly_", "import_", "\\u\\u", "version\\u\\u_", "as_", "mol", "ly", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "mol", "ly", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "mol", "ly", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "document", "s", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "build", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "unu", "sed", "\\u", "docs", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "director", "ies", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "searche", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "trees_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "Maj", "or", " ", "themes", " ", "tha", "t", " ", "come", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "are", " ", "currentl", "y", " ", "'", "default", "'", " ", "and", " ", "'", "sphinx", "doc", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "modi", "nde", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", "mpty", ",", " ", "this", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "mol", "ly", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "pape", "r", "\\u", "size", " ", "=", " ", "'", "letter", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "font", "\\u", "size", " ", "=", " ", "'", "10", "pt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "mol", "ly", ".", "tex", "'_", ",_", "u", "'", "mol", "ly", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Univers", "it", "y", " ", "of", " ", "Ox", "for", "d", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "preamble", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "modi", "nde", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "configura", "tion", " ", "for", " ", "intersphinx", ":", " ", "refer", " ", "to", " ", "the", " ", "Pyth", "on", " ", "standard", " ", "librar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "intersphinx", "\\u", "mapping_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "docs", ".", "python", ".", "org", "/'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "docs", ".", "django", "project", ".", "com", "/", "en", "/", "dev", "/'_", ":_", "'", "http", "://", "docs", ".", "django", "project", ".", "com", "/", "en", "/", "dev", "/\\u", "object", "s", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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MUNTJAC_COPYRIGHT@\n# @MUNTJAC_LICENSE@\n\n\"\"\"Defines a simple drop-down select.\"\"\"\n\nfrom muntjac.ui.abstract_select import AbstractSelect\nfrom muntjac.data.container import IContainer\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NativeSelect(AbstractSelect):\n \"\"\"This is a simple drop-down select without, for instance, support\n for multiselect, new items, lazyloading, and other advanced features.\n Sometimes \"native\" select without all the bells-and-whistles of the\n ComboBox is a better choice.\n \"\"\"\n\n CLIENT_WIDGET = None #ClientWidget(VNativeWidget)\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.NativeSelect", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self, *args):\n # width in characters, mimics TextField\n self._columns = 0\n\n args = args\n nargs = len(args)\n if nargs == 0:\n super(NativeSelect, self).__init__()\n elif nargs == 1:\n caption, = args\n super(NativeSelect, self).__init__(caption)\n elif nargs == 2:\n if isinstance(args[1], IContainer):\n caption, dataSource = args\n super(NativeSelect, self).__init__(caption, dataSource)\n else:\n caption, options = args\n super(NativeSelect, self).__init__(caption, options)\n else:\n raise ValueError, 'too many arguments'", "metadata": "root.NativeSelect.__init__", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 18 }, { "content": " def setColumns(self, columns):\n \"\"\"Sets the number of columns in the editor. If the number of columns\n is set 0, the actual number of displayed columns is determined\n implicitly by the adapter.\n\n @param columns:\n the number of columns to set.\n \"\"\"\n if columns < 0:\n columns = 0\n\n if self._columns != columns:\n self._columns = columns\n self.requestRepaint()", "metadata": "root.NativeSelect.setColumns", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 40 }, { "content": " def getColumns(self):\n return self._columns", "metadata": "root.NativeSelect.getColumns", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 56 }, { "content": " def paintContent(self, target):\n target.addAttribute('type', 'native')\n # Adds the number of columns\n if self._columns != 0:\n target.addAttribute('cols', self._columns)\n\n super(NativeSelect, self).paintContent(target)", "metadata": "root.NativeSelect.paintContent", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 60 }, { "content": " def setMultiSelect(self, multiSelect):\n if multiSelect == True:\n raise NotImplementedError, 'Multiselect not supported'", "metadata": "root.NativeSelect.setMultiSelect", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 69 }, { "content": " def setNewItemsAllowed(self, allowNewOptions):\n if allowNewOptions == True:\n raise NotImplementedError, 'newItemsAllowed not supported'", "metadata": "root.NativeSelect.setNewItemsAllowed", "header": "['class', 'NativeSelect', '(', 'AbstractSelect', ')', ':', '___EOS___']", "index": 74 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "@", "MU", "NT", "JA", "C", "\\u", "COPY", "RIG", "HT", "@_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "MU", "NT", "JA", "C", "\\u", "LICENSE", "@_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Define", "s", " ", "a", " ", "simple", " ", "drop", "-", "down", " ", "select", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "ui_", "._", "abstract", "\\u", "select_", "import_", "Abstract", "Select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "data_", "._", "container_", "import_", "IC", "onta", "iner", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "simple", " ", "drop", "-", "down", " ", "select", " ", "with", "out", ",", " ", "for", " ", "instance", ",", " ", "support", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "multis", "elect", ",", " ", "new", " ", "items", ",", " ", "lazy", "load", "ing", ",", " ", "and", " ", "other", " ", "advanced", " ", "features", ".", "\\", "10", ";", " ", " ", " ", " ", "Some", "times", " ", "\"", "nativ", "e", "\"", " ", "select", " ", "with", "out", " ", "all", " ", "the", " ", "bell", "s", "-", "and", "-", "whis", "tle", "s", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Comb", "o", "Box", " ", "is", " ", "a", " ", "bett", "er", " ", "choice", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CLIENT", "\\u", "WID", "GET_", "=_", "None_", "#", "Client", "Wid", "get", "(", "VN", "ative", "Wid", "get", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "widt", "h", " ", "in", " ", "character", "s", ",", " ", "mimic", "s", " ", "Text", "Field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "columns_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nargs_", "=_", "len_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nargs_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Nat", "ive", "Select_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nargs_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption_", ",_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Nat", "ive", "Select_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "caption_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nargs_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "args_", "[_", "1_", "]_", ",_", "IC", "onta", "iner", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption_", ",_", "data", "Source_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Nat", "ive", "Select_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "caption_", ",_", "data", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption_", ",_", "options_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Nat", "ive", "Select_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "caption_", ",_", "options_", ")_", "\\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_", ",_", "'", "too", " ", "many", " ", "argu", "ment", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\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", "Columns_", "(_", "self_", ",_", "columns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "number", " ", "of", " ", "column", "s", " ", "in", " ", "the", " ", "editor", ".", " ", "If", " ", "the", " ", "number", " ", "of", " ", "column", "s", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "set", " ", "0", ",", " ", "the", " ", "actual", " ", "number", " ", "of", " ", "displaye", "d", " ", "column", "s", " ", "is", " ", "dete", "rmin", "ed", "\\", "10", ";", " ", " ", " ", " ", "implicit", "ly", " ", "by", " ", "the", " ", "adapter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "column", "s", ":", "\\", "10", ";", " ", "the", " ", "number", " ", "of", " ", "column", "s", " ", "to", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "columns_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "columns_", "!=_", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "columns_", "=_", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "Rep", "aint", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\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", "Columns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pain", "t", "Content_", "(_", "self_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "._", "add", "Attribute_", "(_", "'", "type", "'_", ",_", "'", "nativ", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "s", " ", "the", " ", "number", " ", "of", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "columns_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "._", "add", "Attribute_", "(_", "'", "cols", "'_", ",_", "self_", "._", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Nat", "ive", "Select_", ",_", "self_", ")_", "._", "pain", "t", "Content_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Multi", "Select_", "(_", "self_", ",_", "multi", "Select_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "multi", "Select_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "'", "Multi", "select", " ", "not", " ", "support", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nat", "ive", "Select_", "(_", "Abstract", "Select_", ")_", ":_", "\\u\\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", "Item", "s", "Allowed_", "(_", "self_", ",_", "allow", "New", "Options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "allow", "New", "Options_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "'", "new", "Item", "s", "All", "owe", "d", " ", "not", " ", "support", "ed", "'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
frappe/frappe/frappe/patches/v6_24/sync_desktop_icons.py
[ { "content": "def execute():\n\tfrappe.reload_doc('desk', 'doctype', 'desktop_icon')\n\n\tfrappe.db.sql('delete from `tabDesktop Icon`')\n\n\tmodules_list = []\n\tfor app in frappe.get_installed_apps():\n\t\tmodules_list += sync_from_app(app)\n\n\t# sync hidden modules\n\thidden_modules = frappe.db.get_global('hidden_modules')\n\tif hidden_modules:\n\t\tfor m in json.loads(hidden_modules):\n\t\t\ttry:\n\t\t\t\tdesktop_icon = frappe.get_doc('Desktop Icon', {'module_name': m, 'standard': 1, 'app': app})\n\t\t\t\tdesktop_icon.db_set('hidden', 1)\n\t\t\texcept frappe.DoesNotExistError:\n\t\t\t\tpass\n\n\t# sync user sort\n\tfor user in frappe.get_all('User', filters={'user_type': 'System User'}):\n\t\tuser_list = frappe.defaults.get_user_default('_user_desktop_items', user=user.name)\n\t\tif user_list:\n\t\t\tuser_list = json.loads(user_list)\n\t\t\tfor i, module_name in enumerate(user_list):\n\t\t\t\ttry:\n\t\t\t\t\tdesktop_icon = get_user_copy(module_name, user=user.name)\n\t\t\t\t\tdesktop_icon.db_set('idx', i)\n\t\t\t\texcept frappe.DoesNotExistError:\n\t\t\t\t\tpass\n\n\t\t\t# set remaining icons as hidden\n\t\t\tfor module_name in list(set([m['module_name'] for m in modules_list]) - set(user_list)):\n\t\t\t\ttry:\n\t\t\t\t\tdesktop_icon = get_user_copy(module_name, user=user.name)\n\t\t\t\t\tdesktop_icon.db_set('hidden', 1)\n\t\t\t\texcept frappe.DoesNotExistError:\n\t\t\t\t\tpass", "metadata": "root.execute", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "execute_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "frappe_", "._", "relo", "ad", "\\u", "doc_", "(_", "'", "desk", "'_", ",_", "'", "doct", "ype", "'_", ",_", "'", "desk", "top", "\\u", "icon", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frappe_", "._", "db_", "._", "sql_", "(_", "'", "delete", " ", "from", " ", "`", "tab", "Des", "kto", "p", " ", "Ico", "n", "`'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module", "s", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app_", "in_", "frappe_", "._", "get", "\\u", "install", "ed", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "module", "s", "\\u", "list_", "+=_", "sync", "\\u", "from", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "hidden", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hidden", "\\u", "modules_", "=_", "frappe_", "._", "db_", "._", "get", "\\u", "global_", "(_", "'", "hidden", "\\u", "module", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hidden", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "m_", "in_", "json_", "._", "loads_", "(_", "hidden", "\\u", "modules_", ")_", ":_", "\\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_", "desk", "top", "\\u", "icon_", "=_", "frappe_", "._", "get", "\\u", "doc_", "(_", "'", "Des", "kto", "p", " ", "Ico", "n", "'_", ",_", "{_", "'", "module", "\\u", "name", "'_", ":_", "m_", ",_", "'", "standard", "'_", ":_", "1_", ",_", "'", "app", "'_", ":_", "app_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desk", "top", "\\u", "icon_", "._", "db", "\\u", "set_", "(_", "'", "hidden", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "frappe_", "._", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "user", " ", "sort_", "\\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_", "user_", "in_", "frappe_", "._", "get", "\\u", "all_", "(_", "'", "User", "'_", ",_", "filters_", "=_", "{_", "'", "user", "\\u", "type", "'_", ":_", "'", "System", " ", "User", "'_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "user", "\\u", "list_", "=_", "frappe_", "._", "defaults_", "._", "get", "\\u", "user", "\\u", "default_", "(_", "'\\u", "user", "\\u", "desk", "top", "\\u", "items", "'_", ",_", "user_", "=_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "user", "\\u", "list_", "=_", "json_", "._", "loads_", "(_", "user", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "module", "\\u", "name_", "in_", "enumerate_", "(_", "user", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "desk", "top", "\\u", "icon_", "=_", "get", "\\u", "user", "\\u", "copy_", "(_", "module", "\\u", "name_", ",_", "user_", "=_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desk", "top", "\\u", "icon_", "._", "db", "\\u", "set_", "(_", "'", "idx", "'_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "frappe_", "._", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "rema", "inin", "g", " ", "icons", " ", "as", " ", "hidden_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "module", "\\u", "name_", "in_", "list_", "(_", "set_", "(_", "[_", "m_", "[_", "'", "module", "\\u", "name", "'_", "]_", "for_", "m_", "in_", "module", "s", "\\u", "list_", "]_", ")_", "-_", "set_", "(_", "user", "\\u", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "desk", "top", "\\u", "icon_", "=_", "get", "\\u", "user", "\\u", "copy_", "(_", "module", "\\u", "name_", ",_", "user_", "=_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desk", "top", "\\u", "icon_", "._", "db", "\\u", "set_", "(_", "'", "hidden", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "frappe_", "._", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_vartree_passthrough.py
[ { "content": " def test_vartree_passthrough(self):\n \n # Tests that we can create a passthrough of one variable in a tree\n blah = set_as_top(TstAssembly())\n blah.dummy1 = 5.0\n self.assertEqual(blah.dummy1_out, 1.0)\n blah.run()\n self.assertEqual(blah.comp.dummy_data.dummy1, 5.0)\n self.assertEqual(blah.dummy1, 5.0)\n self.assertEqual(blah.dummy1_out, 5.0)", "metadata": "root.VarTreePassthroughTestCase.test_vartree_passthrough", "header": "['class', 'VarTreePassthroughTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Var", "Tree", "Pass", "through", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "vart", "ree", "\\u", "passthrough", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "tha", "t", " ", "we", " ", "can", " ", "create", " ", "a", " ", "passthrough", " ", "of", " ", "one", " ", "variab", "le", " ", "in", " ", "a", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bla", "h_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Ts", "t", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "h_", "._", "dummy", "1_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bla", "h_", "._", "dummy", "1", "\\u", "out_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "h_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bla", "h_", "._", "comp_", "._", "dummy", "\\u", "data_", "._", "dummy", "1_", ",_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bla", "h_", "._", "dummy", "1_", ",_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bla", "h_", "._", "dummy", "1", "\\u", "out_", ",_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
azoft-dev-team/imagrium/env/Lib/pycimport.py
[ { "content": " def find_module(self, fullname, path):\n if __debugging__: print \"MetaImporter.find_module(%s, %s)\" % (\n repr(fullname), repr(path))\n for _path in sys.path:\n if _path not in self.__importers:\n try:\n self.__importers[_path] = __Importer(_path)\n except:\n self.__importers[_path] = None\n importer = self.__importers[_path]\n if importer is not None:\n loader = importer.find_module(fullname, path)\n if loader is not None:\n return loader\n else:\n return None", "metadata": "root.__MetaImporter.find_module", "header": "['class', '__MetaImporter', '(', 'object', ')', ':', '___EOS___']", "index": 65 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "\\u\\u", "Meta", "Importer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "module_", "(_", "self_", ",_", "fullname_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debugg", "ing", "\\u\\u_", ":_", "print_", "\"", "Meta", "Import", "er", ".", "find", "\\u", "module", "(%", "s", ",", " ", "%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "fullname_", ")_", ",_", "repr_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "path_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "path_", "not_", "in_", "self_", "._", "\\u\\u", "importer", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u\\u", "importer", "s_", "[_", "\\u", "path_", "]_", "=_", "\\u\\u", "Importer_", "(_", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u\\u", "importer", "s_", "[_", "\\u", "path_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "importer_", "=_", "self_", "._", "\\u\\u", "importer", "s_", "[_", "\\u", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "importer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "importer_", "._", "find", "\\u", "module_", "(_", "fullname_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loader_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "loader_", "\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
home-assistant/home-assistant/homeassistant/components/sensor/gtfs.py
[ { "content": " def update(self):\n \"\"\"Get the latest data from GTFS and update the states.\"\"\"\n import pygtfs\n\n split_file_name = os.path.splitext(self._data_source)\n\n sqlite_file = \"{}.sqlite\".format(split_file_name[0])\n gtfs = pygtfs.Schedule(os.path.join(self._gtfs_folder, sqlite_file))\n\n # pylint: disable=no-member\n if len(gtfs.feeds) < 1:\n pygtfs.append_feed(gtfs, os.path.join(self._gtfs_folder,\n self._data_source))\n\n self._departure = get_next_departure(gtfs, self.origin,\n self.destination)\n self._state = self._departure[\"minutes_until_departure\"]\n\n origin_station = self._departure[\"origin_station\"]\n destination_station = self._departure[\"destination_station\"]\n origin_stop_time = self._departure[\"origin_stop_time\"]\n destination_stop_time = self._departure[\"destination_stop_time\"]\n agency = self._departure[\"agency\"]\n route = self._departure[\"route\"]\n trip = self._departure[\"trip\"]\n\n name = \"{} {} to {} next departure\"\n self._name = name.format(agency.agency_name,\n origin_station.stop_id,\n destination_station.stop_id)\n\n # Build attributes\n\n self._attributes = {}\n\n def dict_for_table(resource):\n \"\"\"Return a dict for the SQLAlchemy resource given.\"\"\"\n return dict((col, getattr(resource, col))\n for col in resource.__table__.columns.keys())\n\n def append_keys(resource, prefix=None):\n \"\"\"Properly format key val pairs to append to attributes.\"\"\"\n for key, val in resource.items():\n if val == \"\" or val is None or key == \"feed_id\":\n continue\n pretty_key = key.replace(\"_\", \" \")\n pretty_key = pretty_key.title()\n pretty_key = pretty_key.replace(\"Id\", \"ID\")\n pretty_key = pretty_key.replace(\"Url\", \"URL\")\n if prefix is not None and \\\n pretty_key.startswith(prefix) is False:\n pretty_key = \"{} {}\".format(prefix, pretty_key)\n self._attributes[pretty_key] = val\n\n append_keys(dict_for_table(agency), \"Agency\")\n append_keys(dict_for_table(route), \"Route\")\n append_keys(dict_for_table(trip), \"Trip\")\n append_keys(dict_for_table(origin_station), \"Origin Station\")\n append_keys(dict_for_table(destination_station), \"Destination Station\")\n append_keys(origin_stop_time, \"Origin Stop\")\n append_keys(destination_stop_time, \"Destination Stop\")", "metadata": "root.GTFSDepartureSensor.update", "header": "['class', 'GTFSDepartureSensor', '(', 'Entity', ')', ':', '___EOS___']", "index": 202 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "GT", "FS", "Depart", "ure", "Sensor_", "(_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "late", "st", " ", "data", " ", "from", " ", "GT", "FS", " ", "and", " ", "update", " ", "the", " ", "state", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyg", "tfs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "split", "\\u", "file", "\\u", "name_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "self_", "._", "\\u", "data\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "ite", "\\u", "file_", "=_", "\"{}", ".", "sql", "ite", "\"_", "._", "format_", "(_", "split", "\\u", "file", "\\u", "name_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gtfs", "_", "=_", "pyg", "tfs", "_", "._", "Schedule_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "gtfs", "\\u", "folder_", ",_", "sql", "ite", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "no", "-", "member_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "gtfs", "_", "._", "feeds_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyg", "tfs", "_", "._", "append", "\\u", "feed_", "(_", "gtfs", "_", ",_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "gtfs", "\\u", "folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "data\\u", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "departure", "_", "=_", "get", "\\u", "next", "\\u", "departure", "_", "(_", "gtfs", "_", ",_", "self_", "._", "origin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "state_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "minute", "s", "\\u", "unti", "l\\u", "departure", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "in", "\\u", "station_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "orig", "in", "\\u", "station", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "\\u", "station_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "destinat", "ion", "\\u", "station", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "stop", "\\u", "time_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "orig", "in", "\\u", "stop", "\\u", "time", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "\\u", "stop", "\\u", "time_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "destinat", "ion", "\\u", "stop", "\\u", "time", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agency", "_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "agency", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "route", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip_", "=_", "self_", "._", "\\u", "departure", "_", "[_", "\"", "trip", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"{}", " ", "{}", " ", "to", " ", "{}", " ", "next", " ", "departure", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "name_", "._", "format_", "(_", "agency", "_", "._", "agency", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "in", "\\u", "station_", "._", "stop", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destinat", "ion", "\\u", "station_", "._", "stop", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "attributes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dict", "\\u", "for", "\\u", "table_", "(_", "resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "dict", " ", "for", " ", "the", " ", "SQL", "Al", "chem", "y", " ", "resource", " ", "give", "n", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "(_", "col_", ",_", "getattr_", "(_", "resource_", ",_", "col_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "resource_", "._", "\\u\\u", "table\\u\\u_", "._", "columns_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "keys_", "(_", "resource_", ",_", "prefix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Proper", "ly", " ", "format", " ", "key", " ", "val", " ", "pair", "s", " ", "to", " ", "append", " ", "to", " ", "attribute", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "resource_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "==_", "\"\"_", "or_", "val_", "is_", "None_", "or_", "key_", "==_", "\"", "feed", "\\u", "id", "\"_", ":_", "\\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_", "pretty", "\\u", "key_", "=_", "key_", "._", "replace_", "(_", "\"\\u\"_", ",_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "\\u", "key_", "=_", "pretty", "\\u", "key_", "._", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "\\u", "key_", "=_", "pretty", "\\u", "key_", "._", "replace_", "(_", "\"", "Id", "\"_", ",_", "\"", "ID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "\\u", "key_", "=_", "pretty", "\\u", "key_", "._", "replace_", "(_", "\"", "Ur", "l", "\"_", ",_", "\"", "URL", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", "is_", "not_", "None_", "and_", "pretty", "\\u", "key_", "._", "startswith_", "(_", "prefix_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pretty", "\\u", "key_", "=_", "\"{}", " ", "{}\"_", "._", "format_", "(_", "prefix_", ",_", "pretty", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "attributes_", "[_", "pretty", "\\u", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "append", "\\u", "keys_", "(_", "dict", "\\u", "for", "\\u", "table_", "(_", "agency", "_", ")_", ",_", "\"", "Agency", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "dict", "\\u", "for", "\\u", "table_", "(_", "route_", ")_", ",_", "\"", "Route", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "dict", "\\u", "for", "\\u", "table_", "(_", "trip_", ")_", ",_", "\"", "Tri", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "dict", "\\u", "for", "\\u", "table_", "(_", "orig", "in", "\\u", "station_", ")_", ",_", "\"", "Orig", "in", " ", "Station", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "dict", "\\u", "for", "\\u", "table_", "(_", "destinat", "ion", "\\u", "station_", ")_", ",_", "\"", "Dest", "ination", " ", "Station", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "orig", "in", "\\u", "stop", "\\u", "time_", ",_", "\"", "Orig", "in", " ", "Sto", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append", "\\u", "keys_", "(_", "destinat", "ion", "\\u", "stop", "\\u", "time_", ",_", "\"", "Dest", "ination", " ", "Sto", "p", "\"_", ")_" ]
[ 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, 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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 ]
Insecure temporary file
msanders/cider/cider/core.py
[ { "content": "def _apply_icon(app, icon):\n app_path = osx.path_for_app(app)\n if not app_path:\n raise AppMissingError(\"Application not found: '{0}'\".format(app))\n\n try:\n components = urlparse(icon)\n if not components[\"scheme\"] or components['scheme'] == \"file\":\n icon_path = components[\"path\"]\n else:\n tmpdir = mkdtemp()\n icon_path = os.path.join(tmpdir,\n os.path.basename(components[\"path\"]))\n print(tty.progress(\"Downloading {0} icon: {1}\".format(app, icon)))\n curl(icon, icon_path)\n except ValueError:\n icon_path = icon\n\n osx.set_icon(app_path, os.path.expanduser(icon_path))", "metadata": "root._apply_icon", "header": "['module', '___EOS___']", "index": 660 } ]
[]
[]
0
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "module_", "\\u\\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", "appl", "y", "\\u", "icon_", "(_", "app_", ",_", "icon_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "path_", "=_", "os", "x_", "._", "path", "\\u", "for", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "App", "Missing", "Error_", "(_", "\"", "Applica", "tion", " ", "not", " ", "found", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "app_", ")_", ")_", "\\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 ", " _", "components_", "=_", "urlparse_", "(_", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "components_", "[_", "\"", "sche", "me", "\"_", "]_", "or_", "components_", "[_", "'", "sche", "me", "'_", "]_", "==_", "\"", "file", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "path_", "=_", "components_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpdir_", "=_", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "components_", "[_", "\"", "path", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Down", "load", "ing", " ", "{", "0", "}", " ", "icon", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "app_", ",_", "icon_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl_", "(_", "icon_", ",_", "icon", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "path_", "=_", "icon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os", "x_", "._", "set\\u", "icon_", "(_", "app", "\\u", "path_", ",_", "os_", "._", "path_", "._", "expanduser_", "(_", "icon", "\\u", "path_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ganeti/ganeti/lib/cmdlib/instance_migration.py
[ { "content": "#\n#\n\n# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n#\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\"\"\"Logical units dealing with instance migration an failover.\"\"\"\n\nimport logging\nimport time\n\nfrom ganeti import constants\nfrom ganeti import errors\nfrom ganeti import locking\nfrom ganeti import hypervisor\nfrom ganeti.masterd import iallocator\nfrom ganeti import utils\nfrom ganeti.cmdlib.base import LogicalUnit, Tasklet\nfrom ganeti.cmdlib.common import ExpandInstanceUuidAndName, \\\n CheckIAllocatorOrNode, ExpandNodeUuidAndName\nfrom ganeti.cmdlib.instance_storage import CheckDiskConsistency, \\\n ExpandCheckDisks, ShutdownInstanceDisks, AssembleInstanceDisks\nfrom ganeti.cmdlib.instance_utils import BuildInstanceHookEnvByObject, \\\n CheckTargetNodeIPolicy, ReleaseLocks, CheckNodeNotDrained, \\\n CopyLockList, CheckNodeFreeMemory, CheckInstanceBridgesExist\n\nimport ganeti.masterd.instance\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _ExpandNamesForMigration(lu):\n \"\"\"Expands names for use with L{TLMigrateInstance}.\n\n @type lu: L{LogicalUnit}\n\n \"\"\"\n if lu.op.target_node is not None:\n (lu.op.target_node_uuid, lu.op.target_node) = \\\n ExpandNodeUuidAndName(lu.cfg, lu.op.target_node_uuid, lu.op.target_node)\n\n lu.needed_locks[locking.LEVEL_NODE] = []\n lu.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE\n lu.dont_collate_locks[locking.LEVEL_NODE] = True\n\n lu.needed_locks[locking.LEVEL_NODE_RES] = []\n lu.recalculate_locks[locking.LEVEL_NODE_RES] = constants.LOCKS_REPLACE\n lu.dont_collate_locks[locking.LEVEL_NODE_RES] = True", "metadata": "root._ExpandNamesForMigration", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def _DeclareLocksForMigration(lu, level):\n \"\"\"Declares locks for L{TLMigrateInstance}.\n\n @type lu: L{LogicalUnit}\n @param level: Lock level\n\n \"\"\"\n if level == locking.LEVEL_NODE:\n assert lu.op.instance_name in lu.owned_locks(locking.LEVEL_INSTANCE)\n\n instance = lu.cfg.GetInstanceInfo(lu.op.instance_uuid)\n\n disks = lu.cfg.GetInstanceDisks(instance.uuid)\n if utils.AnyDiskOfType(disks, constants.DTS_EXT_MIRROR):\n if lu.op.target_node is None:\n lu.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET\n else:\n lu.needed_locks[locking.LEVEL_NODE] = [instance.primary_node,\n lu.op.target_node_uuid]\n else:\n lu._LockInstancesNodes() # pylint: disable=W0212\n\n assert (lu.needed_locks[locking.LEVEL_NODE] or\n lu.needed_locks[locking.LEVEL_NODE] is locking.ALL_SET)\n\n elif level == locking.LEVEL_NODE_RES:\n # Copy node locks\n lu.needed_locks[locking.LEVEL_NODE_RES] = \\\n CopyLockList(lu.needed_locks[locking.LEVEL_NODE])", "metadata": "root._DeclareLocksForMigration", "header": "['module', '___EOS___']", "index": 72 }, { "content": "class LUInstanceFailover(LogicalUnit):\n \"\"\"Failover an instance.\n\n This is migration by shutting the instance down, but with the disks\n of the instance already available on the new node.\n\n See also:\n L{LUInstanceMove} for moving an instance by copying the data.\n\n L{LUInstanceMigrate} for the live migration of an instance (no shutdown\n required).\n \"\"\"\n HPATH = \"instance-failover\"\n HTYPE = constants.HTYPE_INSTANCE\n REQ_BGL = False\n\n\n\n\n", "metadata": "root.LUInstanceFailover", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def CheckArguments(self):\n \"\"\"Check the arguments.\n\n \"\"\"\n self.iallocator = getattr(self.op, \"iallocator\", None)\n self.target_node = getattr(self.op, \"target_node\", None)", "metadata": "root.LUInstanceFailover.CheckArguments", "header": "['class', 'LUInstanceFailover', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 119 }, { "content": " def ExpandNames(self):\n self._ExpandAndLockInstance(allow_forthcoming=True)\n _ExpandNamesForMigration(self)\n\n self._migrater = \\\n TLMigrateInstance(self, self.op.instance_uuid, self.op.instance_name,\n self.op.cleanup, True, False,\n self.op.ignore_consistency, True,\n self.op.shutdown_timeout, self.op.ignore_ipolicy, True)\n\n self.tasklets = [self._migrater]", "metadata": "root.LUInstanceFailover.ExpandNames", "header": "['class', 'LUInstanceFailover', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 126 }, { "content": " def DeclareLocks(self, level):\n _DeclareLocksForMigration(self, level)", "metadata": "root.LUInstanceFailover.DeclareLocks", "header": "['class', 'LUInstanceFailover', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 138 }, { "content": " def BuildHooksEnv(self):\n \"\"\"Build hooks env.\n\n This runs on master, primary and secondary nodes of the instance.\n\n \"\"\"\n instance = self._migrater.instance\n source_node_uuid = instance.primary_node\n target_node_uuid = self._migrater.target_node_uuid\n env = {\n \"IGNORE_CONSISTENCY\": self.op.ignore_consistency,\n \"SHUTDOWN_TIMEOUT\": self.op.shutdown_timeout,\n \"OLD_PRIMARY\": self.cfg.GetNodeName(source_node_uuid),\n \"NEW_PRIMARY\": self.cfg.GetNodeName(target_node_uuid),\n \"FAILOVER_CLEANUP\": self.op.cleanup,\n }\n\n disks = self.cfg.GetInstanceDisks(instance.uuid)\n if utils.AnyDiskOfType(disks, constants.DTS_INT_MIRROR):\n secondary_nodes = self.cfg.GetInstanceSecondaryNodes(instance.uuid)\n env[\"OLD_SECONDARY\"] = self.cfg.GetNodeName(secondary_nodes[0])\n env[\"NEW_SECONDARY\"] = self.cfg.GetNodeName(source_node_uuid)\n else:\n env[\"OLD_SECONDARY\"] = env[\"NEW_SECONDARY\"] = \"\"\n\n env.update(BuildInstanceHookEnvByObject(self, instance))\n\n return env", "metadata": "root.LUInstanceFailover.BuildHooksEnv", "header": "['class', 'LUInstanceFailover', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 141 }, { "content": " def BuildHooksNodes(self):\n \"\"\"Build hooks nodes.\n\n \"\"\"\n instance = self._migrater.instance\n secondary_nodes = self.cfg.GetInstanceSecondaryNodes(instance.uuid)\n nl = [self.cfg.GetMasterNode()] + list(secondary_nodes)\n nl.append(self._migrater.target_node_uuid)\n return (nl, nl + [instance.primary_node])", "metadata": "root.LUInstanceFailover.BuildHooksNodes", "header": "['class', 'LUInstanceFailover', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 170 }, { "content": "class LUInstanceMigrate(LogicalUnit):\n \"\"\"Migrate an instance.\n\n This is migration without shutting down (live migration) and the disks are\n already available on the new node.\n\n See also:\n L{LUInstanceMove} for moving an instance by copying the data.\n\n L{LUInstanceFailover} for the migration of an instance where a shutdown is\n required.\n \"\"\"\n HPATH = \"instance-migrate\"\n HTYPE = constants.HTYPE_INSTANCE\n REQ_BGL = False\n\n\n\n", "metadata": "root.LUInstanceMigrate", "header": "['module', '___EOS___']", "index": 181 }, { "content": " def ExpandNames(self):\n self._ExpandAndLockInstance()\n _ExpandNamesForMigration(self)\n\n self._migrater = \\\n TLMigrateInstance(self, self.op.instance_uuid, self.op.instance_name,\n self.op.cleanup, False, self.op.allow_failover, False,\n self.op.allow_runtime_changes,\n constants.DEFAULT_SHUTDOWN_TIMEOUT,\n self.op.ignore_ipolicy, self.op.ignore_hvversions)\n\n self.tasklets = [self._migrater]", "metadata": "root.LUInstanceMigrate.ExpandNames", "header": "['class', 'LUInstanceMigrate', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 197 }, { "content": " def DeclareLocks(self, level):\n _DeclareLocksForMigration(self, level)", "metadata": "root.LUInstanceMigrate.DeclareLocks", "header": "['class', 'LUInstanceMigrate', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 210 }, { "content": " def BuildHooksEnv(self):\n \"\"\"Build hooks env.\n\n This runs on master, primary and secondary nodes of the instance.\n\n \"\"\"\n instance = self._migrater.instance\n source_node_uuid = instance.primary_node\n target_node_uuid = self._migrater.target_node_uuid\n env = BuildInstanceHookEnvByObject(self, instance)\n env.update({\n \"MIGRATE_LIVE\": self._migrater.live,\n \"MIGRATE_CLEANUP\": self.op.cleanup,\n \"OLD_PRIMARY\": self.cfg.GetNodeName(source_node_uuid),\n \"NEW_PRIMARY\": self.cfg.GetNodeName(target_node_uuid),\n \"ALLOW_RUNTIME_CHANGES\": self.op.allow_runtime_changes,\n })\n\n disks = self.cfg.GetInstanceDisks(instance.uuid)\n if utils.AnyDiskOfType(disks, constants.DTS_INT_MIRROR):\n secondary_nodes = self.cfg.GetInstanceSecondaryNodes(instance.uuid)\n env[\"OLD_SECONDARY\"] = self.cfg.GetNodeName(secondary_nodes[0])\n env[\"NEW_SECONDARY\"] = self.cfg.GetNodeName(source_node_uuid)\n else:\n env[\"OLD_SECONDARY\"] = env[\"NEW_SECONDARY\"] = \"\"\n\n return env", "metadata": "root.LUInstanceMigrate.BuildHooksEnv", "header": "['class', 'LUInstanceMigrate', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 213 }, { "content": " def BuildHooksNodes(self):\n \"\"\"Build hooks nodes.\n\n \"\"\"\n instance = self._migrater.instance\n secondary_nodes = self.cfg.GetInstanceSecondaryNodes(instance.uuid)\n snode_uuids = list(secondary_nodes)\n nl = [self.cfg.GetMasterNode(), instance.primary_node] + snode_uuids\n nl.append(self._migrater.target_node_uuid)\n return (nl, nl)", "metadata": "root.LUInstanceMigrate.BuildHooksNodes", "header": "['class', 'LUInstanceMigrate', '(', 'LogicalUnit', ')', ':', '___EOS___']", "index": 241 }, { "content": "class TLMigrateInstance(Tasklet):\n \"\"\"Tasklet class for instance migration.\n\n @type live: boolean\n @ivar live: whether the migration will be done live or non-live;\n this variable is initalized only after CheckPrereq has run\n @type cleanup: boolean\n @ivar cleanup: Wheater we cleanup from a failed migration\n @type iallocator: string\n @ivar iallocator: The iallocator used to determine target_node\n @type target_node_uuid: string\n @ivar target_node_uuid: If given, the target node UUID to reallocate the\n instance to\n @type failover: boolean\n @ivar failover: Whether operation results in failover or migration\n @type fallback: boolean\n @ivar fallback: Whether fallback to failover is allowed if migration not\n possible\n @type ignore_consistency: boolean\n @ivar ignore_consistency: Wheter we should ignore consistency between source\n and target node\n @type shutdown_timeout: int\n @ivar shutdown_timeout: In case of failover timeout of the shutdown\n @type ignore_ipolicy: bool\n @ivar ignore_ipolicy: If true, we can ignore instance policy when migrating\n @type ignore_hvversions: bool\n @ivar ignore_hvversions: If true, accept incompatible hypervisor versions\n\n \"\"\"\n\n # Constants\n _MIGRATION_POLL_INTERVAL = 1 # seconds\n _MIGRATION_FEEDBACK_INTERVAL = 10 # seconds\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TLMigrateInstance", "header": "['module', '___EOS___']", "index": 253 }, { "content": " def __init__(self, lu, instance_uuid, instance_name, cleanup, failover,\n fallback, ignore_consistency, allow_runtime_changes,\n shutdown_timeout, ignore_ipolicy, ignore_hvversions):\n \"\"\"Initializes this class.\n\n \"\"\"\n Tasklet.__init__(self, lu)\n\n # Parameters\n self.instance_uuid = instance_uuid\n self.instance_name = instance_name\n self.cleanup = cleanup\n self.live = False # will be overridden later\n self.failover = failover\n self.fallback = fallback\n self.ignore_consistency = ignore_consistency\n self.shutdown_timeout = shutdown_timeout\n self.ignore_ipolicy = ignore_ipolicy\n self.allow_runtime_changes = allow_runtime_changes\n self.ignore_hvversions = ignore_hvversions", "metadata": "root.TLMigrateInstance.__init__", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 287 }, { "content": " def CheckPrereq(self):\n \"\"\"Check prerequisites.\n\n This checks that the instance is in the cluster.\n\n \"\"\"\n (self.instance_uuid, self.instance_name) = \\\n ExpandInstanceUuidAndName(self.lu.cfg, self.instance_uuid,\n self.instance_name)\n self.instance = self.cfg.GetInstanceInfo(self.instance_uuid)\n assert self.instance is not None\n cluster = self.cfg.GetClusterInfo()\n\n if (not self.cleanup and\n not self.instance.admin_state == constants.ADMINST_UP and\n not self.failover and self.fallback):\n self.lu.LogInfo(\"Instance is marked down or offline, fallback allowed,\"\n \" switching to failover\")\n self.failover = True\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n\n if not utils.AllDiskOfType(disks, constants.DTS_MIRRORED):\n if self.failover:\n text = \"failovers\"\n else:\n text = \"migrations\"\n invalid_disks = set(d.dev_type for d in disks\n if d.dev_type not in constants.DTS_MIRRORED)\n raise errors.OpPrereqError(\"Instance's disk layout '%s' does not allow\"\n \" %s\" % (utils.CommaJoin(invalid_disks), text),\n errors.ECODE_STATE)\n\n # TODO allow heterogeneous disk types if all are mirrored in some way.\n if utils.AllDiskOfType(disks, constants.DTS_EXT_MIRROR):\n CheckIAllocatorOrNode(self.lu, \"iallocator\", \"target_node\")\n\n if self.lu.op.iallocator:\n self._RunAllocator()\n else:\n # We set set self.target_node_uuid as it is required by\n # BuildHooksEnv\n self.target_node_uuid = self.lu.op.target_node_uuid\n\n # Check that the target node is correct in terms of instance policy\n nodeinfo = self.cfg.GetNodeInfo(self.target_node_uuid)\n group_info = self.cfg.GetNodeGroup(nodeinfo.group)\n ipolicy = ganeti.masterd.instance.CalculateGroupIPolicy(cluster,\n group_info)\n CheckTargetNodeIPolicy(self.lu, ipolicy, self.instance, nodeinfo,\n self.cfg, ignore=self.ignore_ipolicy)\n\n # self.target_node is already populated, either directly or by the\n # iallocator run\n target_node_uuid = self.target_node_uuid\n if self.target_node_uuid == self.instance.primary_node:\n raise errors.OpPrereqError(\n \"Cannot migrate instance %s to its primary (%s)\" %\n (self.instance.name,\n self.cfg.GetNodeName(self.instance.primary_node)),\n errors.ECODE_STATE)\n\n if len(self.lu.tasklets) == 1:\n # It is safe to release locks only when we're the only tasklet\n # in the LU\n ReleaseLocks(self.lu, locking.LEVEL_NODE,\n keep=[self.instance.primary_node, self.target_node_uuid])\n\n elif utils.AllDiskOfType(disks, constants.DTS_INT_MIRROR):\n templates = [d.dev_type for d in disks]\n secondary_node_uuids = \\\n self.cfg.GetInstanceSecondaryNodes(self.instance.uuid)\n if not secondary_node_uuids:\n raise errors.ConfigurationError(\"No secondary node but using\"\n \" %s disk types\" %\n utils.CommaJoin(set(templates)))\n self.target_node_uuid = target_node_uuid = secondary_node_uuids[0]\n if self.lu.op.iallocator or \\\n (self.lu.op.target_node_uuid and\n self.lu.op.target_node_uuid != target_node_uuid):\n if self.failover:\n text = \"failed over\"\n else:\n text = \"migrated\"\n raise errors.OpPrereqError(\"Instances with disk types %s cannot\"\n \" be %s to arbitrary nodes\"\n \" (neither an iallocator nor a target\"\n \" node can be passed)\" %\n (utils.CommaJoin(set(templates)), text),\n errors.ECODE_INVAL)\n nodeinfo = self.cfg.GetNodeInfo(target_node_uuid)\n group_info = self.cfg.GetNodeGroup(nodeinfo.group)\n ipolicy = ganeti.masterd.instance.CalculateGroupIPolicy(cluster,\n group_info)\n CheckTargetNodeIPolicy(self.lu, ipolicy, self.instance, nodeinfo,\n self.cfg, ignore=self.ignore_ipolicy)\n\n else:\n raise errors.OpPrereqError(\"Instance mixes internal and external \"\n \"mirroring. This is not currently supported.\")\n\n i_be = cluster.FillBE(self.instance)\n\n # check memory requirements on the secondary node\n if (not self.cleanup and\n (not self.failover or\n self.instance.admin_state == constants.ADMINST_UP)):\n self.tgt_free_mem = CheckNodeFreeMemory(\n self.lu, target_node_uuid,\n \"migrating instance %s\" % self.instance.name,\n i_be[constants.BE_MINMEM], self.instance.hypervisor,\n self.cfg.GetClusterInfo().hvparams[self.instance.hypervisor])\n else:\n self.lu.LogInfo(\"Not checking memory on the secondary node as\"\n \" instance will not be started\")\n\n # check if failover must be forced instead of migration\n if (not self.cleanup and not self.failover and\n i_be[constants.BE_ALWAYS_FAILOVER]):\n self.lu.LogInfo(\"Instance configured to always failover; fallback\"\n \" to failover\")\n self.failover = True\n\n # check bridge existance\n CheckInstanceBridgesExist(self.lu, self.instance,\n node_uuid=target_node_uuid)\n\n if not self.cleanup:\n CheckNodeNotDrained(self.lu, target_node_uuid)\n if not self.failover:\n result = self.rpc.call_instance_migratable(self.instance.primary_node,\n self.instance)\n if result.fail_msg and self.fallback:\n self.lu.LogInfo(\"Can't migrate, instance offline, fallback to\"\n \" failover\")\n self.failover = True\n else:\n result.Raise(\"Can't migrate, please use failover\",\n prereq=True, ecode=errors.ECODE_STATE)\n\n assert not (self.failover and self.cleanup)\n\n if not self.failover:\n if self.lu.op.live is not None and self.lu.op.mode is not None:\n raise errors.OpPrereqError(\"Only one of the 'live' and 'mode'\"\n \" parameters are accepted\",\n errors.ECODE_INVAL)\n if self.lu.op.live is not None:\n if self.lu.op.live:\n self.lu.op.mode = constants.HT_MIGRATION_LIVE\n else:\n self.lu.op.mode = constants.HT_MIGRATION_NONLIVE\n # reset the 'live' parameter to None so that repeated\n # invocations of CheckPrereq do not raise an exception\n self.lu.op.live = None\n elif self.lu.op.mode is None:\n # read the default value from the hypervisor\n i_hv = cluster.FillHV(self.instance, skip_globals=False)\n self.lu.op.mode = i_hv[constants.HV_MIGRATION_MODE]\n\n self.live = self.lu.op.mode == constants.HT_MIGRATION_LIVE\n else:\n # Failover is never live\n self.live = False\n\n if not (self.failover or self.cleanup):\n remote_info = self.rpc.call_instance_info(\n self.instance.primary_node, self.instance.name,\n self.instance.hypervisor, cluster.hvparams[self.instance.hypervisor])\n remote_info.Raise(\"Error checking instance on node %s\" %\n self.cfg.GetNodeName(self.instance.primary_node),\n prereq=True)\n instance_running = bool(remote_info.payload)\n if instance_running:\n self.current_mem = int(remote_info.payload[\"memory\"])", "metadata": "root.TLMigrateInstance.CheckPrereq", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 308 }, { "content": " def _RunAllocator(self):\n \"\"\"Run the allocator based on input opcode.\n\n \"\"\"\n # FIXME: add a self.ignore_ipolicy option\n req = iallocator.IAReqRelocate(\n inst_uuid=self.instance_uuid,\n relocate_from_node_uuids=[self.instance.primary_node])\n ial = iallocator.IAllocator(self.cfg, self.rpc, req)\n\n ial.Run(self.lu.op.iallocator)\n\n if not ial.success:\n raise errors.OpPrereqError(\"Can't compute nodes using\"\n \" iallocator '%s': %s\" %\n (self.lu.op.iallocator, ial.info),\n errors.ECODE_NORES)\n self.target_node_uuid = self.cfg.GetNodeInfoByName(ial.result[0]).uuid\n self.lu.LogInfo(\"Selected nodes for instance %s via iallocator %s: %s\",\n self.instance_name, self.lu.op.iallocator,\n utils.CommaJoin(ial.result))", "metadata": "root.TLMigrateInstance._RunAllocator", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 484 }, { "content": " def _WaitUntilSync(self):\n \"\"\"Poll with custom rpc for disk sync.\n\n This uses our own step-based rpc call.\n\n \"\"\"\n self.feedback_fn(\"* wait until resync is done\")\n all_done = False\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n while not all_done:\n all_done = True\n result = self.rpc.call_drbd_wait_sync(self.all_node_uuids,\n (disks, self.instance))\n min_percent = 100\n for node_uuid, nres in result.items():\n nres.Raise(\"Cannot resync disks on node %s\" %\n self.cfg.GetNodeName(node_uuid))\n node_done, node_percent = nres.payload\n all_done = all_done and node_done\n if node_percent is not None:\n min_percent = min(min_percent, node_percent)\n if not all_done:\n if min_percent < 100:\n self.feedback_fn(\" - progress: %.1f%%\" % min_percent)\n time.sleep(2)", "metadata": "root.TLMigrateInstance._WaitUntilSync", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 506 }, { "content": " def _OpenInstanceDisks(self, node_uuid, exclusive):\n \"\"\"Open instance disks.\n\n \"\"\"\n if exclusive:\n mode = \"in exclusive mode\"\n else:\n mode = \"in shared mode\"\n\n node_name = self.cfg.GetNodeName(node_uuid)\n\n self.feedback_fn(\"* opening instance disks on node %s %s\" %\n (node_name, mode))\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n result = self.rpc.call_blockdev_open(node_uuid, self.instance.name,\n (disks, self.instance), exclusive)\n result.Raise(\"Cannot open instance disks on node %s\" % node_name)", "metadata": "root.TLMigrateInstance._OpenInstanceDisks", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 532 }, { "content": " def _CloseInstanceDisks(self, node_uuid):\n \"\"\"Close instance disks.\n\n \"\"\"\n node_name = self.cfg.GetNodeName(node_uuid)\n\n self.feedback_fn(\"* closing instance disks on node %s\" % node_name)\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n result = self.rpc.call_blockdev_close(node_uuid, self.instance.name,\n (disks, self.instance))\n msg = result.fail_msg\n if msg:\n if result.offline or self.ignore_consistency:\n self.lu.LogWarning(\"Could not close instance disks on node %s,\"\n \" proceeding anyway\" % node_name)\n else:\n raise errors.OpExecError(\"Cannot close instance disks on node %s: %s\" %\n (node_name, msg))", "metadata": "root.TLMigrateInstance._CloseInstanceDisks", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 551 }, { "content": " def _GoStandalone(self):\n \"\"\"Disconnect from the network.\n\n \"\"\"\n self.feedback_fn(\"* changing into standalone mode\")\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n result = self.rpc.call_drbd_disconnect_net(\n self.all_node_uuids, (disks, self.instance))\n for node_uuid, nres in result.items():\n nres.Raise(\"Cannot disconnect disks node %s\" %\n self.cfg.GetNodeName(node_uuid))", "metadata": "root.TLMigrateInstance._GoStandalone", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 571 }, { "content": " def _GoReconnect(self, multimaster):\n \"\"\"Reconnect to the network.\n\n \"\"\"\n if multimaster:\n msg = \"dual-master\"\n else:\n msg = \"single-master\"\n self.feedback_fn(\"* changing disks into %s mode\" % msg)\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n result = self.rpc.call_drbd_attach_net(self.all_node_uuids,\n (disks, self.instance),\n multimaster)\n for node_uuid, nres in result.items():\n nres.Raise(\"Cannot change disks config on node %s\" %\n self.cfg.GetNodeName(node_uuid))", "metadata": "root.TLMigrateInstance._GoReconnect", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 583 }, { "content": " def _ExecCleanup(self):\n \"\"\"Try to cleanup after a failed migration.\n\n The cleanup is done by:\n - check that the instance is running only on one node\n (and update the config if needed)\n - change disks on its secondary node to secondary\n - wait until disks are fully synchronized\n - disconnect from the network\n - change disks into single-master mode\n - wait again until disks are fully synchronized\n\n \"\"\"\n # check running on only one node\n self.feedback_fn(\"* checking where the instance actually runs\"\n \" (if this hangs, the hypervisor might be in\"\n \" a bad state)\")\n cluster_hvparams = self.cfg.GetClusterInfo().hvparams\n ins_l = self.rpc.call_instance_list(self.all_node_uuids,\n [self.instance.hypervisor],\n cluster_hvparams)\n for node_uuid, result in ins_l.items():\n result.Raise(\"Can't contact node %s\" % node_uuid)\n\n runningon_source = self.instance.name in \\\n ins_l[self.source_node_uuid].payload\n runningon_target = self.instance.name in \\\n ins_l[self.target_node_uuid].payload\n\n if runningon_source and runningon_target:\n raise errors.OpExecError(\"Instance seems to be running on two nodes,\"\n \" or the hypervisor is confused; you will have\"\n \" to ensure manually that it runs only on one\"\n \" and restart this operation\")\n\n if not (runningon_source or runningon_target):\n raise errors.OpExecError(\"Instance does not seem to be running at all;\"\n \" in this case it's safer to repair by\"\n \" running 'gnt-instance stop' to ensure disk\"\n \" shutdown, and then restarting it\")\n\n if runningon_target:\n # the migration has actually succeeded, we need to update the config\n self.feedback_fn(\"* instance running on secondary node (%s),\"\n \" updating config\" %\n self.cfg.GetNodeName(self.target_node_uuid))\n self.cfg.SetInstancePrimaryNode(self.instance.uuid,\n self.target_node_uuid)\n demoted_node_uuid = self.source_node_uuid\n else:\n self.feedback_fn(\"* instance confirmed to be running on its\"\n \" primary node (%s)\" %\n self.cfg.GetNodeName(self.source_node_uuid))\n demoted_node_uuid = self.target_node_uuid\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n\n self._CloseInstanceDisks(demoted_node_uuid)\n\n if utils.AnyDiskOfType(disks, constants.DTS_INT_MIRROR):\n try:\n self._WaitUntilSync()\n except errors.OpExecError:\n # we ignore here errors, since if the device is standalone, it\n # won't be able to sync\n pass\n self._GoStandalone()\n self._GoReconnect(False)\n self._WaitUntilSync()\n elif utils.AnyDiskOfType(disks, constants.DTS_EXT_MIRROR):\n self._OpenInstanceDisks(self.instance.primary_node, True)\n\n self.feedback_fn(\"* done\")", "metadata": "root.TLMigrateInstance._ExecCleanup", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 600 }, { "content": " def _RevertDiskStatus(self):\n \"\"\"Try to revert the disk status after a failed migration.\n\n \"\"\"\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n\n self._CloseInstanceDisks(self.target_node_uuid)\n\n if utils.AllDiskOfType(disks, constants.DTS_EXT_MIRROR):\n self._OpenInstanceDisks(self.source_node_uuid, True)\n return\n\n try:\n self._GoStandalone()\n self._GoReconnect(False)\n self._WaitUntilSync()\n except errors.OpExecError, err:\n self.lu.LogWarning(\"Migration failed and I can't reconnect the drives,\"\n \" please try to recover the instance manually;\"\n \" error '%s'\" % str(err))", "metadata": "root.TLMigrateInstance._RevertDiskStatus", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 674 }, { "content": " def _AbortMigration(self):\n \"\"\"Call the hypervisor code to abort a started migration.\n\n \"\"\"\n abort_result = self.rpc.call_instance_finalize_migration_dst(\n self.target_node_uuid, self.instance, self.migration_info,\n False)\n abort_msg = abort_result.fail_msg\n if abort_msg:\n logging.error(\"Aborting migration failed on target node %s: %s\",\n self.cfg.GetNodeName(self.target_node_uuid), abort_msg)\n # Don't raise an exception here, as we stil have to try to revert the\n # disk status, even if this step failed.\n\n abort_result = self.rpc.call_instance_finalize_migration_src(\n self.source_node_uuid, self.instance, False, self.live)\n abort_msg = abort_result.fail_msg\n if abort_msg:\n logging.error(\"Aborting migration failed on source node %s: %s\",\n self.cfg.GetNodeName(self.source_node_uuid), abort_msg)", "metadata": "root.TLMigrateInstance._AbortMigration", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 696 }, { "content": " def _ExecMigration(self):\n \"\"\"Migrate an instance.\n\n The migrate is done by:\n - change the disks into dual-master mode\n - wait until disks are fully synchronized again\n - migrate the instance\n - change disks on the new secondary node (the old primary) to secondary\n - wait until disks are fully synchronized\n - change disks into single-master mode\n\n \"\"\"\n # Check for hypervisor version mismatch and warn the user.\n hvspecs = [(self.instance.hypervisor,\n self.cfg.GetClusterInfo().hvparams[self.instance.hypervisor])]\n nodeinfo = self.rpc.call_node_info(\n [self.source_node_uuid, self.target_node_uuid], None, hvspecs)\n for ninfo in nodeinfo.values():\n ninfo.Raise(\"Unable to retrieve node information from node '%s'\" %\n ninfo.node)\n (_, _, (src_info, )) = nodeinfo[self.source_node_uuid].payload\n (_, _, (dst_info, )) = nodeinfo[self.target_node_uuid].payload\n\n if ((constants.HV_NODEINFO_KEY_VERSION in src_info) and\n (constants.HV_NODEINFO_KEY_VERSION in dst_info)):\n src_version = src_info[constants.HV_NODEINFO_KEY_VERSION]\n dst_version = dst_info[constants.HV_NODEINFO_KEY_VERSION]\n if src_version != dst_version:\n self.feedback_fn(\"* warning: hypervisor version mismatch between\"\n \" source (%s) and target (%s) node\" %\n (src_version, dst_version))\n hv = hypervisor.GetHypervisor(self.instance.hypervisor)\n if hv.VersionsSafeForMigration(src_version, dst_version):\n self.feedback_fn(\" migrating from hypervisor version %s to %s should\"\n \" be safe\" % (src_version, dst_version))\n else:\n self.feedback_fn(\" migrating from hypervisor version %s to %s is\"\n \" likely unsupported\" % (src_version, dst_version))\n if self.ignore_hvversions:\n self.feedback_fn(\" continuing anyway (told to ignore version\"\n \" mismatch)\")\n else:\n raise errors.OpExecError(\"Unsupported migration between hypervisor\"\n \" versions (%s to %s)\" %\n (src_version, dst_version))\n\n self.feedback_fn(\"* checking disk consistency between source and target\")\n for (idx, dev) in enumerate(self.cfg.GetInstanceDisks(self.instance.uuid)):\n if not CheckDiskConsistency(self.lu, self.instance, dev,\n self.target_node_uuid,\n False):\n raise errors.OpExecError(\"Disk %s is degraded or not fully\"\n \" synchronized on target node,\"\n \" aborting migration\" % idx)\n\n if self.current_mem > self.tgt_free_mem:\n if not self.allow_runtime_changes:\n raise errors.OpExecError(\"Memory ballooning not allowed and not enough\"\n \" free memory to fit instance %s on target\"\n \" node %s (have %dMB, need %dMB)\" %\n (self.instance.name,\n self.cfg.GetNodeName(self.target_node_uuid),\n self.tgt_free_mem, self.current_mem))\n self.feedback_fn(\"* setting instance memory to %s\" % self.tgt_free_mem)\n rpcres = self.rpc.call_instance_balloon_memory(self.instance.primary_node,\n self.instance,\n self.tgt_free_mem)\n rpcres.Raise(\"Cannot modify instance runtime memory\")\n\n # First get the migration information from the remote node\n result = self.rpc.call_migration_info(self.source_node_uuid, self.instance)\n msg = result.fail_msg\n if msg:\n log_err = (\"Failed fetching source migration information from %s: %s\" %\n (self.cfg.GetNodeName(self.source_node_uuid), msg))\n logging.error(log_err)\n raise errors.OpExecError(log_err)\n\n self.migration_info = migration_info = result.payload\n\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n\n self._CloseInstanceDisks(self.target_node_uuid)\n\n if utils.AnyDiskOfType(disks, constants.DTS_INT_MIRROR):\n # Then switch the disks to master/master mode\n self._GoStandalone()\n self._GoReconnect(True)\n self._WaitUntilSync()\n\n self._OpenInstanceDisks(self.source_node_uuid, False)\n self._OpenInstanceDisks(self.target_node_uuid, False)\n\n self.feedback_fn(\"* preparing %s to accept the instance\" %\n self.cfg.GetNodeName(self.target_node_uuid))\n result = self.rpc.call_accept_instance(self.target_node_uuid,\n self.instance,\n migration_info,\n self.nodes_ip[self.target_node_uuid])\n\n msg = result.fail_msg\n if msg:\n logging.error(\"Instance pre-migration failed, trying to revert\"\n \" disk status: %s\", msg)\n self.feedback_fn(\"Pre-migration failed, aborting\")\n self._AbortMigration()\n self._RevertDiskStatus()\n raise errors.OpExecError(\"Could not pre-migrate instance %s: %s\" %\n (self.instance.name, msg))\n\n self.feedback_fn(\"* migrating instance to %s\" %\n self.cfg.GetNodeName(self.target_node_uuid))\n cluster = self.cfg.GetClusterInfo()\n result = self.rpc.call_instance_migrate(\n self.source_node_uuid, cluster.cluster_name, self.instance,\n self.nodes_ip[self.target_node_uuid], self.live)\n msg = result.fail_msg\n if msg:\n logging.error(\"Instance migration failed, trying to revert\"\n \" disk status: %s\", msg)\n self.feedback_fn(\"Migration failed, aborting\")\n self._AbortMigration()\n self._RevertDiskStatus()\n raise errors.OpExecError(\"Could not migrate instance %s: %s\" %\n (self.instance.name, msg))\n\n self.feedback_fn(\"* starting memory transfer\")\n last_feedback = time.time()\n while True:\n result = self.rpc.call_instance_get_migration_status(\n self.source_node_uuid, self.instance)\n msg = result.fail_msg\n ms = result.payload # MigrationStatus instance\n if msg or (ms.status in constants.HV_MIGRATION_FAILED_STATUSES):\n logging.error(\"Instance migration failed, trying to revert\"\n \" disk status: %s\", msg)\n self.feedback_fn(\"Migration failed, aborting\")\n self._AbortMigration()\n self._RevertDiskStatus()\n if not msg:\n msg = \"hypervisor returned failure\"\n raise errors.OpExecError(\"Could not migrate instance %s: %s\" %\n (self.instance.name, msg))\n\n if result.payload.status != constants.HV_MIGRATION_ACTIVE:\n self.feedback_fn(\"* memory transfer complete\")\n break\n\n if (utils.TimeoutExpired(last_feedback,\n self._MIGRATION_FEEDBACK_INTERVAL) and\n ms.transferred_ram is not None):\n mem_progress = 100 * float(ms.transferred_ram) / float(ms.total_ram)\n self.feedback_fn(\"* memory transfer progress: %.2f %%\" % mem_progress)\n last_feedback = time.time()\n\n time.sleep(self._MIGRATION_POLL_INTERVAL)\n\n result = self.rpc.call_instance_finalize_migration_src(\n self.source_node_uuid, self.instance, True, self.live)\n msg = result.fail_msg\n if msg:\n logging.error(\"Instance migration succeeded, but finalization failed\"\n \" on the source node: %s\", msg)\n raise errors.OpExecError(\"Could not finalize instance migration: %s\" %\n msg)\n\n self.cfg.SetInstancePrimaryNode(self.instance.uuid, self.target_node_uuid)\n self.instance = self.cfg.GetInstanceInfo(self.instance_uuid)\n disks = self.cfg.GetInstanceDisks(self.instance_uuid)\n\n result = self.rpc.call_instance_finalize_migration_dst(\n self.target_node_uuid, self.instance, migration_info, True)\n msg = result.fail_msg\n if msg:\n logging.error(\"Instance migration succeeded, but finalization failed\"\n \" on the target node: %s\", msg)\n raise errors.OpExecError(\"Could not finalize instance migration: %s\" %\n msg)\n\n self._CloseInstanceDisks(self.source_node_uuid)\n\n if utils.AnyDiskOfType(disks, constants.DTS_INT_MIRROR):\n self._WaitUntilSync()\n self._GoStandalone()\n self._GoReconnect(False)\n self._WaitUntilSync()\n elif utils.AnyDiskOfType(disks, constants.DTS_EXT_MIRROR):\n self._OpenInstanceDisks(self.target_node_uuid, True)\n\n # If the instance's disk template is `rbd' or `ext' and there was a\n # successful migration, unmap the device from the source node.\n unmap_types = (constants.DT_RBD, constants.DT_EXT)\n\n if utils.AnyDiskOfType(disks, unmap_types):\n unmap_disks = [d for d in disks if d.dev_type in unmap_types]\n disks = ExpandCheckDisks(unmap_disks, unmap_disks)\n self.feedback_fn(\"* unmapping instance's disks %s from %s\" %\n (utils.CommaJoin(d.name for d in unmap_disks),\n self.cfg.GetNodeName(self.source_node_uuid)))\n for disk in disks:\n result = self.rpc.call_blockdev_shutdown(self.source_node_uuid,\n (disk, self.instance))\n msg = result.fail_msg\n if msg:\n logging.error(\"Migration was successful, but couldn't unmap the\"\n \" block device %s on source node %s: %s\",\n disk.iv_name,\n self.cfg.GetNodeName(self.source_node_uuid), msg)\n logging.error(\"You need to unmap the device %s manually on %s\",\n disk.iv_name,\n self.cfg.GetNodeName(self.source_node_uuid))\n\n self.feedback_fn(\"* done\")", "metadata": "root.TLMigrateInstance._ExecMigration", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 717 }, { "content": " def _ExecFailover(self):\n \"\"\"Failover an instance.\n\n The failover is done by shutting it down on its present node and\n starting it on the secondary.\n\n \"\"\"\n if self.instance.forthcoming:\n self.feedback_fn(\"Instance is forthcoming, just updating the\"\n \" configuration\")\n self.cfg.SetInstancePrimaryNode(self.instance.uuid,\n self.target_node_uuid)\n return\n\n primary_node = self.cfg.GetNodeInfo(self.instance.primary_node)\n\n source_node_uuid = self.instance.primary_node\n\n if self.instance.disks_active:\n self.feedback_fn(\"* checking disk consistency between source and target\")\n inst_disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n for (idx, dev) in enumerate(inst_disks):\n # for drbd, these are drbd over lvm\n if not CheckDiskConsistency(self.lu, self.instance, dev,\n self.target_node_uuid, False):\n if primary_node.offline:\n self.feedback_fn(\"Node %s is offline, ignoring degraded disk %s on\"\n \" target node %s\" %\n (primary_node.name, idx,\n self.cfg.GetNodeName(self.target_node_uuid)))\n elif not self.ignore_consistency:\n raise errors.OpExecError(\"Disk %s is degraded on target node,\"\n \" aborting failover\" % idx)\n else:\n self.feedback_fn(\"* not checking disk consistency as instance is not\"\n \" running\")\n\n self.feedback_fn(\"* shutting down instance on source node\")\n logging.info(\"Shutting down instance %s on node %s\",\n self.instance.name, self.cfg.GetNodeName(source_node_uuid))\n\n result = self.rpc.call_instance_shutdown(source_node_uuid, self.instance,\n self.shutdown_timeout,\n self.lu.op.reason)\n msg = result.fail_msg\n if msg:\n if self.ignore_consistency or primary_node.offline:\n self.lu.LogWarning(\"Could not shutdown instance %s on node %s,\"\n \" proceeding anyway; please make sure node\"\n \" %s is down; error details: %s\",\n self.instance.name,\n self.cfg.GetNodeName(source_node_uuid),\n self.cfg.GetNodeName(source_node_uuid), msg)\n else:\n raise errors.OpExecError(\"Could not shutdown instance %s on\"\n \" node %s: %s\" %\n (self.instance.name,\n self.cfg.GetNodeName(source_node_uuid), msg))\n\n disk_template = self.cfg.GetInstanceDiskTemplate(self.instance.uuid)\n if disk_template in constants.DTS_EXT_MIRROR:\n self._CloseInstanceDisks(source_node_uuid)\n\n self.feedback_fn(\"* deactivating the instance's disks on source node\")\n if not ShutdownInstanceDisks(self.lu, self.instance, ignore_primary=True):\n raise errors.OpExecError(\"Can't shut down the instance's disks\")\n\n self.cfg.SetInstancePrimaryNode(self.instance.uuid, self.target_node_uuid)\n self.instance = self.cfg.GetInstanceInfo(self.instance_uuid)\n\n # Only start the instance if it's marked as up\n if self.instance.admin_state == constants.ADMINST_UP:\n self.feedback_fn(\"* activating the instance's disks on target node %s\" %\n self.cfg.GetNodeName(self.target_node_uuid))\n logging.info(\"Starting instance %s on node %s\", self.instance.name,\n self.cfg.GetNodeName(self.target_node_uuid))\n\n disks_ok, _, _ = AssembleInstanceDisks(self.lu, self.instance,\n ignore_secondaries=True)\n if not disks_ok:\n ShutdownInstanceDisks(self.lu, self.instance)\n raise errors.OpExecError(\"Can't activate the instance's disks\")\n\n self.feedback_fn(\"* starting the instance on the target node %s\" %\n self.cfg.GetNodeName(self.target_node_uuid))\n result = self.rpc.call_instance_start(self.target_node_uuid,\n (self.instance, None, None), False,\n self.lu.op.reason)\n msg = result.fail_msg\n if msg:\n ShutdownInstanceDisks(self.lu, self.instance)\n raise errors.OpExecError(\"Could not start instance %s on node %s: %s\" %\n (self.instance.name,\n self.cfg.GetNodeName(self.target_node_uuid),\n msg))", "metadata": "root.TLMigrateInstance._ExecFailover", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 931 }, { "content": " def Exec(self, feedback_fn):\n \"\"\"Perform the migration.\n\n \"\"\"\n self.feedback_fn = feedback_fn\n self.source_node_uuid = self.instance.primary_node\n\n # FIXME: if we implement migrate-to-any in DRBD, this needs fixing\n disks = self.cfg.GetInstanceDisks(self.instance.uuid)\n\n # TODO allow mixed disks\n if utils.AllDiskOfType(disks, constants.DTS_INT_MIRROR):\n secondary_nodes = self.cfg.GetInstanceSecondaryNodes(self.instance.uuid)\n self.target_node_uuid = secondary_nodes[0]\n # Otherwise self.target_node has been populated either\n # directly, or through an iallocator.\n\n self.all_node_uuids = [self.source_node_uuid, self.target_node_uuid]\n self.nodes_ip = dict((uuid, node.secondary_ip) for (uuid, node)\n in self.cfg.GetMultiNodeInfo(self.all_node_uuids))\n\n if self.failover:\n feedback_fn(\"Failover instance %s\" % self.instance.name)\n self._ExecFailover()\n else:\n feedback_fn(\"Migrating instance %s\" % self.instance.name)\n\n if self.cleanup:\n return self._ExecCleanup()\n else:\n return self._ExecMigration()", "metadata": "root.TLMigrateInstance.Exec", "header": "['class', 'TLMigrateInstance', '(', 'Tasklet', ')', ':', '___EOS___']", "index": 1027 } ]
[]
[]
0
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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", ",", " ", "2007", ",", " ", "2008", ",", " ", "200", "9", ",", " ", "2010", ",", " ", "2011", ",", " ", "2012", ",", " ", "2013", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Logi", "cal", " ", "unit", "s", " ", "deal", "ing", " ", "with", " ", "instance", " ", "migrati", "on", " ", "an", " ", "failover", ".\"\"\"_", "\\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_", "gane", "ti_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "locking_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "hypervisor", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "master", "d_", "import_", "ial", "locator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "cmdli", "b_", "._", "base_", "import_", "Logi", "cal", "Unit_", ",_", "Task", "let_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "cmdli", "b_", "._", "common_", "import_", "Expand", "Insta", "nce", "Uu", "id", "And", "Name_", ",_", "Check", "IA", "lloc", "ator", "Or", "Node_", ",_", "Expand", "Node", "Uu", "id", "And", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "cmdli", "b_", "._", "instance", "\\u", "storage_", "import_", "Check", "Disk", "Cons", "iste", "ncy_", ",_", "Expand", "Check", "Disk", "s_", ",_", "Shut", "down", "Insta", "nce", "Disk", "s_", ",_", "Assemble", "Insta", "nce", "Disk", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "cmdli", "b_", "._", "instance", "\\u", "utils_", "import_", "Build", "Insta", "nce", "Hook", "Env", "By", "Object_", ",_", "Check", "Target", "Node", "IP", "olic", "y_", ",_", "Release", "Lock", "s_", ",_", "Check", "Node", "Not", "Drain", "ed_", ",_", "Copy", "Lock", "List_", ",_", "Check", "Node", "Free", "Memory_", ",_", "Check", "Insta", "nce", "Bridge", "s", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gane", "ti_", "._", "master", "d_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Expand", "Names", "For", "Migration_", "(_", "lu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Expand", "s", " ", "names", " ", "for", " ", "use", " ", "with", " ", "L", "{", "TL", "Migrat", "e", "Insta", "nce", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "lu", ":", " ", "L", "{", "Logi", "cal", "Unit", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lu_", "._", "op_", "._", "target", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "lu_", "._", "op_", "._", "target", "\\u", "node_", ")_", "=_", "Expand", "Node", "Uu", "id", "And", "Name_", "(_", "lu_", "._", "cfg_", ",_", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "lu_", "._", "op_", "._", "target", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lu_", "._", "recalc", "ulate", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "=_", "constants_", "._", "LOCK", "S", "\\u", "REPLACE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lu_", "._", "don", "t", "\\u", "collate", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE", "\\u", "RES", "_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lu_", "._", "recalc", "ulate", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE", "\\u", "RES", "_", "]_", "=_", "constants_", "._", "LOCK", "S", "\\u", "REPLACE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lu_", "._", "don", "t", "\\u", "collate", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE", "\\u", "RES", "_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Declar", "e", "Lock", "s", "For", "Migration_", "(_", "lu_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Declar", "es", " ", "lock", "s", " ", "for", " ", "L", "{", "TL", "Migrat", "e", "Insta", "nce", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "lu", ":", " ", "L", "{", "Logi", "cal", "Unit", "}", "\\", "10", ";", " ", " ", "@", "param", " ", "level", ":", " ", "Lock", " ", "level", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "==_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "lu_", "._", "op_", "._", "instance", "\\u", "name_", "in_", "lu_", "._", "owned", "\\u", "locks_", "(_", "locking_", "._", "LE", "VEL", "\\u", "INSTANCE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "lu_", "._", "cfg_", "._", "Get", "Insta", "nce", "Info_", "(_", "lu_", "._", "op_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "lu_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lu_", "._", "op_", "._", "target", "\\u", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "=_", "locking_", "._", "ALL", "\\u", "SET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "=_", "[_", "instance_", "._", "primary", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", "\\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 ", " _", "lu_", "._", "\\u", "Lock", "Insta", "nce", "s", "Nodes_", "(_", ")_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "021", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", "is_", "locking_", "._", "ALL", "\\u", "SET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "level_", "==_", "locking_", "._", "LE", "VEL", "\\u", "NODE", "\\u", "RES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "node", " ", "locks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE", "\\u", "RES", "_", "]_", "=_", "Copy", "Lock", "List_", "(_", "lu_", "._", "need", "ed", "\\u", "locks_", "[_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fail", "over", " ", "an", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "migrati", "on", " ", "by", " ", "shutt", "ing", " ", "the", " ", "instance", " ", "down", ",", " ", "but", " ", "with", " ", "the", " ", "disks", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "instance", " ", "alr", "ead", "y", " ", "avail", "able", " ", "on", " ", "the", " ", "new", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "als", "o", ":", "\\", "10", ";", " ", " ", "L", "{", "LU", "Insta", "nce", "Move", "}", " ", "for", " ", "movin", "g", " ", "an", " ", "instance", " ", "by", " ", "copy", "ing", " ", "the", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "L", "{", "LU", "Insta", "nce", "Migrat", "e", "}", " ", "for", " ", "the", " ", "live", " ", "migrati", "on", " ", "of", " ", "an", " ", "instance", " ", "(", "no", " ", "shut", "down", "\\", "10", ";", " ", " ", "require", "d", ").", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HP", "ATH", "_", "=_", "\"", "instance", "-", "failover", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HT", "YPE_", "=_", "constants_", "._", "HT", "YP", "E", "\\u", "INSTANCE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REQ", "\\u", "BG", "L_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Check", "Arguments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "the", " ", "argu", "ment", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ial", "locator_", "=_", "getattr_", "(_", "self_", "._", "op_", ",_", "\"", "ial", "locator", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "node_", "=_", "getattr_", "(_", "self_", "._", "op_", ",_", "\"", "target", "\\u", "node", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Expand", "Names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Expand", "And", "Lock", "Instance_", "(_", "allow", "\\u", "fort", "hco", "ming", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Expand", "Names", "For", "Migration_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "migr", "ater", "_", "=_", "TL", "Migrat", "e", "Instance_", "(_", "self_", ",_", "self_", "._", "op_", "._", "instance", "\\u", "uuid_", ",_", "self_", "._", "op_", "._", "instance", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "cleanup_", ",_", "True_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "ignore", "\\u", "consiste", "ncy_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "shut", "down", "\\u", "timeout_", ",_", "self_", "._", "op_", "._", "ignore", "\\u", "ipo", "lic", "y_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "taskl", "ets_", "=_", "[_", "self_", "._", "\\u", "migr", "ater", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Declar", "e", "Lock", "s_", "(_", "self_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "Declar", "e", "Lock", "s", "For", "Migration_", "(_", "self_", ",_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Build", "Hook", "s", "Env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "hook", "s", " ", "env", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "runs", " ", "on", " ", "master", ",", " ", "primary", " ", "and", " ", "second", "ary", " ", "nodes", " ", "of", " ", "the", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "node", "\\u", "uuid_", "=_", "instance_", "._", "primary", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "target", "\\u", "node", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IGNORE", "\\u", "CONS", "ISTE", "NCY", "\"_", ":_", "self_", "._", "op_", "._", "ignore", "\\u", "consiste", "ncy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SHUTDOWN", "\\u", "TIME", "OUT", "\"_", ":_", "self_", "._", "op_", "._", "shut", "down", "\\u", "timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OLD", "\\u", "PRIMA", "RY", "\"_", ":_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NEW", "\\u", "PRIMA", "RY", "\"_", ":_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "target", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FAIL", "OVER", "\\u", "CLEAN", "UP", "\"_", ":_", "self_", "._", "op_", "._", "cleanup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "second", "ary", "\\u", "nodes_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "\"", "OLD", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "second", "ary", "\\u", "nodes_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "\"", "NEW", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "\"", "OLD", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "env_", "[_", "\"", "NEW", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "update_", "(_", "Build", "Insta", "nce", "Hook", "Env", "By", "Object_", "(_", "self_", ",_", "instance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Fail", "over_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Build", "Hook", "s", "Nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "hook", "s", " ", "nodes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "ary", "\\u", "nodes_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "=_", "[_", "self_", "._", "cfg_", "._", "Get", "Master", "Node_", "(_", ")_", "]_", "+_", "list_", "(_", "second", "ary", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "._", "append_", "(_", "self_", "._", "\\u", "migr", "ater", "_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "nl_", ",_", "nl_", "+_", "[_", "instance_", "._", "primary", "\\u", "node_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "LU", "Insta", "nce", "Migrat", "e_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Migrat", "e", " ", "an", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "migrati", "on", " ", "with", "out", " ", "shutt", "ing", " ", "down", " ", "(", "live", " ", "migrati", "on", ")", " ", "and", " ", "the", " ", "disks", " ", "are", "\\", "10", ";", " ", " ", "alr", "ead", "y", " ", "avail", "able", " ", "on", " ", "the", " ", "new", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "als", "o", ":", "\\", "10", ";", " ", " ", "L", "{", "LU", "Insta", "nce", "Move", "}", " ", "for", " ", "movin", "g", " ", "an", " ", "instance", " ", "by", " ", "copy", "ing", " ", "the", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "L", "{", "LU", "Insta", "nce", "Fail", "over", "}", " ", "for", " ", "the", " ", "migrati", "on", " ", "of", " ", "an", " ", "instance", " ", "where", " ", "a", " ", "shut", "down", " ", "is", "\\", "10", ";", " ", " ", "require", "d", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HP", "ATH", "_", "=_", "\"", "instance", "-", "migr", "ate", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HT", "YPE_", "=_", "constants_", "._", "HT", "YP", "E", "\\u", "INSTANCE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REQ", "\\u", "BG", "L_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Migrat", "e_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Expand", "Names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Expand", "And", "Lock", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Expand", "Names", "For", "Migration_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "migr", "ater", "_", "=_", "TL", "Migrat", "e", "Instance_", "(_", "self_", ",_", "self_", "._", "op_", "._", "instance", "\\u", "uuid_", ",_", "self_", "._", "op_", "._", "instance", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "cleanup_", ",_", "False_", ",_", "self_", "._", "op_", "._", "allow", "\\u", "failover", "_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "allow", "\\u", "runt", "ime", "\\u", "changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constants_", "._", "DEF", "AUL", "T", "\\u", "SHUTDOWN", "\\u", "TIMEOUT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "op_", "._", "ignore", "\\u", "ipo", "lic", "y_", ",_", "self_", "._", "op_", "._", "ignore", "\\u", "hv", "versions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "taskl", "ets_", "=_", "[_", "self_", "._", "\\u", "migr", "ater", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Migrat", "e_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Declar", "e", "Lock", "s_", "(_", "self_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "Declar", "e", "Lock", "s", "For", "Migration_", "(_", "self_", ",_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Migrat", "e_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Build", "Hook", "s", "Env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "hook", "s", " ", "env", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "runs", " ", "on", " ", "master", ",", " ", "primary", " ", "and", " ", "second", "ary", " ", "nodes", " ", "of", " ", "the", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "node", "\\u", "uuid_", "=_", "instance_", "._", "primary", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "target", "\\u", "node", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "Build", "Insta", "nce", "Hook", "Env", "By", "Object_", "(_", "self_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MIGRAT", "E", "\\u", "LIVE", "\"_", ":_", "self_", "._", "\\u", "migr", "ater", "_", "._", "live_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MIGRAT", "E", "\\u", "CLEAN", "UP", "\"_", ":_", "self_", "._", "op_", "._", "cleanup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OLD", "\\u", "PRIMA", "RY", "\"_", ":_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NEW", "\\u", "PRIMA", "RY", "\"_", ":_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "target", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALLOW", "\\u", "RUNT", "IME", "\\u", "CHANGE", "S", "\"_", ":_", "self_", "._", "op_", "._", "allow", "\\u", "runt", "ime", "\\u", "changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "second", "ary", "\\u", "nodes_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "\"", "OLD", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "second", "ary", "\\u", "nodes_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "\"", "NEW", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "\"", "OLD", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "env_", "[_", "\"", "NEW", "\\u", "SECOND", "ARY", "\"_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LU", "Insta", "nce", "Migrat", "e_", "(_", "Logi", "cal", "Unit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Build", "Hook", "s", "Nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "hook", "s", " ", "nodes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "migr", "ater", "_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "ary", "\\u", "nodes_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sno", "de", "\\u", "uuids_", "=_", "list_", "(_", "second", "ary", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "=_", "[_", "self_", "._", "cfg_", "._", "Get", "Master", "Node_", "(_", ")_", ",_", "instance_", "._", "primary", "\\u", "node_", "]_", "+_", "sno", "de", "\\u", "uuids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "._", "append_", "(_", "self_", "._", "\\u", "migr", "ater", "_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "nl_", ",_", "nl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Task", "let", " ", "class", " ", "for", " ", "instance", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "live", ":", " ", "boolean", "\\", "10", ";", " ", " ", "@", "ivar", " ", "live", ":", " ", "whe", "ther", " ", "the", " ", "migrati", "on", " ", "will", " ", "be", " ", "don", "e", " ", "live", " ", "or", " ", "non", "-", "live", ";", "\\", "10", ";", " ", " ", "this", " ", "variab", "le", " ", "is", " ", "init", "alize", "d", " ", "only", " ", "after", " ", "Check", "Pre", "req", " ", "has", " ", "run", "\\", "10", ";", " ", " ", "@", "type", " ", "clean", "up", ":", " ", "boolean", "\\", "10", ";", " ", " ", "@", "ivar", " ", "clean", "up", ":", " ", "Whe", "ater", " ", "we", " ", "clean", "up", " ", "from", " ", "a", " ", "fail", "ed", " ", "migrati", "on", "\\", "10", ";", " ", " ", "@", "type", " ", "ial", "locator", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "ivar", " ", "ial", "locator", ":", " ", "The", " ", "ial", "locator", " ", "used", " ", "to", " ", "dete", "rmin", "e", " ", "target", "\\u", "node", "\\", "10", ";", " ", " ", "@", "type", " ", "target", "\\u", "node", "\\u", "uuid", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "ivar", " ", "target", "\\u", "node", "\\u", "uuid", ":", " ", "If", " ", "give", "n", ",", " ", "the", " ", "target", " ", "node", " ", "UU", "ID", " ", "to", " ", "reall", "ocat", "e", " ", "the", "\\", "10", ";", " ", " ", "instance", " ", "to", "\\", "10", ";", " ", " ", "@", "type", " ", "failover", ":", " ", "boolean", "\\", "10", ";", " ", " ", "@", "ivar", " ", "failover", ":", " ", "Whe", "ther", " ", "operati", "on", " ", "results", " ", "in", " ", "failover", " ", "or", " ", "migrati", "on", "\\", "10", ";", " ", " ", "@", "type", " ", "fall", "back", ":", " ", "boolean", "\\", "10", ";", " ", " ", "@", "ivar", " ", "fall", "back", ":", " ", "Whe", "ther", " ", "fall", "back", " ", "to", " ", "failover", " ", "is", " ", "allow", "ed", " ", "if", " ", "migrati", "on", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "possib", "le", "\\", "10", ";", " ", " ", "@", "type", " ", "ignore", "\\u", "consiste", "nc", "y", ":", " ", "boolean", "\\", "10", ";", " ", " ", "@", "ivar", " ", "ignore", "\\u", "consiste", "nc", "y", ":", " ", "Whe", "ter", " ", "we", " ", "shou", "ld", " ", "ignore", " ", "consiste", "nc", "y", " ", "bet", "ween", " ", "source", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "and", " ", "target", " ", "node", "\\", "10", ";", " ", " ", "@", "type", " ", "shut", "down", "\\u", "timeo", "ut", ":", " ", "int", "\\", "10", ";", " ", " ", "@", "ivar", " ", "shut", "down", "\\u", "timeo", "ut", ":", " ", "In", " ", "case", " ", "of", " ", "failover", " ", "timeo", "ut", " ", "of", " ", "the", " ", "shut", "down", "\\", "10", ";", " ", " ", "@", "type", " ", "ignore", "\\u", "ipo", "lic", "y", ":", " ", "bool", "\\", "10", ";", " ", " ", "@", "ivar", " ", "ignore", "\\u", "ipo", "lic", "y", ":", " ", "If", " ", "true", ",", " ", "we", " ", "can", " ", "ignore", " ", "instance", " ", "policy", " ", "whe", "n", " ", "migrati", "ng", "\\", "10", ";", " ", " ", "@", "type", " ", "ignore", "\\u", "hv", "version", "s", ":", " ", "bool", "\\", "10", ";", " ", " ", "@", "ivar", " ", "ignore", "\\u", "hv", "version", "s", ":", " ", "If", " ", "true", ",", " ", "accept", " ", "incomp", "atible", " ", "hypervisor", " ", "version", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "MIGRAT", "ION", "\\u", "POLL", "\\u", "INTERVAL_", "=_", "1_", "#", " ", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIGRAT", "ION", "\\u", "FEED", "BACK", "\\u", "INTERVAL_", "=_", "10_", "#", " ", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lu_", ",_", "instance", "\\u", "uuid_", ",_", "instance", "\\u", "name_", ",_", "cleanup_", ",_", "failover", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fallback_", ",_", "ignore", "\\u", "consiste", "ncy_", ",_", "allow", "\\u", "runt", "ime", "\\u", "changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shut", "down", "\\u", "timeout_", ",_", "ignore", "\\u", "ipo", "lic", "y_", ",_", "ignore", "\\u", "hv", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "es", " ", "this", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Task", "let_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameters_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance", "\\u", "uuid_", "=_", "instance", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance", "\\u", "name_", "=_", "instance", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cleanup_", "=_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "live_", "=_", "False_", "#", " ", "will", " ", "be", " ", "overrid", "den", " ", "later_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "failover", "_", "=_", "failover", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fallback_", "=_", "fallback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "\\u", "consiste", "ncy_", "=_", "ignore", "\\u", "consiste", "ncy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shut", "down", "\\u", "timeout_", "=_", "shut", "down", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "\\u", "ipo", "lic", "y_", "=_", "ignore", "\\u", "ipo", "lic", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "runt", "ime", "\\u", "changes_", "=_", "allow", "\\u", "runt", "ime", "\\u", "changes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "\\u", "hv", "versions_", "=_", "ignore", "\\u", "hv", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Check", "Pre", "req_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "prerequisite", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "checks", " ", "tha", "t", " ", "the", " ", "instance", " ", "is", " ", "in", " ", "the", " ", "cluster", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "self_", "._", "instance", "\\u", "uuid_", ",_", "self_", "._", "instance", "\\u", "name_", ")_", "=_", "Expand", "Insta", "nce", "Uu", "id", "And", "Name_", "(_", "self_", "._", "lu_", "._", "cfg_", ",_", "self_", "._", "instance", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Info_", "(_", "self_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "instance_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "=_", "self_", "._", "cfg_", "._", "Get", "Cluster", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "cleanup_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "instance_", "._", "admin", "\\u", "state_", "==_", "constants_", "._", "ADM", "INST", "\\u", "UP_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "failover", "_", "and_", "self_", "._", "fallback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Info_", "(_", "\"", "Insta", "nce", " ", "is", " ", "marked", " ", "down", " ", "or", " ", "offline", ",", " ", "fall", "back", " ", "allow", "ed", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "switching", " ", "to", " ", "failover", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "failover", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "utils_", "._", "All", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "MIR", "ROR", "ED_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "failover", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "\"", "failover", "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 ", " _", "text_", "=_", "\"", "migrati", "ons", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "invalid", "\\u", "disks_", "=_", "set_", "(_", "d_", "._", "dev", "\\u", "type_", "for_", "d_", "in_", "disks_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "d_", "._", "dev", "\\u", "type_", "not_", "in_", "constants_", "._", "DT", "S", "\\u", "MIR", "ROR", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "Insta", "nce", "'", "s", " ", "disk", " ", "layout", " ", "'%", "s", "'", " ", "doe", "s", " ", "not", " ", "allow", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "%", "s", "\"_", "%_", "(_", "utils_", "._", "Comm", "a", "Join_", "(_", "invalid", "\\u", "disks_", ")_", ",_", "text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "STATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "allow", " ", "hetero", "gene", "ous", " ", "disk", " ", "types", " ", "if", " ", "all", " ", "are", " ", "mirrore", "d", " ", "in", " ", "some", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "utils_", "._", "All", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Check", "IA", "lloc", "ator", "Or", "Node_", "(_", "self_", "._", "lu_", ",_", "\"", "ial", "locator", "\"_", ",_", "\"", "target", "\\u", "node", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "lu_", "._", "op_", "._", "ial", "locator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Run", "Alloc", "ator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "set", " ", "set", " ", "self", ".", "target", "\\u", "node", "\\u", "uuid", " ", "as", " ", "it", " ", "is", " ", "require", "d", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", "Hook", "s", "Env_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "target", " ", "node", " ", "is", " ", "correct", " ", "in", " ", "term", "s", " ", "of", " ", "instance", " ", "policy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "info_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Info_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "info_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Group_", "(_", "node", "info_", "._", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipo", "lic", "y_", "=_", "gane", "ti_", "._", "master", "d_", "._", "instance_", "._", "Calculat", "e", "Group", "IP", "olic", "y_", "(_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Check", "Target", "Node", "IP", "olic", "y_", "(_", "self_", "._", "lu_", ",_", "ipo", "lic", "y_", ",_", "self_", "._", "instance_", ",_", "node", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", ",_", "ignore_", "=_", "self_", "._", "ignore", "\\u", "ipo", "lic", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "target", "\\u", "node", " ", "is", " ", "alr", "ead", "y", " ", "populate", "d", ",", " ", "eit", "her", " ", "direct", "ly", " ", "or", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ial", "locator", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "==_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cann", "ot", " ", "migr", "ate", " ", "instance", " ", "%", "s", " ", "to", " ", "its", " ", "primary", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "STATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "lu_", "._", "taskl", "ets_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "safe", " ", "to", " ", "release", " ", "lock", "s", " ", "only", " ", "whe", "n", " ", "we", "'", "re", " ", "the", " ", "only", " ", "taskl", "et_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "LU_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Release", "Lock", "s_", "(_", "self_", "._", "lu_", ",_", "locking_", "._", "LE", "VEL", "\\u", "NODE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep_", "=_", "[_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ",_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", ")_", "\\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_", "utils_", "._", "All", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "templates_", "=_", "[_", "d_", "._", "dev", "\\u", "type_", "for_", "d_", "in_", "disks_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "ary", "\\u", "node", "\\u", "uuids_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "second", "ary", "\\u", "node", "\\u", "uuids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Configura", "tion", "Error_", "(_", "\"", "No", " ", "second", "ary", " ", "node", " ", "but", " ", "usi", "ng", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "%", "s", " ", "disk", " ", "types", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "Comm", "a", "Join_", "(_", "set_", "(_", "templates_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "=_", "target", "\\u", "node", "\\u", "uuid_", "=_", "second", "ary", "\\u", "node", "\\u", "uuids_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "lu_", "._", "op_", "._", "ial", "locator_", "or_", "(_", "self_", "._", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lu_", "._", "op_", "._", "target", "\\u", "node", "\\u", "uuid_", "!=_", "target", "\\u", "node", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "failover", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "\"", "fail", "ed", " ", "over", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "\"", "migrated", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "Insta", "nce", "s", " ", "with", " ", "disk", " ", "types", " ", "%", "s", " ", "cann", "ot", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "be", " ", "%", "s", " ", "to", " ", "arbitra", "ry", " ", "nodes", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "nei", "ther", " ", "an", " ", "ial", "locator", " ", "nor", " ", "a", " ", "target", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "node", " ", "can", " ", "be", " ", "pass", "ed", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "utils_", "._", "Comm", "a", "Join_", "(_", "set_", "(_", "templates_", ")_", ")_", ",_", "text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "INV", "AL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "info_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Info_", "(_", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "info_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Group_", "(_", "node", "info_", "._", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipo", "lic", "y_", "=_", "gane", "ti_", "._", "master", "d_", "._", "instance_", "._", "Calculat", "e", "Group", "IP", "olic", "y_", "(_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Check", "Target", "Node", "IP", "olic", "y_", "(_", "self_", "._", "lu_", ",_", "ipo", "lic", "y_", ",_", "self_", "._", "instance_", ",_", "node", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", ",_", "ignore_", "=_", "self_", "._", "ignore", "\\u", "ipo", "lic", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "Insta", "nce", " ", "mix", "es", " ", "internal", " ", "and", " ", "external", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mirror", "ing", ".", " ", "Thi", "s", " ", "is", " ", "not", " ", "currentl", "y", " ", "support", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i", "\\u", "be_", "=_", "cluster_", "._", "Fil", "l", "BE_", "(_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "memory", " ", "require", "ment", "s", " ", "on", " ", "the", " ", "second", "ary", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "cleanup_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "self_", "._", "failover", "_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", "._", "admin", "\\u", "state_", "==_", "constants_", "._", "ADM", "INST", "\\u", "UP_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tgt", "\\u", "free", "\\u", "mem_", "=_", "Check", "Node", "Free", "Memory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lu_", ",_", "target", "\\u", "node", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "migrati", "ng", " ", "instance", " ", "%", "s", "\"_", "%_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "be_", "[_", "constants_", "._", "BE", "\\u", "MIN", "MEM", "_", "]_", ",_", "self_", "._", "instance_", "._", "hypervisor", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Cluster", "Info_", "(_", ")_", "._", "hv", "params_", "[_", "self_", "._", "instance_", "._", "hypervisor", "_", "]_", ")_", "\\u\\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_", "._", "lu_", "._", "Log", "Info_", "(_", "\"", "Not", " ", "checking", " ", "memory", " ", "on", " ", "the", " ", "second", "ary", " ", "node", " ", "as", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "instance", " ", "will", " ", "not", " ", "be", " ", "start", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "failover", " ", "must", " ", "be", " ", "forced", " ", "inst", "ead", " ", "of", " ", "migration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "cleanup_", "and_", "not_", "self_", "._", "failover", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "be_", "[_", "constants_", "._", "BE", "\\u", "ALWAYS", "\\u", "FAIL", "OVER", "_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Info_", "(_", "\"", "Insta", "nce", " ", "configur", "ed", " ", "to", " ", "alw", "ay", "s", " ", "failover", ";", " ", "fall", "back", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "failover", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "failover", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "bridge", " ", "exist", "ance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Check", "Insta", "nce", "Bridge", "s", "Exist_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "uuid_", "=_", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "cleanup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Check", "Node", "Not", "Drain", "ed_", "(_", "self_", "._", "lu_", ",_", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "failover", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "migr", "atab", "le_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "fail", "\\u", "msg_", "and_", "self_", "._", "fallback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Info_", "(_", "\"", "Can", "'", "t", " ", "migr", "ate", ",", " ", "instance", " ", "offline", ",", " ", "fall", "back", " ", "to", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "failover", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "failover", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "Raise_", "(_", "\"", "Can", "'", "t", " ", "migr", "ate", ",", " ", "plea", "se", " ", "use", " ", "failover", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prere", "q_", "=_", "True_", ",_", "ecode", "_", "=_", "errors_", "._", "ECO", "DE", "\\u", "STATE_", ")_", "\\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_", "assert_", "not_", "(_", "self_", "._", "failover", "_", "and_", "self_", "._", "cleanup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "failover", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "lu_", "._", "op_", "._", "live_", "is_", "not_", "None_", "and_", "self_", "._", "lu_", "._", "op_", "._", "mode_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "On", "ly", " ", "one", " ", "of", " ", "the", " ", "'", "live", "'", " ", "and", " ", "'", "mode", "'\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "parameter", "s", " ", "are", " ", "accept", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "INV", "AL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "lu_", "._", "op_", "._", "live_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "lu_", "._", "op_", "._", "live_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "op_", "._", "mode_", "=_", "constants_", "._", "HT", "\\u", "MIGRAT", "ION", "\\u", "LIVE", "_", "\\u\\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_", "._", "lu_", "._", "op_", "._", "mode_", "=_", "constants_", "._", "HT", "\\u", "MIGRAT", "ION", "\\u", "NON", "LIVE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reset", " ", "the", " ", "'", "live", "'", " ", "parameter", " ", "to", " ", "Non", "e", " ", "so", " ", "tha", "t", " ", "repeated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invocation", "s", " ", "of", " ", "Check", "Pre", "req", " ", "do", " ", "not", " ", "raise", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lu_", "._", "op_", "._", "live_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "lu_", "._", "op_", "._", "mode_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "read", " ", "the", " ", "default", " ", "value", " ", "from", " ", "the", " ", "hypervisor", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "hv", "_", "=_", "cluster_", "._", "Fil", "l", "HV", "_", "(_", "self_", "._", "instance_", ",_", "skip", "\\u", "globals_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lu_", "._", "op_", "._", "mode_", "=_", "i", "\\u", "hv", "_", "[_", "constants_", "._", "HV", "\\u", "MIGRAT", "ION", "\\u", "MODE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "live_", "=_", "self_", "._", "lu_", "._", "op_", "._", "mode_", "==_", "constants_", "._", "HT", "\\u", "MIGRAT", "ION", "\\u", "LIVE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fail", "over", " ", "is", " ", "neve", "r", " ", "live_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "live_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "self_", "._", "failover", "_", "or_", "self_", "._", "cleanup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "info_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ",_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", "._", "hypervisor", "_", ",_", "cluster_", "._", "hv", "params_", "[_", "self_", "._", "instance_", "._", "hypervisor", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "info_", "._", "Raise_", "(_", "\"", "Error", " ", "checking", " ", "instance", " ", "on", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prere", "q_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "running_", "=_", "bool_", "(_", "remote", "\\u", "info_", "._", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "\\u", "mem_", "=_", "int_", "(_", "remote", "\\u", "info_", "._", "payload_", "[_", "\"", "memory", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Run", "Alloc", "ator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "the", " ", "allocat", "or", " ", "based", " ", "on", " ", "input", " ", "opcode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "add", " ", "a", " ", "self", ".", "ignore", "\\u", "ipo", "lic", "y", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "ial", "locator_", "._", "IA", "Re", "q", "Relo", "cate", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "uuid_", "=_", "self_", "._", "instance", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relocat", "e\\u", "from", "\\u", "node", "\\u", "uuids_", "=_", "[_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ial_", "=_", "ial", "locator_", "._", "IA", "lloc", "ator_", "(_", "self_", "._", "cfg_", ",_", "self_", "._", "rpc_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ial_", "._", "Run_", "(_", "self_", "._", "lu_", "._", "op_", "._", "ial", "locator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ial_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "Can", "'", "t", " ", "compute", " ", "nodes", " ", "usi", "ng", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "ial", "locator", " ", "'%", "s", "':", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "lu_", "._", "op_", "._", "ial", "locator_", ",_", "ial_", "._", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "NOR", "ES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Info", "By", "Name_", "(_", "ial_", "._", "result_", "[_", "0_", "]_", ")_", "._", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lu_", "._", "Log", "Info_", "(_", "\"", "Select", "ed", " ", "nodes", " ", "for", " ", "instance", " ", "%", "s", " ", "via", " ", "ial", "locator", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance", "\\u", "name_", ",_", "self_", "._", "lu_", "._", "op_", "._", "ial", "locator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "Comm", "a", "Join_", "(_", "ial_", "._", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Wait", "Unti", "l", "Sync_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Poll", " ", "with", " ", "custom", " ", "rpc", " ", "for", " ", "disk", " ", "sync", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "use", "s", " ", "our", " ", "own", " ", "step", "-", "based", " ", "rpc", " ", "call", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "wait", " ", "unti", "l", " ", "res", "ync", " ", "is", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "all", "\\u", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "dr", "bd", "\\u", "wait", "\\u", "sync_", "(_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "disks_", ",_", "self_", "._", "instance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "percent_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "\\u", "uuid_", ",_", "nre", "s_", "in_", "result_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nre", "s_", "._", "Raise_", "(_", "\"", "Cann", "ot", " ", "res", "ync", " ", "disks", " ", "on", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "done_", ",_", "node", "\\u", "percent_", "=_", "nre", "s_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "done_", "=_", "all", "\\u", "done_", "and_", "node", "\\u", "done_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node", "\\u", "percent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "percent_", "=_", "min_", "(_", "min", "\\u", "percent_", ",_", "node", "\\u", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "all", "\\u", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "min", "\\u", "percent_", "<_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", " ", " ", " ", "-", " ", "progress", ":", " ", "%", ".1", "f", "%%\"_", "%_", "min", "\\u", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", ",_", "node", "\\u", "uuid_", ",_", "exclusive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Open", " ", "instance", " ", "disks", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "\"", "in", " ", "exclu", "sive", " ", "mode", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "\"", "in", " ", "shared", " ", "mode", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "\\u", "name_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "opening", " ", "instance", " ", "disks", " ", "on", " ", "node", " ", "%", "s", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "\\u", "name_", ",_", "mode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "blockd", "ev", "\\u", "open_", "(_", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "disks_", ",_", "self_", "._", "instance_", ")_", ",_", "exclusive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "Raise_", "(_", "\"", "Cann", "ot", " ", "open", " ", "instance", " ", "disks", " ", "on", " ", "node", " ", "%", "s", "\"_", "%_", "node", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "self_", ",_", "node", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clos", "e", " ", "instance", " ", "disks", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "name_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "clos", "ing", " ", "instance", " ", "disks", " ", "on", " ", "node", " ", "%", "s", "\"_", "%_", "node", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "blockd", "ev", "\\u", "close_", "(_", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "disks_", ",_", "self_", "._", "instance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "._", "offline_", "or_", "self_", "._", "ignore", "\\u", "consiste", "ncy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Warning_", "(_", "\"", "Cou", "ld", " ", "not", " ", "close", " ", "instance", " ", "disks", " ", "on", " ", "node", " ", "%", "s", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "proceed", "ing", " ", "anyway", "\"_", "%_", "node", "\\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 ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cann", "ot", " ", "close", " ", "instance", " ", "disks", " ", "on", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "\\u", "name_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Go", "Stand", "alo", "ne_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Disconnect", " ", "from", " ", "the", " ", "network", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "chang", "ing", " ", "int", "o", " ", "standalone", " ", "mode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "dr", "bd", "\\u", "discon", "nect", "\\u", "net_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", ",_", "(_", "disks_", ",_", "self_", "._", "instance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "\\u", "uuid_", ",_", "nre", "s_", "in_", "result_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nre", "s_", "._", "Raise_", "(_", "\"", "Cann", "ot", " ", "discon", "nect", " ", "disks", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\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", "Go", "Recon", "nect", "_", "(_", "self_", ",_", "multim", "aster", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Recon", "nect", " ", "to", " ", "the", " ", "network", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multim", "aster", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "dual", "-", "master", "\"_", "\\u\\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_", "=_", "\"", "single", "-", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "chang", "ing", " ", "disks", " ", "int", "o", " ", "%", "s", " ", "mode", "\"_", "%_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "dr", "bd", "\\u", "attach", "\\u", "net_", "(_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "disks_", ",_", "self_", "._", "instance_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multim", "aster", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "\\u", "uuid_", ",_", "nre", "s_", "in_", "result_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nre", "s_", "._", "Raise_", "(_", "\"", "Cann", "ot", " ", "change", " ", "disks", " ", "config", " ", "on", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\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", "Exe", "c", "Cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tr", "y", " ", "to", " ", "clean", "up", " ", "after", " ", "a", " ", "fail", "ed", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "clean", "up", " ", "is", " ", "don", "e", " ", "by", ":", "\\", "10", ";", " ", " ", "-", " ", "check", " ", "tha", "t", " ", "the", " ", "instance", " ", "is", " ", "runn", "ing", " ", "only", " ", "on", " ", "one", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "(", "and", " ", "update", " ", "the", " ", "config", " ", "if", " ", "need", "ed", ")", "\\", "10", ";", " ", " ", "-", " ", "change", " ", "disks", " ", "on", " ", "its", " ", "second", "ary", " ", "node", " ", "to", " ", "second", "ary", "\\", "10", ";", " ", " ", "-", " ", "wait", " ", "unti", "l", " ", "disks", " ", "are", " ", "full", "y", " ", "synchronized", "\\", "10", ";", " ", " ", "-", " ", "discon", "nect", " ", "from", " ", "the", " ", "network", "\\", "10", ";", " ", " ", "-", " ", "change", " ", "disks", " ", "int", "o", " ", "single", "-", "master", " ", "mode", "\\", "10", ";", " ", " ", "-", " ", "wait", " ", "again", " ", "unti", "l", " ", "disks", " ", "are", " ", "full", "y", " ", "synchronized", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "runn", "ing", " ", "on", " ", "only", " ", "one", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "checking", " ", "where", " ", "the", " ", "instance", " ", "actual", "ly", " ", "runs", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "if", " ", "this", " ", "hang", "s", ",", " ", "the", " ", "hypervisor", " ", "mig", "ht", " ", "be", " ", "in", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "a", " ", "bad", " ", "state", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "hv", "params_", "=_", "self_", "._", "cfg_", "._", "Get", "Cluster", "Info_", "(_", ")_", "._", "hv", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins", "\\u", "l_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "list_", "(_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "instance_", "._", "hypervisor", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "hv", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "\\u", "uuid_", ",_", "result_", "in_", "ins", "\\u", "l_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "Raise_", "(_", "\"", "Can", "'", "t", " ", "contact", " ", "node", " ", "%", "s", "\"_", "%_", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "runn", "ing", "on", "\\u", "source_", "=_", "self_", "._", "instance_", "._", "name_", "in_", "ins", "\\u", "l_", "[_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", "]_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runn", "ing", "on", "\\u", "target_", "=_", "self_", "._", "instance_", "._", "name_", "in_", "ins", "\\u", "l_", "[_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "runn", "ing", "on", "\\u", "source_", "and_", "runn", "ing", "on", "\\u", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Insta", "nce", " ", "see", "ms", " ", "to", " ", "be", " ", "runn", "ing", " ", "on", " ", "two", " ", "nodes", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "or", " ", "the", " ", "hypervisor", " ", "is", " ", "conf", "used", ";", " ", "you", " ", "will", " ", "have", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "ensure", " ", "manu", "ally", " ", "tha", "t", " ", "it", " ", "runs", " ", "only", " ", "on", " ", "one", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "and", " ", "restart", " ", "this", " ", "operati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "runn", "ing", "on", "\\u", "source_", "or_", "runn", "ing", "on", "\\u", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Insta", "nce", " ", "doe", "s", " ", "not", " ", "see", "m", " ", "to", " ", "be", " ", "runn", "ing", " ", "at", " ", "all", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "in", " ", "this", " ", "case", " ", "it", "'", "s", " ", "safe", "r", " ", "to", " ", "repair", " ", "by", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "runn", "ing", " ", "'", "gn", "t", "-", "instance", " ", "stop", "'", " ", "to", " ", "ensure", " ", "disk", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "shut", "down", ",", " ", "and", " ", "then", " ", "restart", "ing", " ", "it", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "runn", "ing", "on", "\\u", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "migrati", "on", " ", "has", " ", "actual", "ly", " ", "succe", "eded", ",", " ", "we", " ", "need", " ", "to", " ", "update", " ", "the", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "instance", " ", "runn", "ing", " ", "on", " ", "second", "ary", " ", "node", " ", "(%", "s", "),", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "updat", "ing", " ", "config", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cfg_", "._", "Set", "Insta", "nce", "Prim", "ary", "Node_", "(_", "self_", "._", "instance_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "demo", "ted", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", "\\u\\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_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "instance", " ", "confirm", "ed", " ", "to", " ", "be", " ", "runn", "ing", " ", "on", " ", "its", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "primary", " ", "node", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "demo", "ted", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "demo", "ted", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Op", "Exe", "c", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "ignore", " ", "here", " ", "error", "s", ",", " ", "sinc", "e", " ", "if", " ", "the", " ", "device", " ", "is", " ", "standalone", ",", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "won", "'", "t", " ", "be", " ", "able", " ", "to", " ", "sync_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "Go", "Stand", "alo", "ne_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Go", "Recon", "nect", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Rever", "t", "Disk", "Status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tr", "y", " ", "to", " ", "revert", " ", "the", " ", "disk", " ", "status", " ", "after", " ", "a", " ", "fail", "ed", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "All", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Go", "Stand", "alo", "ne_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Go", "Recon", "nect", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Op", "Exe", "c", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Warning_", "(_", "\"", "Migrat", "ion", " ", "fail", "ed", " ", "and", " ", "I", " ", "can", "'", "t", " ", "reconnect", " ", "the", " ", "drives", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "plea", "se", " ", "try", " ", "to", " ", "recover", " ", "the", " ", "instance", " ", "manu", "ally", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "error", " ", "'%", "s", "'\"_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\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", "Abo", "rt", "Migration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", " ", "the", " ", "hypervisor", " ", "code", " ", "to", " ", "abort", " ", "a", " ", "start", "ed", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort", "\\u", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "finalize", "\\u", "migrati", "on", "\\u", "dst_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ",_", "self_", "._", "migrati", "on", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort", "\\u", "msg_", "=_", "abort", "\\u", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abort", "\\u", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Abo", "rti", "ng", " ", "migrati", "on", " ", "fail", "ed", " ", "on", " ", "target", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ",_", "abort", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "raise", " ", "an", " ", "exception", " ", "here", ",", " ", "as", " ", "we", " ", "sti", "l", " ", "have", " ", "to", " ", "try", " ", "to", " ", "revert", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disk", " ", "status", ",", " ", "even", " ", "if", " ", "this", " ", "step", " ", "fail", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abort", "\\u", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "finalize", "\\u", "migrati", "on", "\\u", "src_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ",_", "False_", ",_", "self_", "._", "live_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort", "\\u", "msg_", "=_", "abort", "\\u", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abort", "\\u", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Abo", "rti", "ng", " ", "migrati", "on", " ", "fail", "ed", " ", "on", " ", "source", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "abort", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\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", "Exe", "c", "Migration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Migrat", "e", " ", "an", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "migr", "ate", " ", "is", " ", "don", "e", " ", "by", ":", "\\", "10", ";", " ", " ", "-", " ", "change", " ", "the", " ", "disks", " ", "int", "o", " ", "dual", "-", "master", " ", "mode", "\\", "10", ";", " ", " ", "-", " ", "wait", " ", "unti", "l", " ", "disks", " ", "are", " ", "full", "y", " ", "synchronized", " ", "again", "\\", "10", ";", " ", " ", "-", " ", "migr", "ate", " ", "the", " ", "instance", "\\", "10", ";", " ", " ", "-", " ", "change", " ", "disks", " ", "on", " ", "the", " ", "new", " ", "second", "ary", " ", "node", " ", "(", "the", " ", "old", " ", "primary", ")", " ", "to", " ", "second", "ary", "\\", "10", ";", " ", " ", "-", " ", "wait", " ", "unti", "l", " ", "disks", " ", "are", " ", "full", "y", " ", "synchronized", "\\", "10", ";", " ", " ", "-", " ", "change", " ", "disks", " ", "int", "o", " ", "single", "-", "master", " ", "mode", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "hypervisor", " ", "version", " ", "mism", "atch", " ", "and", " ", "warn", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "hv", "specs_", "=_", "[_", "(_", "self_", "._", "instance_", "._", "hypervisor", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Cluster", "Info_", "(_", ")_", "._", "hv", "params_", "[_", "self_", "._", "instance_", "._", "hypervisor", "_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "info_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "node", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", ",_", "None_", ",_", "hv", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nin", "fo_", "in_", "node", "info_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nin", "fo_", "._", "Raise_", "(_", "\"", "Una", "ble", " ", "to", " ", "retrieve", " ", "node", " ", "informati", "on", " ", "from", " ", "node", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "nin", "fo_", "._", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "\\u_", ",_", "\\u_", ",_", "(_", "src", "\\u", "info_", ",_", ")_", ")_", "=_", "node", "info_", "[_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", "]_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "\\u_", ",_", "(_", "dst", "\\u", "info_", ",_", ")_", ")_", "=_", "node", "info_", "[_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "(_", "constants_", "._", "HV", "\\u", "NODE", "INFO", "\\u", "KEY", "\\u", "VERSION_", "in_", "src", "\\u", "info_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "constants_", "._", "HV", "\\u", "NODE", "INFO", "\\u", "KEY", "\\u", "VERSION_", "in_", "dst", "\\u", "info_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "version_", "=_", "src", "\\u", "info_", "[_", "constants_", "._", "HV", "\\u", "NODE", "INFO", "\\u", "KEY", "\\u", "VERSION_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "version_", "=_", "dst", "\\u", "info_", "[_", "constants_", "._", "HV", "\\u", "NODE", "INFO", "\\u", "KEY", "\\u", "VERSION_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "src", "\\u", "version_", "!=_", "dst", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "warn", "ing", ":", " ", "hypervisor", " ", "version", " ", "mism", "atch", " ", "bet", "ween", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "source", " ", "(%", "s", ")", " ", "and", " ", "target", " ", "(%", "s", ")", " ", "node", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src", "\\u", "version_", ",_", "dst", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hv", "_", "=_", "hypervisor", "_", "._", "Get", "Hyper", "visor", "_", "(_", "self_", "._", "instance_", "._", "hypervisor", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hv", "_", "._", "Version", "s", "Safe", "For", "Migration_", "(_", "src", "\\u", "version_", ",_", "dst", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", " ", " ", "migrati", "ng", " ", "from", " ", "hypervisor", " ", "version", " ", "%", "s", " ", "to", " ", "%", "s", " ", "shou", "ld", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "be", " ", "safe", "\"_", "%_", "(_", "src", "\\u", "version_", ",_", "dst", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", " ", " ", "migrati", "ng", " ", "from", " ", "hypervisor", " ", "version", " ", "%", "s", " ", "to", " ", "%", "s", " ", "is", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "like", "ly", " ", "unsup", "porte", "d", "\"_", "%_", "(_", "src", "\\u", "version_", ",_", "dst", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ignore", "\\u", "hv", "versions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", " ", " ", "continui", "ng", " ", "anyway", " ", "(", "tol", "d", " ", "to", " ", "ignore", " ", "version", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "mism", "atch", ")\"_", ")_", "\\u\\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_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Unsu", "ppo", "rted", " ", "migrati", "on", " ", "bet", "ween", " ", "hypervisor", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "version", "s", " ", "(%", "s", " ", "to", " ", "%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src", "\\u", "version_", ",_", "dst", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "checking", " ", "disk", " ", "consiste", "nc", "y", " ", "bet", "ween", " ", "source", " ", "and", " ", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "idx_", ",_", "dev_", ")_", "in_", "enumerate_", "(_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Check", "Disk", "Cons", "iste", "ncy_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ",_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Disk", " ", "%", "s", " ", "is", " ", "degr", "aded", " ", "or", " ", "not", " ", "full", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "synchronized", " ", "on", " ", "target", " ", "node", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "abort", "ing", " ", "migrati", "on", "\"_", "%_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "current", "\\u", "mem_", ">_", "self_", "._", "tgt", "\\u", "free", "\\u", "mem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "allow", "\\u", "runt", "ime", "\\u", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Memo", "ry", " ", "ballo", "oni", "ng", " ", "not", " ", "allow", "ed", " ", "and", " ", "not", " ", "eno", "ugh", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "free", " ", "memory", " ", "to", " ", "fit", " ", "instance", " ", "%", "s", " ", "on", " ", "target", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "node", " ", "%", "s", " ", "(", "have", " ", "%", "d", "MB", ",", " ", "need", " ", "%", "d", "MB", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tgt", "\\u", "free", "\\u", "mem_", ",_", "self_", "._", "current", "\\u", "mem_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "setti", "ng", " ", "instance", " ", "memory", " ", "to", " ", "%", "s", "\"_", "%_", "self_", "._", "tgt", "\\u", "free", "\\u", "mem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc", "res_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "ballo", "on", "\\u", "memory_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tgt", "\\u", "free", "\\u", "mem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc", "res_", "._", "Raise_", "(_", "\"", "Cann", "ot", " ", "modif", "y", " ", "instance", " ", "runt", "ime", " ", "memory", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "get", " ", "the", " ", "migrati", "on", " ", "informati", "on", " ", "from", " ", "the", " ", "remote", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "migrati", "on", "\\u", "info_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "err_", "=_", "(_", "\"", "Fail", "ed", " ", "fetch", "ing", " ", "source", " ", "migrati", "on", " ", "informati", "on", " ", "from", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "log", "\\u", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "log", "\\u", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "migrati", "on", "\\u", "info_", "=_", "migrati", "on", "\\u", "info_", "=_", "result_", "._", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "n", " ", "switch", " ", "the", " ", "disks", " ", "to", " ", "master", "/", "master", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Go", "Stand", "alo", "ne_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Go", "Recon", "nect", "_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "prepar", "ing", " ", "%", "s", " ", "to", " ", "accept", " ", "the", " ", "instance", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "accept", "\\u", "instance_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "nodes", "\\u", "ip_", "[_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Insta", "nce", " ", "pre", "-", "migrati", "on", " ", "fail", "ed", ",", " ", "try", "ing", " ", "to", " ", "revert", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "disk", " ", "status", ":", " ", "%", "s", "\"_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", "Pre", "-", "migrati", "on", " ", "fail", "ed", ",", " ", "abort", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Abo", "rt", "Migration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Rever", "t", "Disk", "Status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "pre", "-", "migr", "ate", " ", "instance", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "migrati", "ng", " ", "instance", " ", "to", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "=_", "self_", "._", "cfg_", "._", "Get", "Cluster", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "migrate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "cluster_", "._", "cluster", "\\u", "name_", ",_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "nodes", "\\u", "ip_", "[_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", ",_", "self_", "._", "live_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Insta", "nce", " ", "migrati", "on", " ", "fail", "ed", ",", " ", "try", "ing", " ", "to", " ", "revert", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "disk", " ", "status", ":", " ", "%", "s", "\"_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", "Migrat", "ion", " ", "fail", "ed", ",", " ", "abort", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Abo", "rt", "Migration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Rever", "t", "Disk", "Status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "migr", "ate", " ", "instance", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "startin", "g", " ", "memory", " ", "transfer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "feedback_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "get", "\\u", "migrati", "on", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms_", "=_", "result_", "._", "payload_", "#", " ", "Migrat", "ion", "Status", " ", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "or_", "(_", "ms_", "._", "status_", "in_", "constants_", "._", "HV", "\\u", "MIGRAT", "ION", "\\u", "FAIL", "ED", "\\u", "STATUS", "ES_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Insta", "nce", " ", "migrati", "on", " ", "fail", "ed", ",", " ", "try", "ing", " ", "to", " ", "revert", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "disk", " ", "status", ":", " ", "%", "s", "\"_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", "Migrat", "ion", " ", "fail", "ed", ",", " ", "abort", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Abo", "rt", "Migration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Rever", "t", "Disk", "Status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "hypervisor", " ", "return", "ed", " ", "fail", "ure", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "migr", "ate", " ", "instance", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "._", "payload_", "._", "status_", "!=_", "constants_", "._", "HV", "\\u", "MIGRAT", "ION", "\\u", "ACTIVE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "memory", " ", "transfer", " ", "complete", "\"_", ")_", "\\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_", "(_", "utils_", "._", "Time", "out", "Expire", "d_", "(_", "last", "\\u", "feedback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "MIGRAT", "ION", "\\u", "FEED", "BACK", "\\u", "INTERVAL_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "ms_", "._", "transferred", "\\u", "ram_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mem", "\\u", "progress_", "=_", "100_", "*_", "float_", "(_", "ms_", "._", "transferred", "\\u", "ram_", ")_", "/_", "float_", "(_", "ms_", "._", "total", "\\u", "ram_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "memory", " ", "transfer", " ", "progress", ":", " ", "%", ".2", "f", " ", "%%\"_", "%_", "mem", "\\u", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "feedback_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "self_", "._", "\\u", "MIGRAT", "ION", "\\u", "POLL", "\\u", "INTERVAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "finalize", "\\u", "migrati", "on", "\\u", "src_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ",_", "True_", ",_", "self_", "._", "live_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Insta", "nce", " ", "migrati", "on", " ", "succe", "eded", ",", " ", "but", " ", "finali", "zatio", "n", " ", "fail", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "on", " ", "the", " ", "source", " ", "node", ":", " ", "%", "s", "\"_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "finalize", " ", "instance", " ", "migrati", "on", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cfg_", "._", "Set", "Insta", "nce", "Prim", "ary", "Node_", "(_", "self_", "._", "instance_", "._", "uuid_", ",_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Info_", "(_", "self_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "finalize", "\\u", "migrati", "on", "\\u", "dst_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ",_", "migrati", "on", "\\u", "info_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Insta", "nce", " ", "migrati", "on", " ", "succe", "eded", ",", " ", "but", " ", "finali", "zatio", "n", " ", "fail", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "on", " ", "the", " ", "target", " ", "node", ":", " ", "%", "s", "\"_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "finalize", " ", "instance", " ", "migrati", "on", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Go", "Stand", "alo", "ne_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Go", "Recon", "nect", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Wait", "Unti", "l", "Sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Open", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "instance", "'", "s", " ", "disk", " ", "template", " ", "is", " ", "`", "rbd", "'", " ", "or", " ", "`", "ext", "'", " ", "and", " ", "there", " ", "was", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "success", "ful", " ", "migrati", "on", ",", " ", "unma", "p", " ", "the", " ", "device", " ", "from", " ", "the", " ", "source", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unma", "p", "\\u", "types_", "=_", "(_", "constants_", "._", "DT", "\\u", "RB", "D_", ",_", "constants_", "._", "DT", "\\u", "EXT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "Any", "Disk", "Of", "Type_", "(_", "disks_", ",_", "unma", "p", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unma", "p", "\\u", "disks_", "=_", "[_", "d_", "for_", "d_", "in_", "disks_", "if_", "d_", "._", "dev", "\\u", "type_", "in_", "unma", "p", "\\u", "types_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "Expand", "Check", "Disk", "s_", "(_", "unma", "p", "\\u", "disks_", ",_", "unma", "p", "\\u", "disks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "unma", "ppi", "ng", " ", "instance", "'", "s", " ", "disks", " ", "%", "s", " ", "from", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "utils_", "._", "Comm", "a", "Join_", "(_", "d_", "._", "name_", "for_", "d_", "in_", "unma", "p", "\\u", "disks_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "disk_", "in_", "disks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "blockd", "ev", "\\u", "shutdown_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "disk_", ",_", "self_", "._", "instance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Migrat", "ion", " ", "was", " ", "success", "ful", ",", " ", "but", " ", "coul", "dn", "'", "t", " ", "unma", "p", " ", "the", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "block", " ", "device", " ", "%", "s", " ", "on", " ", "source", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk_", "._", "iv", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "\"", "You", " ", "need", " ", "to", " ", "unma", "p", " ", "the", " ", "device", " ", "%", "s", " ", "manu", "ally", " ", "on", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk_", "._", "iv", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\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_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Exe", "c", "Fail", "over_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fail", "over", " ", "an", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "failover", " ", "is", " ", "don", "e", " ", "by", " ", "shutt", "ing", " ", "it", " ", "down", " ", "on", " ", "its", " ", "presen", "t", " ", "node", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "startin", "g", " ", "it", " ", "on", " ", "the", " ", "second", "ary", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "fort", "hco", "ming", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", "Insta", "nce", " ", "is", " ", "fort", "hco", "ming", ",", " ", "just", " ", "updat", "ing", " ", "the", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "configura", "tion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cfg_", "._", "Set", "Insta", "nce", "Prim", "ary", "Node_", "(_", "self_", "._", "instance_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\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_", "primary", "\\u", "node_", "=_", "self_", "._", "cfg_", "._", "Get", "Node", "Info_", "(_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "disks", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "checking", " ", "disk", " ", "consiste", "nc", "y", " ", "bet", "ween", " ", "source", " ", "and", " ", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "\\u", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "idx_", ",_", "dev_", ")_", "in_", "enumerate_", "(_", "inst", "\\u", "disks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "dr", "bd", ",", " ", "these", " ", "are", " ", "dr", "bd", " ", "over", " ", "lvm", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Check", "Disk", "Cons", "iste", "ncy_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ",_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "primary", "\\u", "node_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"", "Node", " ", "%", "s", " ", "is", " ", "offline", ",", " ", "ign", "orin", "g", " ", "degr", "aded", " ", "disk", " ", "%", "s", " ", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "target", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "primary", "\\u", "node_", "._", "name_", ",_", "idx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "self_", "._", "ignore", "\\u", "consiste", "ncy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Disk", " ", "%", "s", " ", "is", " ", "degr", "aded", " ", "on", " ", "target", " ", "node", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "abort", "ing", " ", "failover", "\"_", "%_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "not", " ", "checking", " ", "disk", " ", "consiste", "nc", "y", " ", "as", " ", "instance", " ", "is", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "shutt", "ing", " ", "down", " ", "instance", " ", "on", " ", "source", " ", "node", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Shutt", "ing", " ", "down", " ", "instance", " ", "%", "s", " ", "on", " ", "node", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", "._", "name_", ",_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "shutdown_", "(_", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "shut", "down", "\\u", "timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lu_", "._", "op_", "._", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ignore", "\\u", "consiste", "ncy_", "or_", "primary", "\\u", "node_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lu_", "._", "Log", "Warning_", "(_", "\"", "Cou", "ld", " ", "not", " ", "shut", "down", " ", "instance", " ", "%", "s", " ", "on", " ", "node", " ", "%", "s", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "proceed", "ing", " ", "anyway", ";", " ", "plea", "se", " ", "make", " ", "sure", " ", "node", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "%", "s", " ", "is", " ", "down", ";", " ", "error", " ", "deta", "il", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "shut", "down", " ", "instance", " ", "%", "s", " ", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", ",_", "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_", "disk", "\\u", "template_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "Template_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "disk", "\\u", "template_", "in_", "constants_", "._", "DT", "S", "\\u", "EXT", "\\u", "MIR", "ROR", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Clos", "e", "Insta", "nce", "Disk", "s_", "(_", "source", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "dea", "ctivat", "ing", " ", "the", " ", "instance", "'", "s", " ", "disks", " ", "on", " ", "source", " ", "node", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "Shut", "down", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ",_", "ignore", "\\u", "primary_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Can", "'", "t", " ", "shut", " ", "down", " ", "the", " ", "instance", "'", "s", " ", "disks", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cfg_", "._", "Set", "Insta", "nce", "Prim", "ary", "Node_", "(_", "self_", "._", "instance_", "._", "uuid_", ",_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Info_", "(_", "self_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "start", " ", "the", " ", "instance", " ", "if", " ", "it", "'", "s", " ", "marked", " ", "as", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "admin", "\\u", "state_", "==_", "constants_", "._", "ADM", "INST", "\\u", "UP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "activat", "ing", " ", "the", " ", "instance", "'", "s", " ", "disks", " ", "on", " ", "target", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Start", "ing", " ", "instance", " ", "%", "s", " ", "on", " ", "node", " ", "%", "s", "\"_", ",_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disks", "\\u", "ok_", ",_", "\\u_", ",_", "\\u_", "=_", "Assemble", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "second", "aries", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "disks", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Shut", "down", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Can", "'", "t", " ", "activat", "e", " ", "the", " ", "instance", "'", "s", " ", "disks", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "(_", "\"*", " ", "startin", "g", " ", "the", " ", "instance", " ", "on", " ", "the", " ", "target", " ", "node", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "rpc_", "._", "call", "\\u", "instance", "\\u", "start_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", ",_", "None_", ",_", "None_", ")_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lu_", "._", "op_", "._", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "result_", "._", "fail", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Shut", "down", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "lu_", ",_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Exe", "c", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "start", " ", "instance", " ", "%", "s", " ", "on", " ", "node", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "instance_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cfg_", "._", "Get", "Node", "Name_", "(_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TL", "Migrat", "e", "Instance_", "(_", "Task", "let_", ")_", ":_", "\\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_", "Exec_", "(_", "self_", ",_", "feed", "back", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "the", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feed", "back", "\\u", "fn_", "=_", "feed", "back", "\\u", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", "=_", "self_", "._", "instance_", "._", "primary", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "if", " ", "we", " ", "implement", " ", "migr", "ate", "-", "to", "-", "any", " ", "in", " ", "DR", "BD", ",", " ", "this", " ", "need", "s", " ", "fix", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Disk", "s_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "allow", " ", "mixed", " ", "disks_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "All", "Disk", "Of", "Type_", "(_", "disks_", ",_", "constants_", "._", "DT", "S", "\\u", "INT", "\\u", "MIR", "ROR", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "second", "ary", "\\u", "nodes_", "=_", "self_", "._", "cfg_", "._", "Get", "Insta", "nce", "Second", "ary", "Nodes_", "(_", "self_", "._", "instance_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "=_", "second", "ary", "\\u", "nodes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "self", ".", "target", "\\u", "node", " ", "has", " ", "bee", "n", " ", "populate", "d", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", ",", " ", "or", " ", "through", " ", "an", " ", "ial", "locator", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", "=_", "[_", "self_", "._", "source", "\\u", "node", "\\u", "uuid_", ",_", "self_", "._", "target", "\\u", "node", "\\u", "uuid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nodes", "\\u", "ip_", "=_", "dict_", "(_", "(_", "uuid_", ",_", "node_", "._", "second", "ary", "\\u", "ip_", ")_", "for_", "(_", "uuid_", ",_", "node_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "self_", "._", "cfg_", "._", "Get", "Multi", "Node", "Info_", "(_", "self_", "._", "all", "\\u", "node", "\\u", "uuids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "failover", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed", "back", "\\u", "fn_", "(_", "\"", "Fail", "over", " ", "instance", " ", "%", "s", "\"_", "%_", "self_", "._", "instance_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Exe", "c", "Fail", "over_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed", "back", "\\u", "fn_", "(_", "\"", "Migrat", "ing", " ", "instance", " ", "%", "s", "\"_", "%_", "self_", "._", "instance_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "cleanup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "Exe", "c", "Cleanup_", "(_", ")_", "\\u\\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", "Exe", "c", "Migration_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
emilmont/pyStatParser/stat_parser/parser.py
[ { "content": "def CKY(pcfg, norm_words):\n x, n = [(\"\", \"\")] + norm_words, len(norm_words)\n \n # Charts\n pi = defaultdict(float)\n bp = defaultdict(tuple)\n for i in range(1, n+1):\n for X in pcfg.N:\n norm, word = x[i]\n if (X, norm) in pcfg.q1:\n pi[i, i, X] = pcfg.q1[X, norm]\n bp[i, i, X] = (X, word, i, i)\n \n # Dynamic program\n for l in range(1, n):\n for i in range(1, n-l+1):\n j = i+l\n for X in pcfg.N:\n # Note that we only check rules that exist in training\n # and have non-zero probability\n score, back = argmax([(\n pcfg.q2[X, Y, Z] * pi[i, s, Y] * pi[s+1, j, Z],\n (X, Y, Z, i, s, j)\n ) for s in range(i, j)\n for Y, Z in pcfg.binary_rules[X]\n if pi[i , s, Y] > 0.0\n if pi[s+1, j, Z] > 0.0\n ])\n \n if score > 0.0:\n bp[i, j, X], pi[i, j, X] = back, score\n \n _, top = max([(pi[1, n, X], bp[1, n, X]) for X in pcfg.N])\n return backtrace(top, bp)", "metadata": "root.CKY", "header": "['module', '___EOS___']", "index": 40 } ]
[]
[]
0
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_", "CK", "Y_", "(_", "pc", "fg_", ",_", "norm", "\\u", "words_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "n_", "=_", "[_", "(_", "\"\"_", ",_", "\"\"_", ")_", "]_", "+_", "norm", "\\u", "words_", ",_", "len_", "(_", "norm", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Char", "ts_", "\\u\\u\\uNL\\u\\u\\u_", "pi_", "=_", "defaultdict_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp_", "=_", "defaultdict_", "(_", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "n_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "X_", "in_", "pc", "fg_", "._", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "norm_", ",_", "word_", "=_", "x_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "X_", ",_", "norm_", ")_", "in_", "pc", "fg_", "._", "q1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pi_", "[_", "i_", ",_", "i_", ",_", "X_", "]_", "=_", "pc", "fg_", "._", "q1_", "[_", "X_", ",_", "norm_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp_", "[_", "i_", ",_", "i_", ",_", "X_", "]_", "=_", "(_", "X_", ",_", "word_", ",_", "i_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dynamic", " ", "program_", "\\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_", "l_", "in_", "range_", "(_", "1_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "n_", "-_", "l_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "i_", "+_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "X_", "in_", "pc", "fg_", "._", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "only", " ", "check", " ", "rule", "s", " ", "tha", "t", " ", "exist", " ", "in", " ", "training_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "have", " ", "non", "-", "zero", " ", "probability_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score_", ",_", "back_", "=_", "argmax_", "(_", "[_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pc", "fg_", "._", "q2_", "[_", "X_", ",_", "Y_", ",_", "Z_", "]_", "*_", "pi_", "[_", "i_", ",_", "s_", ",_", "Y_", "]_", "*_", "pi_", "[_", "s_", "+_", "1_", ",_", "j_", ",_", "Z_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "X_", ",_", "Y_", ",_", "Z_", ",_", "i_", ",_", "s_", ",_", "j_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "s_", "in_", "range_", "(_", "i_", ",_", "j_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "Y_", ",_", "Z_", "in_", "pc", "fg_", "._", "binar", "y", "\\u", "rules_", "[_", "X_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pi_", "[_", "i_", ",_", "s_", ",_", "Y_", "]_", ">_", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pi_", "[_", "s_", "+_", "1_", ",_", "j_", ",_", "Z_", "]_", ">_", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "score_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bp_", "[_", "i_", ",_", "j_", ",_", "X_", "]_", ",_", "pi_", "[_", "i_", ",_", "j_", ",_", "X_", "]_", "=_", "back_", ",_", "score_", "\\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_", ",_", "top_", "=_", "max_", "(_", "[_", "(_", "pi_", "[_", "1_", ",_", "n_", ",_", "X_", "]_", ",_", "bp_", "[_", "1_", ",_", "n_", ",_", "X_", "]_", ")_", "for_", "X_", "in_", "pc", "fg_", "._", "N_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "backt", "race_", "(_", "top_", ",_", "bp_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
serverdensity/sd-agent/tests/checks/mock/test_sysstat.py
[ { "content": " def testNetwork(self):\n # FIXME: cx_state to true, but needs sysstat installed\n config = \"\"\"\ninit_config:\n\ninstances:\n - collect_connection_state: false\n excluded_interfaces:\n - lo\n - lo0\n\"\"\"\n check, instances = get_check('network', config)\n\n check.check(instances[0])\n check.get_metrics()\n\n metric_names = [m[0] for m in check.aggregator.metrics]\n\n assert 'system.net.bytes_rcvd' in metric_names\n assert 'system.net.bytes_sent' in metric_names\n if Platform.is_linux():\n assert 'system.net.tcp.retrans_segs' in metric_names\n assert 'system.net.tcp.in_segs' in metric_names\n assert 'system.net.tcp.out_segs' in metric_names\n elif Platform.is_bsd():\n assert 'system.net.tcp.retrans_packs' in metric_names\n assert 'system.net.tcp.sent_packs' in metric_names\n assert 'system.net.tcp.rcv_packs' in metric_names", "metadata": "root.TestSystem.testNetwork", "header": "['class', 'TestSystem', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 127 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "System_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Network_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "cx", "\\u", "state", " ", "to", " ", "true", ",", " ", "but", " ", "need", "s", " ", "sys", "stat", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "\"\"\"", "\\", "10", ";", "init", "\\u", "config", ":", "\\", "10", ";", "\\", "10", ";", "instance", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "collect", "\\u", "connecti", "on", "\\u", "state", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", "exclu", "ded", "\\u", "interface", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "lo", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "lo", "0", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", ",_", "instances_", "=_", "get", "\\u", "check_", "(_", "'", "network", "'_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "._", "check_", "(_", "instances_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "._", "get", "\\u", "metrics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "names_", "=_", "[_", "m_", "[_", "0_", "]_", "for_", "m_", "in_", "check_", "._", "aggregator", "_", "._", "metrics_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "bytes", "\\u", "rcv", "d", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "bytes", "\\u", "sent", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Platform_", "._", "is", "\\u", "linux_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "retra", "ns", "\\u", "seg", "s", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "in", "\\u", "seg", "s", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "out", "\\u", "seg", "s", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Platform_", "._", "is", "\\u", "bsd", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "retra", "ns", "\\u", "packs", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "sent", "\\u", "packs", "'_", "in_", "metric", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "system", ".", "net", ".", "tcp", ".", "rcv", "\\u", "packs", "'_", "in_", "metric", "\\u", "names_" ]
[ 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 ]
Unused import
python-babel/babel/tests/messages/test_checkers.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2008-2011 Edgewall Software\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part of this distribution. The terms\n# are also available at http://babel.edgewall.org/wiki/License.\n#\n# This software consists of voluntary contributions made by many\n# individuals. For the exact contribution history, see the revision\n# history and logs, available at http://babel.edgewall.org/log/.\n\nfrom datetime import datetime\nimport time\nimport unittest\n\nfrom babel import __version__ as VERSION\nfrom babel.core import Locale, UnknownLocaleError\nfrom babel.dates import format_datetime\nfrom babel.messages import checkers\nfrom babel.messages.plurals import PLURALS\nfrom babel.messages.pofile import read_po\nfrom babel.util import LOCALTZ\nfrom babel._compat import BytesIO\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CheckersTestCase(unittest.TestCase):\n # the last msgstr[idx] is always missing except for singular plural forms\n\n\n\n\n\n", "metadata": "root.CheckersTestCase", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def test_1_num_plurals_checkers(self):\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 1]:\n try:\n locale = Locale.parse(_locale)\n except UnknownLocaleError:\n # Just an alias? Not what we're testing here, let's continue\n continue\n po_file = (u\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\\\n\"\n\"PO-Revision-Date: %(date)s\\\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\\\n\"\n\"MIME-Version: 1.0\\\\n\"\n\"Content-Type: text/plain; charset=utf-8\\\\n\"\n\"Content-Transfer-Encoding: 8bit\\\\n\"\n\"Generated-By: Babel %(version)s\\\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=locale.english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale),\n num_plurals=PLURALS[_locale][0],\n plural_expr=PLURALS[_locale][0])).encode('utf-8')\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_1_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 30 }, { "content": " def test_2_num_plurals_checkers(self):\n # in this testcase we add an extra msgstr[idx], we should be\n # disregarding it\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 2]:\n if _locale in ['nn', 'no']:\n _locale = 'nn_NO'\n num_plurals = PLURALS[_locale.split('_')[0]][0]\n plural_expr = PLURALS[_locale.split('_')[0]][1]\n else:\n num_plurals = PLURALS[_locale][0]\n plural_expr = PLURALS[_locale][1]\n try:\n locale = Locale(_locale)\n date = format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale)\n except UnknownLocaleError:\n # Just an alias? Not what we're testing here, let's continue\n continue\n po_file = (u\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\\\n\"\n\"PO-Revision-Date: %(date)s\\\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\\\n\"\n\"MIME-Version: 1.0\\\\n\"\n\"Content-Type: text/plain; charset=utf-8\\\\n\"\n\"Content-Transfer-Encoding: 8bit\\\\n\"\n\"Generated-By: Babel %(version)s\\\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\nmsgstr[2] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=locale.english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=date,\n num_plurals=num_plurals,\n plural_expr=plural_expr)).encode('utf-8')\n # we should be adding the missing msgstr[0]\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_2_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 85 }, { "content": " def test_3_num_plurals_checkers(self):\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 3]:\n po_file = (r\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\n\"\n\"PO-Revision-Date: %(date)s\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Generated-By: Babel %(version)s\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=Locale.parse(_locale).english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale),\n num_plurals=PLURALS[_locale][0],\n plural_expr=PLURALS[_locale][0])).encode('utf-8')\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_3_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 153 }, { "content": " def test_4_num_plurals_checkers(self):\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 4]:\n po_file = (r\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\n\"\n\"PO-Revision-Date: %(date)s\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Generated-By: Babel %(version)s\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\nmsgstr[2] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=Locale.parse(_locale).english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale),\n num_plurals=PLURALS[_locale][0],\n plural_expr=PLURALS[_locale][0])).encode('utf-8')\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_4_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 204 }, { "content": " def test_5_num_plurals_checkers(self):\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 5]:\n po_file = (r\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\n\"\n\"PO-Revision-Date: %(date)s\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Generated-By: Babel %(version)s\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\nmsgstr[2] \"\"\nmsgstr[3] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=Locale.parse(_locale).english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale),\n num_plurals=PLURALS[_locale][0],\n plural_expr=PLURALS[_locale][0])).encode('utf-8')\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_5_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 256 }, { "content": " def test_6_num_plurals_checkers(self):\n for _locale in [p for p in PLURALS if PLURALS[p][0] == 6]:\n po_file = (r\"\"\"\\\n# %(english_name)s translations for TestProject.\n# Copyright (C) 2007 FooBar, Inc.\n# This file is distributed under the same license as the TestProject\n# project.\n# FIRST AUTHOR <EMAIL@ADDRESS>, 2007.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: TestProject 0.1\\n\"\n\"Report-Msgid-Bugs-To: bugs.address@email.tld\\n\"\n\"POT-Creation-Date: 2007-04-01 15:30+0200\\n\"\n\"PO-Revision-Date: %(date)s\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: %(locale)s <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=%(num_plurals)s; plural=%(plural_expr)s\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Generated-By: Babel %(version)s\\n\"\n\n#. This will be a translator comment,\n#. that will include several lines\n#: project/file1.py:8\nmsgid \"bar\"\nmsgstr \"\"\n\n#: project/file2.py:9\nmsgid \"foobar\"\nmsgid_plural \"foobars\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\nmsgstr[2] \"\"\nmsgstr[3] \"\"\nmsgstr[4] \"\"\n\n\"\"\" % dict(locale=_locale,\n english_name=Locale.parse(_locale).english_name,\n version=VERSION,\n year=time.strftime('%Y'),\n date=format_datetime(datetime.now(LOCALTZ),\n 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale=_locale),\n num_plurals=PLURALS[_locale][0],\n plural_expr=PLURALS[_locale][0])).encode('utf-8')\n\n # This test will fail for revisions <= 406 because so far\n # catalog.num_plurals was neglected\n catalog = read_po(BytesIO(po_file), _locale)\n message = catalog['foobar']\n checkers.num_plurals(catalog, message)", "metadata": "root.CheckersTestCase.test_6_num_plurals_checkers", "header": "['class', 'CheckersTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# the last msgstr[idx] is always missing except for singular plural forms', '___NL___', '___EOS___']", "index": 309 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", "-", "2011", " ", "Ed", "ge", "wall", " ", "Sof", "twa", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "is", " ", "license", "d", " ", "as", " ", "descri", "bed", " ", "in", " ", "the", " ", "file", " ", "COPY", "ING", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "as", " ", "part", " ", "of", " ", "this", " ", "distribu", "tion", ".", " ", "The", " ", "terms_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "als", "o", " ", "avail", "able", " ", "at", " ", "http", "://", "babel", ".", "edge", "wall", ".", "org", "/", "wiki", "/", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "consi", "sts", " ", "of", " ", "volu", "nta", "ry", " ", "contributions", " ", "made", " ", "by", " ", "many_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", "s", ".", " ", "For", " ", "the", " ", "exact", " ", "contribution", " ", "histo", "ry", ",", " ", "see", " ", "the", " ", "revision_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "histo", "ry", " ", "and", " ", "logs", ",", " ", "avail", "able", " ", "at", " ", "http", "://", "babel", ".", "edge", "wall", ".", "org", "/", "log", "/.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "babel", "_", "import_", "\\u\\u", "version\\u\\u_", "as_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "core_", "import_", "Locale_", ",_", "Un", "know", "n", "Local", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "dates_", "import_", "format\\u", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "messages_", "import_", "checkers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "messages_", "._", "plural", "s_", "import_", "PLU", "RAL", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "messages_", "._", "pof", "ile_", "import_", "read", "\\u", "po_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "util_", "import_", "LOCAL", "TZ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "babel", "_", "._", "\\u", "compat_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\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_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\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_", "test\\u", "1", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "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 ", " _", "locale_", "=_", "Locale_", "._", "parse_", "(_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Local", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "an", " ", "alias", "?", " ", "Not", " ", "what", " ", "we", "'", "re", " ", "testi", "ng", " ", "here", ",", " ", "let", "'", "s", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "po", "\\u", "file_", "=_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "locale_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "2", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "this", " ", "testc", "ase", " ", "we", " ", "add", " ", "an", " ", "extra", " ", "msgs", "tr", "[", "idx", "],", " ", "we", " ", "shou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dis", "regarding", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "locale_", "in_", "[_", "'", "nn", "'_", ",_", "'", "no", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "locale_", "=_", "'", "nn", "\\u", "NO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "0_", "]_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "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 ", " _", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locale_", "=_", "Locale_", "(_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Local", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "an", " ", "alias", "?", " ", "Not", " ", "what", " ", "we", "'", "re", " ", "testi", "ng", " ", "here", ",", " ", "let", "'", "s", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "po", "\\u", "file_", "=_", "(_", "u", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "1", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "2", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "locale_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "num", "\\u", "plural", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "plural", "\\u", "expr_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "shou", "ld", " ", "be", " ", "addin", "g", " ", "the", " ", "missi", "ng", " ", "msgs", "tr", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "3", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po", "\\u", "file_", "=_", "(_", "r", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "1", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "Locale_", "._", "parse_", "(_", "\\u", "locale_", ")_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "4", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "4_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po", "\\u", "file_", "=_", "(_", "r", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "1", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "2", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "Locale_", "._", "parse_", "(_", "\\u", "locale_", ")_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "5", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po", "\\u", "file_", "=_", "(_", "r", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "1", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "2", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "3", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "Locale_", "._", "parse_", "(_", "\\u", "locale_", ")_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "ers", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "msgs", "tr", "[", "idx", "]", " ", "is", " ", "alw", "ay", "s", " ", "missi", "ng", " ", "except", " ", "for", " ", "singular", " ", "plural", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "6", "\\u", "num", "\\u", "plural", "s", "\\u", "checkers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "locale_", "in_", "[_", "p_", "for_", "p_", "in_", "PLU", "RAL", "S_", "if_", "PLU", "RAL", "S_", "[_", "p_", "]_", "[_", "0_", "]_", "==_", "6_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po", "\\u", "file_", "=_", "(_", "r", "\"\"\"", "\\\\", "\\", "10", ";", "#", " ", "%", "(", "english", "\\u", "name", ")", "s", " ", "translatio", "ns", " ", "for", " ", "Test", "Project", ".", "\\", "10", ";", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Foo", "Bar", ",", " ", "Inc", ".", "\\", "10", ";", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "distributed", " ", "under", " ", "the", " ", "same", " ", "license", " ", "as", " ", "the", " ", "Test", "Project", "\\", "10", ";", "#", " ", "project", ".", "\\", "10", ";", "#", " ", "FIR", "ST", " ", "AUTHOR", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">", ",", " ", "2007", ".", "\\", "10", ";", "#", "\\", "10", ";", "msgid", " ", "\"\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\"", "Project", "-", "Id", "-", "Version", ":", " ", "Test", "Project", " ", "0.", "1", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Report", "-", "Msg", "id", "-", "Bug", "s", "-", "To", ":", " ", "bug", "s", ".", "address", "@", "email", ".", "tld", "\\\\", "n", "\"", "\\", "10", ";", "\"", "POT", "-", "Creat", "ion", "-", "Date", ":", " ", "2007", "-0", "4", "-0", "1", " ", "15", ":", "30", "+0", "200", "\\\\", "n", "\"", "\\", "10", ";", "\"", "PO", "-", "Revi", "sion", "-", "Date", ":", " ", "%", "(", "date", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Las", "t", "-", "Translat", "or", ":", " ", "FULL", " ", "NAME", " ", "<", "EMA", "IL", "@", "ADDR", "ESS", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Lang", "ua", "ge", "-", "Tea", "m", ":", " ", "%", "(", "locale", ")", "s", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "%", "(", "num", "\\u", "plural", "s", ")", "s", ";", " ", "plural", "=", "%", "(", "plural", "\\u", "expr", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\"", "MIME", "-", "Version", ":", " ", "1.0", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", ":", " ", "8b", "it", "\\\\", "n", "\"", "\\", "10", ";", "\"", "Generate", "d", "-", "By", ":", " ", "Bab", "el", " ", "%", "(", "version", ")", "s", "\\\\", "n", "\"", "\\", "10", ";", "\\", "10", ";", "#.", " ", "Thi", "s", " ", "will", " ", "be", " ", "a", " ", "translator", " ", "comment", ",", "\\", "10", ";", "#.", " ", "tha", "t", " ", "will", " ", "include", " ", "sever", "al", " ", "lines", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "1", ".", "py", ":", "8", "\\", "10", ";", "msgid", " ", "\"", "bar", "\"", "\\", "10", ";", "msgs", "tr", " ", "\"\"", "\\", "10", ";", "\\", "10", ";", "#", ":", " ", "project", "/", "file", "2", ".", "py", ":", "9", "\\", "10", ";", "msgid", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", "msgid", "\\u", "plural", " ", "\"", "fooba", "rs", "\"", "\\", "10", ";", "msgs", "tr", "[", "0", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "1", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "2", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "3", "]", " ", "\"\"", "\\", "10", ";", "msgs", "tr", "[", "4", "]", " ", "\"\"", "\\", "10", ";", "\\", "10", ";\"\"\"_", "%_", "dict_", "(_", "locale_", "=_", "\\u", "locale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "english", "\\u", "name_", "=_", "Locale_", "._", "parse_", "(_", "\\u", "locale_", ")_", "._", "english", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "\\u", "locale_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "plural", "s_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plural", "\\u", "expr_", "=_", "PLU", "RAL", "S_", "[_", "\\u", "locale_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "will", " ", "fail", " ", "for", " ", "revis", "ion", "s", " ", "<=", " ", "406", " ", "bec", "aus", "e", " ", "so", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catal", "og", ".", "num", "\\u", "plural", "s", " ", "was", " ", "neg", "lect", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "=_", "read", "\\u", "po_", "(_", "Byte", "s", "IO_", "(_", "po", "\\u", "file_", ")_", ",_", "\\u", "locale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "catalog_", "[_", "'", "fooba", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checkers", "_", "._", "num", "\\u", "plural", "s_", "(_", "catalog_", ",_", "message_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
openstack/horizon/openstack_dashboard/dashboards/admin/aggregates/forms.py
[ { "content": " def handle(self, request, data):\n id = self.initial['id']\n name = data['name']\n availability_zone = data['availability_zone']\n aggregate = {'name': name}\n if availability_zone:\n aggregate['availability_zone'] = availability_zone\n try:\n api.nova.aggregate_update(request, id, aggregate)\n message = (_('Successfully updated aggregate: \"%s.\"')\n % data['name'])\n messages.success(request, message)\n except Exception:\n exceptions.handle(request,\n _('Unable to update the aggregate.'))\n return True", "metadata": "root.UpdateAggregateForm.handle", "header": "['class', 'UpdateAggregateForm', '(', 'forms', '.', 'SelfHandlingForm', ')', ':', '___EOS___']", "index": 31 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Update", "Aggregate", "Form_", "(_", "forms_", "._", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "request_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "self_", "._", "initial_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "data_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avail", "abilit", "y", "\\u", "zone_", "=_", "data_", "[_", "'", "avail", "abilit", "y", "\\u", "zone", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggregate_", "=_", "{_", "'", "name", "'_", ":_", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "avail", "abilit", "y", "\\u", "zone_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggregate_", "[_", "'", "avail", "abilit", "y", "\\u", "zone", "'_", "]_", "=_", "avail", "abilit", "y", "\\u", "zone_", "\\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 ", " _", "api_", "._", "nova_", "._", "aggre", "gate", "\\u", "update_", "(_", "request_", ",_", "id_", ",_", "aggregate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "(_", "\\u_", "(_", "'", "Success", "full", "y", " ", "update", "d", " ", "aggre", "gate", ":", " ", "\"%", "s", ".\"", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "data_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exceptions_", "._", "handle_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Una", "ble", " ", "to", " ", "update", " ", "the", " ", "aggre", "gate", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/custom/ilsgateway/models.py
[ { "content": "from datetime import datetime\n\nimport json_field\nfrom django.dispatch.dispatcher import receiver\nfrom corehq.apps.domain.signals import commcare_domain_pre_delete\nfrom corehq.apps.locations.signals import location_edited\nfrom dimagi.ext.couchdbkit import Document, BooleanProperty, StringProperty\nfrom django.db import models, connection\n\nfrom casexml.apps.stock.models import DocDomainMapping\nfrom corehq.apps.locations.models import SQLLocation\nfrom custom.utils.utils import add_to_module_map\nfrom dimagi.utils.dates import force_to_datetime\n\n\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L68\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L78\n\n\n# Ported from: https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L124\n\n\n# Ported from: https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L170\n\n\n# Ported from: https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L170\n# https://github.com/dimagi/rapidsms-logistics/blob/master/logistics/warehouse_models.py#L14\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L9\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L16\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L78\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L85\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L97\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/models.py#L11\n\n\n# Ported from:\n# https://github.com/dimagi/logistics/blob/tz-master/logistics_project/apps/tanzania/reporting/models.py#L97\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ILSGatewayConfig(Document):\n enabled = BooleanProperty(default=False)\n domain = StringProperty()\n url = StringProperty(default=\"http://ilsgateway.com/api/v0_1\")\n username = StringProperty()\n password = StringProperty()\n steady_sync = BooleanProperty(default=False)\n all_stock_data = BooleanProperty(default=False)\n\n\n\n\n\n", "metadata": "root.ILSGatewayConfig", "header": "['module', '___EOS___']", "index": 15 }, { "content": " @classmethod\n def for_domain(cls, name):\n try:\n mapping = DocDomainMapping.objects.get(domain_name=name, doc_type='ILSGatewayConfig')\n return cls.get(docid=mapping.doc_id)\n except DocDomainMapping.DoesNotExist:\n return None", "metadata": "root.ILSGatewayConfig.for_domain", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 24 }, { "content": " @classmethod\n def get_all_configs(cls):\n mappings = DocDomainMapping.objects.filter(doc_type='ILSGatewayConfig')\n configs = [cls.get(docid=mapping.doc_id) for mapping in mappings]\n return configs", "metadata": "root.ILSGatewayConfig.get_all_configs", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 32 }, { "content": " @classmethod\n def get_all_enabled_domains(cls):\n configs = cls.get_all_configs()\n return [c.domain for c in filter(lambda config: config.enabled, configs)]", "metadata": "root.ILSGatewayConfig.get_all_enabled_domains", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 38 }, { "content": " @classmethod\n def get_all_steady_sync_configs(cls):\n return [\n config for config in cls.get_all_configs()\n if config.steady_sync\n ]", "metadata": "root.ILSGatewayConfig.get_all_steady_sync_configs", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 43 }, { "content": " @property\n def is_configured(self):\n return True if self.enabled and self.url and self.password and self.username else False", "metadata": "root.ILSGatewayConfig.is_configured", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 50 }, { "content": " def save(self, **params):\n super(ILSGatewayConfig, self).save(**params)\n try:\n DocDomainMapping.objects.get(doc_id=self._id,\n domain_name=self.domain,\n doc_type=\"ILSGatewayConfig\")\n except DocDomainMapping.DoesNotExist:\n DocDomainMapping.objects.create(doc_id=self._id,\n domain_name=self.domain,\n doc_type='ILSGatewayConfig')\n add_to_module_map(self.domain, 'custom.ilsgateway')", "metadata": "root.ILSGatewayConfig.save", "header": "['class', 'ILSGatewayConfig', '(', 'Document', ')', ':', '___EOS___']", "index": 54 }, { "content": "class SupplyPointStatusValues(object):\n RECEIVED = \"received\"\n NOT_RECEIVED = \"not_received\"\n SUBMITTED = \"submitted\"\n NOT_SUBMITTED = \"not_submitted\"\n REMINDER_SENT = \"reminder_sent\"\n ALERT_SENT = \"alert_sent\"\n CHOICES = [RECEIVED, NOT_RECEIVED, SUBMITTED,\n NOT_SUBMITTED, REMINDER_SENT, ALERT_SENT]", "metadata": "root.SupplyPointStatusValues", "header": "['module', '___EOS___']", "index": 69 }, { "content": "class SupplyPointStatusTypes(object):\n DELIVERY_FACILITY = \"del_fac\"\n DELIVERY_DISTRICT = \"del_dist\"\n R_AND_R_FACILITY = \"rr_fac\"\n R_AND_R_DISTRICT = \"rr_dist\"\n SOH_FACILITY = \"soh_fac\"\n SUPERVISION_FACILITY = \"super_fac\"\n LOSS_ADJUSTMENT_FACILITY = \"la_fac\"\n DELINQUENT_DELIVERIES = \"del_del\"\n TRANS_FACILITY = \"trans_fac\"\n\n CHOICE_MAP = {\n DELIVERY_FACILITY: {SupplyPointStatusValues.REMINDER_SENT: \"Waiting Delivery Confirmation\",\n SupplyPointStatusValues.RECEIVED: \"Delivery received\",\n SupplyPointStatusValues.NOT_RECEIVED: \"Delivery Not Received\"},\n DELIVERY_DISTRICT: {SupplyPointStatusValues.REMINDER_SENT: \"Waiting Delivery Confirmation\",\n SupplyPointStatusValues.RECEIVED: \"Delivery received\",\n SupplyPointStatusValues.NOT_RECEIVED: \"Delivery not received\"},\n R_AND_R_FACILITY: {SupplyPointStatusValues.REMINDER_SENT: \"Waiting R&R sent confirmation\",\n SupplyPointStatusValues.SUBMITTED: \"R&R Submitted From Facility to District\",\n SupplyPointStatusValues.NOT_SUBMITTED: \"R&R Not Submitted\"},\n R_AND_R_DISTRICT: {SupplyPointStatusValues.REMINDER_SENT: \"R&R Reminder Sent to District\",\n SupplyPointStatusValues.SUBMITTED: \"R&R Submitted from District to MSD\"},\n SOH_FACILITY: {SupplyPointStatusValues.REMINDER_SENT: \"Stock on hand reminder sent to Facility\",\n SupplyPointStatusValues.SUBMITTED: \"Stock on hand Submitted\"},\n SUPERVISION_FACILITY: {SupplyPointStatusValues.REMINDER_SENT: \"Supervision Reminder Sent\",\n SupplyPointStatusValues.RECEIVED: \"Supervision Received\",\n SupplyPointStatusValues.NOT_RECEIVED: \"Supervision Not Received\"},\n LOSS_ADJUSTMENT_FACILITY: {\n SupplyPointStatusValues.REMINDER_SENT: \"Lost/Adjusted Reminder sent to Facility\"\n },\n DELINQUENT_DELIVERIES: {\n SupplyPointStatusValues.ALERT_SENT: \"Delinquent deliveries summary sent to District\"\n },\n TRANS_FACILITY: {\n SupplyPointStatusValues.SUBMITTED: \"Transfer Stock Submitted\",\n SupplyPointStatusValues.NOT_SUBMITTED: \"Transfer Stock Not Submitted\",\n SupplyPointStatusValues.REMINDER_SENT: \"Transfer Reminder Sent\"\n }\n }\n\n", "metadata": "root.SupplyPointStatusTypes", "header": "['module', '___EOS___']", "index": 82 }, { "content": " @classmethod\n def get_display_name(cls, type, value):\n return cls.CHOICE_MAP[type][value]", "metadata": "root.SupplyPointStatusTypes.get_display_name", "header": "['class', 'SupplyPointStatusTypes', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " @classmethod\n def is_legal_combination(cls, type, value):\n return type in cls.CHOICE_MAP and value in cls.CHOICE_MAP[type]", "metadata": "root.SupplyPointStatusTypes.is_legal_combination", "header": "['class', 'SupplyPointStatusTypes', '(', 'object', ')', ':', '___EOS___']", "index": 127 }, { "content": "class SupplyPointStatus(models.Model):\n status_type = models.CharField(choices=((k, k) for k in SupplyPointStatusTypes.CHOICE_MAP.keys()),\n max_length=50)\n status_value = models.CharField(max_length=50,\n choices=((c, c) for c in SupplyPointStatusValues.CHOICES))\n status_date = models.DateTimeField(default=datetime.utcnow)\n location_id = models.CharField(max_length=100, db_index=True)\n external_id = models.PositiveIntegerField(null=True, db_index=True)\n\n\n\n\n class Meta:\n app_label = 'ilsgateway'\n verbose_name = \"Facility Status\"\n verbose_name_plural = \"Facility Statuses\"\n get_latest_by = \"status_date\"\n ordering = ('-status_date',)", "metadata": "root.SupplyPointStatus", "header": "['module', '___EOS___']", "index": 133 }, { "content": " def save(self, *args, **kwargs):\n if not SupplyPointStatusTypes.is_legal_combination(self.status_type, self.status_value):\n raise ValueError(\"%s and %s is not a legal value combination\" %\n (self.status_type, self.status_value))\n super(SupplyPointStatus, self).save(*args, **kwargs)", "metadata": "root.SupplyPointStatus.save", "header": "['class', 'SupplyPointStatus', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 142 }, { "content": " def __unicode__(self):\n return \"%s: %s\" % (self.status_type, self.status_value)", "metadata": "root.SupplyPointStatus.__unicode__", "header": "['class', 'SupplyPointStatus', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 148 }, { "content": " @property\n def name(self):\n return SupplyPointStatusTypes.get_display_name(self.status_type, self.status_value)", "metadata": "root.SupplyPointStatus.name", "header": "['class', 'SupplyPointStatus', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 151 }, { "content": "class DeliveryGroupReport(models.Model):\n location_id = models.CharField(max_length=100, db_index=True)\n quantity = models.IntegerField()\n report_date = models.DateTimeField(default=datetime.utcnow)\n message = models.CharField(max_length=100, db_index=True)\n delivery_group = models.CharField(max_length=1)\n external_id = models.PositiveIntegerField(null=True, db_index=True)\n\n class Meta:\n app_label = 'ilsgateway'\n ordering = ('-report_date',)", "metadata": "root.DeliveryGroupReport", "header": "['module', '___EOS___']", "index": 164 }, { "content": "class ReportingModel(models.Model):\n \"\"\"\n A model to encapsulate aggregate (data warehouse) data used by a report.\n \"\"\"\n date = models.DateTimeField() # viewing time period\n location_id = models.CharField(max_length=100, db_index=True)\n create_date = models.DateTimeField(editable=False)\n update_date = models.DateTimeField(editable=False)\n external_id = models.PositiveIntegerField(db_index=True, null=True)\n\n class Meta:\n app_label = 'ilsgateway'\n\n\n class Meta:\n abstract = True", "metadata": "root.ReportingModel", "header": "['module', '___EOS___']", "index": 179 }, { "content": " def save(self, *args, **kwargs):\n if not self.id:\n self.create_date = datetime.utcnow()\n self.update_date = datetime.utcnow()\n super(ReportingModel, self).save(*args, **kwargs)", "metadata": "root.ReportingModel.save", "header": "['class', 'ReportingModel', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 192 }, { "content": "class OrganizationSummary(ReportingModel):\n total_orgs = models.PositiveIntegerField(default=0)\n average_lead_time_in_days = models.FloatField(default=0)\n\n class Meta:\n app_label = 'ilsgateway'\n", "metadata": "root.OrganizationSummary", "header": "['module', '___EOS___']", "index": 204 }, { "content": " def __unicode__(self):\n return \"%s: %s/%s\" % (self.location_id, self.date.month, self.date.year)", "metadata": "root.OrganizationSummary.__unicode__", "header": "['class', 'OrganizationSummary', '(', 'ReportingModel', ')', ':', '___EOS___']", "index": 211 }, { "content": "class GroupSummary(models.Model):\n \"\"\"\n Warehouse data related to a particular category of reporting\n (e.g. stock on hand summary)\n \"\"\"\n org_summary = models.ForeignKey('OrganizationSummary')\n title = models.CharField(max_length=50, blank=True, null=True) # SOH\n total = models.PositiveIntegerField(default=0)\n responded = models.PositiveIntegerField(default=0)\n on_time = models.PositiveIntegerField(default=0)\n complete = models.PositiveIntegerField(default=0) # \"complete\" = submitted or responded\n external_id = models.PositiveIntegerField(db_index=True, null=True)\n\n class Meta:\n app_label = 'ilsgateway'\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.GroupSummary", "header": "['module', '___EOS___']", "index": 217 }, { "content": " @classmethod\n def wrap_form_json(cls, obj, location_id):\n org_summary_id = obj['org_summary']['id']\n del obj['org_summary']['id']\n obj['org_summary']['external_id'] = org_summary_id\n obj['org_summary']['location_id'] = location_id\n obj['org_summary']['create_date'] = force_to_datetime(obj['org_summary']['create_date'])\n obj['org_summary']['update_date'] = force_to_datetime(obj['org_summary']['update_date'])\n obj['org_summary']['date'] = force_to_datetime(obj['org_summary']['date'])\n try:\n obj['org_summary'] = OrganizationSummary.objects.get(external_id=org_summary_id)\n except OrganizationSummary.DoesNotExist:\n obj['org_summary'] = OrganizationSummary.objects.create(**obj['org_summary'])\n obj['external_id'] = obj['id']\n del obj['id']\n return cls(**obj)", "metadata": "root.GroupSummary.wrap_form_json", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 233 }, { "content": " @property\n def late(self):\n return self.complete - self.on_time", "metadata": "root.GroupSummary.late", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 250 }, { "content": " @property\n def not_responding(self):\n return self.total - self.responded", "metadata": "root.GroupSummary.not_responding", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 254 }, { "content": " def is_delivery_or_supervision_facility(self):\n return self.title in [SupplyPointStatusTypes.DELIVERY_FACILITY,\n SupplyPointStatusTypes.SUPERVISION_FACILITY]", "metadata": "root.GroupSummary.is_delivery_or_supervision_facility", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 258 }, { "content": " @property\n def received(self):\n assert self.is_delivery_or_supervision_facility()\n return self.complete", "metadata": "root.GroupSummary.received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 262 }, { "content": " @property\n def not_received(self):\n assert self.is_delivery_or_supervision_facility()\n return self.responded - self.complete", "metadata": "root.GroupSummary.not_received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 267 }, { "content": " @property\n def sup_received(self):\n assert self.title in SupplyPointStatusTypes.SUPERVISION_FACILITY\n return self.complete", "metadata": "root.GroupSummary.sup_received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 272 }, { "content": " @property\n def sup_not_received(self):\n assert self.title == SupplyPointStatusTypes.SUPERVISION_FACILITY\n return self.responded - self.complete", "metadata": "root.GroupSummary.sup_not_received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 277 }, { "content": " @property\n def del_received(self):\n assert self.title == SupplyPointStatusTypes.DELIVERY_FACILITY\n return self.complete", "metadata": "root.GroupSummary.del_received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 282 }, { "content": " @property\n def del_not_received(self):\n assert self.title == SupplyPointStatusTypes.DELIVERY_FACILITY\n return self.responded - self.complete", "metadata": "root.GroupSummary.del_not_received", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 287 }, { "content": " @property\n def not_submitted(self):\n assert self.title in [SupplyPointStatusTypes.SOH_FACILITY,\n SupplyPointStatusTypes.R_AND_R_FACILITY]\n return self.responded - self.complete", "metadata": "root.GroupSummary.not_submitted", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 292 }, { "content": " def __unicode__(self):\n return \"%s - %s\" % (self.org_summary, self.title)", "metadata": "root.GroupSummary.__unicode__", "header": "['class', 'GroupSummary', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 298 }, { "content": "class ProductAvailabilityData(ReportingModel):\n product = models.CharField(max_length=100, db_index=True)\n total = models.PositiveIntegerField(default=0)\n with_stock = models.PositiveIntegerField(default=0)\n without_stock = models.PositiveIntegerField(default=0)\n without_data = models.PositiveIntegerField(default=0)\n\n class Meta:\n app_label = 'ilsgateway'\n", "metadata": "root.ProductAvailabilityData", "header": "['module', '___EOS___']", "index": 304 }, { "content": " def __str__(self):\n return 'ProductAvailabilityData(date={}, product={}, total={}, with_stock={}, without_stock={}, ' \\\n 'without_data={})'.format(self.date, self.product, self.total, self.with_stock,\n self.without_stock, self.without_data)", "metadata": "root.ProductAvailabilityData.__str__", "header": "['class', 'ProductAvailabilityData', '(', 'ReportingModel', ')', ':', '___EOS___']", "index": 314 }, { "content": "class ProductAvailabilityDashboardChart(object):\n label_color = {\n \"Stocked out\": \"#a30808\",\n \"Not Stocked out\": \"#7aaa7a\",\n \"No Stock Data\": \"#efde7f\"\n }\n width = 900\n height = 300\n div = \"product_availability_summary_plot_placeholder\"\n legenddiv = \"product_availability_summary_legend\"\n xaxistitle = \"Products\"\n yaxistitle = \"Facilities\"\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.ProductAvailabilityDashboardChart", "header": "['module', '___EOS___']", "index": 322 }, { "content": "class Alert(ReportingModel):\n type = models.CharField(max_length=50, blank=True, null=True)\n number = models.PositiveIntegerField(default=0)\n text = models.TextField()\n url = models.CharField(max_length=100, blank=True, null=True)\n expires = models.DateTimeField()\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.Alert", "header": "['module', '___EOS___']", "index": 341 }, { "content": "class DeliveryGroups(object):\n \"\"\"\n There are three delivery groups of facilities: A, B, C.\n Every month groups have different roles starting from the state below.\n Submitting group: January = A\n Processing group: January = C\n Delivering group: January = B\n Next month A will be changed to B, B to C and C to B.\n \"\"\"\n\n GROUPS = ('A', 'B', 'C')\n\n\n\n\n\n\n", "metadata": "root.DeliveryGroups", "header": "['module', '___EOS___']", "index": 354 }, { "content": " def __init__(self, month=None, facs=None):\n self.month = month if month else datetime.utcnow().month\n self.facs = facs", "metadata": "root.DeliveryGroups.__init__", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 366 }, { "content": " def current_submitting_group(self, month=None):\n month = month if month else self.month\n return self.GROUPS[(month + 2) % 3]", "metadata": "root.DeliveryGroups.current_submitting_group", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 370 }, { "content": " def current_processing_group(self, month=None):\n month = month if month else self.month\n return self.current_submitting_group(month=(month + 2))", "metadata": "root.DeliveryGroups.current_processing_group", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 374 }, { "content": " def current_delivering_group(self, month=None):\n month = month if month else self.month\n return self.current_submitting_group(month=(month + 1))", "metadata": "root.DeliveryGroups.current_delivering_group", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 378 }, { "content": " def delivering(self, facs=None, month=None):\n if not facs:\n facs = self.facs\n if not facs:\n return []\n return filter(lambda f: self.current_delivering_group(month) == f.metadata.get('group', None), facs)", "metadata": "root.DeliveryGroups.delivering", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 382 }, { "content": " def processing(self, facs=None, month=None):\n if not facs:\n facs = self.facs\n if not facs:\n return []\n return filter(lambda f: self.current_processing_group(month) == f.metadata.get('group', None), facs)", "metadata": "root.DeliveryGroups.processing", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 389 }, { "content": " def submitting(self, facs=None, month=None):\n if not facs:\n facs = self.facs\n if not facs:\n return []\n return filter(lambda f: self.current_submitting_group(month) == f.metadata.get('group', None), facs)", "metadata": "root.DeliveryGroups.submitting", "header": "['class', 'DeliveryGroups', '(', 'object', ')', ':', '___EOS___']", "index": 396 }, { "content": "class ReportRun(models.Model):\n \"\"\"\n Log of whenever the warehouse models get updated.\n \"\"\"\n start = models.DateTimeField() # the start of the period covered (from a data perspective)\n end = models.DateTimeField() # the end of the period covered (from a data perspective)\n start_run = models.DateTimeField() # when this started\n end_run = models.DateTimeField(null=True) # when this finished\n complete = models.BooleanField(default=False)\n has_error = models.BooleanField(default=False)\n domain = models.CharField(max_length=60)\n location = models.ForeignKey(SQLLocation, null=True, on_delete=models.PROTECT)\n\n class Meta:\n app_label = 'ilsgateway'\n\n", "metadata": "root.ReportRun", "header": "['module', '___EOS___']", "index": 406 }, { "content": " @classmethod\n def last_success(cls, domain):\n \"\"\"\n The last successful execution of a report, or None if no records found.\n \"\"\"\n qs = cls.objects.filter(complete=True, has_error=False, domain=domain)\n return qs.order_by(\"-start_run\")[0] if qs.count() else None", "metadata": "root.ReportRun.last_success", "header": "['class', 'ReportRun', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 422 }, { "content": " @classmethod\n def last_run(cls, domain):\n qs = cls.objects.filter(complete=True, domain=domain)\n return qs.order_by(\"-start_run\")[0] if qs.count() else None", "metadata": "root.ReportRun.last_run", "header": "['class', 'ReportRun', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 430 }, { "content": "class RequisitionReport(models.Model):\n location_id = models.CharField(max_length=100, db_index=True)\n submitted = models.BooleanField(default=False)\n report_date = models.DateTimeField(default=datetime.utcnow)\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.RequisitionReport", "header": "['module', '___EOS___']", "index": 436 }, { "content": "class SupervisionDocument(models.Model):\n document = models.TextField()\n domain = models.CharField(max_length=100)\n name = models.CharField(max_length=100)\n data_type = models.CharField(max_length=100)\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.SupervisionDocument", "header": "['module', '___EOS___']", "index": 445 }, { "content": "class ILSNotes(models.Model):\n location = models.ForeignKey(SQLLocation, on_delete=models.PROTECT)\n domain = models.CharField(max_length=100, null=False)\n user_name = models.CharField(max_length=128, null=False)\n user_role = models.CharField(max_length=100, null=True)\n user_phone = models.CharField(max_length=20, null=True)\n date = models.DateTimeField()\n text = models.TextField()\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.ILSNotes", "header": "['module', '___EOS___']", "index": 455 }, { "content": "class PendingReportingDataRecalculation(models.Model):\n domain = models.CharField(max_length=128)\n sql_location = models.ForeignKey(SQLLocation)\n type = models.CharField(max_length=128)\n data = json_field.JSONField()\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.PendingReportingDataRecalculation", "header": "['module', '___EOS___']", "index": 468 }, { "content": "class SLABConfig(models.Model):\n is_pilot = models.BooleanField(default=False)\n sql_location = models.ForeignKey(SQLLocation, null=False, unique=True)\n closest_supply_points = models.ManyToManyField(SQLLocation, related_name='+')\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.SLABConfig", "header": "['module', '___EOS___']", "index": 478 }, { "content": "class OneOffTaskProgress(models.Model):\n domain = models.CharField(max_length=128)\n task_name = models.CharField(max_length=128)\n last_synced_object_id = models.CharField(max_length=128, null=True)\n complete = models.BooleanField(default=False)\n progress = models.IntegerField(default=0)\n total = models.IntegerField(default=0)\n\n class Meta:\n app_label = 'ilsgateway'", "metadata": "root.OneOffTaskProgress", "header": "['module', '___EOS___']", "index": 487 }, { "content": "@receiver(commcare_domain_pre_delete)\ndef domain_pre_delete_receiver(domain, **kwargs):\n from corehq.apps.domain.deletion import ModelDeletion, CustomDeletion\n\n def _delete_ilsgateway_data(domain_name):\n locations_ids = SQLLocation.objects.filter(domain=domain_name).values_list('location_id', flat=True)\n if not locations_ids:\n return\n\n DeliveryGroupReport.objects.filter(location_id__in=locations_ids).delete()\n\n with connection.cursor() as cursor:\n cursor.execute(\n \"DELETE FROM ilsgateway_alert WHERE location_id IN \"\n \"(SELECT location_id FROM locations_sqllocation WHERE domain=%s)\", [domain_name]\n )\n cursor.execute(\n \"DELETE FROM ilsgateway_groupsummary WHERE org_summary_id IN \"\n \"(SELECT id FROM ilsgateway_organizationsummary WHERE location_id IN \"\n \"(SELECT location_id FROM locations_sqllocation WHERE domain=%s))\", [domain_name]\n )\n\n cursor.execute(\n \"DELETE FROM ilsgateway_organizationsummary WHERE location_id IN \"\n \"(SELECT location_id FROM locations_sqllocation WHERE domain=%s)\", [domain_name]\n )\n\n cursor.execute(\n \"DELETE FROM ilsgateway_productavailabilitydata WHERE location_id IN \"\n \"(SELECT location_id FROM locations_sqllocation WHERE domain=%s)\", [domain_name]\n )\n\n cursor.execute(\n \"DELETE FROM ilsgateway_supplypointstatus WHERE location_id IN \"\n \"(SELECT location_id FROM locations_sqllocation WHERE domain=%s)\", [domain_name]\n )\n\n return [\n CustomDeletion('ilsgateway', _delete_ilsgateway_data),\n ModelDeletion('ilsgateway', 'ReportRun', 'domain'),\n ModelDeletion('ilsgateway', 'ILSNotes', 'domain'),\n ModelDeletion('ilsgateway', 'SupervisionDocument', 'domain'),\n ]", "metadata": "root.domain_pre_delete_receiver", "header": "['module', '___EOS___']", "index": 499 }, { "content": "@receiver(location_edited)\ndef location_edited_receiver(sender, loc, moved, **kwargs):\n from custom.ilsgateway.utils import last_location_group\n config = ILSGatewayConfig.for_domain(loc.domain)\n if not config or not config.enabled:\n return\n\n last_run = ReportRun.last_success(loc.domain)\n if not last_run:\n return\n\n if moved:\n PendingReportingDataRecalculation.objects.create(\n domain=loc.domain,\n type='parent_change',\n sql_location=loc.sql_location,\n data={'previous_parent': loc.previous_parents[-1], 'current_parent': loc.parent_id}\n )\n\n group = last_location_group(loc)\n if not loc.sql_location.location_type.administrative and group != loc.metadata['group']:\n PendingReportingDataRecalculation.objects.create(\n domain=loc.domain,\n type='group_change',\n sql_location=loc.sql_location,\n data={'previous_group': group, 'current_group': loc.metadata['group']}\n )", "metadata": "root.location_edited_receiver", "header": "['module', '___EOS___']", "index": 544 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "dispatch_", "._", "dispatcher_", "import_", "receiver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "signals_", "import_", "comm", "care", "\\u", "domain", "\\u", "pre", "\\u", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "locations_", "._", "signals_", "import_", "location", "\\u", "edited", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "ext_", "._", "couchdb", "kit_", "import_", "Document_", ",_", "Boo", "lean", "Property_", ",_", "String", "Property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "stock_", "._", "models_", "import_", "Doc", "Doma", "in", "Mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "locations_", "._", "models_", "import_", "SQL", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "utils_", "._", "utils_", "import_", "add", "\\u", "to", "\\u", "module", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "dates_", "import_", "force", "\\u", "to", "\\u", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L", "68_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L", "78_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L1", "24_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L1", "70_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L1", "70_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "rapid", "sms", "-", "logistic", "s", "/", "blob", "/", "master", "/", "logistic", "s", "/", "ware", "house", "\\u", "model", "s", ".", "py", "#", "L1", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L", "9_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L1", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L", "78_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L", "85_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L", "97_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "model", "s", ".", "py", "#", "L1", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ed", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "dim", "agi", "/", "logistic", "s", "/", "blob", "/", "tz", "-", "master", "/", "logistic", "s", "\\u", "project", "/", "apps", "/", "tan", "zan", "ia", "/", "reporting", "/", "model", "s", ".", "py", "#", "L", "97_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enabled_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "String", "Property_", "(_", "default_", "=_", "\"", "http", "://", "il", "sg", "ate", "way", ".", "com", "/", "api", "/", "v", "0", "\\u", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stead", "y", "\\u", "sync_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "stock", "\\u", "data_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "for", "\\u", "domain_", "(_", "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 ", " _", "mapping_", "=_", "Doc", "Doma", "in", "Mapping_", "._", "objects_", "._", "get_", "(_", "domain", "\\u", "name_", "=_", "name_", ",_", "doc", "\\u", "type_", "=_", "'", "IL", "SG", "ate", "way", "Config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "get_", "(_", "docid", "_", "=_", "mapping_", "._", "doc", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Doc", "Doma", "in", "Mapping_", "._", "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_", "IL", "SG", "ate", "way", "Config_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "configs_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mappings_", "=_", "Doc", "Doma", "in", "Mapping_", "._", "objects_", "._", "filter_", "(_", "doc", "\\u", "type_", "=_", "'", "IL", "SG", "ate", "way", "Config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configs_", "=_", "[_", "cls_", "._", "get_", "(_", "docid", "_", "=_", "mapping_", "._", "doc", "\\u", "id_", ")_", "for_", "mapping_", "in_", "mappings_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\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", "all", "\\u", "enable", "d\\u", "domains_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configs_", "=_", "cls_", "._", "get", "\\u", "all", "\\u", "configs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "c_", "._", "domain_", "for_", "c_", "in_", "filter_", "(_", "lambda_", "config_", ":_", "config_", "._", "enabled_", ",_", "configs_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\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", "all", "\\u", "stead", "y", "\\u", "sync", "\\u", "configs_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "for_", "config_", "in_", "cls_", "._", "get", "\\u", "all", "\\u", "configs_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "._", "stead", "y", "\\u", "sync_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\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_", "is", "\\u", "configured_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "if_", "self_", "._", "enabled_", "and_", "self_", "._", "url_", "and_", "self_", "._", "password_", "and_", "self_", "._", "username_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IL", "SG", "ate", "way", "Config_", "(_", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "IL", "SG", "ate", "way", "Config_", ",_", "self_", ")_", "._", "save_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Doc", "Doma", "in", "Mapping_", "._", "objects_", "._", "get_", "(_", "doc", "\\u", "id_", "=_", "self_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "name_", "=_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "\"", "IL", "SG", "ate", "way", "Config", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Doc", "Doma", "in", "Mapping_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Doc", "Doma", "in", "Mapping_", "._", "objects_", "._", "create_", "(_", "doc", "\\u", "id_", "=_", "self_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "name_", "=_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "IL", "SG", "ate", "way", "Config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "to", "\\u", "module", "\\u", "map_", "(_", "self_", "._", "domain_", ",_", "'", "custom", ".", "il", "sg", "ate", "way", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Suppl", "y", "Point", "Status", "Values_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "RECEIVE", "D_", "=_", "\"", "receive", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NOT", "\\u", "RECEIVE", "D_", "=_", "\"", "not", "\\u", "receive", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SUBMIT", "TED_", "=_", "\"", "submitted", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NOT", "\\u", "SUBMIT", "TED_", "=_", "\"", "not", "\\u", "submitted", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REM", "INDE", "R", "\\u", "SENT", "_", "=_", "\"", "reminder", "\\u", "sent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALERT", "\\u", "SENT", "_", "=_", "\"", "alert", "\\u", "sent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHOICES_", "=_", "[_", "RECEIVE", "D_", ",_", "NOT", "\\u", "RECEIVE", "D_", ",_", "SUBMIT", "TED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NOT", "\\u", "SUBMIT", "TED_", ",_", "REM", "INDE", "R", "\\u", "SENT", "_", ",_", "ALERT", "\\u", "SENT", "_", "]_", "\\u\\u\\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_", "Suppl", "y", "Point", "Status", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DELI", "VERY", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "del", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DELI", "VERY", "\\u", "DISTRI", "CT_", "=_", "\"", "del", "\\u", "dist", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R", "\\u", "AND", "\\u", "R", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "rr", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R", "\\u", "AND", "\\u", "R", "\\u", "DISTRI", "CT_", "=_", "\"", "rr", "\\u", "dist", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SO", "H", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "so", "h", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SUPER", "VISI", "ON", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "super", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOSS", "\\u", "ADJ", "UST", "MENT", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "la", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DELI", "NQ", "UE", "NT", "\\u", "DELI", "VERI", "ES_", "=_", "\"", "del", "\\u", "del", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TRANS", "\\u", "FAC", "ILI", "TY_", "=_", "\"", "trans", "\\u", "fac", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CHOICE", "\\u", "MAP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "DELI", "VERY", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Wait", "ing", " ", "Deliver", "y", " ", "Confirmation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "RECEIVE", "D_", ":_", "\"", "Deliver", "y", " ", "receive", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "NOT", "\\u", "RECEIVE", "D_", ":_", "\"", "Deliver", "y", " ", "Not", " ", "Receive", "d", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DELI", "VERY", "\\u", "DISTRI", "CT_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Wait", "ing", " ", "Deliver", "y", " ", "Confirmation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "RECEIVE", "D_", ":_", "\"", "Deliver", "y", " ", "receive", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "NOT", "\\u", "RECEIVE", "D_", ":_", "\"", "Deliver", "y", " ", "not", " ", "receive", "d", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "R", "\\u", "AND", "\\u", "R", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Wait", "ing", " ", "R", "&", "R", " ", "sent", " ", "confirmation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "SUBMIT", "TED_", ":_", "\"", "R", "&", "R", " ", "Submitte", "d", " ", "Fro", "m", " ", "Faci", "lit", "y", " ", "to", " ", "Distr", "ict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "NOT", "\\u", "SUBMIT", "TED_", ":_", "\"", "R", "&", "R", " ", "Not", " ", "Submitte", "d", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "R", "\\u", "AND", "\\u", "R", "\\u", "DISTRI", "CT_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "R", "&", "R", " ", "Remi", "nder", " ", "Sent", " ", "to", " ", "Distr", "ict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "SUBMIT", "TED_", ":_", "\"", "R", "&", "R", " ", "Submitte", "d", " ", "from", " ", "Distr", "ict", " ", "to", " ", "MS", "D", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SO", "H", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Stock", " ", "on", " ", "hand", " ", "reminder", " ", "sent", " ", "to", " ", "Faci", "lit", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "SUBMIT", "TED_", ":_", "\"", "Stock", " ", "on", " ", "hand", " ", "Submitte", "d", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SUPER", "VISI", "ON", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Supervis", "ion", " ", "Remi", "nder", " ", "Sent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "RECEIVE", "D_", ":_", "\"", "Supervis", "ion", " ", "Receive", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "NOT", "\\u", "RECEIVE", "D_", ":_", "\"", "Supervis", "ion", " ", "Not", " ", "Receive", "d", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LOSS", "\\u", "ADJ", "UST", "MENT", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Lost", "/", "Adjust", "ed", " ", "Remi", "nder", " ", "sent", " ", "to", " ", "Faci", "lit", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DELI", "NQ", "UE", "NT", "\\u", "DELI", "VERI", "ES_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "ALERT", "\\u", "SENT", "_", ":_", "\"", "Del", "inqu", "ent", " ", "deliver", "ies", " ", "summar", "y", " ", "sent", " ", "to", " ", "Distr", "ict", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TRANS", "\\u", "FAC", "ILI", "TY_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "SUBMIT", "TED_", ":_", "\"", "Transfer", " ", "Stock", " ", "Submitte", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "NOT", "\\u", "SUBMIT", "TED_", ":_", "\"", "Transfer", " ", "Stock", " ", "Not", " ", "Submitte", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Values_", "._", "REM", "INDE", "R", "\\u", "SENT", "_", ":_", "\"", "Transfer", " ", "Remi", "nder", " ", "Sent", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Suppl", "y", "Point", "Status", "Types_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "display", "\\u", "name_", "(_", "cls_", ",_", "type_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "CHOICE", "\\u", "MAP_", "[_", "type_", "]_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Suppl", "y", "Point", "Status", "Types_", "(_", "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_", "is", "\\u", "lega", "l\\u", "combination_", "(_", "cls_", ",_", "type_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "in_", "cls_", "._", "CHOICE", "\\u", "MAP_", "and_", "value_", "in_", "cls_", "._", "CHOICE", "\\u", "MAP_", "[_", "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_", "Suppl", "y", "Point", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "choices_", "=_", "(_", "(_", "k_", ",_", "k_", ")_", "for_", "k_", "in_", "Suppl", "y", "Point", "Status", "Types_", "._", "CHOICE", "\\u", "MAP_", "._", "keys_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "value_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "(_", "c_", ",_", "c_", ")_", "for_", "c_", "in_", "Suppl", "y", "Point", "Status", "Values_", "._", "CHOICES_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "default_", "=_", "datetime_", "._", "utcnow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Faci", "lit", "y", " ", "Status", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Faci", "lit", "y", " ", "Status", "es", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "late", "st", "\\u", "by_", "=_", "\"", "status", "\\u", "date", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "(_", "'-", "status", "\\u", "date", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Suppl", "y", "Point", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Suppl", "y", "Point", "Status", "Types_", "._", "is", "\\u", "lega", "l\\u", "combination_", "(_", "self_", "._", "status", "\\u", "type_", ",_", "self_", "._", "status", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"%", "s", " ", "and", " ", "%", "s", " ", "is", " ", "not", " ", "a", " ", "lega", "l", " ", "value", " ", "combinat", "ion", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "status", "\\u", "type_", ",_", "self_", "._", "status", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Suppl", "y", "Point", "Status_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Suppl", "y", "Point", "Status_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "status", "\\u", "type_", ",_", "self_", "._", "status", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Suppl", "y", "Point", "Status_", "(_", "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_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Suppl", "y", "Point", "Status", "Types_", "._", "get", "\\u", "display", "\\u", "name_", "(_", "self_", "._", "status", "\\u", "type_", ",_", "self_", "._", "status", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Deliver", "y", "Group", "Report_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantity_", "=_", "models_", "._", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "report", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "default_", "=_", "datetime_", "._", "utcnow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delivery", "\\u", "group_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "(_", "'-", "report", "\\u", "date", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Report", "ing", "Model_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "model", " ", "to", " ", "encapsulat", "e", " ", "aggre", "gate", " ", "(", "data", " ", "ware", "house", ")", " ", "data", " ", "used", " ", "by", " ", "a", " ", "report", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "#", " ", "viewin", "g", " ", "time", " ", "period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ",_", "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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Model_", "(_", "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 ", " _", "if_", "not_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "update", "\\u", "date_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Report", "ing", "Model_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "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_", "Organiz", "ation", "Summary_", "(_", "Report", "ing", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "orgs", "_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "averag", "e\\u", "lead", "\\u", "time", "\\u", "in", "\\u", "days_", "=_", "models_", "._", "Float", "Field_", "(_", "default_", "=_", "0_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Organiz", "ation", "Summary_", "(_", "Report", "ing", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", ":", " ", "%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "location", "\\u", "id_", ",_", "self_", "._", "date_", "._", "month_", ",_", "self_", "._", "date_", "._", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Group", "Summary_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "War", "eh", "ouse", " ", "data", " ", "relate", "d", " ", "to", " ", "a", " ", "partic", "ular", " ", "category", " ", "of", " ", "reporting", "\\", "10", ";", " ", " ", " ", " ", "(", "e", ".", "g", ".", " ", "stock", " ", "on", " ", "hand", " ", "summar", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org", "\\u", "summary_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "Organiz", "ation", "Summ", "ary", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "#", " ", "SO", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "respond", "ed_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "time_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "#", " ", "\"", "complete", "\"", " ", "=", " ", "submitted", " ", "or", " ", "respond", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ",_", "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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Group", "Summary_", "(_", "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_", "wrap", "\\u", "form", "\\u", "json_", "(_", "cls_", ",_", "obj_", ",_", "location", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "org", "\\u", "summar", "y", "\\u", "id_", "=_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "external", "\\u", "id", "'_", "]_", "=_", "org", "\\u", "summar", "y", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "location", "\\u", "id", "'_", "]_", "=_", "location", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "create", "\\u", "date", "'_", "]_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "create", "\\u", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "update", "\\u", "date", "'_", "]_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "update", "\\u", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "date", "'_", "]_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "[_", "'", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "=_", "Organiz", "ation", "Summary_", "._", "objects_", "._", "get_", "(_", "external", "\\u", "id_", "=_", "org", "\\u", "summar", "y", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Organiz", "ation", "Summary_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", "=_", "Organiz", "ation", "Summary_", "._", "objects_", "._", "create_", "(_", "**_", "obj_", "[_", "'", "org", "\\u", "summar", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "[_", "'", "external", "\\u", "id", "'_", "]_", "=_", "obj_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "obj_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "**_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "late", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "complete_", "-_", "self_", "._", "on", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "not", "\\u", "respond", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "total_", "-_", "self_", "._", "respond", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "delivery", "\\u", "or", "\\u", "supervis", "ion", "\\u", "facility_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "title_", "in_", "[_", "Suppl", "y", "Point", "Status", "Types_", "._", "DELI", "VERY", "\\u", "FAC", "ILI", "TY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Types_", "._", "SUPER", "VISI", "ON", "\\u", "FAC", "ILI", "TY_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "is", "\\u", "delivery", "\\u", "or", "\\u", "supervis", "ion", "\\u", "facility_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "not", "\\u", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "is", "\\u", "delivery", "\\u", "or", "\\u", "supervis", "ion", "\\u", "facility_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "respond", "ed_", "-_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "sup", "\\u", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "title_", "in_", "Suppl", "y", "Point", "Status", "Types_", "._", "SUPER", "VISI", "ON", "\\u", "FAC", "ILI", "TY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "sup", "\\u", "not", "\\u", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "title_", "==_", "Suppl", "y", "Point", "Status", "Types_", "._", "SUPER", "VISI", "ON", "\\u", "FAC", "ILI", "TY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "respond", "ed_", "-_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "del", "\\u", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "title_", "==_", "Suppl", "y", "Point", "Status", "Types_", "._", "DELI", "VERY", "\\u", "FAC", "ILI", "TY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "del", "\\u", "not", "\\u", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "title_", "==_", "Suppl", "y", "Point", "Status", "Types_", "._", "DELI", "VERY", "\\u", "FAC", "ILI", "TY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "respond", "ed_", "-_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "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_", "not", "\\u", "submitted", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "title_", "in_", "[_", "Suppl", "y", "Point", "Status", "Types_", "._", "SO", "H", "\\u", "FAC", "ILI", "TY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suppl", "y", "Point", "Status", "Types_", "._", "R", "\\u", "AND", "\\u", "R", "\\u", "FAC", "ILI", "TY_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "respond", "ed_", "-_", "self_", "._", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "Summary_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", " ", "-", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "org", "\\u", "summary_", ",_", "self_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "Avail", "abilit", "y", "Data_", "(_", "Report", "ing", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "stock_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "out", "\\u", "stock_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "out", "\\u", "data_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "Avail", "abilit", "y", "Data_", "(_", "Report", "ing", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Product", "Avail", "abilit", "y", "Data", "(", "date", "={}", ",", " ", "product", "={}", ",", " ", "total", "={}", ",", " ", "with", "\\u", "stock", "={}", ",", " ", "with", "out", "\\u", "stock", "={}", ",", " ", "'_", "'", "with", "out", "\\u", "data", "={}", ")'_", "._", "format_", "(_", "self_", "._", "date_", ",_", "self_", "._", "product_", ",_", "self_", "._", "total_", ",_", "self_", "._", "with", "\\u", "stock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "with", "out", "\\u", "stock_", ",_", "self_", "._", "with", "out", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "Avail", "abilit", "y", "Dash", "board", "Chart_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "color_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Stock", "ed", " ", "out", "\"_", ":_", "\"#", "a3", "080", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Not", " ", "Stock", "ed", " ", "out", "\"_", ":_", "\"#", "7a", "aa", "7a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "Stock", " ", "Data", "\"_", ":_", "\"#", "ef", "de", "7f", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "900_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div_", "=_", "\"", "product", "\\u", "avail", "abilit", "y", "\\u", "summar", "y", "\\u", "plot", "\\u", "placehold", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "legend", "div_", "=_", "\"", "product", "\\u", "avail", "abilit", "y", "\\u", "summar", "y", "\\u", "legend", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis", "title_", "=_", "\"", "Product", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yax", "isti", "tle_", "=_", "\"", "Faci", "lities", "\"_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Alert_", "(_", "Report", "ing", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "50_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "models_", "._", "Text", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expires_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "are", " ", "three", " ", "delivery", " ", "group", "s", " ", "of", " ", "facilit", "ies", ":", " ", "A", ",", " ", "B", ",", " ", "C", ".", "\\", "10", ";", " ", " ", " ", " ", "Every", " ", "month", " ", "group", "s", " ", "have", " ", "different", " ", "role", "s", " ", "startin", "g", " ", "from", " ", "the", " ", "state", " ", "belo", "w", ".", "\\", "10", ";", " ", " ", " ", " ", "Submit", "ting", " ", "group", ":", " ", "Januar", "y", " ", "=", " ", "A", "\\", "10", ";", " ", " ", " ", " ", "Process", "ing", " ", "group", ":", " ", "Januar", "y", " ", "=", " ", "C", "\\", "10", ";", " ", " ", " ", " ", "Deliver", "ing", " ", "group", ":", " ", "Januar", "y", " ", "=", " ", "B", "\\", "10", ";", " ", " ", " ", " ", "Ne", "xt", " ", "month", " ", "A", " ", "will", " ", "be", " ", "change", "d", " ", "to", " ", "B", ",", " ", "B", " ", "to", " ", "C", " ", "and", " ", "C", " ", "to", " ", "B", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GROUPS", "_", "=_", "(_", "'", "A", "'_", ",_", "'", "B", "'_", ",_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "month_", "=_", "None_", ",_", "fac", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "month_", "=_", "month_", "if_", "month_", "else_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fac", "s_", "=_", "fac", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "\\u", "submit", "ting", "\\u", "group_", "(_", "self_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "month_", "=_", "month_", "if_", "month_", "else_", "self_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "GROUPS", "_", "[_", "(_", "month_", "+_", "2_", ")_", "%_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "\\u", "process", "ing", "\\u", "group_", "(_", "self_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "month_", "=_", "month_", "if_", "month_", "else_", "self_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "current", "\\u", "submit", "ting", "\\u", "group_", "(_", "month_", "=_", "(_", "month_", "+_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "\\u", "deliver", "ing", "\\u", "group_", "(_", "self_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "month_", "=_", "month_", "if_", "month_", "else_", "self_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "current", "\\u", "submit", "ting", "\\u", "group_", "(_", "month_", "=_", "(_", "month_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deliver", "ing_", "(_", "self_", ",_", "fac", "s_", "=_", "None_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fac", "s_", "=_", "self_", "._", "fac", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "filter_", "(_", "lambda_", "f_", ":_", "self_", "._", "current", "\\u", "deliver", "ing", "\\u", "group_", "(_", "month_", ")_", "==_", "f_", "._", "metadata_", "._", "get_", "(_", "'", "group", "'_", ",_", "None_", ")_", ",_", "fac", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "processing_", "(_", "self_", ",_", "fac", "s_", "=_", "None_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fac", "s_", "=_", "self_", "._", "fac", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "filter_", "(_", "lambda_", "f_", ":_", "self_", "._", "current", "\\u", "process", "ing", "\\u", "group_", "(_", "month_", ")_", "==_", "f_", "._", "metadata_", "._", "get_", "(_", "'", "group", "'_", ",_", "None_", ")_", ",_", "fac", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deliver", "y", "Groups_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "submit", "ting_", "(_", "self_", ",_", "fac", "s_", "=_", "None_", ",_", "month_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fac", "s_", "=_", "self_", "._", "fac", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fac", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "filter_", "(_", "lambda_", "f_", ":_", "self_", "._", "current", "\\u", "submit", "ting", "\\u", "group_", "(_", "month_", ")_", "==_", "f_", "._", "metadata_", "._", "get_", "(_", "'", "group", "'_", ",_", "None_", ")_", ",_", "fac", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Report", "Run_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Log", " ", "of", " ", "whe", "neve", "r", " ", "the", " ", "ware", "house", " ", "model", "s", " ", "get", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "#", " ", "the", " ", "start", " ", "of", " ", "the", " ", "period", " ", "covered", " ", "(", "from", " ", "a", " ", "data", " ", "perspective", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "#", " ", "the", " ", "end", " ", "of", " ", "the", " ", "period", " ", "covered", " ", "(", "from", " ", "a", " ", "data", " ", "perspective", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "run_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "#", " ", "whe", "n", " ", "this", " ", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "run_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ")_", "#", " ", "whe", "n", " ", "this", " ", "finished_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "error_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "SQL", "Location_", ",_", "null_", "=_", "True_", ",_", "on", "\\u", "delete_", "=_", "models_", "._", "PROTECT_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Report", "Run_", "(_", "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_", "last", "\\u", "success_", "(_", "cls_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "last", " ", "success", "ful", " ", "executi", "on", " ", "of", " ", "a", " ", "report", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "record", "s", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "complete_", "=_", "True_", ",_", "has", "\\u", "error_", "=_", "False_", ",_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "order", "\\u", "by_", "(_", "\"-", "start", "\\u", "run", "\"_", ")_", "[_", "0_", "]_", "if_", "qs_", "._", "count_", "(_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Run_", "(_", "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_", "last", "\\u", "run_", "(_", "cls_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "cls_", "._", "objects_", "._", "filter_", "(_", "complete_", "=_", "True_", ",_", "domain_", "=_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "order", "\\u", "by_", "(_", "\"-", "start", "\\u", "run", "\"_", ")_", "[_", "0_", "]_", "if_", "qs_", "._", "count_", "(_", ")_", "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_", "Requ", "isi", "tion", "Report_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location", "\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submitted", "_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "report", "\\u", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "default_", "=_", "datetime_", "._", "utcnow_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Supervis", "ion", "Document_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "document_", "=_", "models_", "._", "Text", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "IL", "SN", "otes", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "SQL", "Location_", ",_", "on", "\\u", "delete_", "=_", "models_", "._", "PROTECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ",_", "null_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "role_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "phone_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "20_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "models_", "._", "Text", "Field_", "(_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Pend", "ing", "Report", "ing", "Data", "Recal", "cula", "tion_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql", "\\u", "location_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "SQL", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json", "\\u", "field_", "._", "JSO", "NF", "ield_", "(_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "SLA", "BC", "onfig_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "pilot", "_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql", "\\u", "location_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "SQL", "Location_", ",_", "null_", "=_", "False_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closest", "\\u", "supply", "\\u", "points_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "SQL", "Location_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "One", "Off", "Task", "Progress_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "synced", "\\u", "object\\u", "id_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "=_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\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_", "=_", "'", "il", "sg", "ate", "way", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "receiver_", "(_", "comm", "care", "\\u", "domain", "\\u", "pre", "\\u", "delete_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "domain", "\\u", "pre", "\\u", "delete", "\\u", "receiver_", "(_", "domain_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "deletion_", "import_", "Model", "Deletion", "_", ",_", "Custom", "Deletion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "delete", "\\u", "il", "sg", "ate", "way", "\\u", "data_", "(_", "domain", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location", "s", "\\u", "ids_", "=_", "SQL", "Location_", "._", "objects_", "._", "filter_", "(_", "domain_", "=_", "domain", "\\u", "name_", ")_", "._", "values", "\\u", "list_", "(_", "'", "location", "\\u", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "location", "s", "\\u", "ids_", ":_", "\\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_", "Deliver", "y", "Group", "Report_", "._", "objects_", "._", "filter_", "(_", "location", "\\u", "id", "\\u\\u", "in_", "=_", "location", "s", "\\u", "ids_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "connection_", "._", "cursor_", "(_", ")_", "as_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DELET", "E", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "alert", " ", "WHE", "RE", " ", "location", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "location", "\\u", "id", " ", "FROM", " ", "location", "s", "\\u", "sql", "location", " ", "WHE", "RE", " ", "domain", "=", "%", "s", ")\"_", ",_", "[_", "domain", "\\u", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DELET", "E", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "group", "summar", "y", " ", "WHE", "RE", " ", "org", "\\u", "summar", "y", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "id", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "organization", "summar", "y", " ", "WHE", "RE", " ", "location", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "location", "\\u", "id", " ", "FROM", " ", "location", "s", "\\u", "sql", "location", " ", "WHE", "RE", " ", "domain", "=", "%", "s", "))\"_", ",_", "[_", "domain", "\\u", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DELET", "E", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "organization", "summar", "y", " ", "WHE", "RE", " ", "location", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "location", "\\u", "id", " ", "FROM", " ", "location", "s", "\\u", "sql", "location", " ", "WHE", "RE", " ", "domain", "=", "%", "s", ")\"_", ",_", "[_", "domain", "\\u", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DELET", "E", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "product", "avail", "abilit", "yda", "ta", " ", "WHE", "RE", " ", "location", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "location", "\\u", "id", " ", "FROM", " ", "location", "s", "\\u", "sql", "location", " ", "WHE", "RE", " ", "domain", "=", "%", "s", ")\"_", ",_", "[_", "domain", "\\u", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DELET", "E", " ", "FROM", " ", "il", "sg", "ate", "way", "\\u", "supply", "points", "tat", "us", " ", "WHE", "RE", " ", "location", "\\u", "id", " ", "IN", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "SELECT", " ", "location", "\\u", "id", " ", "FROM", " ", "location", "s", "\\u", "sql", "location", " ", "WHE", "RE", " ", "domain", "=", "%", "s", ")\"_", ",_", "[_", "domain", "\\u", "name_", "]_", "\\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_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Deletion", "_", "(_", "'", "il", "sg", "ate", "way", "'_", ",_", "\\u", "delete", "\\u", "il", "sg", "ate", "way", "\\u", "data_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Deletion", "_", "(_", "'", "il", "sg", "ate", "way", "'_", ",_", "'", "Report", "Run", "'_", ",_", "'", "domain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Deletion", "_", "(_", "'", "il", "sg", "ate", "way", "'_", ",_", "'", "IL", "SN", "otes", "'_", ",_", "'", "domain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Deletion", "_", "(_", "'", "il", "sg", "ate", "way", "'_", ",_", "'", "Supervis", "ion", "Document", "'_", ",_", "'", "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_", "@_", "receiver_", "(_", "location", "\\u", "edited", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "location", "\\u", "edited", "\\u", "receiver_", "(_", "sender_", ",_", "loc_", ",_", "moved_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "custom_", "._", "il", "sg", "ate", "way_", "._", "utils_", "import_", "last", "\\u", "location", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "IL", "SG", "ate", "way", "Config_", "._", "for", "\\u", "domain_", "(_", "loc_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "config_", "or_", "not_", "config_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "run_", "=_", "Report", "Run_", "._", "last", "\\u", "success_", "(_", "loc_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "last", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "moved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pend", "ing", "Report", "ing", "Data", "Recal", "cula", "tion_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "loc_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "parent", "\\u", "change", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "location_", "=_", "loc_", "._", "sql", "\\u", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "'", "previ", "ous", "\\u", "parent", "'_", ":_", "loc_", "._", "previ", "ous", "\\u", "parents_", "[_", "-_", "1_", "]_", ",_", "'", "current", "\\u", "parent", "'_", ":_", "loc_", "._", "parent", "\\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_", "group_", "=_", "last", "\\u", "location", "\\u", "group_", "(_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "loc_", "._", "sql", "\\u", "location_", "._", "location", "\\u", "type_", "._", "administrati", "ve_", "and_", "group_", "!=_", "loc_", "._", "metadata_", "[_", "'", "group", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pend", "ing", "Report", "ing", "Data", "Recal", "cula", "tion_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "loc_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "group", "\\u", "change", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "location_", "=_", "loc_", "._", "sql", "\\u", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "'", "previ", "ous", "\\u", "group", "'_", ":_", "group_", ",_", "'", "current", "\\u", "group", "'_", ":_", "loc_", "._", "metadata_", "[_", "'", "group", "'_", "]_", "}_", "\\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,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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 ]
Testing equality to None
fdb/choicewords/choicewords.py
[ { "content": "def parse_phrase_book(fname):\n phrases = []\n current_phrase = None\n for line_number, line in enumerate(open(fname).readlines()):\n line = line.strip()\n if line.startswith('#'):\n # Ignore lines with comments.\n continue\n elif len(line) == 0:\n # Empty lines reset the phrase.\n current_phrase = None\n elif line.startswith('- '):\n # Phrases are prefixed with \"- \".\n if current_phrase is None:\n raise ValueError(\"%s: line without a key.\" % line_number)\n else:\n current_phrase['values'].append(line[2:].strip())\n elif line.endswith(':'):\n # Keys end with \":\"\n current_phrase = {'key': line[:-1], 'values': []}\n phrases.append(current_phrase)\n else:\n raise ValueError('%s: do not know what to do with line \"%s\".' % (line_number, line))\n phrase_book = {}\n for phrase in phrases:\n phrase_book[phrase['key']] = phrase['values']\n return phrase_book", "metadata": "root.parse_phrase_book", "header": "['module', '___EOS___']", "index": 74 } ]
[]
[]
0
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_", "parse", "\\u", "phrase", "\\u", "book_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phrases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "phrase_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line", "\\u", "number_", ",_", "line_", "in_", "enumerate_", "(_", "open_", "(_", "fname_", ")_", "._", "readlines_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "lines", " ", "with", " ", "comment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "line_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Emp", "ty", " ", "lines", " ", "reset", " ", "the", " ", "phrase", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "phrase_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'-", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Phrase", "s", " ", "are", " ", "prefixed", " ", "with", " ", "\"-", " ", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "current", "\\u", "phrase_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"%", "s", ":", " ", "line", " ", "with", "out", " ", "a", " ", "key", ".\"_", "%_", "line", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "phrase_", "[_", "'", "values", "'_", "]_", "._", "append_", "(_", "line_", "[_", "2_", ":_", "]_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "endswith_", "(_", "':'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Keys", " ", "end", " ", "with", " ", "\":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "phrase_", "=_", "{_", "'", "key", "'_", ":_", "line_", "[_", ":_", "-_", "1_", "]_", ",_", "'", "values", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phrases_", "._", "append_", "(_", "current", "\\u", "phrase_", ")_", "\\u\\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_", "(_", "'%", "s", ":", " ", "do", " ", "not", " ", "know", " ", "what", " ", "to", " ", "do", " ", "with", " ", "line", " ", "\"%", "s", "\".'_", "%_", "(_", "line", "\\u", "number_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "phrase", "\\u", "book_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "phrase_", "in_", "phrases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phrase", "\\u", "book_", "[_", "phrase_", "[_", "'", "key", "'_", "]_", "]_", "=_", "phrase_", "[_", "'", "values", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "phrase", "\\u", "book_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
saltstack/salt/tests/unit/modules/pecl_test.py
[ { "content": " def test_install(self):\n '''\n Test to installs one or several pecl extensions.\n '''\n with patch.object(pecl, '_pecl', return_value='A'):\n self.assertEqual(pecl.install('fuse', force=True), 'A')\n\n self.assertFalse(pecl.install('fuse'))\n\n with patch.object(pecl, 'list_', return_value={'A': ['A', 'B']}):\n self.assertTrue(pecl.install(['A', 'B']))", "metadata": "root.PeclTestCase.test_install", "header": "['class', 'PeclTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 29 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pe", "cl", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "install_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "to", " ", "install", "s", " ", "one", " ", "or", " ", "sever", "al", " ", "pec", "l", " ", "extensi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "pec", "l_", ",_", "'\\u", "pec", "l", "'_", ",_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "pec", "l_", "._", "install_", "(_", "'", "fuse", "'_", ",_", "force_", "=_", "True_", ")_", ",_", "'", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "pec", "l_", "._", "install_", "(_", "'", "fuse", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "pec", "l_", ",_", "'", "list", "\\u'_", ",_", "return", "\\u", "value_", "=_", "{_", "'", "A", "'_", ":_", "[_", "'", "A", "'_", ",_", "'", "B", "'_", "]_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "pec", "l_", "._", "install_", "(_", "[_", "'", "A", "'_", ",_", "'", "B", "'_", "]_", ")_", ")_", "\\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 ]
Except block handles 'BaseException'
timvideos/streaming-system/website/website/settings.py
[ { "content": "# Django settings for streamtime project.\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n # ('Your Name', 'your_email@example.com'),\n)\n\nMANAGERS = ADMINS\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.\n 'NAME': 'db/website.sqlite3', # Or path to database file if using sqlite3.\n 'USER': '', # Not used with sqlite3.\n 'PASSWORD': '', # Not used with sqlite3.\n 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.\n 'PORT': '', # Set to empty string for default. Not used with sqlite3.\n }\n}\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# On Unix systems, a value of None will cause Django to use the same\n# timezone as the operating system.\n# If running in a Windows environment this must be set to the same as your\n# system time zone.\nTIME_ZONE = 'Australia/Sydney'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\nSITE_ID = 1\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# If you set this to False, Django will not format dates, numbers and\n# calendars according to the current locale\nUSE_L10N = True\n\n# Absolute filesystem path to the directory that will hold user-uploaded files.\n# Example: \"/home/media/media.lawrence.com/media/\"\nMEDIA_ROOT = ''\n\n# URL that handles the media served from MEDIA_ROOT. Make sure to use a\n# trailing slash.\n# Examples: \"http://media.lawrence.com/media/\", \"http://example.com/media/\"\nMEDIA_URL = '/media/'\n\n# Absolute path to the directory static files should be collected to.\n# Don't put anything in this directory yourself; store your static files\n# in apps' \"static/\" subdirectories and in STATICFILES_DIRS.\n# Example: \"/home/media/media.lawrence.com/static/\"\nSTATIC_ROOT = ''\n\n# URL prefix for static files.\n# Example: \"http://media.lawrence.com/static/\"\nSTATIC_URL = '/static/'\n\n# Additional locations of static files\nSTATICFILES_DIRS = (\n # Put strings here, like \"/home/html/static\" or \"C:/www/django/static\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)\n\n# List of finder classes that know how to find static files in\n# various locations.\nSTATICFILES_FINDERS = (\n 'django.contrib.staticfiles.finders.FileSystemFinder',\n 'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n# 'django.contrib.staticfiles.finders.DefaultStorageFinder',\n)\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = ')6wvm#5!^&z@ivqu2thiw%sg^*)ep5^p!1umkx44z$p_ll8)i0'\n\n# List of callables that know how to import templates from various sources.\nTEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n# 'django.template.loaders.eggs.Loader',\n)\n\nTEMPLATE_CONTEXT_PROCESSORS = [\n \"django.contrib.auth.context_processors.auth\",\n \"django.core.context_processors.debug\",\n \"django.core.context_processors.i18n\",\n \"django.core.context_processors.media\",\n \"django.core.context_processors.static\",\n \"django.core.context_processors.tz\",\n \"django.contrib.messages.context_processors.messages\",\n]\n\nMIDDLEWARE_CLASSES = [\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n# 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n]\n\nif DEBUG:\n MIDDLEWARE_CLASSES += [\n 'website.middleware.SetHttpRealIp',\n ]\n\nROOT_URLCONF = 'website.urls'\n\nTEMPLATE_DIRS = (\n # Put strings here, like \"/home/html/django_templates\" or \"C:/www/django/templates\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)\n\nOUR_APPS = (\n 'frontend',\n 'tracker',\n)\n\nINSTALLED_APPS = OUR_APPS + (\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n 'django.contrib.admin',\n 'django.contrib.admindocs',\n 'switter',\n)\n\n# A sample logging configuration. The only tangible logging\n# performed by this configuration is to send an email to\n# the site admins on every HTTP 500 error.\n# See http://docs.djangoproject.com/en/dev/topics/logging for\n# more details on how to customize your logging configuration.\nLOGGING = {\n 'version': 1,\n 'disable_existing_loggers': False,\n 'handlers': {\n 'mail_admins': {\n 'level': 'ERROR',\n 'class': 'django.utils.log.AdminEmailHandler'\n },\n 'null': {\n 'level': 'DEBUG',\n 'class': 'django.utils.log.NullHandler',\n },\n 'console': {\n 'level': 'DEBUG',\n 'class': 'logging.StreamHandler',\n },\n },\n 'loggers': {\n 'django.request': {\n 'handlers': ['mail_admins'],\n 'level': 'ERROR',\n 'propagate': True,\n },\n '': {\n 'handlers': ['console'],\n 'level': 'DEBUG',\n 'filters': [],\n },\n },\n}\n\n# This is the field that is used to check the remote IP of a user.\n# - Set to 'REMOTE_ADDR' if you want to use the IP of the host you're\n# connecting from.\n# - Set to 'HTTP_X_FORWARDED_FOR' if you have a reverse proxy.\n#\nHTTP_REMOTE_ADDR_META = 'REMOTE_ADDR'\n\ntry:\n from private.settings import *\nexcept ImportError:\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "settings", " ", "for", " ", "stream", "time", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DEBUG_", "=_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ADMINS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "You", "r", " ", "Name", "',", " ", "'", "your", "\\u", "email", "@", "example", ".", "com", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MANAGER", "S_", "=_", "ADMINS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DATABASES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "'_", ",_", "#", " ", "Add", " ", "'", "postgres", "ql", "\\u", "psy", "cop", "g2", "',", " ", "'", "postgres", "ql", "',", " ", "'", "mysql", "',", " ", "'", "sql", "ite", "3", "'", " ", "or", " ", "'", "oracle", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "db", "/", "webs", "ite", ".", "sql", "ite", "3", "'_", ",_", "#", " ", "Or", " ", "path", " ", "to", " ", "databa", "se", " ", "file", " ", "if", " ", "usi", "ng", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "USER", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PASS", "WORD", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOST", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "local", "host", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PORT", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "default", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "time", " ", "zone", " ", "for", " ", "this", " ", "installation", ".", " ", "Choi", "ces", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "List", "\\u", "of", "\\u", "tz", "\\u", "zone", "s", "\\u", "by", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alth", "ou", "gh", " ", "not", " ", "all", " ", "choice", "s", " ", "may", " ", "be", " ", "avail", "able", " ", "on", " ", "all", " ", "operati", "ng", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "Uni", "x", " ", "system", "s", ",", " ", "a", " ", "value", " ", "of", " ", "Non", "e", " ", "will", " ", "caus", "e", " ", "Dj", "ang", "o", " ", "to", " ", "use", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "timezon", "e", " ", "as", " ", "the", " ", "operati", "ng", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "runn", "ing", " ", "in", " ", "a", " ", "Window", "s", " ", "environ", "ment", " ", "this", " ", "must", " ", "be", " ", "set", " ", "to", " ", "the", " ", "same", " ", "as", " ", "your", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", " ", "time", " ", "zone", "._", "\\u\\u\\uNL\\u\\u\\u_", "TIME", "\\u", "ZONE_", "=_", "'", "Aust", "ral", "ia", "/", "Sy", "dne", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "code", " ", "for", " ", "this", " ", "installation", ".", " ", "All", " ", "choice", "s", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "i18n", "guy", ".", "com", "/", "unicode", "/", "language", "-", "identifi", "ers", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "LANGUAGE", "\\u", "CODE_", "=_", "'", "en", "-", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SITE", "\\u", "ID_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "make", " ", "some", " ", "optimization", "s", " ", "so", " ", "as", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "load", " ", "the", " ", "international", "izatio", "n", " ", "machine", "ry", "._", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "I1", "8", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "not", " ", "format", " ", "dates", ",", " ", "numbers", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calendar", "s", " ", "according", " ", "to", " ", "the", " ", "current", " ", "locale_", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "L1", "0", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abs", "olute", " ", "filesystem", " ", "path", " ", "to", " ", "the", " ", "director", "y", " ", "tha", "t", " ", "will", " ", "hold", " ", "user", "-", "uploade", "d", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "\"/", "home", "/", "media", "/", "media", ".", "law", "ren", "ce", ".", "com", "/", "media", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "ROOT_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "tha", "t", " ", "handle", "s", " ", "the", " ", "media", " ", "serve", "d", " ", "from", " ", "MEDIA", "\\u", "ROO", "T", ".", " ", "Make", " ", "sure", " ", "to", " ", "use", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trail", "ing", " ", "slash", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":", " ", "\"", "http", "://", "media", ".", "law", "ren", "ce", ".", "com", "/", "media", "/\"", ",", " ", "\"", "http", "://", "example", ".", "com", "/", "media", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "URL_", "=_", "'/", "media", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abs", "olute", " ", "path", " ", "to", " ", "the", " ", "director", "y", " ", "static", " ", "files", " ", "shou", "ld", " ", "be", " ", "collected", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "put", " ", "anyt", "hing", " ", "in", " ", "this", " ", "director", "y", " ", "your", "self", ";", " ", "store", " ", "your", " ", "static", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "apps", "'", " ", "\"", "static", "/\"", " ", "subdir", "ector", "ies", " ", "and", " ", "in", " ", "STATI", "CF", "ILE", "S", "\\u", "DIR", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "\"/", "home", "/", "media", "/", "media", ".", "law", "ren", "ce", ".", "com", "/", "static", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "STATI", "C", "\\u", "ROOT_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "prefix", " ", "for", " ", "static", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "\"", "http", "://", "media", ".", "law", "ren", "ce", ".", "com", "/", "static", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "STATI", "C", "\\u", "URL_", "=_", "'/", "static", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "location", "s", " ", "of", " ", "static", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "STATI", "CF", "ILE", "S", "\\u", "DIRS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "string", "s", " ", "here", ",", " ", "like", " ", "\"/", "home", "/", "html", "/", "static", "\"", " ", "or", " ", "\"", "C", ":/", "www", "/", "django", "/", "static", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "use", " ", "forward", " ", "slash", "es", ",", " ", "even", " ", "on", " ", "Window", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "forget", " ", "to", " ", "use", " ", "abs", "olute", " ", "path", "s", ",", " ", "not", " ", "relative", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "finde", "r", " ", "classe", "s", " ", "tha", "t", " ", "know", " ", "how", " ", "to", " ", "find", " ", "static", " ", "files", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vari", "ous", " ", "location", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "STATI", "CF", "ILE", "S", "\\u", "FIND", "ERS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", ".", "finde", "rs", ".", "File", "System", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", ".", "finde", "rs", ".", "App", "Director", "ies", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "django", ".", "contrib", ".", "static", "files", ".", "finde", "rs", ".", "Default", "Stor", "age", "Fin", "der", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "unique", ",", " ", "and", " ", "don", "'", "t", " ", "share", " ", "it", " ", "with", " ", "any", "body", "._", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "')", "6", "wv", "m", "#", "5", "!", "^", "&", "z", "@", "iv", "qu", "2t", "hi", "w", "%", "sg", "^", "*)", "ep", "5", "^", "p", "!", "1", "um", "kx", "4", "4", "z", "$", "p", "\\u", "ll", "8", ")", "i", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "calla", "bles", " ", "tha", "t", " ", "know", " ", "how", " ", "to", " ", "import", " ", "template", "s", " ", "from", " ", "vari", "ous", " ", "source", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "LOADER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "filesystem", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "app", "\\u", "director", "ies", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "django", ".", "template", ".", "load", "ers", ".", "egg", "s", ".", "Load", "er", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "CONTE", "XT", "\\u", "PROCESSOR", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "contrib", ".", "auth", ".", "context", "\\u", "process", "ors", ".", "auth", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "debug", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "i18n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "media", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "static", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "tz", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "contrib", ".", "message", "s", ".", "context", "\\u", "process", "ors", ".", "message", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "common", ".", "Common", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", ".", "middle", "ware", ".", "Sess", "ion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "django", ".", "middle", "ware", ".", "csr", "f", ".", "Cs", "rf", "View", "Mid", "dle", "ware", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "middle", "ware", ".", "Auth", "entica", "tion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "message", "s", ".", "middle", "ware", ".", "Messag", "e", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MIDDLE", "WARE", "\\u", "CLASSES_", "+=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webs", "ite", ".", "middle", "ware", ".", "Set", "Http", "Real", "Ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "webs", "ite", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "string", "s", " ", "here", ",", " ", "like", " ", "\"/", "home", "/", "html", "/", "django", "\\u", "template", "s", "\"", " ", "or", " ", "\"", "C", ":/", "www", "/", "django", "/", "template", "s", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "use", " ", "forward", " ", "slash", "es", ",", " ", "even", " ", "on", " ", "Window", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "forget", " ", "to", " ", "use", " ", "abs", "olute", " ", "path", "s", ",", " ", "not", " ", "relative", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OUR", "\\u", "APPS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "front", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "APPS_", "=_", "OUR", "\\u", "APPS_", "+_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "contenttype", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "sites", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "message", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "admin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "admin", "docs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "swi", "tter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "sample", " ", "logg", "ing", " ", "configura", "tion", ".", " ", "The", " ", "only", " ", "tang", "ibl", "e", " ", "logging_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "ed", " ", "by", " ", "this", " ", "configura", "tion", " ", "is", " ", "to", " ", "send", " ", "an", " ", "email", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "site", " ", "admin", "s", " ", "on", " ", "every", " ", "HTTP", " ", "500", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "docs", ".", "django", "project", ".", "com", "/", "en", "/", "dev", "/", "topic", "s", "/", "logg", "ing", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "more", " ", "deta", "il", "s", " ", "on", " ", "how", " ", "to", " ", "customize", " ", "your", " ", "logg", "ing", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "LOGGING_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disable", "\\u", "exist", "ing", "\\u", "logg", "ers", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "handler", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "\\u", "admin", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "'", "ERROR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", "'_", ":_", "'", "django", ".", "util", "s", ".", "log", ".", "Admi", "n", "Ema", "il", "Handle", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "null", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "'", "DEBU", "G", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", "'_", ":_", "'", "django", ".", "util", "s", ".", "log", ".", "Null", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "console", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "'", "DEBU", "G", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", "'_", ":_", "'", "logg", "ing", ".", "Stream", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logg", "ers", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "request", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "handler", "s", "'_", ":_", "[_", "'", "mail", "\\u", "admin", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "'", "ERROR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "propagate", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "handler", "s", "'_", ":_", "[_", "'", "console", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "'", "DEBU", "G", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "field", " ", "tha", "t", " ", "is", " ", "used", " ", "to", " ", "check", " ", "the", " ", "remote", " ", "IP", " ", "of", " ", "a", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "Set", " ", "to", " ", "'", "REMO", "TE", "\\u", "ADDR", "'", " ", "if", " ", "you", " ", "want", " ", "to", " ", "use", " ", "the", " ", "IP", " ", "of", " ", "the", " ", "host", " ", "you", "'", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "connecti", "ng", " ", "from", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "Set", " ", "to", " ", "'", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", "'", " ", "if", " ", "you", " ", "have", " ", "a", " ", "reverse", " ", "proxy", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "\\u", "REMO", "TE", "\\u", "ADDR", "\\u", "META_", "=_", "'", "REMO", "TE", "\\u", "ADDR", "'_", "\\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_", "private_", "._", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Comparison of constants
rspivak/slimit/src/slimit/visitors/scopevisitor.py
[ { "content": " @staticmethod\n def _fill_scope_refs(name, scope):\n \"\"\"Put referenced name in 'ref' dictionary of a scope.\n\n Walks up the scope tree and adds the name to 'ref' of every scope\n up in the tree until a scope that defines referenced name is reached.\n \"\"\"\n symbol = scope.resolve(name)\n if symbol is None:\n return\n\n orig_scope = symbol.scope\n scope.refs[name] = orig_scope\n while scope is not orig_scope:\n scope = scope.get_enclosing_scope()\n scope.refs[name] = orig_scope", "metadata": "root.RefVisitor._fill_scope_refs", "header": "['class', 'RefVisitor', '(', 'Visitor', ')', ':', '___EOS___']", "index": 121 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Ref", "Visitor_", "(_", "Visitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "fill", "\\u", "scope", "\\u", "refs_", "(_", "name_", ",_", "scope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Put", " ", "referenced", " ", "name", " ", "in", " ", "'", "ref", "'", " ", "dictionar", "y", " ", "of", " ", "a", " ", "scope", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Walk", "s", " ", "up", " ", "the", " ", "scope", " ", "tree", " ", "and", " ", "adds", " ", "the", " ", "name", " ", "to", " ", "'", "ref", "'", " ", "of", " ", "every", " ", "scope", "\\", "10", ";", " ", " ", " ", " ", "up", " ", "in", " ", "the", " ", "tree", " ", "unti", "l", " ", "a", " ", "scope", " ", "tha", "t", " ", "defin", "es", " ", "referenced", " ", "name", " ", "is", " ", "reache", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", "=_", "scope_", "._", "resolve_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "symbol_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "scope_", "=_", "symbol_", "._", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope_", "._", "refs_", "[_", "name_", "]_", "=_", "orig", "\\u", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "scope_", "is_", "not_", "orig", "\\u", "scope_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scope_", "=_", "scope_", "._", "get", "\\u", "encl", "osin", "g", "\\u", "scope_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope_", "._", "refs_", "[_", "name_", "]_", "=_", "orig", "\\u", "scope_", "\\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 ]
Unused import
twisted/txmongo/tests/test_queries.py
[ { "content": "# coding: utf-8\n# Copyright 2010 Mark L.\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 absolute_import, division\n\nfrom bson import BSON, ObjectId\nfrom bson.son import SON\nfrom pymongo.errors import OperationFailure, WriteError, BulkWriteError, \\\n DuplicateKeyError\nfrom pymongo.results import InsertOneResult, InsertManyResult, UpdateResult, \\\n DeleteResult\nfrom pymongo.collection import ReturnDocument\nfrom pymongo.write_concern import WriteConcern\nfrom twisted.internet import defer\nfrom twisted.trial import unittest\nimport txmongo\nfrom txmongo.protocol import MongoClientProtocol\nimport txmongo.filter as qf\n\nmongo_host = \"localhost\"\nmongo_port = 27017\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class _CallCounter(object):\n", "metadata": "root._CallCounter", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def __init__(self, original):\n self.call_count = 0\n self.original = original", "metadata": "root._CallCounter.__init__", "header": "['class', '_CallCounter', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def __call__(self, this, *args, **kwargs):\n self.call_count += 1\n return self.original(this, *args, **kwargs)", "metadata": "root._CallCounter.__call__", "header": "['class', '_CallCounter', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": "class _SingleCollectionTest(unittest.TestCase):\n\n", "metadata": "root._SingleCollectionTest", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def setUp(self):\n self.conn = txmongo.MongoConnection(mongo_host, mongo_port)\n self.db = self.conn.mydb\n self.coll = self.db.mycol", "metadata": "root._SingleCollectionTest.setUp", "header": "['class', '_SingleCollectionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " @defer.inlineCallbacks\n def tearDown(self):\n yield self.coll.drop()\n yield self.conn.disconnect()", "metadata": "root._SingleCollectionTest.tearDown", "header": "['class', '_SingleCollectionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": "class TestMongoQueries(_SingleCollectionTest):\n\n timeout = 15\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestMongoQueries", "header": "['module', '___EOS___']", "index": 58 }, { "content": " @defer.inlineCallbacks\n def test_SingleCursorIteration(self):\n yield self.coll.insert([{'v': i} for i in range(10)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 10)", "metadata": "root.TestMongoQueries.test_SingleCursorIteration", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 62 }, { "content": " @defer.inlineCallbacks\n def test_MultipleCursorIterations(self):\n yield self.coll.insert([{'v': i} for i in range(450)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 450)", "metadata": "root.TestMongoQueries.test_MultipleCursorIterations", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 68 }, { "content": " @defer.inlineCallbacks\n def test_FindWithCursor(self):\n yield self.coll.insert([{'v': i} for i in range(750)], safe=True)\n docs, d = yield self.coll.find_with_cursor()\n self.assertEqual(len(docs), 101)\n total = 0\n while docs:\n total += len(docs)\n docs, d = yield d\n self.assertEqual(total, 750)\n\n # Same thing, but with the \"cursor\" keyword argument on find()\n docs, d = yield self.coll.find(cursor=True)\n self.assertEqual(len(docs), 101)\n total = 0\n while docs:\n total += len(docs)\n docs, d = yield d\n self.assertEqual(total, 750)", "metadata": "root.TestMongoQueries.test_FindWithCursor", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 74 }, { "content": " @defer.inlineCallbacks\n def test_FindWithCursorLimit(self):\n yield self.coll.insert([{'v': i} for i in range(750)], safe=True)\n\n docs, d = yield self.coll.find_with_cursor(limit=150)\n total = 0\n while docs:\n total += len(docs)\n docs, d = yield d\n self.assertEqual(total, 150)\n\n # Same using find(cursor=True)\n docs, d = yield self.coll.find(limit=150, cursor=True)\n total = 0\n while docs:\n total += len(docs)\n docs, d = yield d\n self.assertEqual(total, 150)", "metadata": "root.TestMongoQueries.test_FindWithCursorLimit", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 94 }, { "content": " @defer.inlineCallbacks\n def test_LargeData(self):\n yield self.coll.insert([{'v': ' '*(2**19)} for _ in range(4)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 4)", "metadata": "root.TestMongoQueries.test_LargeData", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 113 }, { "content": " @defer.inlineCallbacks\n def test_SpecifiedFields(self):\n yield self.coll.insert([dict((k, v) for k in \"abcdefg\") for v in range(5)], safe=True)\n res = yield self.coll.find(fields={'a': 1, 'c': 1})\n yield self.coll.count(fields={'a': 1, 'c': 1})\n self.assertTrue(all(x in ['a', 'c', \"_id\"] for x in res[0].keys()))\n res = yield self.coll.find(fields=['a', 'c'])\n yield self.coll.count(fields=['a', 'c'])\n self.assertTrue(all(x in ['a', 'c', \"_id\"] for x in res[0].keys()))\n res = yield self.coll.find(fields=[])\n yield self.coll.count(fields=[])\n self.assertTrue(all(x in [\"_id\"] for x in res[0].keys()))\n yield self.assertFailure(self.coll.find({}, fields=[1]), TypeError)", "metadata": "root.TestMongoQueries.test_SpecifiedFields", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 119 }, { "content": " @defer.inlineCallbacks\n def test_group(self):\n yield self.coll.insert([{'v': i % 2} for i in range(5)], safe=True)\n reduce_ = \"\"\"\n function(curr, result) {\n result.total += curr.v;\n }\n \"\"\"\n keys = {'v': 1}\n initial = {\"total\": 0}\n cond = {'v': {\"$in\": [0, 1]}}\n final = \"\"\"\n function(result) {\n result.five = 5;\n }\n \"\"\"\n res = yield self.coll.group(keys, initial, reduce_, cond, final)\n self.assertEqual(len(res[\"retval\"]), 2)\n\n keys = \"\"\"\n function(doc) {\n return {\"value\": 5, 'v': 1};\n }\n \"\"\"\n\n res = yield self.coll.group(keys, initial, reduce_, cond, final)\n self.assertEqual(len(res[\"retval\"]), 1)", "metadata": "root.TestMongoQueries.test_group", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 133 }, { "content": " def __make_big_object(self):\n return {\"_id\": ObjectId(), 'x': 'a' * 1000}", "metadata": "root.TestMongoQueries.__make_big_object", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 161 }, { "content": " @defer.inlineCallbacks\n def __check_no_open_cursors(self):\n status = yield self.db.command(\"serverStatus\")\n if \"cursor\" in status[\"metrics\"]:\n self.assertEqual(status[\"metrics\"][\"cursor\"][\"open\"][\"total\"], 0)\n else:\n self.assertEqual(status[\"cursors\"][\"totalOpen\"], 0)", "metadata": "root.TestMongoQueries.__check_no_open_cursors", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 164 }, { "content": " @defer.inlineCallbacks\n def test_CursorClosing(self):\n # Calculate number of objects in 4mb batch\n obj_count_4mb = 4 * 1024**2 // len(BSON.encode(self.__make_big_object())) + 1\n\n first_batch = 5\n yield self.coll.insert(\n [self.__make_big_object() for _ in range(first_batch + obj_count_4mb)])\n result = yield self.coll.find(limit=first_batch)\n\n self.assertEqual(len(result), 5)\n\n yield self.__check_no_open_cursors()", "metadata": "root.TestMongoQueries.test_CursorClosing", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 172 }, { "content": " @defer.inlineCallbacks\n def test_CursorClosingWithCursor(self):\n # Calculate number of objects in 4mb batch\n obj_count_4mb = 4 * 1024**2 // len(BSON.encode(self.__make_big_object())) + 1\n\n first_batch = 5\n yield self.coll.insert(\n [self.__make_big_object() for _ in range(first_batch + obj_count_4mb)])\n\n result = []\n docs, dfr = yield self.coll.find_with_cursor({}, limit=first_batch)\n while docs:\n result.extend(docs)\n docs, dfr = yield dfr\n\n self.assertEqual(len(result), 5)\n\n yield self.__check_no_open_cursors()", "metadata": "root.TestMongoQueries.test_CursorClosingWithCursor", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 186 }, { "content": " @defer.inlineCallbacks\n def test_GetMoreCount(self):\n counter = _CallCounter(MongoClientProtocol.send_GETMORE)\n self.patch(MongoClientProtocol, 'send_GETMORE', counter)\n\n yield self.coll.insert([{'x': 42} for _ in range(20)])\n result = yield self.coll.find({}, limit=10)\n\n self.assertEqual(len(result), 10)\n self.assertEqual(counter.call_count, 0)", "metadata": "root.TestMongoQueries.test_GetMoreCount", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 205 }, { "content": " @defer.inlineCallbacks\n def test_GetMoreCountWithCursor(self):\n counter = _CallCounter(MongoClientProtocol.send_GETMORE)\n self.patch(MongoClientProtocol, 'send_GETMORE', counter)\n\n yield self.coll.insert([{'x': 42} for _ in range(20)])\n\n result = []\n docs, dfr = yield self.coll.find_with_cursor({}, limit=5)\n while docs:\n result.extend(docs)\n docs, dfr = yield dfr\n\n self.assertEqual(len(result), 5)\n self.assertEqual(counter.call_count, 0)", "metadata": "root.TestMongoQueries.test_GetMoreCountWithCursor", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 216 }, { "content": " @defer.inlineCallbacks\n def test_AsClass(self):\n yield self.coll.insert({'x': 42})\n\n doc = yield self.coll.find_one({})\n self.assertTrue(type(doc) is dict)\n\n class CustomDict(dict):\n pass\n\n doc = yield self.coll.find_one({}, as_class=CustomDict)\n self.assertTrue(type(doc) is CustomDict)", "metadata": "root.TestMongoQueries.test_AsClass", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 232 }, { "content": " @defer.inlineCallbacks\n def test_FindOneNone(self):\n doc = yield self.coll.find_one()\n self.assertEqual(doc, None)", "metadata": "root.TestMongoQueries.test_FindOneNone", "header": "['class', 'TestMongoQueries', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 245 }, { "content": "class TestMongoQueriesEdgeCases(_SingleCollectionTest):\n\n timeout = 15\n\n\n", "metadata": "root.TestMongoQueriesEdgeCases", "header": "['module', '___EOS___']", "index": 251 }, { "content": " @defer.inlineCallbacks\n def test_BelowBatchThreshold(self):\n yield self.coll.insert([{'v': i} for i in range(100)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 100)", "metadata": "root.TestMongoQueriesEdgeCases.test_BelowBatchThreshold", "header": "['class', 'TestMongoQueriesEdgeCases', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 255 }, { "content": " @defer.inlineCallbacks\n def test_EqualToBatchThreshold(self):\n yield self.coll.insert([{'v': i} for i in range(101)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 101)", "metadata": "root.TestMongoQueriesEdgeCases.test_EqualToBatchThreshold", "header": "['class', 'TestMongoQueriesEdgeCases', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 261 }, { "content": " @defer.inlineCallbacks\n def test_AboveBatchThreshold(self):\n yield self.coll.insert([{'v': i} for i in range(102)], safe=True)\n res = yield self.coll.find()\n self.assertEqual(len(res), 102)", "metadata": "root.TestMongoQueriesEdgeCases.test_AboveBatchThreshold", "header": "['class', 'TestMongoQueriesEdgeCases', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 267 }, { "content": "class TestLimit(_SingleCollectionTest):\n\n timeout = 15\n\n\n\n\n\n", "metadata": "root.TestLimit", "header": "['module', '___EOS___']", "index": 274 }, { "content": " @defer.inlineCallbacks\n def test_LimitBelowBatchThreshold(self):\n yield self.coll.insert([{'v': i} for i in range(50)], safe=True)\n res = yield self.coll.find(limit=20)\n self.assertEqual(len(res), 20)", "metadata": "root.TestLimit.test_LimitBelowBatchThreshold", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 278 }, { "content": " @defer.inlineCallbacks\n def test_LimitAboveBatchThreshold(self):\n yield self.coll.insert([{'v': i} for i in range(200)], safe=True)\n res = yield self.coll.find(limit=150)\n self.assertEqual(len(res), 150)", "metadata": "root.TestLimit.test_LimitAboveBatchThreshold", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 284 }, { "content": " @defer.inlineCallbacks\n def test_LimitAtBatchThresholdEdge(self):\n yield self.coll.insert([{'v': i} for i in range(200)], safe=True)\n res = yield self.coll.find(limit=100)\n self.assertEqual(len(res), 100)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(200)], safe=True)\n res = yield self.coll.find(limit=101)\n self.assertEqual(len(res), 101)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(200)], safe=True)\n res = yield self.coll.find(limit=102)\n self.assertEqual(len(res), 102)", "metadata": "root.TestLimit.test_LimitAtBatchThresholdEdge", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 290 }, { "content": " @defer.inlineCallbacks\n def test_LimitAboveMessageSizeThreshold(self):\n yield self.coll.insert([{'v': ' '*(2**20)} for _ in range(8)], safe=True)\n res = yield self.coll.find(limit=5)\n self.assertEqual(len(res), 5)", "metadata": "root.TestLimit.test_LimitAboveMessageSizeThreshold", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 308 }, { "content": " @defer.inlineCallbacks\n def test_HardLimit(self):\n yield self.coll.insert([{'v': i} for i in range(200)], safe=True)\n res = yield self.coll.find(limit=-150)\n self.assertEqual(len(res), 150)", "metadata": "root.TestLimit.test_HardLimit", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 314 }, { "content": " @defer.inlineCallbacks\n def test_HardLimitAboveMessageSizeThreshold(self):\n yield self.coll.insert([{'v': ' '*(2**20)} for _ in range(8)], safe=True)\n res = yield self.coll.find(limit=-6)\n self.assertEqual(len(res), 4)", "metadata": "root.TestLimit.test_HardLimitAboveMessageSizeThreshold", "header": "['class', 'TestLimit', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 320 }, { "content": "class TestSkip(_SingleCollectionTest):\n\n timeout = 15\n\n", "metadata": "root.TestSkip", "header": "['module', '___EOS___']", "index": 327 }, { "content": " @defer.inlineCallbacks\n def test_Skip(self):\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=3)\n self.assertEqual(len(res), 2)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=5)\n self.assertEqual(len(res), 0)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=6)\n self.assertEqual(len(res), 0)", "metadata": "root.TestSkip.test_Skip", "header": "['class', 'TestSkip', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 331 }, { "content": " @defer.inlineCallbacks\n def test_SkipWithLimit(self):\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=3, limit=1)\n self.assertEqual(len(res), 1)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=4, limit=2)\n self.assertEqual(len(res), 1)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=4, limit=1)\n self.assertEqual(len(res), 1)\n\n yield self.coll.drop()\n\n yield self.coll.insert([{'v': i} for i in range(5)], safe=True)\n res = yield self.coll.find(skip=5, limit=1)\n self.assertEqual(len(res), 0)", "metadata": "root.TestSkip.test_SkipWithLimit", "header": "['class', 'TestSkip', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 349 }, { "content": "class TestCommand(_SingleCollectionTest):\n\n\n", "metadata": "root.TestCommand", "header": "['module', '___EOS___']", "index": 374 }, { "content": " @defer.inlineCallbacks\n def test_SimpleCommand(self):\n pong = yield self.db.command(\"ping\")\n self.assertEqual(pong[\"ok\"], 1)", "metadata": "root.TestCommand.test_SimpleCommand", "header": "['class', 'TestCommand', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 376 }, { "content": " @defer.inlineCallbacks\n def test_ComplexCommand(self):\n yield self.coll.insert([{'x': 42}, {'y': 123}], safe=True)\n\n # In form of command name, value and additional params\n result = yield self.db.command(\"count\", \"mycol\", query={'x': 42})\n self.assertEqual(result['n'], 1)\n\n # In form of SON object\n result = yield self.db.command(SON([(\"count\", \"mycol\"), (\"query\", {'y': 123})]))\n self.assertEqual(result['n'], 1)", "metadata": "root.TestCommand.test_ComplexCommand", "header": "['class', 'TestCommand', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 381 }, { "content": " @defer.inlineCallbacks\n def test_CheckResult(self):\n yield self.coll.insert([{'x': 42}, {'y': 123}], safe=True)\n\n # missing 'deletes' argument\n self.assertFailure(self.db.command(\"delete\", \"mycol\"), OperationFailure)\n\n result = yield self.db.command(\"delete\", \"mycol\", check=False)\n self.assertFalse(result[\"ok\"])\n\n result = yield self.db.command(\"delete\", \"mycol\", check=True,\n allowable_errors=[\"missing deletes field\"])\n self.assertFalse(result[\"ok\"])", "metadata": "root.TestCommand.test_CheckResult", "header": "['class', 'TestCommand', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 393 }, { "content": "class TestUpdate(_SingleCollectionTest):\n\n\n", "metadata": "root.TestUpdate", "header": "['module', '___EOS___']", "index": 408 }, { "content": " @defer.inlineCallbacks\n def test_SimpleUpdate(self):\n yield self.coll.insert([{'x': 42}, {'x': 123}])\n\n yield self.coll.update({}, {\"$set\": {'x': 456}})\n\n docs = yield self.coll.find(fields={\"_id\": 0})\n\n # Check that only one document was updated\n self.assertTrue({'x': 456} in docs)\n self.assertTrue(({'x': 42} in docs) or ({'x': 123} in docs))", "metadata": "root.TestUpdate.test_SimpleUpdate", "header": "['class', 'TestUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 410 }, { "content": " @defer.inlineCallbacks\n def test_MultiUpdate(self):\n yield self.coll.insert([{'x': 42}, {'x': 123}])\n\n yield self.coll.update({}, {\"$set\": {'x': 456}}, multi=True)\n\n docs = yield self.coll.find(fields={\"_id\": 0})\n\n self.assertEqual(len(docs), 2)\n self.assertTrue(all(doc == {'x': 456} for doc in docs))", "metadata": "root.TestUpdate.test_MultiUpdate", "header": "['class', 'TestUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 422 }, { "content": " @defer.inlineCallbacks\n def test_Upsert(self):\n yield self.coll.update({}, {\"$set\": {'x': 42}}, upsert=True)\n yield self.coll.update({}, {\"$set\": {'x': 123}}, upsert=True)\n\n docs = yield self.coll.find(fields={\"_id\": 0})\n\n self.assertEqual(len(docs), 1)\n self.assertEqual(docs[0], {'x': 123})", "metadata": "root.TestUpdate.test_Upsert", "header": "['class', 'TestUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 433 }, { "content": "class TestSave(_SingleCollectionTest):\n", "metadata": "root.TestSave", "header": "['module', '___EOS___']", "index": 444 }, { "content": " @defer.inlineCallbacks\n def test_Save(self):\n yield self.assertFailure(self.coll.save(123), TypeError)\n\n yield self.coll.save({'x': 1})\n oid = ObjectId()\n yield self.coll.save({\"_id\": oid, 'x': 2})\n yield self.coll.save({\"_id\": oid, 'x': 3})\n\n docs = yield self.coll.find()\n self.assertTrue(any(doc['x'] == 1 for doc in docs))\n self.assertTrue({\"_id\": oid, 'x': 3} in docs)", "metadata": "root.TestSave.test_Save", "header": "['class', 'TestSave', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 446 }, { "content": "class TestRemove(_SingleCollectionTest):\n\n\n\n", "metadata": "root.TestRemove", "header": "['module', '___EOS___']", "index": 460 }, { "content": " @defer.inlineCallbacks\n def test_RemoveOne(self):\n docs = [{'x': 42}, {'x': 123}]\n yield self.coll.insert(docs)\n yield self.coll.remove({}, single=True)\n\n remaining = yield self.coll.find()\n self.assertEqual(len(remaining), 1)\n self.assertTrue(remaining[0] in docs)", "metadata": "root.TestRemove.test_RemoveOne", "header": "['class', 'TestRemove', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 462 }, { "content": " @defer.inlineCallbacks\n def test_RemoveMulti(self):\n yield self.coll.insert([{'x': 42}, {'x': 123}, {'y': 456}])\n yield self.coll.remove({'x': {\"$exists\": True}})\n\n remaining = yield self.coll.find(fields={\"_id\": 0})\n self.assertEqual(remaining, [{'y': 456}])", "metadata": "root.TestRemove.test_RemoveMulti", "header": "['class', 'TestRemove', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 472 }, { "content": " @defer.inlineCallbacks\n def test_RemoveById(self):\n oid = ObjectId()\n yield self.coll.insert([{\"_id\": oid, 'x': 42}, {'y': 123}])\n yield self.coll.remove(oid)\n\n remaining = yield self.coll.find(fields={\"_id\": 0})\n self.assertEqual(remaining, [{'y': 123}])", "metadata": "root.TestRemove.test_RemoveById", "header": "['class', 'TestRemove', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 480 }, { "content": " def test_RemoveInvalid(self):\n self.assertFailure(self.coll.remove(123), TypeError)", "metadata": "root.TestRemove.test_RemoveInvalid", "header": "['class', 'TestRemove', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 489 }, { "content": "class TestDistinct(unittest.TestCase):\n\n\n\n", "metadata": "root.TestDistinct", "header": "['module', '___EOS___']", "index": 493 }, { "content": " def setUp(self):\n self.conn = txmongo.MongoConnection(mongo_host, mongo_port)\n self.db = self.conn.mydb\n self.coll = self.db.mycol", "metadata": "root.TestDistinct.setUp", "header": "['class', 'TestDistinct', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 495 }, { "content": " @defer.inlineCallbacks\n def tearDown(self):\n yield self.coll.drop()\n yield self.conn.disconnect()", "metadata": "root.TestDistinct.tearDown", "header": "['class', 'TestDistinct', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 500 }, { "content": " @defer.inlineCallbacks\n def test_Simple(self):\n yield self.coll.insert([{'x': 13}, {'x': 42}, {'x': 13}])\n\n d = yield self.coll.distinct('x')\n self.assertEqual(set(d), {13, 42})", "metadata": "root.TestDistinct.test_Simple", "header": "['class', 'TestDistinct', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 505 }, { "content": " @defer.inlineCallbacks\n def test_WithQuery(self):\n yield self.coll.insert([{'x': 13}, {'x': 42}, {'x': 123}, {'x': 42}])\n\n d = yield self.coll.distinct('x', {'x': {\"$gt\": 20}})\n self.assertEqual(set(d), {42, 123})", "metadata": "root.TestDistinct.test_WithQuery", "header": "['class', 'TestDistinct', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 512 }, { "content": "class TestMapReduce(_SingleCollectionTest):\n", "metadata": "root.TestMapReduce", "header": "['module', '___EOS___']", "index": 520 }, { "content": " @defer.inlineCallbacks\n def test_MapReduce(self):\n yield self.coll.insert([\n {\"kid\": \"John\", \"grade\": 5},\n {\"kid\": \"Kate\", \"grade\": 4},\n {\"kid\": \"John\", \"grade\": 4},\n {\"kid\": \"Kate\", \"grade\": 4},\n {\"kid\": \"Adam\", \"grade\": 4},\n {\"kid\": \"Kate\", \"grade\": 2},\n {\"kid\": \"John\", \"grade\": 5},\n ])\n\n t_map = \"\"\"\n function () {\n emit(this.kid, this.grade);\n }\n \"\"\"\n\n t_reduce = \"\"\"\n function (key, values) {\n return Array.sum(values);\n }\n \"\"\"\n\n result = yield self.coll.map_reduce(t_map, t_reduce, out={\"inline\": 1})\n self.assertEqual(len(result), 3)\n self.assertTrue({\"_id\": \"John\", \"value\": 14} in result)\n self.assertTrue({\"_id\": \"Kate\", \"value\": 10} in result)\n self.assertTrue({\"_id\": \"Adam\", \"value\": 4} in result)\n\n result = yield self.coll.map_reduce(t_map, t_reduce, out={\"inline\": 1}, full_response=True)\n self.assertTrue(result[\"ok\"], 1)\n self.assertTrue(\"counts\" in result)\n self.assertTrue(\"results\" in result)", "metadata": "root.TestMapReduce.test_MapReduce", "header": "['class', 'TestMapReduce', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 522 }, { "content": "class TestInsertOne(_SingleCollectionTest):\n\n\n", "metadata": "root.TestInsertOne", "header": "['module', '___EOS___']", "index": 558 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.insert_one({'x': 42})\n self.assertTrue(isinstance(result, InsertOneResult))\n self.assertEqual(result.acknowledged, True)\n self.assertTrue(isinstance(result.inserted_id, ObjectId))\n\n count = yield self.coll.count()\n self.assertEqual(count, 1)", "metadata": "root.TestInsertOne.test_Acknowledged", "header": "['class', 'TestInsertOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 560 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n oid = ObjectId()\n doc = {'x': 42, \"_id\": oid}\n result = yield self.coll.with_options(write_concern=WriteConcern(w=0)).insert_one(doc)\n self.assertEqual(result.acknowledged, False)\n self.assertEqual(result.inserted_id, oid)\n\n # It's ok to issue count() right after unacknowledged insert because\n # we have exactly one connection\n count = yield self.coll.count()\n self.assertEqual(count, 1)", "metadata": "root.TestInsertOne.test_Unacknowledged", "header": "['class', 'TestInsertOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 570 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n yield self.coll.insert_one({\"_id\": 1})\n\n yield self.assertFailure(self.coll.insert_one({\"_id\": 1}), DuplicateKeyError)\n yield self.coll.with_options(write_concern=WriteConcern(w=0)).insert_one({\"_id\": 1})\n\n yield self.assertFailure(self.coll.insert_one({'$': 1}), WriteError)\n yield self.coll.with_options(write_concern=WriteConcern(w=0)).insert_one({'$': 1})", "metadata": "root.TestInsertOne.test_Failures", "header": "['class', 'TestInsertOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 583 }, { "content": "class TestInsertMany(_SingleCollectionTest):\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestInsertMany", "header": "['module', '___EOS___']", "index": 594 }, { "content": " def setUp(self):\n self.more_than_1k = [{\"_id\": i} for i in range(2016)]\n return super(TestInsertMany, self).setUp()", "metadata": "root.TestInsertMany.setUp", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 596 }, { "content": " @defer.inlineCallbacks\n def test_InvalidArg(self):\n yield self.assertFailure(self.coll.insert_many({'x': 42}), TypeError)", "metadata": "root.TestInsertMany.test_InvalidArg", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 600 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.insert_many([{'x': 42} for _ in range(100)])\n self.assertTrue(isinstance(result, InsertManyResult))\n self.assertEqual(result.acknowledged, True)\n\n docs = yield self.coll.find()\n ids = set(doc[\"_id\"] for doc in docs)\n\n self.assertEqual(ids, set(result.inserted_ids))", "metadata": "root.TestInsertMany.test_Acknowledged", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 604 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n result = yield self.coll.with_options(write_concern=WriteConcern(w=0))\\\n .insert_many([{'x': 42} for _ in range(100)])\n self.assertTrue(isinstance(result, InsertManyResult))\n self.assertEqual(result.acknowledged, False)\n\n docs = yield self.coll.find()\n self.assertEqual({doc[\"_id\"] for doc in docs}, set(result.inserted_ids))", "metadata": "root.TestInsertMany.test_Unacknowledged", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 615 }, { "content": " @defer.inlineCallbacks\n def test_OrderedAck_Ok(self):\n result = yield self.coll.insert_many(self.more_than_1k)\n found = yield self.coll.find()\n self.assertEqual(len(result.inserted_ids), len(self.more_than_1k))\n self.assertEqual(len(found), len(self.more_than_1k))\n self.assertEqual(set(result.inserted_ids), {doc[\"_id\"] for doc in found})", "metadata": "root.TestInsertMany.test_OrderedAck_Ok", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 625 }, { "content": " @defer.inlineCallbacks\n def test_OrderedUnack_Ok(self):\n w_0 = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield w_0.insert_many(self.more_than_1k)\n found = yield self.coll.find()\n self.assertEqual(len(result.inserted_ids), len(self.more_than_1k))\n self.assertEqual(len(found), len(self.more_than_1k))\n self.assertEqual(set(result.inserted_ids), {doc[\"_id\"] for doc in found})", "metadata": "root.TestInsertMany.test_OrderedUnack_Ok", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 633 }, { "content": " @defer.inlineCallbacks\n def testOrderedAck_Fail(self):\n self.more_than_1k[500] = self.more_than_1k[499]\n error = yield self.assertFailure(self.coll.insert_many(self.more_than_1k), BulkWriteError)\n self.assertEqual(error.details[\"nInserted\"], 500)\n self.assertEqual((yield self.coll.count()), 500)\n self.assertEqual(len(error.details[\"writeErrors\"]), 1)\n self.assertEqual(error.details[\"writeErrors\"][0][\"index\"], 500)\n self.assertEqual(error.details[\"writeErrors\"][0][\"op\"], {\"_id\": 499})", "metadata": "root.TestInsertMany.testOrderedAck_Fail", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 642 }, { "content": " @defer.inlineCallbacks\n def test_OrderedUnack_Fail(self):\n self.more_than_1k[500] = self.more_than_1k[499]\n\n w_0 = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield w_0.insert_many(self.more_than_1k)\n self.assertEqual(len(result.inserted_ids), len(self.more_than_1k))\n found = yield self.coll.find()\n self.assertEqual(len(found), 500)\n self.assertEqual({doc[\"_id\"] for doc in found[:500]}, set(result.inserted_ids[:500]))", "metadata": "root.TestInsertMany.test_OrderedUnack_Fail", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 652 }, { "content": " @defer.inlineCallbacks\n def test_UnorderedAck_Fail(self):\n self.more_than_1k[500] = self.more_than_1k[499]\n error = yield self.assertFailure(self.coll.insert_many(self.more_than_1k, ordered=False),\n BulkWriteError)\n self.assertEqual(error.details[\"nInserted\"], len(self.more_than_1k) - 1)\n self.assertEqual((yield self.coll.count()), len(self.more_than_1k) - 1)\n self.assertEqual(len(error.details[\"writeErrors\"]), 1)\n self.assertEqual(error.details[\"writeErrors\"][0][\"index\"], 500)\n self.assertEqual(error.details[\"writeErrors\"][0][\"op\"], {\"_id\": 499})", "metadata": "root.TestInsertMany.test_UnorderedAck_Fail", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 663 }, { "content": " @defer.inlineCallbacks\n def test_UnorderedUnack_Fail(self):\n self.more_than_1k[500] = self.more_than_1k[499]\n\n w_0 = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield w_0.insert_many(self.more_than_1k, ordered=False)\n self.assertEqual(len(result.inserted_ids), len(self.more_than_1k))\n found = yield self.coll.find()\n self.assertEqual(len(found), len(self.more_than_1k) - 1)\n self.assertEqual({doc[\"_id\"] for doc in found}, set(result.inserted_ids) - {500})", "metadata": "root.TestInsertMany.test_UnorderedUnack_Fail", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 674 }, { "content": " @defer.inlineCallbacks\n def test_MoreThan16Mb(self):\n # 8mb x 5\n mb40 = [{\"_id\": i, 'x': 'y'*(8*1024**2)} for i in range(5)]\n\n result = yield self.coll.insert_many(mb40)\n self.assertEqual(result.inserted_ids, list(range(5)))\n found = yield self.coll.find()\n self.assertEqual(len(found), 5)\n total_size = sum(len(BSON.encode(doc)) for doc in found)\n self.assertGreater(total_size, 40*1024**2)", "metadata": "root.TestInsertMany.test_MoreThan16Mb", "header": "['class', 'TestInsertMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 685 }, { "content": "class TestUpdateOne(_SingleCollectionTest):\n\n\n\n\n\n\n", "metadata": "root.TestUpdateOne", "header": "['module', '___EOS___']", "index": 698 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestUpdateOne, self).setUp()\n yield self.coll.insert_many([{'x': 1}, {'x': 2}])", "metadata": "root.TestUpdateOne.setUp", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 700 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.update_one({'x': {\"$exists\": True}}, {\"$set\": {'y': 123}})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.matched_count, 1)\n self.assertEqual(result.modified_count, 1)\n self.assertEqual(result.upserted_id, None)", "metadata": "root.TestUpdateOne.test_Acknowledged", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 705 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.update_one({'x': {\"$exists\": True}}, {\"$set\": {'y': 123}})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, False)", "metadata": "root.TestUpdateOne.test_Unacknowledged", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 714 }, { "content": " @defer.inlineCallbacks\n def test_UpsertAcknowledged(self):\n result = yield self.coll.update_one({'y': 123}, {\"$set\": {'z': 456}}, upsert=True)\n self.assertTrue(isinstance(result.upserted_id, ObjectId))\n\n doc = yield self.coll.find_one({\"_id\": result.upserted_id}, fields={\"_id\": 0})\n self.assertEqual(doc, {'y': 123, 'z': 456})", "metadata": "root.TestUpdateOne.test_UpsertAcknowledged", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 721 }, { "content": " @defer.inlineCallbacks\n def test_UpsertUnacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.update_one({'y': 123}, {\"$set\": {'z': 456}}, upsert=True)\n self.assertEqual(result.acknowledged, False)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 3)", "metadata": "root.TestUpdateOne.test_UpsertUnacknowledged", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 729 }, { "content": " @defer.inlineCallbacks\n def test_InvalidUpdate(self):\n # update_one/update_many only allow $-operators, not whole document replace)\n yield self.assertFailure(self.coll.update_one({'x': 1}, {'y': 123}), ValueError)", "metadata": "root.TestUpdateOne.test_InvalidUpdate", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 738 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n # can't alter _id\n yield self.assertFailure(self.coll.update_one({'x': 1}, {\"$set\": {\"_id\": 1}}), WriteError)\n # invalid field name\n yield self.assertFailure(self.coll.update_one({'x': 1}, {\"$set\": {'$': 1}}), WriteError)\n\n yield self.coll.create_index(qf.sort(qf.ASCENDING('x')), unique=True)\n yield self.assertFailure(self.coll.update_one({'x': 2}, {\"$set\": {'x': 1}}), DuplicateKeyError)", "metadata": "root.TestUpdateOne.test_Failures", "header": "['class', 'TestUpdateOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 743 }, { "content": "class TestReplaceOne(_SingleCollectionTest):\n\n\n\n\n\n\n", "metadata": "root.TestReplaceOne", "header": "['module', '___EOS___']", "index": 754 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestReplaceOne, self).setUp()\n yield self.coll.insert_many([{'x': 1}, {'x': 2}])", "metadata": "root.TestReplaceOne.setUp", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 756 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.replace_one({'x': {\"$exists\": True}}, {'y': 123})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.matched_count, 1)\n self.assertEqual(result.modified_count, 1)\n self.assertEqual(result.upserted_id, None)", "metadata": "root.TestReplaceOne.test_Acknowledged", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 761 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.replace_one({'x': {\"$exists\": True}}, {'y': 123})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, False)", "metadata": "root.TestReplaceOne.test_Unacknowledged", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 770 }, { "content": " @defer.inlineCallbacks\n def test_UpsertAcknowledged(self):\n result = yield self.coll.replace_one({'x': 5}, {'y': 123}, upsert=True)\n self.assertTrue(isinstance(result.upserted_id, ObjectId))\n\n doc = yield self.coll.find_one({\"_id\": result.upserted_id}, fields={\"_id\": 0})\n self.assertEqual(doc, {'y': 123})", "metadata": "root.TestReplaceOne.test_UpsertAcknowledged", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 777 }, { "content": " @defer.inlineCallbacks\n def test_UpsertUnacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.replace_one({'x': 5}, {'y': 123}, upsert=True)\n self.assertEqual(result.acknowledged, False)\n\n doc = yield self.coll.find_one({\"y\": {\"$exists\": True}}, fields={\"_id\": 0})\n self.assertEqual(doc, {'y': 123})", "metadata": "root.TestReplaceOne.test_UpsertUnacknowledged", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 785 }, { "content": " @defer.inlineCallbacks\n def test_InvalidReplace(self):\n # replace_one does not allow $-operators, only whole document replace\n yield self.assertFailure(self.coll.replace_one({'x': 1}, {\"$set\": {'y': 123}}),\n ValueError)", "metadata": "root.TestReplaceOne.test_InvalidReplace", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 794 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n yield self.assertFailure(self.coll.replace_one({'x': 1}, {'x': {'$': 5}}), WriteError)\n\n yield self.coll.create_index(qf.sort(qf.ASCENDING('x')), unique=True)\n yield self.assertFailure(self.coll.replace_one({'x': 1}, {'x': 2}), DuplicateKeyError)", "metadata": "root.TestReplaceOne.test_Failures", "header": "['class', 'TestReplaceOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 800 }, { "content": "class TestUpdateMany(_SingleCollectionTest):\n\n\n\n\n\n\n", "metadata": "root.TestUpdateMany", "header": "['module', '___EOS___']", "index": 808 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestUpdateMany, self).setUp()\n yield self.coll.insert_many([{'x': 1}, {'x': 2}])", "metadata": "root.TestUpdateMany.setUp", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 810 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.update_many({'x': {\"$exists\": True}}, {\"$set\": {'y': 5}})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.matched_count, 2)\n self.assertEqual(result.modified_count, 2)\n self.assertEqual(result.upserted_id, None)\n\n cnt = yield self.coll.count({'y': 5})\n self.assertEqual(cnt, 2)", "metadata": "root.TestUpdateMany.test_Acknowledged", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 815 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.update_many({'x': {\"$exists\": True}}, {\"$set\": {'y': 5}})\n self.assertTrue(isinstance(result, UpdateResult))\n self.assertEqual(result.acknowledged, False)\n\n cnt = yield self.coll.count({'y': 5})\n self.assertEqual(cnt, 2)", "metadata": "root.TestUpdateMany.test_Unacknowledged", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 827 }, { "content": " @defer.inlineCallbacks\n def test_UpsertAcknowledged(self):\n result = yield self.coll.update_many({'x': 5}, {\"$set\": {'y': 5}}, upsert=True)\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.matched_count, 0)\n self.assertEqual(result.modified_count, 0)\n self.assertTrue(isinstance(result.upserted_id, ObjectId))\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 3)", "metadata": "root.TestUpdateMany.test_UpsertAcknowledged", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 837 }, { "content": " @defer.inlineCallbacks\n def test_UpsertUnacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.update_many({'x': 5}, {\"$set\": {'y': 5}}, upsert=True)\n self.assertEqual(result.acknowledged, False)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 3)", "metadata": "root.TestUpdateMany.test_UpsertUnacknowledged", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 848 }, { "content": " @defer.inlineCallbacks\n def test_InvalidUpdate(self):\n # update_one/update_many only allow $-operators, not whole document replace)\n yield self.assertFailure(self.coll.update_many({'x': 1}, {'y': 123}), ValueError)", "metadata": "root.TestUpdateMany.test_InvalidUpdate", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 857 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n # can't alter _id\n yield self.assertFailure(self.coll.update_many({}, {\"$set\": {\"_id\": 1}}), WriteError)\n # invalid field name\n yield self.assertFailure(self.coll.update_many({}, {\"$set\": {'$': 1}}), WriteError)\n\n yield self.coll.create_index(qf.sort(qf.ASCENDING('x')), unique=True)\n yield self.assertFailure(self.coll.update_many({'x': 2}, {\"$set\": {'x': 1}}), DuplicateKeyError)", "metadata": "root.TestUpdateMany.test_Failures", "header": "['class', 'TestUpdateMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 862 }, { "content": "class TestDeleteOne(_SingleCollectionTest):\n\n\n\n", "metadata": "root.TestDeleteOne", "header": "['module', '___EOS___']", "index": 873 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestDeleteOne, self).setUp()\n yield self.coll.insert_many([{'x': 1}, {'x': 1}])", "metadata": "root.TestDeleteOne.setUp", "header": "['class', 'TestDeleteOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 875 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.delete_one({'x': 1})\n self.assertTrue(isinstance(result, DeleteResult))\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.deleted_count, 1)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 1)", "metadata": "root.TestDeleteOne.test_Acknowledged", "header": "['class', 'TestDeleteOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 880 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.delete_one({'x': 1})\n self.assertTrue(isinstance(result, DeleteResult))\n self.assertEqual(result.acknowledged, False)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 1)", "metadata": "root.TestDeleteOne.test_Unacknowledged", "header": "['class', 'TestDeleteOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 890 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n yield self.assertFailure(self.coll.delete_one({'x': {'$': 1}}), WriteError)", "metadata": "root.TestDeleteOne.test_Failures", "header": "['class', 'TestDeleteOne', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 900 }, { "content": "class TestDeleteMany(_SingleCollectionTest):\n\n\n\n", "metadata": "root.TestDeleteMany", "header": "['module', '___EOS___']", "index": 905 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestDeleteMany, self).setUp()\n yield self.coll.insert_many([{'x': 1}, {'x': 1}])", "metadata": "root.TestDeleteMany.setUp", "header": "['class', 'TestDeleteMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 907 }, { "content": " @defer.inlineCallbacks\n def test_Acknowledged(self):\n result = yield self.coll.delete_many({'x': 1})\n self.assertTrue(isinstance(result, DeleteResult))\n self.assertEqual(result.acknowledged, True)\n self.assertEqual(result.deleted_count, 2)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 0)", "metadata": "root.TestDeleteMany.test_Acknowledged", "header": "['class', 'TestDeleteMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 912 }, { "content": " @defer.inlineCallbacks\n def test_Unacknowledged(self):\n coll = self.coll.with_options(write_concern=WriteConcern(w=0))\n result = yield coll.delete_many({'x': 1})\n self.assertTrue(isinstance(result, DeleteResult))\n self.assertEqual(result.acknowledged, False)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 0)", "metadata": "root.TestDeleteMany.test_Unacknowledged", "header": "['class', 'TestDeleteMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 922 }, { "content": " @defer.inlineCallbacks\n def test_Failures(self):\n yield self.assertFailure(self.coll.delete_many({'x': {'$': 1}}), WriteError)", "metadata": "root.TestDeleteMany.test_Failures", "header": "['class', 'TestDeleteMany', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 932 }, { "content": "class TestFindOneAndDelete(_SingleCollectionTest):\n\n\n", "metadata": "root.TestFindOneAndDelete", "header": "['module', '___EOS___']", "index": 937 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestFindOneAndDelete, self).setUp()\n yield self.coll.insert_many([{'x': 1, 'y': 1},\n {'x': 2, 'y': 2},\n {'x': 3, 'y': 3}])", "metadata": "root.TestFindOneAndDelete.setUp", "header": "['class', 'TestFindOneAndDelete', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 939 }, { "content": " @defer.inlineCallbacks\n def test_Sort(self):\n doc = yield self.coll.find_one_and_delete({'x': {\"$exists\": True}},\n sort=qf.sort(qf.ASCENDING('y')))\n self.assertEqual(doc['x'], 1)\n\n doc = yield self.coll.find_one_and_delete({'x': {\"$exists\": True}},\n sort=qf.sort(qf.DESCENDING('y')))\n self.assertEqual(doc['x'], 3)\n\n cnt = yield self.coll.count()\n self.assertEqual(cnt, 1)", "metadata": "root.TestFindOneAndDelete.test_Sort", "header": "['class', 'TestFindOneAndDelete', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 946 }, { "content": " @defer.inlineCallbacks\n def test_Projection(self):\n doc = yield self.coll.find_one_and_delete({'x': 2}, {'y': 1, \"_id\": 0})\n self.assertEqual(doc, {'y': 2})", "metadata": "root.TestFindOneAndDelete.test_Projection", "header": "['class', 'TestFindOneAndDelete', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 959 }, { "content": "class TestFindOneAndReplace(_SingleCollectionTest):\n\n\n\n\n\n", "metadata": "root.TestFindOneAndReplace", "header": "['module', '___EOS___']", "index": 965 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestFindOneAndReplace, self).setUp()\n yield self.coll.insert_many([{'x': 10, 'y': 10},\n {'x': 20, 'y': 20},\n {'x': 30, 'y': 30}])", "metadata": "root.TestFindOneAndReplace.setUp", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 967 }, { "content": " @defer.inlineCallbacks\n def test_Sort(self):\n doc = yield self.coll.find_one_and_replace({}, {'x': 5, 'y': 5},\n projection={\"_id\": 0},\n sort=qf.sort(qf.ASCENDING('y')))\n self.assertEqual(doc, {'x': 10, 'y': 10})\n\n doc = yield self.coll.find_one_and_replace({}, {'x': 40, 'y': 40},\n projection={\"_id\": 0},\n sort=qf.sort(qf.DESCENDING('y')))\n self.assertEqual(doc, {'x': 30, 'y': 30})\n\n ys = yield self.coll.distinct('y')\n self.assertEqual(set(ys), {5, 20, 40})", "metadata": "root.TestFindOneAndReplace.test_Sort", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 974 }, { "content": " @defer.inlineCallbacks\n def test_InvalidReplace(self):\n yield self.assertFailure(self.coll.find_one_and_replace({}, {\"$set\": {'z': 1}}), ValueError)", "metadata": "root.TestFindOneAndReplace.test_InvalidReplace", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 989 }, { "content": " @defer.inlineCallbacks\n def test_Upsert(self):\n doc = yield self.coll.find_one_and_replace({'x': 40}, {'x': 50}, upsert=True)\n self.assertEqual(doc, None)\n\n xs = yield self.coll.distinct('x')\n self.assertEqual(set(xs), {10, 20, 30, 50})", "metadata": "root.TestFindOneAndReplace.test_Upsert", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 993 }, { "content": " @defer.inlineCallbacks\n def test_ReturnDocument(self):\n doc = yield self.coll.find_one_and_replace({'x': 10}, {'x': 15},\n return_document=ReturnDocument.BEFORE)\n self.assertEqual(doc['x'], 10)\n\n doc = yield self.coll.find_one_and_replace({'x': 20}, {'x': 25},\n return_document=ReturnDocument.AFTER)\n self.assertEqual(doc['x'], 25)", "metadata": "root.TestFindOneAndReplace.test_ReturnDocument", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1001 }, { "content": " @defer.inlineCallbacks\n def test_InvalidReturnDocument(self):\n yield self.assertFailure(self.coll.find_one_and_replace({}, {}, return_document=1),\n ValueError)", "metadata": "root.TestFindOneAndReplace.test_InvalidReturnDocument", "header": "['class', 'TestFindOneAndReplace', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1011 }, { "content": "class TestFindOneAndUpdate(_SingleCollectionTest):\n\n\n\n\n", "metadata": "root.TestFindOneAndUpdate", "header": "['module', '___EOS___']", "index": 1017 }, { "content": " @defer.inlineCallbacks\n def setUp(self):\n yield super(TestFindOneAndUpdate, self).setUp()\n yield self.coll.insert_many([{'x': 10, 'y': 10},\n {'x': 20, 'y': 20},\n {'x': 30, 'y': 30}])", "metadata": "root.TestFindOneAndUpdate.setUp", "header": "['class', 'TestFindOneAndUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1019 }, { "content": " @defer.inlineCallbacks\n def test_Sort(self):\n doc = yield self.coll.find_one_and_update({}, {\"$set\": {'y': 5}},\n projection={\"_id\": 0},\n sort=qf.sort(qf.ASCENDING('y')))\n self.assertEqual(doc, {'x': 10, 'y': 10})\n\n doc = yield self.coll.find_one_and_update({}, {\"$set\": {'y': 35}},\n projection={\"_id\": 0},\n sort=qf.sort(qf.DESCENDING('y')))\n self.assertEqual(doc, {'x': 30, 'y': 30})\n\n ys = yield self.coll.distinct('y')\n self.assertEqual(set(ys), {5, 20, 35})", "metadata": "root.TestFindOneAndUpdate.test_Sort", "header": "['class', 'TestFindOneAndUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1026 }, { "content": " def test_InvalidUpdate(self):\n self.assertFailure(self.coll.find_one_and_update({}, {'x': 123}), ValueError)", "metadata": "root.TestFindOneAndUpdate.test_InvalidUpdate", "header": "['class', 'TestFindOneAndUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1041 }, { "content": " @defer.inlineCallbacks\n def test_Upsert(self):\n doc = yield self.coll.find_one_and_update({'x': 40}, {\"$set\": {'y': 40}},\n upsert=True)\n self.assertEqual(doc, None)\n\n inserted = yield self.coll.find_one({'x': 40})\n self.assertEqual(inserted['y'], 40)", "metadata": "root.TestFindOneAndUpdate.test_Upsert", "header": "['class', 'TestFindOneAndUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1044 }, { "content": " @defer.inlineCallbacks\n def test_ReturnDocument(self):\n doc = yield self.coll.find_one_and_update({'x': 10}, {\"$set\": {'y': 5}},\n return_document=ReturnDocument.BEFORE)\n self.assertEqual(doc['y'], 10)\n\n doc = yield self.coll.find_one_and_update({'x': 10}, {\"$set\": {'y': 15}},\n return_document=ReturnDocument.AFTER)\n self.assertEqual(doc['y'], 15)", "metadata": "root.TestFindOneAndUpdate.test_ReturnDocument", "header": "['class', 'TestFindOneAndUpdate', '(', '_SingleCollectionTest', ')', ':', '___EOS___']", "index": 1053 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Mark", " ", "L", "._", "\\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_", "abs", "olute", "\\u", "import_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bson_", "import_", "BS", "ON_", ",_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "son_", "import_", "SON", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pymongo_", "._", "errors_", "import_", "Opera", "tion", "Failure_", ",_", "Write", "Error_", ",_", "Bul", "k", "Write", "Error_", ",_", "Duplicate", "Key", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pymongo_", "._", "results_", "import_", "Insert", "One", "Result_", ",_", "Insert", "Many", "Result_", ",_", "Update", "Result_", ",_", "Delete", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pymongo_", "._", "collection_", "import_", "Return", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pymongo_", "._", "write", "\\u", "concern", "_", "import_", "Write", "Conce", "rn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "trial_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tx", "mongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tx", "mongo_", "._", "protocol_", "import_", "Mon", "go", "Client", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tx", "mongo_", "._", "filter_", "as_", "qf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mongo", "\\u", "host_", "=_", "\"", "local", "host", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mongo", "\\u", "port_", "=_", "27017", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Call", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Call", "Counter_", "(_", "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_", ",_", "original_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "call", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "original_", "=_", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Call", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "this_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "call", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "original_", "(_", "this_", ",_", "*_", "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_", "\\u", "Sing", "le", "Collecti", "on", "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_", "[SEP]_", "class_", "\\u", "Sing", "le", "Collecti", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "=_", "tx", "mongo_", "._", "Mon", "go", "Connection_", "(_", "mongo", "\\u", "host_", ",_", "mongo", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "=_", "self_", "._", "conn_", "._", "myd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "coll_", "=_", "self_", "._", "db_", "._", "myco", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sing", "le", "Collecti", "on", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "conn_", "._", "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_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Sing", "le", "Curs", "or", "Iteration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Multipl", "e", "Curs", "or", "Iterations", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "450_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "450_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fin", "d", "With", "Cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "750_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "with", "\\u", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "docs_", ")_", ",_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "+=_", "len_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "total_", ",_", "750_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sam", "e", " ", "thing", ",", " ", "but", " ", "with", " ", "the", " ", "\"", "cursor", "\"", " ", "keyw", "ord", " ", "argu", "ment", " ", "on", " ", "find", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "cursor_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "docs_", ")_", ",_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "+=_", "len_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "total_", ",_", "750_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fin", "d", "With", "Curs", "or", "Limit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "750_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "with", "\\u", "cursor_", "(_", "limit_", "=_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "+=_", "len_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "total_", ",_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sam", "e", " ", "usi", "ng", " ", "find", "(", "cursor", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "150_", ",_", "cursor_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "+=_", "len_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "d_", "=_", "yield_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "total_", ",_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Large", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "'", " ", "'_", "*_", "(_", "2_", "**_", "19_", ")_", "}_", "for_", "\\u_", "in_", "range_", "(_", "4_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Specifie", "d", "Fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", "in_", "\"", "abcdefg", "\"_", ")_", "for_", "v_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "c", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", "fields_", "=_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "c", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "x_", "in_", "[_", "'", "a", "'_", ",_", "'", "c", "'_", ",_", "\"\\u", "id", "\"_", "]_", "for_", "x_", "in_", "res_", "[_", "0_", "]_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "[_", "'", "a", "'_", ",_", "'", "c", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", "fields_", "=_", "[_", "'", "a", "'_", ",_", "'", "c", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "x_", "in_", "[_", "'", "a", "'_", ",_", "'", "c", "'_", ",_", "\"\\u", "id", "\"_", "]_", "for_", "x_", "in_", "res_", "[_", "0_", "]_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", "fields_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "x_", "in_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "x_", "in_", "res_", "[_", "0_", "]_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "find_", "(_", "{_", "}_", ",_", "fields_", "=_", "[_", "1_", "]_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "%_", "2_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce", "\\u_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "function", "(", "curr", ",", " ", "result", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "result", ".", "total", " ", "+=", " ", "curr", ".", "v", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "{_", "'", "v", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "=_", "{_", "\"", "total", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond_", "=_", "{_", "'", "v", "'_", ":_", "{_", "\"$", "in", "\"_", ":_", "[_", "0_", ",_", "1_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "function", "(", "result", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "result", ".", "five", " ", "=", " ", "5", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "group_", "(_", "keys_", ",_", "initial_", ",_", "reduce", "\\u_", ",_", "cond_", ",_", "final_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", "[_", "\"", "ret", "val", "\"_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "function", "(", "doc", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "{", "\"", "value", "\":", " ", "5", ",", " ", "'", "v", "':", " ", "1", "};", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "group_", "(_", "keys_", ",_", "initial_", ",_", "reduce", "\\u_", ",_", "cond_", ",_", "final_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", "[_", "\"", "ret", "val", "\"_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "make", "\\u", "big", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\"\\u", "id", "\"_", ":_", "Object", "Id_", "(_", ")_", ",_", "'", "x", "'_", ":_", "'", "a", "'_", "*_", "1000_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "check", "\\u", "no", "\\u", "open", "\\u", "cursors", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "\"", "server", "Status", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "cursor", "\"_", "in_", "status_", "[_", "\"", "metric", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "status_", "[_", "\"", "metric", "s", "\"_", "]_", "[_", "\"", "cursor", "\"_", "]_", "[_", "\"", "open", "\"_", "]_", "[_", "\"", "total", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "status_", "[_", "\"", "cursors", "\"_", "]_", "[_", "\"", "total", "Open", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "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_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Curs", "or", "Clos", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "number", " ", "of", " ", "object", "s", " ", "in", " ", "4", "mb", " ", "batch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "count", "\\u", "4", "mb_", "=_", "4_", "*_", "1024_", "**_", "2_", "//_", "len_", "(_", "BS", "ON_", "._", "encode_", "(_", "self_", "._", "\\u\\u", "make", "\\u", "big", "\\u", "object_", "(_", ")_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "batch_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "\\u\\u", "make", "\\u", "big", "\\u", "object_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "first", "\\u", "batch_", "+_", "obj", "\\u", "count", "\\u", "4", "mb_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "first", "\\u", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "\\u\\u", "check", "\\u", "no", "\\u", "open", "\\u", "cursors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Curs", "or", "Clos", "ing", "With", "Cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "number", " ", "of", " ", "object", "s", " ", "in", " ", "4", "mb", " ", "batch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "count", "\\u", "4", "mb_", "=_", "4_", "*_", "1024_", "**_", "2_", "//_", "len_", "(_", "BS", "ON_", "._", "encode_", "(_", "self_", "._", "\\u\\u", "make", "\\u", "big", "\\u", "object_", "(_", ")_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "batch_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "\\u\\u", "make", "\\u", "big", "\\u", "object_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "first", "\\u", "batch_", "+_", "obj", "\\u", "count", "\\u", "4", "mb_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "dfr", "_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "with", "\\u", "cursor_", "(_", "{_", "}_", ",_", "limit_", "=_", "first", "\\u", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "extend_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "dfr", "_", "=_", "yield_", "dfr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "\\u\\u", "check", "\\u", "no", "\\u", "open", "\\u", "cursors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Get", "Mor", "e", "Count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "=_", "\\u", "Call", "Counter_", "(_", "Mon", "go", "Client", "Protocol_", "._", "send", "\\u", "GET", "MOR", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "(_", "Mon", "go", "Client", "Protocol_", ",_", "'", "send", "\\u", "GET", "MOR", "E", "'_", ",_", "counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", "for_", "\\u_", "in_", "range_", "(_", "20_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "{_", "}_", ",_", "limit_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "counter_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Get", "Mor", "e", "Count", "With", "Cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "=_", "\\u", "Call", "Counter_", "(_", "Mon", "go", "Client", "Protocol_", "._", "send", "\\u", "GET", "MOR", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "(_", "Mon", "go", "Client", "Protocol_", ",_", "'", "send", "\\u", "GET", "MOR", "E", "'_", ",_", "counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", "for_", "\\u_", "in_", "range_", "(_", "20_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "dfr", "_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "with", "\\u", "cursor_", "(_", "{_", "}_", ",_", "limit_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "extend_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", ",_", "dfr", "_", "=_", "yield_", "dfr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "counter_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "As", "Class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "{_", "'", "x", "'_", ":_", "42_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "type_", "(_", "doc_", ")_", "is_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Custom", "Dict_", "(_", "dict_", ")_", ":_", "\\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_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "}_", ",_", "as", "\\u", "class_", "=_", "Custom", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "type_", "(_", "doc_", ")_", "is_", "Custom", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fin", "d", "One", "None_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "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_", "Test", "Mon", "go", "Querie", "s", "Ed", "ge", "Cases_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Mon", "go", "Querie", "s", "Ed", "ge", "Cases_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Below", "Bat", "ch", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "100_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s", "Ed", "ge", "Cases_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Equal", "To", "Bat", "ch", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "101_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mon", "go", "Querie", "s", "Ed", "ge", "Cases_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Abo", "ve", "Bat", "ch", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "102_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "102_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Limit", "Below", "Bat", "ch", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "50_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Limit", "Abo", "ve", "Bat", "ch", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "200_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Limit", "At", "Bat", "ch", "Thresh", "old", "Edge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "200_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "200_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "200_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "102_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "102_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Limit", "Abo", "ve", "Messag", "e", "Size", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "'", " ", "'_", "*_", "(_", "2_", "**_", "20_", ")_", "}_", "for_", "\\u_", "in_", "range_", "(_", "8_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Hard", "Limit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "200_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "-_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Limit_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Hard", "Limit", "Abo", "ve", "Messag", "e", "Size", "Threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "'", " ", "'_", "*_", "(_", "2_", "**_", "20_", ")_", "}_", "for_", "\\u_", "in_", "range_", "(_", "8_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "limit_", "=_", "-_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Skip_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "15_", "\\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", "Skip_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Skip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Skip_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ski", "p", "With", "Limit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "3_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "4_", ",_", "limit_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "4_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "v", "'_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "skip_", "=_", "5_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Command_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Command_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Simple", "Command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pong", "_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "\"", "ping", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pong", "_", "[_", "\"", "ok", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Command_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Comple", "x", "Command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "form", " ", "of", " ", "command", " ", "name", ",", " ", "value", " ", "and", " ", "addition", "al", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "\"", "count", "\"_", ",_", "\"", "myco", "l", "\"_", ",_", "query_", "=_", "{_", "'", "x", "'_", ":_", "42_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "'", "n", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "form", " ", "of", " ", "SON", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "SON", "_", "(_", "[_", "(_", "\"", "count", "\"_", ",_", "\"", "myco", "l", "\"_", ")_", ",_", "(_", "\"", "query", "\"_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "'", "n", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Command_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Check", "Result_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", "]_", ",_", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missi", "ng", " ", "'", "delete", "s", "'", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "db_", "._", "command_", "(_", "\"", "delete", "\"_", ",_", "\"", "myco", "l", "\"_", ")_", ",_", "Opera", "tion", "Failure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "\"", "delete", "\"_", ",_", "\"", "myco", "l", "\"_", ",_", "check_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", "[_", "\"", "ok", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "db_", "._", "command_", "(_", "\"", "delete", "\"_", ",_", "\"", "myco", "l", "\"_", ",_", "check_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "able", "\\u", "errors_", "=_", "[_", "\"", "missi", "ng", " ", "delete", "s", " ", "field", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", "[_", "\"", "ok", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Simple", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "456_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "only", " ", "one", " ", "document", " ", "was", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'", "x", "'_", ":_", "456_", "}_", "in_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "{_", "'", "x", "'_", ":_", "42_", "}_", "in_", "docs_", ")_", "or_", "(_", "{_", "'", "x", "'_", ":_", "123_", "}_", "in_", "docs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Multi", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "456_", "}_", "}_", ",_", "multi_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "docs_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "doc_", "==_", "{_", "'", "x", "'_", ":_", "456_", "}_", "for_", "doc_", "in_", "docs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "42_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "123_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "docs_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "docs_", "[_", "0_", "]_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Save_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Save_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "save_", "(_", "123_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "save_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oid_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "save_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "oid_", ",_", "'", "x", "'_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "save_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "oid_", ",_", "'", "x", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "any_", "(_", "doc_", "[_", "'", "x", "'_", "]_", "==_", "1_", "for_", "doc_", "in_", "docs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "oid_", ",_", "'", "x", "'_", ":_", "3_", "}_", "in_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Remove_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Remove_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Remove", "One_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docs_", "=_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "remove_", "(_", "{_", "}_", ",_", "single_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "remaining_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "remaining_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "remaining_", "[_", "0_", "]_", "in_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Remove_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Remove", "Multi", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", ",_", "{_", "'", "y", "'_", ":_", "456_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "remove_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "remaining_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "remaining_", ",_", "[_", "{_", "'", "y", "'_", ":_", "456_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Remove_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Remove", "By", "Id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oid_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "\"\\u", "id", "\"_", ":_", "oid_", ",_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "remove_", "(_", "oid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "remaining_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "remaining_", ",_", "[_", "{_", "'", "y", "'_", ":_", "123_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Remove_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Remove", "Invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "remove_", "(_", "123_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Dist", "inc", "t_", "(_", "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_", "[SEP]_", "class_", "Test", "Dist", "inc", "t_", "(_", "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 ", " _", "self_", "._", "conn_", "=_", "tx", "mongo_", "._", "Mon", "go", "Connection_", "(_", "mongo", "\\u", "host_", ",_", "mongo", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "=_", "self_", "._", "conn_", "._", "myd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "coll_", "=_", "self_", "._", "db_", "._", "myco", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dist", "inc", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "drop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "conn_", "._", "disconnect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dist", "inc", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "13_", "}_", ",_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "13_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "distinct_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "d_", ")_", ",_", "{_", "13_", ",_", "42_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dist", "inc", "t_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "With", "Query_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "{_", "'", "x", "'_", ":_", "13_", "}_", ",_", "{_", "'", "x", "'_", ":_", "42_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", ",_", "{_", "'", "x", "'_", ":_", "42_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "yield_", "self_", "._", "coll_", "._", "distinct_", "(_", "'", "x", "'_", ",_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "gt", "\"_", ":_", "20_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "d_", ")_", ",_", "{_", "42_", ",_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Map", "Reduce", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map", "Reduce", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Map", "Reduce", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Joh", "n", "\"_", ",_", "\"", "grade", "\"_", ":_", "5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Kat", "e", "\"_", ",_", "\"", "grade", "\"_", ":_", "4_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Joh", "n", "\"_", ",_", "\"", "grade", "\"_", ":_", "4_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Kat", "e", "\"_", ",_", "\"", "grade", "\"_", ":_", "4_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Adam", "\"_", ",_", "\"", "grade", "\"_", ":_", "4_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Kat", "e", "\"_", ",_", "\"", "grade", "\"_", ":_", "2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "kid", "\"_", ":_", "\"", "Joh", "n", "\"_", ",_", "\"", "grade", "\"_", ":_", "5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "map_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "emit", "(", "this", ".", "kid", ",", " ", "this", ".", "grade", ");", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "reduce_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "(", "key", ",", " ", "values", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Array", ".", "sum", "(", "values", ");", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "map", "\\u", "reduce_", "(_", "t", "\\u", "map_", ",_", "t", "\\u", "reduce_", ",_", "out_", "=_", "{_", "\"", "inline", "\"_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "\"", "Joh", "n", "\"_", ",_", "\"", "value", "\"_", ":_", "14_", "}_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "\"", "Kat", "e", "\"_", ",_", "\"", "value", "\"_", ":_", "10_", "}_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "\"", "Adam", "\"_", ",_", "\"", "value", "\"_", ":_", "4_", "}_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "map", "\\u", "reduce_", "(_", "t", "\\u", "map_", ",_", "t", "\\u", "reduce_", ",_", "out_", "=_", "{_", "\"", "inline", "\"_", ":_", "1_", "}_", ",_", "full", "\\u", "response_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "[_", "\"", "ok", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "count", "s", "\"_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "results", "\"_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Insert", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "42_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Insert", "One", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", "._", "inserted", "\\u", "id_", ",_", "Object", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oid_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "{_", "'", "x", "'_", ":_", "42_", ",_", "\"\\u", "id", "\"_", ":_", "oid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "._", "insert", "\\u", "one_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "inserted", "\\u", "id_", ",_", "oid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "ok", " ", "to", " ", "issue", " ", "count", "()", " ", "right", " ", "after", " ", "una", "ck", "nowl", "edge", "d", " ", "insert", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "exact", "ly", " ", "one", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "one_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "insert", "\\u", "one_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "1_", "}_", ")_", ",_", "Duplicate", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "._", "insert", "\\u", "one_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "insert", "\\u", "one_", "(_", "{_", "'$'_", ":_", "1_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "._", "insert", "\\u", "one_", "(_", "{_", "'$'_", ":_", "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_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "=_", "[_", "{_", "\"\\u", "id", "\"_", ":_", "i_", "}_", "for_", "i_", "in_", "range_", "(_", "2016_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Test", "Insert", "Many", "_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Arg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "42_", "}_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", "for_", "\\u_", "in_", "range_", "(_", "100_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Insert", "Many", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "set_", "(_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "docs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ids_", ",_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "42_", "}_", "for_", "\\u_", "in_", "range_", "(_", "100_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Insert", "Many", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "{_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "docs_", "}_", ",_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Order", "ed", "Ack", "\\u", "Ok_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "{_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "found_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Order", "ed", "Una", "ck", "\\u", "Ok_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w", "\\u", "0_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "w", "\\u", "0_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "{_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "found_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Order", "ed", "Ack", "\\u", "Fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "500_", "]_", "=_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "499", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ",_", "Bul", "k", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "n", "Insert", "ed", "\"_", "]_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", ")_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "index", "\"_", "]_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "op", "\"_", "]_", ",_", "{_", "\"\\u", "id", "\"_", ":_", "499", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Order", "ed", "Una", "ck", "\\u", "Fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "500_", "]_", "=_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "499", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w", "\\u", "0_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "w", "\\u", "0_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "{_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "found_", "[_", ":_", "500_", "]_", "}_", ",_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", "[_", ":_", "500_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Uno", "rder", "ed", "Ack", "\\u", "Fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "500_", "]_", "=_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "499", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ",_", "ordered_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bul", "k", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "n", "Insert", "ed", "\"_", "]_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "index", "\"_", "]_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "error_", "._", "details_", "[_", "\"", "write", "Error", "s", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "op", "\"_", "]_", ",_", "{_", "\"\\u", "id", "\"_", ":_", "499", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Uno", "rder", "ed", "Una", "ck", "\\u", "Fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "500_", "]_", "=_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", "[_", "499", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w", "\\u", "0_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "w", "\\u", "0_", "._", "insert", "\\u", "many_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ",_", "ordered_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "len_", "(_", "self_", "._", "more", "\\u", "than", "\\u", "1", "k_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "{_", "doc_", "[_", "\"\\u", "id", "\"_", "]_", "for_", "doc_", "in_", "found_", "}_", ",_", "set_", "(_", "result_", "._", "inserted", "\\u", "ids_", ")_", "-_", "{_", "500_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Insert", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Mor", "e", "Than", "16", "Mb", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "8", "mb", " ", "x", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb", "40_", "=_", "[_", "{_", "\"\\u", "id", "\"_", ":_", "i_", ",_", "'", "x", "'_", ":_", "'", "y", "'_", "*_", "(_", "8_", "*_", "1024_", "**_", "2_", ")_", "}_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "mb", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "inserted", "\\u", "ids_", ",_", "list_", "(_", "range_", "(_", "5_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "yield_", "self_", "._", "coll_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "size_", "=_", "sum_", "(_", "len_", "(_", "BS", "ON_", "._", "encode_", "(_", "doc_", ")_", ")_", "for_", "doc_", "in_", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "total", "\\u", "size_", ",_", "40_", "*_", "1024_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Update", "One_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "2_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "123_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "matche", "d\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "modifi", "ed", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "123_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "y", "'_", ":_", "123_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "z", "'_", ":_", "456_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "Object", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "result_", "._", "upse", "rted", "\\u", "id_", "}_", ",_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "y", "'_", ":_", "123_", ",_", "'", "z", "'_", ":_", "456_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "y", "'_", ":_", "123_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "z", "'_", ":_", "456_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", "\\u", "one", "/", "update", "\\u", "many", " ", "only", " ", "allow", " ", "$", "-", "opera", "tors", ",", " ", "not", " ", "whole", " ", "document", " ", "replace", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", ",_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "alter", " ", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "\"\\u", "id", "\"_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "invalid", " ", "field", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'$'_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "create", "\\u", "index_", "(_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "x", "'_", ")_", ")_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "2_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "1_", "}_", "}_", ")_", ",_", "Duplicate", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Replace", "One_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "2_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "matche", "d\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "modifi", "ed", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "5_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "Object", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "\"\\u", "id", "\"_", ":_", "result_", "._", "upse", "rted", "\\u", "id_", "}_", ",_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "5_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "\"", "y", "\"_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "fields_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Replace", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", "\\u", "one", " ", "doe", "s", " ", "not", " ", "allow", " ", "$", "-", "opera", "tors", ",", " ", "only", " ", "whole", " ", "document", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "123_", "}_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Replace", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "{_", "'$'_", ":_", "5_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "create", "\\u", "index_", "(_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "x", "'_", ")_", ")_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "replace", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "2_", "}_", ")_", ",_", "Duplicate", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Update", "Many", "_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "2_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "matche", "d\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "modifi", "ed", "\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", "{_", "'", "y", "'_", ":_", "5_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Update", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", "{_", "'", "y", "'_", ":_", "5_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "5_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "matche", "d\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "modifi", "ed", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", "._", "upse", "rted", "\\u", "id_", ",_", "Object", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "5_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", "\\u", "one", "/", "update", "\\u", "many", " ", "only", " ", "allow", " ", "$", "-", "opera", "tors", ",", " ", "not", " ", "whole", " ", "document", " ", "replace", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "y", "'_", ":_", "123_", "}_", ")_", ",_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Update", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "alter", " ", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "\"\\u", "id", "\"_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "invalid", " ", "field", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'$'_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "create", "\\u", "index_", "(_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "x", "'_", ")_", ")_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "update", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "2_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "x", "'_", ":_", "1_", "}_", "}_", ")_", ",_", "Duplicate", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Delete", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Delete", "One_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "1_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "delete", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Delete", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "delete", "d\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "delete", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Delete", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "One_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "delete", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "{_", "'$'_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Delete", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Delete", "Many", "_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", "}_", ",_", "{_", "'", "x", "'_", ":_", "1_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ack", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "yield_", "self_", "._", "coll_", "._", "delete", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Delete", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "delete", "d\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Una", "ck", "nowl", "edge", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "=_", "self_", "._", "coll_", "._", "with", "\\u", "options_", "(_", "write", "\\u", "concern", "_", "=_", "Write", "Conce", "rn_", "(_", "w_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "yield_", "coll_", "._", "delete", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "result_", ",_", "Delete", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "acknowledge", "d_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Delete", "Many", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Fail", "ures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "delete", "\\u", "many_", "(_", "{_", "'", "x", "'_", ":_", "{_", "'$'_", ":_", "1_", "}_", "}_", ")_", ",_", "Write", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Fin", "d", "One", "And", "Delete_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Delete_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Fin", "d", "One", "And", "Delete_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "1_", ",_", "'", "y", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "2_", ",_", "'", "y", "'_", ":_", "2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "3_", ",_", "'", "y", "'_", ":_", "3_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Delete_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Sort_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "delete_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", "[_", "'", "x", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "delete_", "(_", "{_", "'", "x", "'_", ":_", "{_", "\"$", "exist", "s", "\"_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "DESC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", "[_", "'", "x", "'_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "yield_", "self_", "._", "coll_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cnt_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Delete_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Projection", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "delete_", "(_", "{_", "'", "x", "'_", ":_", "2_", "}_", ",_", "{_", "'", "y", "'_", ":_", "1_", ",_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "y", "'_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Fin", "d", "One", "And", "Replace", "_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "10_", ",_", "'", "y", "'_", ":_", "10_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "20_", ",_", "'", "y", "'_", ":_", "20_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "30_", ",_", "'", "y", "'_", ":_", "30_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Sort_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "}_", ",_", "{_", "'", "x", "'_", ":_", "5_", ",_", "'", "y", "'_", ":_", "5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "x", "'_", ":_", "10_", ",_", "'", "y", "'_", ":_", "10_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "}_", ",_", "{_", "'", "x", "'_", ":_", "40_", ",_", "'", "y", "'_", ":_", "40_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "DESC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "x", "'_", ":_", "30_", ",_", "'", "y", "'_", ":_", "30_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ys_", "=_", "yield_", "self_", "._", "coll_", "._", "distinct_", "(_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "ys_", ")_", ",_", "{_", "5_", ",_", "20_", ",_", "40_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Replace", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "z", "'_", ":_", "1_", "}_", "}_", ")_", ",_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "'", "x", "'_", ":_", "40_", "}_", ",_", "{_", "'", "x", "'_", ":_", "50_", "}_", ",_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xs_", "=_", "yield_", "self_", "._", "coll_", "._", "distinct_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "xs_", ")_", ",_", "{_", "10_", ",_", "20_", ",_", "30_", ",_", "50_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Return", "Document_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "'", "x", "'_", ":_", "10_", "}_", ",_", "{_", "'", "x", "'_", ":_", "15_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "document_", "=_", "Return", "Document_", "._", "BEFORE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", "[_", "'", "x", "'_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "'", "x", "'_", ":_", "20_", "}_", ",_", "{_", "'", "x", "'_", ":_", "25_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "document_", "=_", "Return", "Document_", "._", "AFTER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", "[_", "'", "x", "'_", "]_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Replace", "_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Return", "Document_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "replace_", "(_", "{_", "}_", ",_", "{_", "}_", ",_", "return", "\\u", "document_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "super_", "(_", "Test", "Fin", "d", "One", "And", "Update_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "coll_", "._", "insert", "\\u", "many_", "(_", "[_", "{_", "'", "x", "'_", ":_", "10_", ",_", "'", "y", "'_", ":_", "10_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "20_", ",_", "'", "y", "'_", ":_", "20_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "30_", ",_", "'", "y", "'_", ":_", "30_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Sort_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "ASC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "x", "'_", ":_", "10_", ",_", "'", "y", "'_", ":_", "10_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "35_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "{_", "\"\\u", "id", "\"_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "qf", "_", "._", "sort_", "(_", "qf", "_", "._", "DESC", "ENDING_", "(_", "'", "y", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "{_", "'", "x", "'_", ":_", "30_", ",_", "'", "y", "'_", ":_", "30_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ys_", "=_", "yield_", "self_", "._", "coll_", "._", "distinct_", "(_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "ys_", ")_", ",_", "{_", "5_", ",_", "20_", ",_", "35_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Inva", "lid", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Failure_", "(_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "}_", ",_", "{_", "'", "x", "'_", ":_", "123_", "}_", ")_", ",_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Ups", "ert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "'", "x", "'_", ":_", "40_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "40_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inserted", "_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one_", "(_", "{_", "'", "x", "'_", ":_", "40_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inserted", "_", "[_", "'", "y", "'_", "]_", ",_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "One", "And", "Update_", "(_", "\\u", "Sing", "le", "Collecti", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "Return", "Document_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "'", "x", "'_", ":_", "10_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "5_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "document_", "=_", "Return", "Document_", "._", "BEFORE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "doc_", "[_", "'", "y", "'_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "yield_", "self_", "._", "coll_", "._", "find", "\\u", "one", "\\u", "and", "\\u", "update_", "(_", "{_", "'", "x", "'_", ":_", "10_", "}_", ",_", "{_", "\"$", "set", "\"_", ":_", "{_", "'", "y", "'_", ":_", "15_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "document_", "=_", "Return", "Document_", "._", "AFTER",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
haystack/eyebrowse-server/accounts/urls.py
[ { "content": "from django.conf.urls import include\nfrom django.conf.urls import patterns\nfrom django.conf.urls import url\n\nurlpatterns = patterns('accounts.views',\n\n url(r'', include('registration.backends.default.urls')),\n\n url(r'^profile/sharelist$', 'whitelist'),\n url(r'^profile/account$', 'account'),\n url(r'^profile/mutelist', 'mutelist'),\n url(r'^profile/edit_tags', 'edit_tags'),\n url(r'^profile/sync_twitter', 'sync_twitter'),\n url(r'^profile/sync_delicious', 'sync_delicious'),\n url(r'^profile/edit$', 'account'), # old extensions\n url(r'^profile/connections$', 'connections'),\n url(r'^connect$', 'connect')\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "include_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "'", "account", "s", ".", "views", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "''_", ",_", "include_", "(_", "'", "registration", ".", "back", "ends", ".", "default", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "share", "list", "$'_", ",_", "'", "whitelist", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "account", "$'_", ",_", "'", "account", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "mute", "list", "'_", ",_", "'", "mute", "list", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "edit", "\\u", "tags", "'_", ",_", "'", "edit", "\\u", "tags", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "sync", "\\u", "twit", "ter", "'_", ",_", "'", "sync", "\\u", "twit", "ter", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "sync", "\\u", "deli", "cio", "us", "'_", ",_", "'", "sync", "\\u", "deli", "cio", "us", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "edit", "$'_", ",_", "'", "account", "'_", ")_", ",_", "#", " ", "old", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "profile", "/", "connections", "$'_", ",_", "'", "connections", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "connect", "$'_", ",_", "'", "connect", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ipython/ipython-py3k/IPython/core/tests/test_iplib.py
[ { "content": "@dec.parametric\ndef test_reset():\n \"\"\"reset must clear most namespaces.\"\"\"\n # The number of variables in the private user_ns_hidden is not zero, but it\n # should be constant regardless of what we do\n nvars_config_ns = len(ip.user_ns_hidden)\n\n # Check that reset runs without error\n ip.reset()\n\n # Once we've reset it (to clear of any junk that might have been there from\n # other tests, we can count how many variables are in the user's namespace\n nvars_user_ns = len(ip.user_ns)\n\n # Now add a few variables to user_ns, and check that reset clears them\n ip.user_ns['x'] = 1\n ip.user_ns['y'] = 1\n ip.reset()\n \n # Finally, check that all namespaces have only as many variables as we\n # expect to find in them:\n for ns in ip.ns_refs_table:\n if ns is ip.user_ns:\n nvars_expected = nvars_user_ns\n elif ns is ip.user_ns_hidden:\n nvars_expected = nvars_config_ns\n else:\n nvars_expected = 0\n \n yield nt.assert_equals(len(ns), nvars_expected)", "metadata": "root.test_reset", "header": "['module', '___EOS___']", "index": 29 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "dec_", "._", "parametr", "ic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "reset_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "reset", " ", "must", " ", "clear", " ", "most", " ", "namespace", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "number", " ", "of", " ", "variab", "les", " ", "in", " ", "the", " ", "private", " ", "user", "\\u", "ns", "\\u", "hidden", " ", "is", " ", "not", " ", "zero", ",", " ", "but", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "constant", " ", "rega", "rd", "less", " ", "of", " ", "what", " ", "we", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "nvar", "s", "\\u", "config", "\\u", "ns_", "=_", "len_", "(_", "ip_", "._", "user", "\\u", "ns", "\\u", "hidden_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "reset", " ", "runs", " ", "with", "out", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ce", " ", "we", "'", "ve", " ", "reset", " ", "it", " ", "(", "to", " ", "clear", " ", "of", " ", "any", " ", "junk", " ", "tha", "t", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "there", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "tests", ",", " ", "we", " ", "can", " ", "count", " ", "how", " ", "many", " ", "variab", "les", " ", "are", " ", "in", " ", "the", " ", "user", "'", "s", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "nvar", "s", "\\u", "user", "\\u", "ns_", "=_", "len_", "(_", "ip_", "._", "user", "\\u", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "add", " ", "a", " ", "few", " ", "variab", "les", " ", "to", " ", "user", "\\u", "ns", ",", " ", "and", " ", "check", " ", "tha", "t", " ", "reset", " ", "clear", "s", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "x", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "y", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "all", " ", "namespace", "s", " ", "have", " ", "only", " ", "as", " ", "many", " ", "variab", "les", " ", "as", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expect", " ", "to", " ", "find", " ", "in", " ", "them", ":_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ns_", "in_", "ip_", "._", "ns", "\\u", "refs", "\\u", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ns_", "is_", "ip_", "._", "user", "\\u", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "nvar", "s", "\\u", "user", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ns_", "is_", "ip_", "._", "user", "\\u", "ns", "\\u", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "nvar", "s", "\\u", "config", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "nt_", "._", "assert", "\\u", "equals_", "(_", "len_", "(_", "ns_", ")_", ",_", "nvar", "s", "\\u", "expected_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete URL substring sanitization
openstack/bandit/examples/requests-ssl-verify-disabled.py
[ { "content": "import requests\n\nrequests.get('https://gmail.com', verify=True)\nrequests.get('https://gmail.com', verify=False)\nrequests.post('https://gmail.com', verify=True)\nrequests.post('https://gmail.com', verify=False)\nrequests.put('https://gmail.com', verify=True)\nrequests.put('https://gmail.com', verify=False)\nrequests.delete('https://gmail.com', verify=True)\nrequests.delete('https://gmail.com', verify=False)\nrequests.patch('https://gmail.com', verify=True)\nrequests.patch('https://gmail.com', verify=False)\nrequests.options('https://gmail.com', verify=True)\nrequests.options('https://gmail.com', verify=False)\nrequests.head('https://gmail.com', verify=True)\nrequests.head('https://gmail.com', verify=False)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "._", "get_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "get_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "post_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "post_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "put_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "put_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "delete_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "delete_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "patch_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "patch_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "options_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "options_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "head_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "head_", "(_", "'", "https", "://", "gma", "il", ".", "com", "'_", ",_", "verify_", "=_", "False_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
heiskr/sagefy/server/test/test_routes_user.py
[ { "content": "from passlib.hash import bcrypt\nfrom models.user import User\nfrom conftest import create_user_in_db\nimport rethinkdb as r\nimport routes.user\nimport pytest\n\nxfail = pytest.mark.xfail\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_user_get(db_conn, users_table):\n \"\"\"\n Ensure a user can be retrieved by ID.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {'params': {}, 'db_conn': db_conn}\n code, response = routes.user.get_user_route(request, 'abcd1234')\n assert response['user']['name'] == 'test'", "metadata": "root.test_user_get", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def test_user_get_failed(db_conn, users_table):\n \"\"\"\n Ensure a no user is returned when ID doesn't match.\n \"\"\"\n\n request = {'params': {}, 'db_conn': db_conn}\n code, response = routes.user.get_user_route(request, 'abcd1234')\n assert 'errors' in response", "metadata": "root.test_user_get_failed", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_get_user_posts(db_conn, session, posts_table):\n \"\"\"\n Expect to get user's 10 latest posts when requested in addition.\n \"\"\"\n\n posts_table.insert([{\n 'created': r.now(),\n 'modified': r.now(),\n 'user_id': 'abcd1234',\n 'topic_id': 'fj2Ojfdskl2',\n 'body': '''A Modest Proposal for Preventing the Children of Poor\n People From Being a Burthen to Their Parents or Country, and\n for Making Them Beneficial to the Publick.''',\n 'kind': 'post',\n }, {\n 'created': r.now(),\n 'modified': r.now(),\n 'user_id': 'gjrklj15431',\n 'topic_id': 'fj2Ojfdskl2',\n 'body': '''A Modest Proposal for Preventing the Children of Poor\n People From Being a Burthen to Their Parents or Country, and\n for Making Them Beneficial to the Publick.''',\n 'kind': 'post',\n }, {\n 'created': r.now(),\n 'modified': r.now(),\n 'user_id': 'abcd1234',\n 'topic_id': 'fj2Ojfdskl2',\n 'body': '''A Modest Proposal for Preventing the Children of Poor\n People From Being a Burthen to Their Parents or Country, and\n for Making Them Beneficial to the Publick.''',\n 'kind': 'post',\n }]).run(db_conn)\n\n request = {\n 'params': {'posts': True},\n 'cookies': {'session_id': session},\n 'db_conn': db_conn\n }\n code, response = routes.user.get_user_route(request, 'abcd1234')\n assert 'posts' in response\n assert len(response['posts']) == 2", "metadata": "root.test_get_user_posts", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def test_get_user_sets(db_conn, session, users_sets_table,\n users_table, sets_table):\n \"\"\"\n Expect to get user's sets, if requested and allowed.\n \"\"\"\n\n users_table.get('abcd1234').update({\n 'settings': {'view_sets': 'public'}\n }).run(db_conn)\n\n sets_table.insert([{\n 'entity_id': 'A1',\n 'name': 'A',\n 'body': 'Apple',\n 'created': r.now(),\n 'modified': r.now(),\n 'status': 'accepted',\n }, {\n 'entity_id': 'B2',\n 'name': 'B',\n 'body': 'Banana',\n 'created': r.now(),\n 'modified': r.now(),\n 'status': 'accepted',\n }]).run(db_conn)\n\n users_sets_table.insert({\n 'user_id': 'abcd1234',\n 'set_ids': [\n 'A1',\n 'B2',\n ],\n 'created': r.now(),\n 'modified': r.now(),\n }).run(db_conn)\n\n request = {\n 'params': {'sets': True},\n 'cookies': {'session_id': session},\n 'db_conn': db_conn\n }\n code, response = routes.user.get_user_route(request, 'abcd1234')\n assert 'sets' in response\n assert len(response['sets']) == 2", "metadata": "root.test_get_user_sets", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def test_get_user_follows(db_conn, session, users_table, follows_table):\n \"\"\"\n Expect to get user's follows, if requested and allowed.\n \"\"\"\n\n users_table.get('abcd1234').update({\n 'settings': {'view_follows': 'public'}\n }).run(db_conn)\n\n follows_table.insert([{\n 'id': 'JIkfo034n',\n 'user_id': 'abcd1234',\n 'entity': {\n 'kind': 'card',\n 'id': 'JFlsjFm',\n },\n 'created': r.now(),\n 'modified': r.now(),\n }]).run(db_conn)\n\n request = {\n 'params': {'follows': True},\n 'cookies': {'session_id': session},\n 'db_conn': db_conn\n }\n code, response = routes.user.get_user_route(request, 'abcd1234')\n assert 'follows' in response\n assert len(response['follows']) == 1", "metadata": "root.test_get_user_follows", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def test_user_log_in(db_conn, users_table):\n \"\"\"\n Ensure a user can log in.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {\n 'params': {'name': 'test', 'password': 'abcd1234'},\n 'db_conn': db_conn\n }\n code, response = routes.user.log_in_route(request)\n assert 'test@example.com' == response['user']['email']", "metadata": "root.test_user_log_in", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def test_user_log_in_none(db_conn, users_table):\n \"\"\"\n Ensure a user can't log in if no user by name.\n \"\"\"\n\n request = {\n 'params': {'name': 'test', 'password': 'abcd1234'},\n 'db_conn': db_conn\n }\n code, response = routes.user.log_in_route(request)\n assert 'errors' in response", "metadata": "root.test_user_log_in_none", "header": "['module', '___EOS___']", "index": 165 }, { "content": "def test_user_log_in_password_fail(db_conn, users_table):\n \"\"\"\n Ensure a user can't log in if password is wrong.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {\n 'params': {'name': 'test', 'password': '1234abcd'},\n 'db_conn': db_conn\n }\n code, response = routes.user.log_in_route(request)\n assert 'errors' in response", "metadata": "root.test_user_log_in_password_fail", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def test_user_log_out(db_conn, users_table):\n \"\"\"\n Ensure a user can log out.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {\n 'params': {'name': 'test', 'password': 'abcd1234'},\n 'db_conn': db_conn\n }\n code, response = routes.user.log_in_route(request)\n assert code == 200\n session_id = response['cookies']['session_id']\n request = {'cookies': {'session_id': session_id}}\n code, response = routes.user.log_out_route(request)\n assert code == 200\n assert 'cookies' in response", "metadata": "root.test_user_log_out", "header": "['module', '___EOS___']", "index": 192 }, { "content": "def test_user_get_current(session, db_conn):\n \"\"\"\n Ensure the current user can be retrieved.\n \"\"\"\n\n request = {'cookies': {'session_id': session}, 'db_conn': db_conn}\n code, response = routes.user.get_current_user_route(request)\n assert response['user']['name'] == 'test'", "metadata": "root.test_user_get_current", "header": "['module', '___EOS___']", "index": 211 }, { "content": "def test_user_get_current_failed(db_conn, users_table):\n \"\"\"\n Ensure no user is returned when logged out.\n \"\"\"\n\n code, response = routes.user.get_current_user_route({})\n assert code == 401", "metadata": "root.test_user_get_current_failed", "header": "['module', '___EOS___']", "index": 221 }, { "content": "def test_user_create(db_conn, users_table):\n \"\"\"\n Ensure a user can be created.\n \"\"\"\n\n request = {\n 'params': {\n 'name': 'test',\n 'email': 'test@example.com',\n 'password': 'abcd1234',\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.create_user_route(request)\n assert code == 200\n assert response['user']['name'] == 'test'", "metadata": "root.test_user_create", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def test_user_create_failed(db_conn, users_table):\n \"\"\"\n Ensure a user will fail to create when invalid.\n \"\"\"\n\n request = {\n 'params': {},\n 'db_conn': db_conn\n }\n code, response = routes.user.create_user_route(request)\n assert 'errors' in response", "metadata": "root.test_user_create_failed", "header": "['module', '___EOS___']", "index": 248 }, { "content": "def test_user_update(session, db_conn):\n \"\"\"\n Ensure a user can be updated.\n \"\"\"\n\n request = {\n 'params': {\n 'email': 'other@example.com'\n },\n 'cookies': {\n 'session_id': session,\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.update_user_route(request, 'abcd1234')\n assert code == 200\n assert response['user']['email'] == 'other@example.com'", "metadata": "root.test_user_update", "header": "['module', '___EOS___']", "index": 261 }, { "content": "def test_user_update_none(db_conn, users_table):\n \"\"\"\n Ensure a user won't update if not exist.\n \"\"\"\n\n request = {\n 'params': {\n 'email': 'other@example.com'\n },\n 'cookies': {\n 'session_id': 'fjsknl',\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.update_user_route(request, 'abcd1234')\n assert 'errors' in response", "metadata": "root.test_user_update_none", "header": "['module', '___EOS___']", "index": 280 }, { "content": "def test_user_update_self_only(db_conn, users_table, session):\n \"\"\"\n Ensure a user can only update herself.\n \"\"\"\n\n users_table.insert({\n 'id': '1234abcd',\n 'name': 'other',\n 'email': 'other@example.com',\n 'password': bcrypt.encrypt('1234abcd'),\n }).run(db_conn)\n\n request = {\n 'params': {\n 'email': 'other@example.com'\n },\n 'cookies': {\n 'session_id': session,\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.update_user_route(request, '1234abcd')\n assert 'errors' in response", "metadata": "root.test_user_update_self_only", "header": "['module', '___EOS___']", "index": 298 }, { "content": "def test_user_update_invalid(db_conn, users_table, session):\n \"\"\"\n Ensure a user won't update if invalid.\n \"\"\"\n\n request = {\n 'params': {\n 'email': 'other'\n },\n 'cookies': {\n 'session_id': session,\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.update_user_route(request, 'abcd1234')\n assert 'errors' in response", "metadata": "root.test_user_update_invalid", "header": "['module', '___EOS___']", "index": 323 }, { "content": "def test_user_token_fail(db_conn, users_table):\n \"\"\"\n Expect to create a token so the user can get a new password.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {'params': {'email': 'other'}, 'db_conn': db_conn}\n code, response = routes.user.create_token_route(request)\n assert code == 404", "metadata": "root.test_user_token_fail", "header": "['module', '___EOS___']", "index": 341 }, { "content": "def test_user_token_success(db_conn, users_table):\n \"\"\"\n Expect to create a token so the user can get a new password.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n request = {'params': {'email': 'test@example.com'}, 'db_conn': db_conn}\n code, response = routes.user.create_token_route(request)\n assert code == 200", "metadata": "root.test_user_token_success", "header": "['module', '___EOS___']", "index": 352 }, { "content": "def test_user_create_password_fail(db_conn, users_table):\n \"\"\"\n Expect a user to be able to reset their password.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n user = User.get(db_conn, id='abcd1234')\n pw1 = user['password']\n user.get_email_token(send_email=False)\n\n request = {\n 'params': {\n 'token': 'qza',\n 'password': 'qwer1234'\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.create_password_route(request, 'abcd1234')\n assert code == 403\n user.sync(db_conn)\n assert user['password'] == pw1", "metadata": "root.test_user_create_password_fail", "header": "['module', '___EOS___']", "index": 363 }, { "content": "def test_user_create_password_ok(db_conn, users_table):\n \"\"\"\n Expect a user to be able to reset their password.\n \"\"\"\n\n create_user_in_db(users_table, db_conn)\n user = User.get(db_conn, id='abcd1234')\n pw1 = user['password']\n token = user.get_email_token(send_email=False)\n\n request = {\n 'params': {\n 'token': token,\n 'password': 'qwer1234'\n },\n 'db_conn': db_conn\n }\n code, response = routes.user.create_password_route(request, 'abcd1234')\n assert code == 200\n user.sync(db_conn)\n assert user['password'] != pw1", "metadata": "root.test_user_create_password_ok", "header": "['module', '___EOS___']", "index": 386 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pass", "lib_", "._", "hash_", "import_", "bcrypt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "models_", "._", "user_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "conftest", "_", "import_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ret", "hin", "kd", "b_", "as_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xfail_", "=_", "pytest_", "._", "mark_", "._", "xfail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "user", "\\u", "get_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "be", " ", "retrieved", " ", "by", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "'", "params", "'_", ":_", "{_", "}_", ",_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "'", "user", "'_", "]_", "[_", "'", "name", "'_", "]_", "==_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "get", "\\u", "failed_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "no", " ", "user", " ", "is", " ", "return", "ed", " ", "whe", "n", " ", "ID", " ", "doe", "sn", "'", "t", " ", "match", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "params", "'_", ":_", "{_", "}_", ",_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "get", "\\u", "user", "\\u", "posts_", "(_", "db", "\\u", "conn_", ",_", "session_", ",_", "posts", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "to", " ", "get", " ", "user", "'", "s", " ", "10", " ", "late", "st", " ", "posts", " ", "whe", "n", " ", "request", "ed", " ", "in", " ", "addition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts", "\\u", "table_", "._", "insert_", "(_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "abc", "d1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "\\u", "id", "'_", ":_", "'", "fj", "2", "Oj", "fds", "kl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "'''", "A", " ", "Mode", "st", " ", "Propos", "al", " ", "for", " ", "Prev", "enti", "ng", " ", "the", " ", "Chil", "dre", "n", " ", "of", " ", "Poo", "r", "\\", "10", ";", " ", " ", " ", " ", "Pe", "opl", "e", " ", "Fro", "m", " ", "Bei", "ng", " ", "a", " ", "Bur", "then", " ", "to", " ", "The", "ir", " ", "Parent", "s", " ", "or", " ", "Count", "ry", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "Maki", "ng", " ", "Them", " ", "Benefi", "cia", "l", " ", "to", " ", "the", " ", "Public", "k", ".'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "gj", "rk", "lj", "154", "3", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "\\u", "id", "'_", ":_", "'", "fj", "2", "Oj", "fds", "kl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "'''", "A", " ", "Mode", "st", " ", "Propos", "al", " ", "for", " ", "Prev", "enti", "ng", " ", "the", " ", "Chil", "dre", "n", " ", "of", " ", "Poo", "r", "\\", "10", ";", " ", " ", " ", " ", "Pe", "opl", "e", " ", "Fro", "m", " ", "Bei", "ng", " ", "a", " ", "Bur", "then", " ", "to", " ", "The", "ir", " ", "Parent", "s", " ", "or", " ", "Count", "ry", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "Maki", "ng", " ", "Them", " ", "Benefi", "cia", "l", " ", "to", " ", "the", " ", "Public", "k", ".'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "abc", "d1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "\\u", "id", "'_", ":_", "'", "fj", "2", "Oj", "fds", "kl", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "'''", "A", " ", "Mode", "st", " ", "Propos", "al", " ", "for", " ", "Prev", "enti", "ng", " ", "the", " ", "Chil", "dre", "n", " ", "of", " ", "Poo", "r", "\\", "10", ";", " ", " ", " ", " ", "Pe", "opl", "e", " ", "Fro", "m", " ", "Bei", "ng", " ", "a", " ", "Bur", "then", " ", "to", " ", "The", "ir", " ", "Parent", "s", " ", "or", " ", "Count", "ry", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "Maki", "ng", " ", "Them", " ", "Benefi", "cia", "l", " ", "to", " ", "the", " ", "Public", "k", ".'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "posts", "'_", ":_", "True_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "'", "session", "\\u", "id", "'_", ":_", "session_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "posts", "'_", "in_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "response_", "[_", "'", "posts", "'_", "]_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "user", "\\u", "sets_", "(_", "db", "\\u", "conn_", ",_", "session_", ",_", "users", "\\u", "sets", "\\u", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "table_", ",_", "sets", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "to", " ", "get", " ", "user", "'", "s", " ", "sets", ",", " ", "if", " ", "request", "ed", " ", "and", " ", "allow", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "table_", "._", "get_", "(_", "'", "abc", "d1", "234", "'_", ")_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "settings", "'_", ":_", "{_", "'", "view", "\\u", "sets", "'_", ":_", "'", "public", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sets", "\\u", "table_", "._", "insert_", "(_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "id", "'_", ":_", "'", "A1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "A", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "'", "Apple", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "accept", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "id", "'_", ":_", "'", "B2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "'", "Ban", "ana", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "accept", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "sets", "\\u", "table_", "._", "insert_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "abc", "d1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "ids", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "A1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "B2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "sets", "'_", ":_", "True_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "'", "session", "\\u", "id", "'_", ":_", "session_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "sets", "'_", "in_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "response_", "[_", "'", "sets", "'_", "]_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "user", "\\u", "follow", "s_", "(_", "db", "\\u", "conn_", ",_", "session_", ",_", "users", "\\u", "table_", ",_", "follow", "s", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "to", " ", "get", " ", "user", "'", "s", " ", "follow", "s", ",", " ", "if", " ", "request", "ed", " ", "and", " ", "allow", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "table_", "._", "get_", "(_", "'", "abc", "d1", "234", "'_", ")_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "settings", "'_", ":_", "{_", "'", "view", "\\u", "follow", "s", "'_", ":_", "'", "public", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "follow", "s", "\\u", "table_", "._", "insert_", "(_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "JI", "kf", "o0", "3", "4", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "abc", "d1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "card", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "JF", "ls", "j", "Fm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "r_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "follow", "s", "'_", ":_", "True_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "'", "session", "\\u", "id", "'_", ":_", "session_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "follow", "s", "'_", "in_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "response_", "[_", "'", "follow", "s", "'_", "]_", ")_", "==_", "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_", "test\\u", "user", "\\u", "log", "\\u", "in_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "log", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "test", "'_", ",_", "'", "password", "'_", ":_", "'", "abc", "d1", "234", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "log", "\\u", "in", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "test", "@", "example", ".", "com", "'_", "==_", "response_", "[_", "'", "user", "'_", "]_", "[_", "'", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "log", "\\u", "in", "\\u", "none_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", "'", "t", " ", "log", " ", "in", " ", "if", " ", "no", " ", "user", " ", "by", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "test", "'_", ",_", "'", "password", "'_", ":_", "'", "abc", "d1", "234", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "log", "\\u", "in", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "log", "\\u", "in", "\\u", "password", "\\u", "fail_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", "'", "t", " ", "log", " ", "in", " ", "if", " ", "password", " ", "is", " ", "wrong", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "test", "'_", ",_", "'", "password", "'_", ":_", "'", "1234", "abc", "d", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "log", "\\u", "in", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "log", "\\u", "out_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "log", " ", "out", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "test", "'_", ",_", "'", "password", "'_", ":_", "'", "abc", "d1", "234", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "log", "\\u", "in", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "id_", "=_", "response_", "[_", "'", "cookie", "s", "'_", "]_", "[_", "'", "session", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "'", "cookie", "s", "'_", ":_", "{_", "'", "session", "\\u", "id", "'_", ":_", "session", "\\u", "id_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "log", "\\u", "out", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "cookie", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "get", "\\u", "current_", "(_", "session_", ",_", "db", "\\u", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "current", " ", "user", " ", "can", " ", "be", " ", "retrieved", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "cookie", "s", "'_", ":_", "{_", "'", "session", "\\u", "id", "'_", ":_", "session_", "}_", ",_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "current", "\\u", "user", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "'", "user", "'_", "]_", "[_", "'", "name", "'_", "]_", "==_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "get", "\\u", "current", "\\u", "failed_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "no", " ", "user", " ", "is", " ", "return", "ed", " ", "whe", "n", " ", "logged", " ", "out", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "get", "\\u", "current", "\\u", "user", "\\u", "route_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "401_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "create_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "be", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "test", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "abc", "d1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "user", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "'", "user", "'_", "]_", "[_", "'", "name", "'_", "]_", "==_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "create", "\\u", "failed_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "will", " ", "fail", " ", "to", " ", "create", " ", "whe", "n", " ", "invalid", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "user", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "update_", "(_", "session_", ",_", "db", "\\u", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "other", "@", "example", ".", "com", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "id", "'_", ":_", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "update", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "'", "user", "'_", "]_", "[_", "'", "email", "'_", "]_", "==_", "'", "other", "@", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "update", "\\u", "none_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "won", "'", "t", " ", "update", " ", "if", " ", "not", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "other", "@", "example", ".", "com", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "id", "'_", ":_", "'", "fj", "sk", "nl", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "update", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "update", "\\u", "self", "\\u", "only_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "can", " ", "only", " ", "update", " ", "hers", "elf", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "table_", "._", "insert_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "1234", "abc", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "other", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "other", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "bcrypt", "_", "._", "encrypt_", "(_", "'", "1234", "abc", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "run_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "other", "@", "example", ".", "com", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "id", "'_", ":_", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "update", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "1234", "abc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "update", "\\u", "invalid_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "a", " ", "user", " ", "won", "'", "t", " ", "update", " ", "if", " ", "invalid", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "other", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "id", "'_", ":_", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "update", "\\u", "user", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "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_", "test\\u", "user", "\\u", "token", "\\u", "fail_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "to", " ", "create", " ", "a", " ", "token", " ", "so", " ", "the", " ", "user", " ", "can", " ", "get", " ", "a", " ", "new", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "'", "params", "'_", ":_", "{_", "'", "email", "'_", ":_", "'", "other", "'_", "}_", ",_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "token", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "404_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "token", "\\u", "success_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "to", " ", "create", " ", "a", " ", "token", " ", "so", " ", "the", " ", "user", " ", "can", " ", "get", " ", "a", " ", "new", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "'", "params", "'_", ":_", "{_", "'", "email", "'_", ":_", "'", "test", "@", "example", ".", "com", "'_", "}_", ",_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "token", "\\u", "route_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "create", "\\u", "password", "\\u", "fail_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "a", " ", "user", " ", "to", " ", "be", " ", "able", " ", "to", " ", "reset", " ", "thei", "r", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "._", "get_", "(_", "db", "\\u", "conn_", ",_", "id_", "=_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pw", "1_", "=_", "user_", "[_", "'", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "get", "\\u", "email", "\\u", "token_", "(_", "send", "\\u", "email_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "'", "qz", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "qwe", "r1", "234", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "password", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "403_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "sync_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "user_", "[_", "'", "password", "'_", "]_", "==_", "pw", "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_", "test\\u", "user", "\\u", "create", "\\u", "password", "\\u", "ok_", "(_", "db", "\\u", "conn_", ",_", "users", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", " ", "a", " ", "user", " ", "to", " ", "be", " ", "able", " ", "to", " ", "reset", " ", "thei", "r", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "user", "\\u", "in", "\\u", "db_", "(_", "users", "\\u", "table_", ",_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "._", "get_", "(_", "db", "\\u", "conn_", ",_", "id_", "=_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pw", "1_", "=_", "user_", "[_", "'", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "user_", "._", "get", "\\u", "email", "\\u", "token_", "(_", "send", "\\u", "email_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "qwe", "r1", "234", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "\\u", "conn", "'_", ":_", "db", "\\u", "conn_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "response_", "=_", "routes_", "._", "user_", "._", "create", "\\u", "password", "\\u", "route_", "(_", "request_", ",_", "'", "abc", "d1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "sync_", "(_", "db", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "user_", "[_", "'", "password", "'_", "]_", "!=_", "pw", "1_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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core_tasks/reporting_server_run.py
[ { "content": "# coding=utf-8\n# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n unicode_literals, with_statement)\n\nimport logging\n\nfrom pants.binaries import binary_util\nfrom pants.reporting.reporting_server import ReportingServerManager\nfrom pants.task.task import QuietTaskMixin, Task\n\n\nlogger = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ReportingServerRun(QuietTaskMixin, Task):\n \"\"\"Run the reporting server.\"\"\"\n\n\n", "metadata": "root.ReportingServerRun", "header": "['module', '___EOS___']", "index": 17 }, { "content": " @classmethod\n def register_options(cls, register):\n super(ReportingServerRun, cls).register_options(register)\n register('--port', type=int, default=0,\n help='Serve on this port. Leave unset to choose a free port '\n 'automatically (recommended if using pants concurrently in '\n 'multiple workspaces on the same host).')\n register('--allowed-clients', type=list, default=['127.0.0.1'],\n help='Only requests from these IPs may access this server. Useful for '\n 'temporarily showing build results to a colleague. The special '\n 'value ALL means any client may connect. Use with caution, as '\n 'your source code is exposed to all allowed clients!')\n register('--open', type=bool,\n help='Attempt to open the server web ui in a browser.')\n register('--template-dir', advanced=True,\n help='Use templates from this dir instead of the defaults.')\n register('--assets-dir', advanced=True,\n help='Use assets from this dir instead of the defaults.')", "metadata": "root.ReportingServerRun.register_options", "header": "['class', 'ReportingServerRun', '(', 'QuietTaskMixin', ',', 'Task', ')', ':', '___EOS___']", "index": 20 }, { "content": " def _maybe_open(self, port):\n if self.get_options().open:\n binary_util.ui_open('http://localhost:{port}'.format(port=port))", "metadata": "root.ReportingServerRun._maybe_open", "header": "['class', 'ReportingServerRun', '(', 'QuietTaskMixin', ',', 'Task', ')', ':', '___EOS___']", "index": 39 }, { "content": " def execute(self):\n manager = ReportingServerManager(self.context, self.get_options())\n\n if manager.is_alive():\n logger.info('Server already running with pid {pid} at http://localhost:{port}'\n .format(pid=manager.pid, port=manager.socket))\n else:\n manager.daemonize()\n manager.await_socket(10)\n\n logger.info('Launched server with pid {pid} at http://localhost:{port}'\n .format(pid=manager.pid, port=manager.socket))\n\n self._maybe_open(manager.socket)", "metadata": "root.ReportingServerRun.execute", "header": "['class', 'ReportingServerRun', '(', 'QuietTaskMixin', ',', 'Task', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Pant", "s", " ", "project", " ", "contributor", "s", " ", "(", "see", " ", "CONTRIB", "UTO", "RS", ".", "md", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "see", " ", "LICENSE", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "generators_", ",_", "nest", "ed", "\\u", "scopes_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ",_", "with", "\\u", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pants_", "._", "binaries", "_", "import_", "binar", "y", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pants_", "._", "reporting", "_", "._", "reporting", "\\u", "server_", "import_", "Report", "ing", "Server", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pants_", "._", "task_", "._", "task_", "import_", "Qui", "et", "Task", "Mixin_", ",_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Report", "ing", "Server", "Run_", "(_", "Qui", "et", "Task", "Mixin_", ",_", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "the", " ", "reporting", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Server", "Run_", "(_", "Qui", "et", "Task", "Mixin_", ",_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "options_", "(_", "cls_", ",_", "register_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Report", "ing", "Server", "Run_", ",_", "cls_", ")_", "._", "register", "\\u", "options_", "(_", "register_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "(_", "'--", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Serv", "e", " ", "on", " ", "this", " ", "port", ".", " ", "Leav", "e", " ", "unse", "t", " ", "to", " ", "choose", " ", "a", " ", "free", " ", "port", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "automati", "call", "y", " ", "(", "recommende", "d", " ", "if", " ", "usi", "ng", " ", "pant", "s", " ", "concurrent", "ly", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "multiple", " ", "workspaces", " ", "on", " ", "the", " ", "same", " ", "host", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "(_", "'--", "allow", "ed", "-", "clients", "'_", ",_", "type_", "=_", "list_", ",_", "default_", "=_", "[_", "'", "127", ".0", ".0", ".1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "On", "ly", " ", "request", "s", " ", "from", " ", "these", " ", "IP", "s", " ", "may", " ", "access", " ", "this", " ", "server", ".", " ", "Us", "efu", "l", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "temporar", "il", "y", " ", "showin", "g", " ", "build", " ", "results", " ", "to", " ", "a", " ", "coll", "ea", "gue", ".", " ", "The", " ", "special", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", " ", "ALL", " ", "means", " ", "any", " ", "client", " ", "may", " ", "connect", ".", " ", "Us", "e", " ", "with", " ", "cau", "tion", ",", " ", "as", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "your", " ", "source", " ", "code", " ", "is", " ", "exposed", " ", "to", " ", "all", " ", "allow", "ed", " ", "clients", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "(_", "'--", "open", "'_", ",_", "type_", "=_", "bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Atte", "mpt", " ", "to", " ", "open", " ", "the", " ", "server", " ", "web", " ", "ui", " ", "in", " ", "a", " ", "browse", "r", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "(_", "'--", "template", "-", "dir", "'_", ",_", "advanced", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Us", "e", " ", "template", "s", " ", "from", " ", "this", " ", "dir", " ", "inst", "ead", " ", "of", " ", "the", " ", "default", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "(_", "'--", "asset", "s", "-", "dir", "'_", ",_", "advanced", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Us", "e", " ", "asset", "s", " ", "from", " ", "this", " ", "dir", " ", "inst", "ead", " ", "of", " ", "the", " ", "default", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Server", "Run_", "(_", "Qui", "et", "Task", "Mixin_", ",_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "may", "be", "\\u", "open_", "(_", "self_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "options_", "(_", ")_", "._", "open_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binar", "y", "\\u", "util_", "._", "ui", "\\u", "open_", "(_", "'", "http", "://", "local", "host", ":", "{", "port", "}'_", "._", "format_", "(_", "port_", "=_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Server", "Run_", "(_", "Qui", "et", "Task", "Mixin_", ",_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "Report", "ing", "Server", "Manager_", "(_", "self_", "._", "context_", ",_", "self_", "._", "get", "\\u", "options_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "manager_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Server", " ", "alr", "ead", "y", " ", "runn", "ing", " ", "with", " ", "pid", " ", "{", "pid", "}", " ", "at", " ", "http", "://", "local", "host", ":", "{", "port", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "pid_", "=_", "manager_", "._", "pid_", ",_", "port_", "=_", "manager_", "._", "socket_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "._", "daemon", "ize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "await", "\\u", "socket_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Launch", "ed", " ", "server", " ", "with", " ", "pid", " ", "{", "pid", "}", " ", "at", " ", "http", "://", "local", "host", ":", "{", "port", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "pid_", "=_", "manager_", "._", "pid_", ",_", "port_", "=_", "manager_", "._", "socket_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
GoogleCloudPlatform/appengine-mapreduce/python/src/mapreduce/handlers.py
[ { "content": "#!/usr/bin/env python\n# Copyright 2010 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"Defines executor tasks handlers for MapReduce implementation.\"\"\"\n\n\n\n# pylint: disable=protected-access\n# pylint: disable=g-bad-name\n\nimport datetime\nimport logging\nimport math\nimport os\nimport random\nimport sys\nimport time\nimport traceback\nimport zlib\n\ntry:\n import json\nexcept ImportError:\n import simplejson as json\n\nfrom google.appengine.ext import ndb\n\nfrom google.appengine import runtime\nfrom google.appengine.api import datastore_errors\nfrom google.appengine.api import logservice\nfrom google.appengine.api import taskqueue\nfrom google.appengine.ext import db\nfrom mapreduce import base_handler\nfrom mapreduce import context\nfrom mapreduce import errors\nfrom mapreduce import input_readers\nfrom mapreduce import map_job_context\nfrom mapreduce import model\nfrom mapreduce import operation\nfrom mapreduce import output_writers\nfrom mapreduce import parameters\nfrom mapreduce import shard_life_cycle\nfrom mapreduce import util\nfrom mapreduce.api import map_job\nfrom google.appengine.runtime import apiproxy_errors\n\n# pylint: disable=g-import-not-at-top\ntry:\n import cloudstorage\n # In 25 runtime, the above code will be scrubbed to import the stub version\n # of cloudstorage. All occurences of the following if condition in MR\n # codebase is to tell it apart.\n # TODO(user): Remove after 25 runtime MR is abondoned.\n if hasattr(cloudstorage, \"_STUB\"):\n cloudstorage = None\nexcept ImportError:\n cloudstorage = None # CloudStorage library not available\n\n\n# A guide to logging.\n# log.critical: messages user absolutely should see, e.g. failed job.\n# log.error: exceptions during processing user data, or unexpected\n# errors detected by mr framework.\n# log.warning: errors mr framework knows how to handle.\n# log.info: other expected events.\n\n\n# Set of strings of various test-injected faults.\n_TEST_INJECTED_FAULTS = set()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Define", "s", " ", "exec", "uto", "r", " ", "task", "s", " ", "handler", "s", " ", "for", " ", "Map", "Reduce", " ", "implementation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "bad", "-", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "ndb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "import_", "runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "logs", "ervice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "task", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "base", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "input", "\\u", "readers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "map", "\\u", "job", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "output", "\\u", "writers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "shard", "\\u", "life", "\\u", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "._", "api_", "import_", "map", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "runtime_", "import_", "api", "proxy", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "import", "-", "not", "-", "at", "-", "top_", "\\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_", "#", " ", "In", " ", "25", " ", "runt", "ime", ",", " ", "the", " ", "above", " ", "code", " ", "will", " ", "be", " ", "scrub", "bed", " ", "to", " ", "import", " ", "the", " ", "stub", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "clouds", "tora", "ge", ".", " ", "All", " ", "occure", "nce", "s", " ", "of", " ", "the", " ", "follow", "ing", " ", "if", " ", "condition", " ", "in", " ", "MR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "codeb", "ase", " ", "is", " ", "to", " ", "tell", " ", "it", " ", "apart", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Remove", " ", "after", " ", "25", " ", "runt", "ime", " ", "MR", " ", "is", " ", "abo", "ndo", "ned", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "clouds", "tora", "ge_", ",_", "\"\\u", "STU", "B", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clouds", "tora", "ge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clouds", "tora", "ge_", "=_", "None_", "#", " ", "Cloud", "Stor", "age", " ", "librar", "y", " ", "not", " ", "available_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "guide", " ", "to", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "critic", "al", ":", " ", "message", "s", " ", "user", " ", "abs", "olute", "ly", " ", "shou", "ld", " ", "see", ",", " ", "e", ".", "g", ".", " ", "fail", "ed", " ", "job", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "error", ":", " ", "exception", "s", " ", "dur", "ing", " ", "process", "ing", " ", "user", " ", "data", ",", " ", "or", " ", "unexpected", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "s", " ", "detect", "ed", " ", "by", " ", "mr", " ", "frame", "work", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "warn", "ing", ":", " ", "error", "s", " ", "mr", " ", "frame", "work", " ", "knows", " ", "how", " ", "to", " ", "handle", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "info", ":", " ", "other", " ", "expected", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "of", " ", "string", "s", " ", "of", " ", "vari", "ous", " ", "test", "-", "injected", " ", "faults", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEST", "\\u", "IN", "JE", "CT", "ED", "\\u", "FA", "ULT", "S_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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 ]
Nested loops with same variable
benedictpaten/jobTree/test/jobTest.py
[ { "content": " def testJobUpdate(self):\n jobDir = os.path.join(os.getcwd(), \"testJobDir\")\n os.mkdir(jobDir) #If directory already exists then the test will fail\n command = \"by your command\"\n memory = 2^32\n cpu = 1\n tryCount = 100\n \n for i in xrange(40):\n startTime = time.time()\n j = Job(command, memory, cpu, tryCount, jobDir)\n childNumber = random.choice(range(20))\n for k in xrange(childNumber):\n j.children.append((command, memory, cpu))\n self.assertEquals(len(j.children), childNumber)\n j.update(tryCount=tryCount, depth=0)\n j = Job.read(j.getJobFileName())\n self.assertEquals(len(j.children) + len(j.followOnCommands), childNumber + 1)\n for childJobFile, memory, cpu in j.children:\n cJ = Job.read(childJobFile)\n self.assertEquals(cJ.remainingRetryCount, tryCount)\n #self.assertEquals(cJ.jobDir, os.path.split(cJ)[0])\n self.assertEquals(cJ.children, [])\n self.assertEquals(cJ.followOnCommands, [ (command, memory, cpu, 0)])\n self.assertEquals(cJ.messages, [])\n self.assertTrue(os.path.exists(cJ.getJobFileName()))\n cJ.delete()\n self.assertTrue(not os.path.exists(cJ.getJobFileName()))\n self.assertEquals(os.listdir(jobDir), [ \"job\" ])\n j.delete()\n print \"It took %f seconds to update jobs\" % (time.time() - startTime) #We've just used it for benchmarking, so far \n \n system(\"rm -rf %s\" % jobDir)", "metadata": "root.TestCase.testJobUpdate", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 } ]
[]
[]
0
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "variable_", "[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", "Jo", "b", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "Dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "\"", "test", "Jo", "b", "Dir", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "job", "Dir_", ")_", "#", "If", " ", "director", "y", " ", "alr", "ead", "y", " ", "exist", "s", " ", "then", " ", "the", " ", "test", " ", "will", " ", "fail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "\"", "by", " ", "your", " ", "command", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memory_", "=_", "2_", "^_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try", "Count_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "40_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Job_", "(_", "command_", ",_", "memory_", ",_", "cpu_", ",_", "try", "Count_", ",_", "job", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "Number_", "=_", "random_", "._", "choice_", "(_", "range_", "(_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "child", "Number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "._", "children_", "._", "append_", "(_", "(_", "command_", ",_", "memory_", ",_", "cpu_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "j_", "._", "children_", ")_", ",_", "child", "Number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "._", "update_", "(_", "try", "Count_", "=_", "try", "Count_", ",_", "depth_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Job_", "._", "read_", "(_", "j_", "._", "get", "Jo", "b", "File", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "j_", "._", "children_", ")_", "+_", "len_", "(_", "j_", "._", "follow", "On", "Commands_", ")_", ",_", "child", "Number_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child", "Jo", "b", "File_", ",_", "memory_", ",_", "cpu_", "in_", "j_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c", "J_", "=_", "Job_", "._", "read_", "(_", "child", "Jo", "b", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "c", "J_", "._", "rema", "inin", "g", "Retr", "y", "Count_", ",_", "try", "Count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "s", "(", "c", "J", ".", "job", "Dir", ",", " ", "os", ".", "path", ".", "split", "(", "c", "J", ")[", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "c", "J_", "._", "children_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "c", "J_", "._", "follow", "On", "Commands_", ",_", "[_", "(_", "command_", ",_", "memory_", ",_", "cpu_", ",_", "0_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "c", "J_", "._", "messages_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "c", "J_", "._", "get", "Jo", "b", "File", "Name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "J_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "c", "J_", "._", "get", "Jo", "b", "File", "Name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "os_", "._", "listdir_", "(_", "job", "Dir_", ")_", ",_", "[_", "\"", "job", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "It", " ", "too", "k", " ", "%", "f", " ", "second", "s", " ", "to", " ", "update", " ", "jobs", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start", "Time_", ")_", "#", "We", "'", "ve", " ", "just", " ", "used", " ", "it", " ", "for", " ", "bench", "marking", ",", " ", "so", " ", "far", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "system_", "(_", "\"", "rm", " ", "-", "rf", " ", "%", "s", "\"_", "%_", "job", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
mozilla/pontoon/pontoon/sync/tests/test_tasks.py
[ { "content": "from django_nose.tools import assert_equal, assert_false, assert_raises, assert_true\nfrom mock import ANY, patch, PropertyMock\n\nfrom pontoon.base.models import ChangedEntityLocale, Project, Repository\nfrom pontoon.base.tests import (\n ChangedEntityLocaleFactory,\n CONTAINS,\n ProjectFactory,\n RepositoryFactory,\n TestCase,\n TranslationFactory,\n)\nfrom pontoon.base.utils import aware_datetime\nfrom pontoon.sync.core import serial_task\nfrom pontoon.sync.models import ProjectSyncLog, RepositorySyncLog, SyncLog\nfrom pontoon.sync.tasks import sync_project, sync_project_repo\nfrom pontoon.sync.tests import (\n FAKE_CHECKOUT_PATH,\n FakeCheckoutTestCase,\n ProjectSyncLogFactory,\n SyncLogFactory,\n)\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django", "\\u", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", ",_", "assert", "\\u", "false_", ",_", "assert", "\\u", "raises_", ",_", "assert", "\\u", "true_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "ANY_", ",_", "patch_", ",_", "Proper", "ty", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "base_", "._", "models_", "import_", "Change", "d", "Entit", "y", "Locale_", ",_", "Project_", ",_", "Repository_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "base_", "._", "tests_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Change", "d", "Entit", "y", "Local", "e", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CONT", "AINS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Repos", "itor", "y", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Case_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Translat", "ion", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "base_", "._", "utils_", "import_", "awa", "re", "\\u", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "sync_", "._", "core_", "import_", "serial", "\\u", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "sync_", "._", "models_", "import_", "Project", "Sync", "Log_", ",_", "Repos", "itor", "y", "Sync", "Log_", ",_", "Sync", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "sync_", "._", "tasks_", "import_", "sync", "\\u", "project_", ",_", "sync", "\\u", "project", "\\u", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "sync_", "._", "tests_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "CHECK", "OUT", "\\u", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fake", "Check", "out", "Test", "Case_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project", "Sync", "Log", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sync", "Log", "Factory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
flashingpumpkin/django-socialregistration/socialregistration/signals.py
[ { "content": "from django import dispatch\n\nlogin = dispatch.Signal(providing_args = [\"user\", \"profile\", \"client\"])\nconnect = dispatch.Signal(providing_args = [\"user\", \"profile\", \"client\"])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "login_", "=_", "dispatch_", "._", "Signal_", "(_", "provi", "ding", "\\u", "args_", "=_", "[_", "\"", "user", "\"_", ",_", "\"", "profile", "\"_", ",_", "\"", "client", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "=_", "dispatch_", "._", "Signal_", "(_", "provi", "ding", "\\u", "args_", "=_", "[_", "\"", "user", "\"_", ",_", "\"", "profile", "\"_", ",_", "\"", "client", "\"_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Deprecated slice method
cjlee112/pygr/pygr/sequence.py
[ { "content": " def __getitem__(self, k):\n if isinstance(k, types.IntType):\n if k == -1: # HAVE TO HANDLE THIS CASE SPECIALLY\n k = slice(k, None, 1) # -1 IS LAST LETTER, SO [-1:None] slice\n else: # REGULAR CASE, JUST [k:k+1] slice\n k = slice(k, k + 1, 1)\n if isinstance(k, types.SliceType): # GET AN INTERVAL USING slice\n return self.classySlice(self, k.start, k.stop, k.step)\n elif isinstance(k, SeqPath): # MODEL SEQ AS GRAPH\n if k.path is not self.path:\n raise KeyError('node is not in this sequence!')\n try:\n target = self.classySlice(self.path, k.stop,\n k.stop + len(k) * k.step, k.step)\n return {target: LetterEdge(k, target)}\n except IndexError: # OUT OF BOUNDS, SO NO NEXT NODE\n return {}\n raise KeyError('requires a slice object or integer key')", "metadata": "root.SeqPath.__getitem__", "header": "['class', 'SeqPath', '(', 'object', ')', ':', '___EOS___']", "index": 331 } ]
[]
[]
0
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "Seq", "Path_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "k_", ",_", "types_", "._", "Int", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "-_", "1_", ":_", "#", " ", "HA", "VE", " ", "TO", " ", "HANDLE", " ", "THIS", " ", "CASE", " ", "SPECIAL", "LY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "slice_", "(_", "k_", ",_", "None_", ",_", "1_", ")_", "#", " ", "-1", " ", "IS", " ", "LAS", "T", " ", "LETTER", ",", " ", "SO", " ", "[-", "1", ":", "Non", "e", "]", " ", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "REGULA", "R", " ", "CASE", ",", " ", "JU", "ST", " ", "[", "k", ":", "k", "+", "1", "]", " ", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "slice_", "(_", "k_", ",_", "k_", "+_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "k_", ",_", "types_", "._", "Slice", "Type_", ")_", ":_", "#", " ", "GET", " ", "AN", " ", "INTERVAL", " ", "US", "ING", " ", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "class", "y", "Slice_", "(_", "self_", ",_", "k_", "._", "start_", ",_", "k_", "._", "stop_", ",_", "k_", "._", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "k_", ",_", "Seq", "Path_", ")_", ":_", "#", " ", "MODEL", " ", "SEQ", " ", "AS", " ", "GRAPH", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "._", "path_", "is_", "not_", "self_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", "(_", "'", "node", " ", "is", " ", "not", " ", "in", " ", "this", " ", "sequence", "!'_", ")_", "\\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 ", " _", "target_", "=_", "self_", "._", "class", "y", "Slice_", "(_", "self_", "._", "path_", ",_", "k_", "._", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "._", "stop_", "+_", "len_", "(_", "k_", ")_", "*_", "k_", "._", "step_", ",_", "k_", "._", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "target_", ":_", "Letter", "Edge_", "(_", "k_", ",_", "target_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "#", " ", "OUT", " ", "OF", " ", "BOUND", "S", ",", " ", "SO", " ", "NO", " ", "NEXT", " ", "NODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Key", "Error_", "(_", "'", "require", "s", " ", "a", " ", "slice", " ", "object", " ", "or", " ", "integ", "er", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ucrcsedept/galah/galah/sheep/virtualsuites/vz/pyvz.py
[ { "content": "class FakeHeaderWrapper(object):", "metadata": "root.FakeHeaderWrapper", "header": "['module', '___EOS___']", "index": 75 }, { "content": " def __iter__(self):\n return self", "metadata": "root.FakeHeaderWrapper.__iter__", "header": "['class', 'FakeHeaderWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 79 } ]
[]
[]
0
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_", "Fake", "Head", "er", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Head", "er", "Wrapper_", "(_", "object_", ")_", ":_", "\\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, 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 ]
Except block handles 'BaseException'
lisa-lab/pylearn2/pylearn2/linear/tests/test_conv2d.py
[ { "content": "import theano\nfrom theano import tensor\nimport numpy\nfrom pylearn2.linear.conv2d import Conv2D, make_random_conv2D\nfrom pylearn2.space import Conv2DSpace\nfrom pylearn2.utils import sharedX\nimport unittest\ntry:\n scipy_available = True\n import scipy.ndimage\nexcept ImportError:\n scipy_available = False\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "import_", "tensor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "linear_", "._", "conv2d_", "import_", "Conv", "2", "D_", ",_", "make", "\\u", "random", "\\u", "conv2", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "space_", "import_", "Conv", "2", "DS", "pace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "utils_", "import_", "shared", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "py", "\\u", "available_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "ndimage_", "\\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 ", " _", "sci", "py", "\\u", "available_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/adapters/_google_appengine_ext_db.py
[ { "content": "def loadInstanceFromDatastore(klass, key, codec=None):\n \"\"\"\n Attempt to load an instance from the datastore, based on C{klass}\n and C{key}. We create an index on the codec's context (if it exists)\n so we can check that first before accessing the datastore.\n\n @param klass: The class that will be loaded from the datastore.\n @type klass: Sub-class of C{db.Model} or C{db.Expando}\n @param key: The key which is used to uniquely identify the instance in the\n datastore.\n @type key: C{str}\n @param codec: The codec to reference the C{gae_objects} index. If\n supplied,The codec must have have a context attribute.\n @return: The loaded instance from the datastore.\n @rtype: Instance of C{klass}.\n @since: 0.4.1\n \"\"\"\n if not issubclass(klass, (db.Model, db.Expando)):\n raise TypeError('expected db.Model/db.Expando class, got %s' % (klass,))\n\n if not isinstance(key, basestring):\n raise TypeError('string expected for key, got %s', (repr(key),))\n\n key = str(key)\n\n if codec is None:\n return klass.get(key)\n\n gae_objects = getGAEObjects(codec.context)\n\n try:\n return gae_objects.getClassKey(klass, key)\n except KeyError:\n pass\n\n obj = klass.get(key)\n gae_objects.addClassKey(klass, key, obj)\n\n return obj", "metadata": "root.loadInstanceFromDatastore", "header": "['module', '___EOS___']", "index": 249 } ]
[]
[]
0
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_", "load", "Insta", "nce", "Fro", "m", "Datas", "tore_", "(_", "klass_", ",_", "key_", ",_", "codec_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", " ", "to", " ", "load", " ", "an", " ", "instance", " ", "from", " ", "the", " ", "datast", "ore", ",", " ", "based", " ", "on", " ", "C", "{", "klass", "}", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "C", "{", "key", "}.", " ", "We", " ", "create", " ", "an", " ", "index", " ", "on", " ", "the", " ", "codec", "'", "s", " ", "context", " ", "(", "if", " ", "it", " ", "exist", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "we", " ", "can", " ", "check", " ", "tha", "t", " ", "first", " ", "bef", "ore", " ", "accessi", "ng", " ", "the", " ", "datast", "ore", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "klass", ":", " ", "The", " ", "class", " ", "tha", "t", " ", "will", " ", "be", " ", "load", "ed", " ", "from", " ", "the", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "klass", ":", " ", "Sub", "-", "class", " ", "of", " ", "C", "{", "db", ".", "Model", "}", " ", "or", " ", "C", "{", "db", ".", "Expand", "o", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "key", ":", " ", "The", " ", "key", " ", "whi", "ch", " ", "is", " ", "used", " ", "to", " ", "unique", "ly", " ", "identify", " ", "the", " ", "instance", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "key", ":", " ", "C", "{", "str", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "codec", ":", " ", "The", " ", "codec", " ", "to", " ", "reference", " ", "the", " ", "C", "{", "gae", "\\u", "object", "s", "}", " ", "index", ".", " ", "If", "\\", "10", ";", " ", " ", " ", " ", "supplie", "d", ",", "The", " ", "codec", " ", "must", " ", "have", " ", "have", " ", "a", " ", "context", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "The", " ", "load", "ed", " ", "instance", " ", "from", " ", "the", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "Insta", "nce", " ", "of", " ", "C", "{", "klass", "}.", "\\", "10", ";", " ", " ", " ", " ", "@", "sinc", "e", ":", " ", "0.", "4.1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "klass_", ",_", "(_", "db_", "._", "Model_", ",_", "db_", "._", "Expand", "o_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "expected", " ", "db", ".", "Model", "/", "db", ".", "Expand", "o", " ", "class", ",", " ", "got", " ", "%", "s", "'_", "%_", "(_", "klass_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "key_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "string", " ", "expected", " ", "for", " ", "key", ",", " ", "got", " ", "%", "s", "'_", ",_", "(_", "repr_", "(_", "key_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "str_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "codec_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "klass_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gae", "\\u", "objects_", "=_", "get", "GA", "EO", "bject", "s_", "(_", "codec_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gae", "\\u", "objects_", "._", "get", "Class", "Key_", "(_", "klass_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "klass_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gae", "\\u", "objects_", "._", "add", "Class", "Key_", "(_", "klass_", ",_", "key_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_", "\\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, 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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 ]
Redundant assignment
blynch/CloudMemeBackend/pymongo/auth.py
[ { "content": "def _authenticate_mongo_cr(credentials, sock_info, cmd_func):\n \"\"\"Authenticate using MONGODB-CR.\n \"\"\"\n source, username, password = credentials\n # Get a nonce\n response, _ = cmd_func(sock_info, source, {'getnonce': 1})\n nonce = response['nonce']\n key = _auth_key(nonce, username, password)\n\n # Actually authenticate\n query = SON([('authenticate', 1),\n ('user', username),\n ('nonce', nonce),\n ('key', key)])\n cmd_func(sock_info, source, query)", "metadata": "root._authenticate_mongo_cr", "header": "['module', '___EOS___']", "index": 206 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "authenticat", "e\\u", "mongo", "\\u", "cr_", "(_", "credentials_", ",_", "sock", "\\u", "info_", ",_", "cmd", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Auth", "entica", "te", " ", "usi", "ng", " ", "MONGO", "DB", "-", "CR", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", ",_", "username_", ",_", "password_", "=_", "credentials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "nonce_", "\\u\\u\\uNL\\u\\u\\u_", "response_", ",_", "\\u_", "=_", "cmd", "\\u", "func_", "(_", "sock", "\\u", "info_", ",_", "source_", ",_", "{_", "'", "getn", "onc", "e", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nonce_", "=_", "response_", "[_", "'", "nonc", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\\u", "auth", "\\u", "key_", "(_", "nonce_", ",_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", "ly", " ", "authenticate_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "SON", "_", "(_", "[_", "(_", "'", "authenticat", "e", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "user", "'_", ",_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "nonc", "e", "'_", ",_", "nonce_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "key", "'_", ",_", "key_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "func_", "(_", "sock", "\\u", "info_", ",_", "source_", ",_", "query_", ")_", "\\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 ]
Unnecessary 'else' clause in loop
ummahusla/Codecademy-Exercise-Answers/Language Skills/Python/Unit 8/1-Loops/Step Up 'For's/17-For, Else.py
[ { "content": "fruits = ['banana', 'apple', 'orange', 'tomato', 'pear', 'grape']\n\nprint 'You have...'\nfor f in fruits:\n if f == 'tomato':\n print 'A tomato is not a fruit!' # (It actually is.)\n break\n print 'A', f\nelse:\n print 'A fine selection of fruits!' \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "fruit", "s_", "=_", "[_", "'", "banana", "'_", ",_", "'", "apple", "'_", ",_", "'", "orange", "'_", ",_", "'", "toma", "to", "'_", ",_", "'", "pea", "r", "'_", ",_", "'", "gra", "pe", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "You", " ", "have", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "fruit", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "==_", "'", "toma", "to", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "A", " ", "toma", "to", " ", "is", " ", "not", " ", "a", " ", "fruit", "!'_", "#", " ", "(", "It", " ", "actual", "ly", " ", "is", ".)", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "A", "'_", ",_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "A", " ", "fine", " ", "selection", " ", "of", " ", "fruit", "s", "!'_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
GoogleCloudPlatform/gsutil/gslib/tests/testcase/unit_testcase.py
[ { "content": "# -*- coding: utf-8 -*-\n# Copyright 2013 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Contains gsutil base unit test case class.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport logging\nimport os\nimport sys\nimport tempfile\n\nimport boto\nfrom gslib import wildcard_iterator\nfrom gslib.boto_translation import BotoTranslation\nfrom gslib.cloud_api_delegator import CloudApiDelegator\nfrom gslib.command_runner import CommandRunner\nfrom gslib.cs_api_map import ApiMapConstants\nfrom gslib.cs_api_map import ApiSelector\nfrom gslib.tests.mock_logging_handler import MockLoggingHandler\nfrom gslib.tests.testcase import base\nimport gslib.tests.util as util\nfrom gslib.tests.util import unittest\nfrom gslib.tests.util import WorkingDirectory\nfrom gslib.util import DiscardMessagesQueue\nfrom gslib.util import GsutilStreamHandler\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GsutilApiUnitTestClassMapFactory(object):\n \"\"\"Class map factory for use in unit tests.\n\n BotoTranslation is used for all cases so that GSMockBucketStorageUri can\n be used to communicate with the mock XML service.\n \"\"\"\n", "metadata": "root.GsutilApiUnitTestClassMapFactory", "header": "['module', '___EOS___']", "index": 39 }, { "content": " @classmethod\n def GetClassMap(cls):\n \"\"\"Returns a class map for use in unit tests.\"\"\"\n gs_class_map = {\n ApiSelector.XML: BotoTranslation,\n ApiSelector.JSON: BotoTranslation\n }\n s3_class_map = {\n ApiSelector.XML: BotoTranslation\n }\n class_map = {\n 'gs': gs_class_map,\n 's3': s3_class_map\n }\n return class_map", "metadata": "root.GsutilApiUnitTestClassMapFactory.GetClassMap", "header": "['class', 'GsutilApiUnitTestClassMapFactory', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": "@unittest.skipUnless(util.RUN_UNIT_TESTS,\n 'Not running integration tests.')\nclass GsUtilUnitTestCase(base.GsUtilTestCase):\n \"\"\"Base class for gsutil unit tests.\"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.GsUtilUnitTestCase", "header": "['module', '___EOS___']", "index": 63 }, { "content": " @classmethod\n def setUpClass(cls):\n base.GsUtilTestCase.setUpClass()\n cls.mock_bucket_storage_uri = util.GSMockBucketStorageUri\n cls.mock_gsutil_api_class_map_factory = GsutilApiUnitTestClassMapFactory\n cls.logger = logging.getLogger()\n cls.command_runner = CommandRunner(\n bucket_storage_uri_class=cls.mock_bucket_storage_uri,\n gsutil_api_class_map_factory=cls.mock_gsutil_api_class_map_factory)", "metadata": "root.GsUtilUnitTestCase.setUpClass", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def setUp(self):\n super(GsUtilUnitTestCase, self).setUp()\n self.bucket_uris = []\n self.stdout_save = sys.stdout\n self.stderr_save = sys.stderr\n fd, self.stdout_file = tempfile.mkstemp()\n sys.stdout = os.fdopen(fd, 'w+')\n fd, self.stderr_file = tempfile.mkstemp()\n sys.stderr = os.fdopen(fd, 'w+')\n self.accumulated_stdout = []\n self.accumulated_stderr = []\n\n self.root_logger = logging.getLogger()\n self.is_debugging = self.root_logger.isEnabledFor(logging.DEBUG)\n self.log_handlers_save = self.root_logger.handlers\n fd, self.log_handler_file = tempfile.mkstemp()\n self.log_handler_stream = os.fdopen(fd, 'w+')\n self.temp_log_handler = GsutilStreamHandler(self.log_handler_stream)\n self.root_logger.handlers = [self.temp_log_handler]", "metadata": "root.GsUtilUnitTestCase.setUp", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def tearDown(self):\n super(GsUtilUnitTestCase, self).tearDown()\n\n self.root_logger.handlers = self.log_handlers_save\n self.temp_log_handler.flush()\n self.temp_log_handler.close()\n self.log_handler_stream.seek(0)\n log_output = self.log_handler_stream.read()\n self.log_handler_stream.close()\n os.unlink(self.log_handler_file)\n\n sys.stdout.seek(0)\n sys.stderr.seek(0)\n stdout = sys.stdout.read()\n stderr = sys.stderr.read()\n stdout += ''.join(self.accumulated_stdout)\n stderr += ''.join(self.accumulated_stderr)\n sys.stdout.close()\n sys.stderr.close()\n sys.stdout = self.stdout_save\n sys.stderr = self.stderr_save\n os.unlink(self.stdout_file)\n os.unlink(self.stderr_file)\n\n if self.is_debugging and stdout:\n sys.stderr.write('==== stdout %s ====\\n' % self.id())\n sys.stderr.write(stdout)\n sys.stderr.write('==== end stdout ====\\n')\n if self.is_debugging and stderr:\n sys.stderr.write('==== stderr %s ====\\n' % self.id())\n sys.stderr.write(stderr)\n sys.stderr.write('==== end stderr ====\\n')\n if self.is_debugging and log_output:\n sys.stderr.write('==== log output %s ====\\n' % self.id())\n sys.stderr.write(log_output)\n sys.stderr.write('==== end log output ====\\n')", "metadata": "root.GsUtilUnitTestCase.tearDown", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def RunCommand(self, command_name, args=None, headers=None, debug=0,\n return_stdout=False, return_stderr=False,\n return_log_handler=False, cwd=None):\n \"\"\"Method for calling gslib.command_runner.CommandRunner.\n\n Passes parallel_operations=False for all tests, optionally saving/returning\n stdout output. We run all tests multi-threaded, to exercise those more\n complicated code paths.\n TODO: Change to run with parallel_operations=True for all tests. At\n present when you do this it causes many test failures.\n\n Args:\n command_name: The name of the command being run.\n args: Command-line args (arg0 = actual arg, not command name ala bash).\n headers: Dictionary containing optional HTTP headers to pass to boto.\n debug: Debug level to pass in to boto connection (range 0..3).\n return_stdout: If True, will save and return stdout produced by command.\n return_stderr: If True, will save and return stderr produced by command.\n return_log_handler: If True, will return a MockLoggingHandler instance\n that was attached to the command's logger while running.\n cwd: The working directory that should be switched to before running the\n command. The working directory will be reset back to its original\n value after running the command. If not specified, the working\n directory is left unchanged.\n\n Returns:\n One or a tuple of requested return values, depending on whether\n return_stdout, return_stderr, and/or return_log_handler were specified.\n \"\"\"\n args = args or []\n\n command_line = ' '.join([command_name] + args)\n if self.is_debugging:\n self.stderr_save.write('\\nRunCommand of %s\\n' % command_line)\n\n # Save and truncate stdout and stderr for the lifetime of RunCommand. This\n # way, we can return just the stdout and stderr that was output during the\n # RunNamedCommand call below.\n sys.stdout.seek(0)\n sys.stderr.seek(0)\n stdout = sys.stdout.read()\n stderr = sys.stderr.read()\n if stdout:\n self.accumulated_stdout.append(stdout)\n if stderr:\n self.accumulated_stderr.append(stderr)\n sys.stdout.seek(0)\n sys.stderr.seek(0)\n sys.stdout.truncate()\n sys.stderr.truncate()\n\n mock_log_handler = MockLoggingHandler()\n logging.getLogger(command_name).addHandler(mock_log_handler)\n\n try:\n with WorkingDirectory(cwd):\n self.command_runner.RunNamedCommand(\n command_name, args=args, headers=headers, debug=debug,\n parallel_operations=False, do_shutdown=False)\n finally:\n sys.stdout.seek(0)\n stdout = sys.stdout.read()\n sys.stderr.seek(0)\n stderr = sys.stderr.read()\n logging.getLogger(command_name).removeHandler(mock_log_handler)\n mock_log_handler.close()\n\n log_output = '\\n'.join(\n '%s:\\n ' % level + '\\n '.join(records)\n for level, records in mock_log_handler.messages.iteritems()\n if records)\n if self.is_debugging and log_output:\n self.stderr_save.write(\n '==== logging RunCommand %s %s ====\\n' % (self.id(), command_line))\n self.stderr_save.write(log_output)\n self.stderr_save.write('\\n==== end logging ====\\n')\n if self.is_debugging and stdout:\n self.stderr_save.write(\n '==== stdout RunCommand %s %s ====\\n' % (self.id(), command_line))\n self.stderr_save.write(stdout)\n self.stderr_save.write('==== end stdout ====\\n')\n if self.is_debugging and stderr:\n self.stderr_save.write(\n '==== stderr RunCommand %s %s ====\\n' % (self.id(), command_line))\n self.stderr_save.write(stderr)\n self.stderr_save.write('==== end stderr ====\\n')\n\n # Reset stdout and stderr files, so that we won't print them out again\n # in tearDown if debugging is enabled.\n sys.stdout.seek(0)\n sys.stderr.seek(0)\n sys.stdout.truncate()\n sys.stderr.truncate()\n\n to_return = []\n if return_stdout:\n to_return.append(stdout)\n if return_stderr:\n to_return.append(stderr)\n if return_log_handler:\n to_return.append(mock_log_handler)\n if len(to_return) == 1:\n return to_return[0]\n return tuple(to_return)", "metadata": "root.GsUtilUnitTestCase.RunCommand", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 135 }, { "content": " @classmethod\n def MakeGsUtilApi(cls, debug=0):\n gsutil_api_map = {\n ApiMapConstants.API_MAP: (\n cls.mock_gsutil_api_class_map_factory.GetClassMap()),\n ApiMapConstants.SUPPORT_MAP: {\n 'gs': [ApiSelector.XML, ApiSelector.JSON],\n 's3': [ApiSelector.XML]\n },\n ApiMapConstants.DEFAULT_MAP: {\n 'gs': ApiSelector.JSON,\n 's3': ApiSelector.XML\n }\n }\n\n return CloudApiDelegator(\n cls.mock_bucket_storage_uri, gsutil_api_map, cls.logger,\n DiscardMessagesQueue(), debug=debug)", "metadata": "root.GsUtilUnitTestCase.MakeGsUtilApi", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 240 }, { "content": " @classmethod\n def _test_wildcard_iterator(cls, uri_or_str, debug=0):\n \"\"\"Convenience method for instantiating a test instance of WildcardIterator.\n\n This makes it unnecessary to specify all the params of that class\n (like bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri).\n Also, naming the factory method this way makes it clearer in the test code\n that WildcardIterator needs to be set up for testing.\n\n Args are same as for wildcard_iterator.wildcard_iterator(), except\n there are no class args for bucket_storage_uri_class or gsutil_api_class.\n\n Args:\n uri_or_str: StorageUri or string representing the wildcard string.\n debug: debug level to pass to the underlying connection (0..3)\n\n Returns:\n WildcardIterator, over which caller can iterate.\n \"\"\"\n # TODO: Remove when tests no longer pass StorageUri arguments.\n uri_string = uri_or_str\n if hasattr(uri_or_str, 'uri'):\n uri_string = uri_or_str.uri\n\n return wildcard_iterator.CreateWildcardIterator(\n uri_string, cls.MakeGsUtilApi())", "metadata": "root.GsUtilUnitTestCase._test_wildcard_iterator", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 259 }, { "content": " @staticmethod\n def _test_storage_uri(uri_str, default_scheme='file', debug=0,\n validate=True):\n \"\"\"Convenience method for instantiating a testing instance of StorageUri.\n\n This makes it unnecessary to specify\n bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri.\n Also naming the factory method this way makes it clearer in the test\n code that StorageUri needs to be set up for testing.\n\n Args, Returns, and Raises are same as for boto.storage_uri(), except there's\n no bucket_storage_uri_class arg.\n\n Args:\n uri_str: Uri string to create StorageUri for.\n default_scheme: Default scheme for the StorageUri\n debug: debug level to pass to the underlying connection (0..3)\n validate: If True, validate the resource that the StorageUri refers to.\n\n Returns:\n StorageUri based on the arguments.\n \"\"\"\n return boto.storage_uri(uri_str, default_scheme, debug, validate,\n util.GSMockBucketStorageUri)", "metadata": "root.GsUtilUnitTestCase._test_storage_uri", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 286 }, { "content": " def CreateBucket(self, bucket_name=None, test_objects=0, storage_class=None,\n provider='gs'):\n \"\"\"Creates a test bucket.\n\n The bucket and all of its contents will be deleted after the test.\n\n Args:\n bucket_name: Create the bucket with this name. If not provided, a\n temporary test bucket name is constructed.\n test_objects: The number of objects that should be placed in the bucket or\n a list of object names to place in the bucket. Defaults to\n 0.\n storage_class: storage class to use. If not provided we us standard.\n provider: string provider to use, default gs.\n\n Returns:\n StorageUri for the created bucket.\n \"\"\"\n bucket_name = bucket_name or self.MakeTempName('bucket')\n bucket_uri = boto.storage_uri(\n '%s://%s' % (provider, bucket_name.lower()),\n suppress_consec_slashes=False,\n bucket_storage_uri_class=util.GSMockBucketStorageUri)\n bucket_uri.create_bucket(storage_class=storage_class)\n self.bucket_uris.append(bucket_uri)\n try:\n iter(test_objects)\n except TypeError:\n test_objects = [self.MakeTempName('obj') for _ in range(test_objects)]\n for i, name in enumerate(test_objects):\n self.CreateObject(bucket_uri=bucket_uri, object_name=name,\n contents='test %d' % i)\n return bucket_uri", "metadata": "root.GsUtilUnitTestCase.CreateBucket", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 311 }, { "content": " def CreateObject(self, bucket_uri=None, object_name=None, contents=None):\n \"\"\"Creates a test object.\n\n Args:\n bucket_uri: The URI of the bucket to place the object in. If not\n specified, a new temporary bucket is created.\n object_name: The name to use for the object. If not specified, a temporary\n test object name is constructed.\n contents: The contents to write to the object. If not specified, the key\n is not written to, which means that it isn't actually created\n yet on the server.\n\n Returns:\n A StorageUri for the created object.\n \"\"\"\n bucket_uri = bucket_uri or self.CreateBucket()\n object_name = object_name or self.MakeTempName('obj')\n key_uri = bucket_uri.clone_replace_name(object_name)\n if contents is not None:\n key_uri.set_contents_from_string(contents)\n return key_uri", "metadata": "root.GsUtilUnitTestCase.CreateObject", "header": "['class', 'GsUtilUnitTestCase', '(', 'base', '.', 'GsUtilTestCase', ')', ':', '___EOS___']", "index": 345 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Contain", "s", " ", "gsu", "til", " ", "base", " ", "unit", " ", "test", " ", "case", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "import_", "wild", "card", "\\u", "iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "boto", "\\u", "translation_", "import_", "Bot", "o", "Translation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "cloud", "\\u", "api", "\\u", "delegat", "or_", "import_", "Cloud", "Ap", "i", "Del", "egat", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "command", "\\u", "runner_", "import_", "Command", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "cs", "\\u", "api", "\\u", "map_", "import_", "Ap", "i", "Map", "Constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "cs", "\\u", "api", "\\u", "map_", "import_", "Ap", "i", "Selector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "tests_", "._", "mock", "\\u", "logg", "ing", "\\u", "handler_", "import_", "Moc", "k", "Log", "ging", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "tests_", "._", "testcase_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gsl", "ib_", "._", "tests_", "._", "util_", "as_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "tests_", "._", "util_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "tests_", "._", "util_", "import_", "Work", "ing", "Directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "util_", "import_", "Discard", "Messag", "es", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "util_", "import_", "Gs", "util", "Stream", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Gs", "util", "Ap", "i", "Unit", "Test", "Class", "Map", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Class", " ", "map", " ", "factor", "y", " ", "for", " ", "use", " ", "in", " ", "unit", " ", "tests", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Bot", "o", "Translat", "ion", " ", "is", " ", "used", " ", "for", " ", "all", " ", "case", "s", " ", "so", " ", "tha", "t", " ", "GS", "Moc", "k", "Buck", "et", "Stor", "age", "Ur", "i", " ", "can", "\\", "10", ";", " ", " ", "be", " ", "used", " ", "to", " ", "communi", "cate", " ", "with", " ", "the", " ", "mock", " ", "XML", " ", "service", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gs", "util", "Ap", "i", "Unit", "Test", "Class", "Map", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Get", "Class", "Map_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "class", " ", "map", " ", "for", " ", "use", " ", "in", " ", "unit", " ", "tests", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gs", "\\u", "class", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Selector_", "._", "XML_", ":_", "Bot", "o", "Translation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Selector_", "._", "JSON_", ":_", "Bot", "o", "Translation_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "class", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Selector_", "._", "XML_", ":_", "Bot", "o", "Translation_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gs", "'_", ":_", "gs", "\\u", "class", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s3", "'_", ":_", "s3", "\\u", "class", "\\u", "map_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "class", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "util_", "._", "RUN", "\\u", "UNIT", "\\u", "TESTS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Not", " ", "runn", "ing", " ", "integrati", "on", " ", "tests", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "gsu", "til", " ", "unit", " ", "tests", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", "._", "set", "Up", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "mock", "\\u", "bucket", "\\u", "storage", "\\u", "uri_", "=_", "util_", "._", "GS", "Moc", "k", "Buck", "et", "Stor", "age", "Uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "mock", "\\u", "gsu", "til", "\\u", "api", "\\u", "class", "\\u", "map", "\\u", "factory_", "=_", "Gs", "util", "Ap", "i", "Unit", "Test", "Class", "Map", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "command", "\\u", "runner_", "=_", "Command", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class_", "=_", "cls_", "._", "mock", "\\u", "bucket", "\\u", "storage", "\\u", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gsu", "til", "\\u", "api", "\\u", "class", "\\u", "map", "\\u", "factory_", "=_", "cls_", "._", "mock", "\\u", "gsu", "til", "\\u", "api", "\\u", "class", "\\u", "map", "\\u", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\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_", "(_", "Gs", "Ut", "il", "Unit", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bucket", "\\u", "uris_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stdout", "\\u", "save_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", ",_", "self_", "._", "stdout", "\\u", "file_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "os_", "._", "fdo", "pen_", "(_", "fd_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", ",_", "self_", "._", "std", "err", "\\u", "file_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "os_", "._", "fdo", "pen_", "(_", "fd_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulated", "\\u", "stdout_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulated", "\\u", "stderr_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "root", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "debugg", "ing_", "=_", "self_", "._", "root", "\\u", "logger_", "._", "is", "Enable", "d", "For_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler", "s", "\\u", "save_", "=_", "self_", "._", "root", "\\u", "logger_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", ",_", "self_", "._", "log", "\\u", "handler", "\\u", "file_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler", "\\u", "stream_", "=_", "os_", "._", "fdo", "pen_", "(_", "fd_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temp", "\\u", "log", "\\u", "handler_", "=_", "Gs", "util", "Stream", "Handler_", "(_", "self_", "._", "log", "\\u", "handler", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root", "\\u", "logger_", "._", "handlers_", "=_", "[_", "self_", "._", "temp", "\\u", "log", "\\u", "handler_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "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 ", " _", "super_", "(_", "Gs", "Ut", "il", "Unit", "Test", "Case_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "root", "\\u", "logger_", "._", "handlers_", "=_", "self_", "._", "log", "\\u", "handler", "s", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temp", "\\u", "log", "\\u", "handler_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temp", "\\u", "log", "\\u", "handler_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler", "\\u", "stream_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "output_", "=_", "self_", "._", "log", "\\u", "handler", "\\u", "stream_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler", "\\u", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "self_", "._", "log", "\\u", "handler", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "sys_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "=_", "sys_", "._", "stderr_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "+=_", "''_", "._", "join_", "(_", "self_", "._", "accumulated", "\\u", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "+=_", "''_", "._", "join_", "(_", "self_", "._", "accumulated", "\\u", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "self_", "._", "stdout", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "self_", "._", "std", "err", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "self_", "._", "stdout", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "self_", "._", "std", "err", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "stdout", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "self_", "._", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "end", " ", "stdout", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "std", "err", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "self_", "._", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "end", " ", "std", "err", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "log", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "log", " ", "output", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "self_", "._", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "log", "\\u", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "'===", "=", " ", "end", " ", "log", " ", "output", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "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_", "Run", "Command_", "(_", "self_", ",_", "command", "\\u", "name_", ",_", "args_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "debug_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "stdout_", "=_", "False_", ",_", "return", "\\u", "stderr_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "log", "\\u", "handler_", "=_", "False_", ",_", "cwd_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Meth", "od", " ", "for", " ", "calling", " ", "gsl", "ib", ".", "command", "\\u", "runn", "er", ".", "Command", "Run", "ner", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "parall", "el", "\\u", "operati", "ons", "=", "Fal", "se", " ", "for", " ", "all", " ", "tests", ",", " ", "option", "ally", " ", "saving", "/", "return", "ing", "\\", "10", ";", " ", " ", " ", " ", "stdout", " ", "output", ".", " ", "We", " ", "run", " ", "all", " ", "tests", " ", "multi", "-", "threaded", ",", " ", "to", " ", "exercise", " ", "tho", "se", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "compli", "cated", " ", "code", " ", "path", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "Change", " ", "to", " ", "run", " ", "with", " ", "parall", "el", "\\u", "operati", "ons", "=", "Tru", "e", " ", "for", " ", "all", " ", "tests", ".", " ", "At", "\\", "10", ";", " ", " ", " ", " ", "presen", "t", " ", "whe", "n", " ", "you", " ", "do", " ", "this", " ", "it", " ", "caus", "es", " ", "many", " ", "test", " ", "fail", "ure", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "command", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "command", " ", "bei", "ng", " ", "run", ".", "\\", "10", ";", " ", " ", "args", ":", " ", "Command", "-", "line", " ", "args", " ", "(", "arg", "0", " ", "=", " ", "actual", " ", "arg", ",", " ", "not", " ", "command", " ", "name", " ", "ala", " ", "bash", ").", "\\", "10", ";", " ", " ", "header", "s", ":", " ", "Dict", "ionar", "y", " ", "contain", "ing", " ", "option", "al", " ", "HTTP", " ", "header", "s", " ", "to", " ", "pass", " ", "to", " ", "boto", ".", "\\", "10", ";", " ", " ", "debug", ":", " ", "Deb", "ug", " ", "level", " ", "to", " ", "pass", " ", "in", " ", "to", " ", "boto", " ", "connecti", "on", " ", "(", "range", " ", "0.", ".3", ").", "\\", "10", ";", " ", " ", "return", "\\u", "stdout", ":", " ", "If", " ", "Tru", "e", ",", " ", "will", " ", "save", " ", "and", " ", "return", " ", "stdout", " ", "produce", "d", " ", "by", " ", "command", ".", "\\", "10", ";", " ", " ", "return", "\\u", "std", "err", ":", " ", "If", " ", "Tru", "e", ",", " ", "will", " ", "save", " ", "and", " ", "return", " ", "std", "err", " ", "produce", "d", " ", "by", " ", "command", ".", "\\", "10", ";", " ", " ", "return", "\\u", "log", "\\u", "handler", ":", " ", "If", " ", "Tru", "e", ",", " ", "will", " ", "return", " ", "a", " ", "Moc", "k", "Log", "ging", "Handle", "r", " ", "instance", "\\", "10", ";", " ", " ", " ", "tha", "t", " ", "was", " ", "attache", "d", " ", "to", " ", "the", " ", "command", "'", "s", " ", "logg", "er", " ", "whi", "le", " ", "runn", "ing", ".", "\\", "10", ";", " ", " ", "cw", "d", ":", " ", "The", " ", "working", " ", "director", "y", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "switche", "d", " ", "to", " ", "bef", "ore", " ", "runn", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", "command", ".", " ", "The", " ", "working", " ", "director", "y", " ", "will", " ", "be", " ", "reset", " ", "back", " ", "to", " ", "its", " ", "original", "\\", "10", ";", " ", " ", " ", "value", " ", "after", " ", "runn", "ing", " ", "the", " ", "command", ".", " ", "If", " ", "not", " ", "specified", ",", " ", "the", " ", "working", "\\", "10", ";", " ", " ", " ", "director", "y", " ", "is", " ", "left", " ", "unchanged", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "One", " ", "or", " ", "a", " ", "tuple", " ", "of", " ", "request", "ed", " ", "return", " ", "values", ",", " ", "depend", "ing", " ", "on", " ", "whe", "ther", "\\", "10", ";", " ", " ", "return", "\\u", "stdout", ",", " ", "return", "\\u", "std", "err", ",", " ", "and", "/", "or", " ", "return", "\\u", "log", "\\u", "handler", " ", "wer", "e", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "line_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "command", "\\u", "name_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "'\\\\", "n", "Run", "Command", " ", "of", " ", "%", "s", "\\\\", "n", "'_", "%_", "command", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "and", " ", "truncat", "e", " ", "stdout", " ", "and", " ", "std", "err", " ", "for", " ", "the", " ", "life", "time", " ", "of", " ", "Run", "Command", ".", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "way", ",", " ", "we", " ", "can", " ", "return", " ", "just", " ", "the", " ", "stdout", " ", "and", " ", "std", "err", " ", "tha", "t", " ", "was", " ", "output", " ", "dur", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", "Name", "d", "Command", " ", "call", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "sys_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "=_", "sys_", "._", "stderr_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "accumulated", "\\u", "stdout_", "._", "append_", "(_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "accumulated", "\\u", "stderr_", "._", "append_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "truncate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "truncate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "log", "\\u", "handler_", "=_", "Moc", "k", "Log", "ging", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "command", "\\u", "name_", ")_", "._", "add", "Handler_", "(_", "mock", "\\u", "log", "\\u", "handler_", ")_", "\\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 ", " _", "with_", "Work", "ing", "Directory_", "(_", "cwd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "\\u", "runner_", "._", "Run", "Name", "d", "Command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "name_", ",_", "args_", "=_", "args_", ",_", "headers_", "=_", "headers_", ",_", "debug_", "=_", "debug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parall", "el", "\\u", "operations_", "=_", "False_", ",_", "do", "\\u", "shutdown_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "sys_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "=_", "sys_", "._", "stderr_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "command", "\\u", "name_", ")_", "._", "remove", "Handler_", "(_", "mock", "\\u", "log", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "log", "\\u", "handler_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "output_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":\\\\", "n", " ", " ", "'_", "%_", "level_", "+_", "'\\\\", "n", " ", " ", "'_", "._", "join_", "(_", "records_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "level_", ",_", "records_", "in_", "mock", "\\u", "log", "\\u", "handler_", "._", "messages_", "._", "iteritems_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "log", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'===", "=", " ", "logg", "ing", " ", "Run", "Command", " ", "%", "s", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "id_", "(_", ")_", ",_", "command", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "log", "\\u", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "'\\\\", "n", "====", " ", "end", " ", "logg", "ing", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'===", "=", " ", "stdout", " ", "Run", "Command", " ", "%", "s", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "id_", "(_", ")_", ",_", "command", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "'===", "=", " ", "end", " ", "stdout", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "debugg", "ing_", "and_", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'===", "=", " ", "std", "err", " ", "Run", "Command", " ", "%", "s", " ", "%", "s", " ", "====", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "id_", "(_", ")_", ",_", "command", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "std", "err", "\\u", "save_", "._", "write_", "(_", "'===", "=", " ", "end", " ", "std", "err", " ", "====", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "stdout", " ", "and", " ", "std", "err", " ", "files", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "won", "'", "t", " ", "print", " ", "them", " ", "out", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "tear", "Down", " ", "if", " ", "debugg", "ing", " ", "is", " ", "enable", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "truncate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "truncate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "return_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "return", "\\u", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "return_", "._", "append_", "(_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "return", "\\u", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "return_", "._", "append_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "return", "\\u", "log", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "return_", "._", "append_", "(_", "mock", "\\u", "log", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "to", "\\u", "return_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "return_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tuple_", "(_", "to", "\\u", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\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_", "Make", "Gs", "Ut", "il", "Api_", "(_", "cls_", ",_", "debug_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gsu", "til", "\\u", "api", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Map", "Constants_", "._", "API", "\\u", "MAP_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "mock", "\\u", "gsu", "til", "\\u", "api", "\\u", "class", "\\u", "map", "\\u", "factory_", "._", "Get", "Class", "Map_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Map", "Constants_", "._", "SUPPORT", "\\u", "MAP_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gs", "'_", ":_", "[_", "Ap", "i", "Selector_", "._", "XML_", ",_", "Ap", "i", "Selector_", "._", "JSON_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s3", "'_", ":_", "[_", "Ap", "i", "Selector_", "._", "XML_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Map", "Constants_", "._", "DEF", "AUL", "T", "\\u", "MAP_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gs", "'_", ":_", "Ap", "i", "Selector_", "._", "JSON_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s3", "'_", ":_", "Ap", "i", "Selector_", "._", "XML_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Cloud", "Ap", "i", "Del", "egat", "or_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "mock", "\\u", "bucket", "\\u", "storage", "\\u", "uri_", ",_", "gsu", "til", "\\u", "api", "\\u", "map_", ",_", "cls_", "._", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Discard", "Messag", "es", "Queue_", "(_", ")_", ",_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\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", "test\\u", "wild", "card", "\\u", "iterator_", "(_", "cls_", ",_", "uri", "\\u", "or", "\\u", "str_", ",_", "debug_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Conve", "nie", "nce", " ", "method", " ", "for", " ", "instant", "iati", "ng", " ", "a", " ", "test", " ", "instance", " ", "of", " ", "Wildcard", "Iterat", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "make", "s", " ", "it", " ", "unne", "cess", "ary", " ", "to", " ", "speci", "fy", " ", "all", " ", "the", " ", "params", " ", "of", " ", "tha", "t", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "(", "like", " ", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class", "=", "mock", "\\u", "storage", "\\u", "service", ".", "Moc", "k", "Buck", "et", "Stor", "age", "Ur", "i", ").", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", ",", " ", "nami", "ng", " ", "the", " ", "factor", "y", " ", "method", " ", "this", " ", "way", " ", "make", "s", " ", "it", " ", "clear", "er", " ", "in", " ", "the", " ", "test", " ", "code", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "Wildcard", "Iterat", "or", " ", "need", "s", " ", "to", " ", "be", " ", "set", " ", "up", " ", "for", " ", "testi", "ng", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", " ", "are", " ", "same", " ", "as", " ", "for", " ", "wild", "card", "\\u", "iter", "ator", ".", "wild", "card", "\\u", "iter", "ator", "()", ",", " ", "except", "\\", "10", ";", " ", " ", " ", " ", "there", " ", "are", " ", "no", " ", "class", " ", "args", " ", "for", " ", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class", " ", "or", " ", "gsu", "til", "\\u", "api", "\\u", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "uri", "\\u", "or", "\\u", "str", ":", " ", "Stor", "age", "Ur", "i", " ", "or", " ", "string", " ", "represent", "ing", " ", "the", " ", "wild", "card", " ", "string", ".", "\\", "10", ";", " ", " ", "debug", ":", " ", "debug", " ", "level", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "connecti", "on", " ", "(", "0.", ".3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Wildcard", "Iterat", "or", ",", " ", "over", " ", "whi", "ch", " ", "caller", " ", "can", " ", "iterate", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Remove", " ", "whe", "n", " ", "tests", " ", "no", " ", "long", "er", " ", "pass", " ", "Stor", "age", "Ur", "i", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "uri", "\\u", "string_", "=_", "uri", "\\u", "or", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "uri", "\\u", "or", "\\u", "str_", ",_", "'", "uri", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "string_", "=_", "uri", "\\u", "or", "\\u", "str_", "._", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wild", "card", "\\u", "iterator_", "._", "Creat", "e", "Wildcard", "Iterator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "uri", "\\u", "string_", ",_", "cls_", "._", "Make", "Gs", "Ut", "il", "Api_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "test\\u", "storage", "\\u", "uri_", "(_", "uri", "\\u", "str_", ",_", "default", "\\u", "scheme_", "=_", "'", "file", "'_", ",_", "debug_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Conve", "nie", "nce", " ", "method", " ", "for", " ", "instant", "iati", "ng", " ", "a", " ", "testi", "ng", " ", "instance", " ", "of", " ", "Stor", "age", "Ur", "i", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "make", "s", " ", "it", " ", "unne", "cess", "ary", " ", "to", " ", "speci", "fy", "\\", "10", ";", " ", " ", " ", " ", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class", "=", "mock", "\\u", "storage", "\\u", "service", ".", "Moc", "k", "Buck", "et", "Stor", "age", "Ur", "i", ".", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", " ", "nami", "ng", " ", "the", " ", "factor", "y", " ", "method", " ", "this", " ", "way", " ", "make", "s", " ", "it", " ", "clear", "er", " ", "in", " ", "the", " ", "test", "\\", "10", ";", " ", " ", " ", " ", "code", " ", "tha", "t", " ", "Stor", "age", "Ur", "i", " ", "need", "s", " ", "to", " ", "be", " ", "set", " ", "up", " ", "for", " ", "testi", "ng", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ",", " ", "Return", "s", ",", " ", "and", " ", "Rai", "ses", " ", "are", " ", "same", " ", "as", " ", "for", " ", "boto", ".", "storage", "\\u", "uri", "()", ",", " ", "except", " ", "there", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "no", " ", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class", " ", "arg", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "uri", "\\u", "str", ":", " ", "Ur", "i", " ", "string", " ", "to", " ", "create", " ", "Stor", "age", "Ur", "i", " ", "for", ".", "\\", "10", ";", " ", " ", "default", "\\u", "sche", "me", ":", " ", "Default", " ", "sche", "me", " ", "for", " ", "the", " ", "Stor", "age", "Ur", "i", "\\", "10", ";", " ", " ", "debug", ":", " ", "debug", " ", "level", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "connecti", "on", " ", "(", "0.", ".3", ")", "\\", "10", ";", " ", " ", "validat", "e", ":", " ", "If", " ", "Tru", "e", ",", " ", "validat", "e", " ", "the", " ", "resource", " ", "tha", "t", " ", "the", " ", "Stor", "age", "Ur", "i", " ", "refer", "s", " ", "to", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Stor", "age", "Ur", "i", " ", "based", " ", "on", " ", "the", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "boto_", "._", "storage", "\\u", "uri_", "(_", "uri", "\\u", "str_", ",_", "default", "\\u", "scheme_", ",_", "debug_", ",_", "validate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "GS", "Moc", "k", "Buck", "et", "Stor", "age", "Uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Creat", "e", "Bucket_", "(_", "self_", ",_", "bucket", "\\u", "name_", "=_", "None_", ",_", "test\\u", "objects_", "=_", "0_", ",_", "storage", "\\u", "class_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provider_", "=_", "'", "gs", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "test", " ", "bucket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bucket", " ", "and", " ", "all", " ", "of", " ", "its", " ", "content", "s", " ", "will", " ", "be", " ", "delete", "d", " ", "after", " ", "the", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "bucket", "\\u", "name", ":", " ", "Creat", "e", " ", "the", " ", "bucket", " ", "with", " ", "this", " ", "name", ".", " ", "If", " ", "not", " ", "provided", ",", " ", "a", "\\", "10", ";", " ", "temporar", "y", " ", "test", " ", "bucket", " ", "name", " ", "is", " ", "construct", "ed", ".", "\\", "10", ";", " ", " ", "test\\u", "object", "s", ":", " ", "The", " ", "number", " ", "of", " ", "object", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "place", "d", " ", "in", " ", "the", " ", "bucket", " ", "or", "\\", "10", ";", " ", " ", "a", " ", "list", " ", "of", " ", "object", " ", "names", " ", "to", " ", "place", " ", "in", " ", "the", " ", "bucket", ".", " ", "Default", "s", " ", "to", "\\", "10", ";", " ", " ", "0.", "\\", "10", ";", " ", " ", "storage", "\\u", "class", ":", " ", "storage", " ", "class", " ", "to", " ", "use", ".", " ", "If", " ", "not", " ", "provided", " ", "we", " ", "us", " ", "standard", ".", "\\", "10", ";", " ", " ", "provide", "r", ":", " ", "string", " ", "provide", "r", " ", "to", " ", "use", ",", " ", "default", " ", "gs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Stor", "age", "Ur", "i", " ", "for", " ", "the", " ", "created", " ", "bucket", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "name_", "=_", "bucket", "\\u", "name_", "or_", "self_", "._", "Make", "Temp", "Name_", "(_", "'", "bucket", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "uri_", "=_", "boto_", "._", "storage", "\\u", "uri_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "://", "%", "s", "'_", "%_", "(_", "provider_", ",_", "bucket", "\\u", "name_", "._", "lower_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suppress", "\\u", "consec", "\\u", "slash", "es_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bucket", "\\u", "storage", "\\u", "uri", "\\u", "class_", "=_", "util_", "._", "GS", "Moc", "k", "Buck", "et", "Stor", "age", "Uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "uri_", "._", "create", "\\u", "bucket_", "(_", "storage", "\\u", "class_", "=_", "storage", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bucket", "\\u", "uris_", "._", "append_", "(_", "bucket", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter_", "(_", "test\\u", "objects_", ")_", "\\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 ", " _", "test\\u", "objects_", "=_", "[_", "self_", "._", "Make", "Temp", "Name_", "(_", "'", "obj", "'_", ")_", "for_", "\\u_", "in_", "range_", "(_", "test\\u", "objects_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "name_", "in_", "enumerate_", "(_", "test\\u", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Creat", "e", "Object_", "(_", "bucket", "\\u", "uri_", "=_", "bucket", "\\u", "uri_", ",_", "object\\u", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "'", "test", " ", "%", "d", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bucket", "\\u", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Ut", "il", "Unit", "Test", "Case_", "(_", "base_", "._", "Gs", "Ut", "il", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Creat", "e", "Object_", "(_", "self_", ",_", "bucket", "\\u", "uri_", "=_", "None_", ",_", "object\\u", "name_", "=_", "None_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "test", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "bucket", "\\u", "uri", ":", " ", "The", " ", "URI", " ", "of", " ", "the", " ", "bucket", " ", "to", " ", "place", " ", "the", " ", "object", " ", "in", ".", " ", "If", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "specified", ",", " ", "a", " ", "new", " ", "temporar", "y", " ", "bucket", " ", "is", " ", "created", ".", "\\", "10", ";", " ", " ", "object\\u", "name", ":", " ", "The", " ", "name", " ", "to", " ", "use", " ", "for", " ", "the", " ", "object", ".", " ", "If", " ", "not", " ", "specified", ",", " ", "a", " ", "temporar", "y", "\\", "10", ";", " ", "test", " ", "object", " ", "name", " ", "is", " ", "construct", "ed", ".", "\\", "10", ";", " ", " ", "content", "s", ":", " ", "The", " ", "content", "s", " ", "to", " ", "write", " ", "to", " ", "the", " ", "object", ".", " ", "If", " ", "not", " ", "specified", ",", " ", "the", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "not", " ", "writt", "en", " ", "to", ",", " ", "whi", "ch", " ", "means", " ", "tha", "t", " ", "it", " ", "isn", "'", "t", " ", "actual", "ly", " ", "created", "\\", "10", ";", " ", " ", " ", " ", "ye", "t", " ", "on", " ", "the", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "Stor", "age", "Ur", "i", " ", "for", " ", "the", " ", "created", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "uri_", "=_", "bucket", "\\u", "uri_", "or_", "self_", "._", "Creat", "e", "Bucket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "name_", "or_", "self_", "._", "Make", "Temp", "Name_", "(_", "'", "obj", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "uri_", "=_", "bucket", "\\u", "uri_", "._", "clone", "\\u", "replace", "\\u", "name_", "(_", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "uri_", "._", "set\\u", "content", "s", "\\u", "from", "\\u", "string_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
XiaoMi/minos/client/deploy_chronos.py
[ { "content": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport service_config\nimport subprocess\nimport sys\nimport urlparse\n\nimport deploy_utils\n\nfrom log import Log\n\nALL_JOBS = [\"chronos\"]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n test()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "service", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "deploy", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "log_", "import_", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ALL", "\\u", "JOB", "S_", "=_", "[_", "\"", "chrono", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "test_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
veegee/guv/guv/event.py
[ { "content": " def get(self, block=True, timeout=None):\n \"\"\"Return the stored value or raise the exception.\n\n If this instance already holds a value / an exception, return / raise it immediatelly.\n Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception` or\n until the optional timeout occurs.\n\n When the *timeout* argument is present and not ``None``, it should be a\n floating point number specifying a timeout for the operation in seconds\n (or fractions thereof).\n \"\"\"\n if self._exception is not _NONE:\n if self._exception is None:\n return self.value\n raise self._exception\n elif block:\n switch = greenlet.getcurrent().switch\n self.rawlink(switch)\n try:\n timer = Timeout(timeout)\n try:\n result = self.hub.switch()\n assert result is self, 'Invalid switch into AsyncResult.get(): %r' % (result, )\n finally:\n timer.cancel()\n except:\n self.unlink(switch)\n raise\n if self._exception is None:\n return self.value\n raise self._exception\n else:\n raise Timeout", "metadata": "root.AsyncResult.get", "header": "['class', 'AsyncResult', ':', '___EOS___']", "index": 428 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Async", "Result_", ":_", "\\u\\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_", "(_", "self_", ",_", "block_", "=_", "True_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "store", "d", " ", "value", " ", "or", " ", "raise", " ", "the", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "this", " ", "instance", " ", "alr", "ead", "y", " ", "hold", "s", " ", "a", " ", "value", " ", "/", " ", "an", " ", "exception", ",", " ", "return", " ", "/", " ", "raise", " ", "it", " ", "immediate", "ll", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", ",", " ", "block", " ", "unti", "l", " ", "anot", "her", " ", "greenlet", " ", "calls", " ", ":", "meth", ":`", "set", "`", " ", "or", " ", ":", "meth", ":`", "set\\u", "exception", "`", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "unti", "l", " ", "the", " ", "option", "al", " ", "timeo", "ut", " ", "occur", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "*", "timeo", "ut", "*", " ", "argu", "ment", " ", "is", " ", "presen", "t", " ", "and", " ", "not", " ", "``", "Non", "e", "``", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "float", "ing", " ", "point", " ", "number", " ", "speci", "fy", "ing", " ", "a", " ", "timeo", "ut", " ", "for", " ", "the", " ", "operati", "on", " ", "in", " ", "second", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "or", " ", "fract", "ion", "s", " ", "there", "of", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "exception_", "is_", "not_", "\\u", "NONE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "exception_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "self_", "._", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "switch_", "=_", "greenlet", "_", "._", "getc", "urrent", "_", "(_", ")_", "._", "switch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raw", "link_", "(_", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timer_", "=_", "Timeout_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "self_", "._", "hub_", "._", "switch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "self_", ",_", "'", "Inva", "lid", " ", "switch", " ", "int", "o", " ", "Async", "Result", ".", "get", "():", " ", "%", "r", "'_", "%_", "(_", "result_", ",_", ")_", "\\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 ", " ", "_", "timer_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unlink_", "(_", "switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exception_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "self_", "._", "\\u", "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 ", " _", "raise_", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/engine/base.py
[ { "content": " def _prepare_twophase_impl(self, xid):\n if self._has_events or self.engine._has_events:\n self.dispatch.prepare_twophase(self, xid)\n\n if self._still_open_and_connection_is_valid:\n assert isinstance(self.__transaction, TwoPhaseTransaction)\n self.engine.dialect.do_prepare_twophase(self, xid)", "metadata": "root.Connection._prepare_twophase_impl", "header": "['class', 'Connection', '(', 'Connectable', ')', ':', '___EOS___']", "index": 572 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Connection_", "(_", "Connect", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "prepar", "e\\u", "two", "phase", "\\u", "impl_", "(_", "self_", ",_", "xid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "has", "\\u", "events_", "or_", "self_", "._", "engine_", "._", "\\u", "has", "\\u", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch_", "._", "prepar", "e\\u", "two", "phase_", "(_", "self_", ",_", "xid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "still", "\\u", "open", "\\u", "and", "\\u", "connecti", "on", "\\u", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "self_", "._", "\\u\\u", "transaction_", ",_", "Tw", "o", "Phase", "Transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "dialect_", "._", "do", "\\u", "prepar", "e\\u", "two", "phase_", "(_", "self_", ",_", "xid_", ")_", "\\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 ]
Unused import
projectatomic/osbs-client/tests/cli/test_render.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\"\"\"\nfrom __future__ import print_function, absolute_import, unicode_literals\n\nimport osbs.cli.render\nfrom osbs.cli.render import TablePrinter, get_terminal_size\n\nfrom flexmock import flexmock\n\n\nLONGEST_VAL1 = \"l\" * 10\nLONGEST_VAL2 = \"l\" * 100\nLONGEST_VAL3 = \"l\" * 80\n\nSAMPLE_DATA = [\n {\"x\": \"H\" * 8, \"y\": \"H\" * 20, \"z\": \"H\" * 4},\n {\"x\": LONGEST_VAL1, \"y\": LONGEST_VAL2, \"z\": \"a\"},\n {\"x\": \"zxc\", \"y\": \"asdqwe\", \"z\": LONGEST_VAL3},\n]\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_get_terminal_size():\n result = get_terminal_size()\n assert isinstance(result, tuple)\n assert isinstance(result[0], int) or result[0] is None\n assert isinstance(result[1], int) or result[1] is None", "metadata": "root.test_get_terminal_size", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def test_get_longest_val_in_col():\n p = TablePrinter(SAMPLE_DATA, [\"x\", \"y\"])\n assert p._longest_val_in_column(\"x\") == len(LONGEST_VAL1) + 2\n assert p._longest_val_in_column(\"y\") == len(LONGEST_VAL2) + 2", "metadata": "root.test_get_longest_val_in_col", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def test_get_longest_col_vals():\n p = TablePrinter(SAMPLE_DATA, [\"x\", \"y\", \"z\"])\n response = p.get_all_longest_col_lengths()\n assert response[\"x\"] == len(LONGEST_VAL1) + 2\n assert response[\"y\"] == len(LONGEST_VAL2) + 2\n assert response[\"z\"] == len(LONGEST_VAL3) + 2", "metadata": "root.test_get_longest_col_vals", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def test_print_table():\n p = TablePrinter(SAMPLE_DATA, [\"x\", \"y\", \"z\"])\n p.render()", "metadata": "root.test_print_table", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def test_print_table_with_mocked_terminal(capsys):\n (flexmock(osbs.cli.render)\n .should_receive('get_terminal_size')\n .and_return(25, 80)\n .once())\n short_data = [{'x': 'Header1', 'y': 'Header2', 'z': 'Header3'},\n {'x': 'x' * 8, 'y': 'y' * 20, 'z': 'z' * 4}]\n p = TablePrinter(short_data, [\"x\", \"y\", \"z\"])\n p.render()\n out, err = capsys.readouterr()\n expected_header = \"\"\"\n Header1 | Header2 | Header3 \n-----------------------+----------------------------------+---------------------\n\"\"\".lstrip('\\n')\n expected_data = \"\"\"\n xxxxxxxx | yyyyyyyyyyyyyyyyyyyy | zzzz \n\"\"\".lstrip('\\n')\n\n assert err == expected_header\n assert out == expected_data", "metadata": "root.test_print_table_with_mocked_terminal", "header": "['module', '___EOS___']", "index": 52 } ]
[]
[]
0
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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os", "bs_", "._", "cli_", "._", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os", "bs_", "._", "cli_", "._", "render_", "import_", "Table", "Printer_", ",_", "get", "\\u", "termina", "l\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flex", "mock_", "import_", "flex", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LONG", "EST", "\\u", "VAL", "1_", "=_", "\"", "l", "\"_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LONG", "EST", "\\u", "VAL", "2_", "=_", "\"", "l", "\"_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LONG", "EST", "\\u", "VAL", "3_", "=_", "\"", "l", "\"_", "*_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SAMPLE", "\\u", "DATA_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "x", "\"_", ":_", "\"", "H", "\"_", "*_", "8_", ",_", "\"", "y", "\"_", ":_", "\"", "H", "\"_", "*_", "20_", ",_", "\"", "z", "\"_", ":_", "\"", "H", "\"_", "*_", "4_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "x", "\"_", ":_", "LONG", "EST", "\\u", "VAL", "1_", ",_", "\"", "y", "\"_", ":_", "LONG", "EST", "\\u", "VAL", "2_", ",_", "\"", "z", "\"_", ":_", "\"", "a", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "x", "\"_", ":_", "\"", "zx", "c", "\"_", ",_", "\"", "y", "\"_", ":_", "\"", "asd", "qwe", "\"_", ",_", "\"", "z", "\"_", ":_", "LONG", "EST", "\\u", "VAL", "3_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "get", "\\u", "termina", "l\\u", "size_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "get", "\\u", "termina", "l\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "result_", ",_", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "result_", "[_", "0_", "]_", ",_", "int_", ")_", "or_", "result_", "[_", "0_", "]_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "result_", "[_", "1_", "]_", ",_", "int_", ")_", "or_", "result_", "[_", "1_", "]_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "long", "est", "\\u", "val", "\\u", "in", "\\u", "col_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Table", "Printer_", "(_", "SAMPLE", "\\u", "DATA_", ",_", "[_", "\"", "x", "\"_", ",_", "\"", "y", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "\\u", "long", "est", "\\u", "val", "\\u", "in", "\\u", "column_", "(_", "\"", "x", "\"_", ")_", "==_", "len_", "(_", "LONG", "EST", "\\u", "VAL", "1_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "\\u", "long", "est", "\\u", "val", "\\u", "in", "\\u", "column_", "(_", "\"", "y", "\"_", ")_", "==_", "len_", "(_", "LONG", "EST", "\\u", "VAL", "2_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "long", "est", "\\u", "col", "\\u", "vals_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Table", "Printer_", "(_", "SAMPLE", "\\u", "DATA_", ",_", "[_", "\"", "x", "\"_", ",_", "\"", "y", "\"_", ",_", "\"", "z", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "p_", "._", "get", "\\u", "all", "\\u", "long", "est", "\\u", "col", "\\u", "lengths_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "\"", "x", "\"_", "]_", "==_", "len_", "(_", "LONG", "EST", "\\u", "VAL", "1_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "\"", "y", "\"_", "]_", "==_", "len_", "(_", "LONG", "EST", "\\u", "VAL", "2_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "[_", "\"", "z", "\"_", "]_", "==_", "len_", "(_", "LONG", "EST", "\\u", "VAL", "3_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "print", "\\u", "table_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Table", "Printer_", "(_", "SAMPLE", "\\u", "DATA_", ",_", "[_", "\"", "x", "\"_", ",_", "\"", "y", "\"_", ",_", "\"", "z", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "print", "\\u", "table", "\\u", "with", "\\u", "mocked", "\\u", "terminal_", "(_", "capsys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "flex", "mock_", "(_", "os", "bs_", "._", "cli_", "._", "render_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "shou", "ld", "\\u", "receive_", "(_", "'", "get", "\\u", "termina", "l\\u", "size", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "and", "\\u", "return_", "(_", "25_", ",_", "80_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "once_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "\\u", "data_", "=_", "[_", "{_", "'", "x", "'_", ":_", "'", "Head", "er1", "'_", ",_", "'", "y", "'_", ":_", "'", "Head", "er2", "'_", ",_", "'", "z", "'_", ":_", "'", "Head", "er", "3", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "'_", ":_", "'", "x", "'_", "*_", "8_", ",_", "'", "y", "'_", ":_", "'", "y", "'_", "*_", "20_", ",_", "'", "z", "'_", ":_", "'", "z", "'_", "*_", "4_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Table", "Printer_", "(_", "short", "\\u", "data_", ",_", "[_", "\"", "x", "\"_", ",_", "\"", "y", "\"_", ",_", "\"", "z", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "err_", "=_", "capsys_", "._", "readouterr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "header_", "=_", "\"\"\"", "\\", "10", ";", " ", "Head", "er1", " ", " ", " ", "|", " ", "Head", "er2", " ", " ", " ", " ", "|", " ", "Head", "er", "3", " ", " ", " ", " ", " ", "\\", "10", ";", "--------------", "---------", "+----------", "--------------", "----------", "+----------", "-----------", "\\", "10", ";\"\"\"_", "._", "lstrip_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "data_", "=_", "\"\"\"", "\\", "10", ";", " ", "xxxxxxxx", " ", " ", " ", " ", " ", " ", "|", " ", "yyyy", "yyyy", "yyyy", "yyyy", "yyyy", " ", " ", " ", " ", " ", "|", " ", "zzz", "z", " ", " ", " ", " ", "\\", "10", ";\"\"\"_", "._", "lstrip_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "err_", "==_", "expected", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "out_", "==_", "expected", "\\u", "data_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Use of 'global' at module level
osrg/ryu/ryu/contrib/__init__.py
[ { "content": "def restore_module_path():\n global _orig_sys_path\n\n sys.path = _orig_sys_path\n _orig_sys_path = None", "metadata": "root.restore_module_path", "header": "['module', '___EOS___']", "index": 21 } ]
[]
[]
0
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restore", "\\u", "module", "\\u", "path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "orig", "\\u", "sys", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "=_", "\\u", "orig", "\\u", "sys", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "orig", "\\u", "sys", "\\u", "path_", "=_", "None_" ]
[ 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 ]
Unreachable code
memsql/memsql-loader/memsql_loader/cli/tasks.py
[ { "content": " def run(self):\n self.logger = log.get_logger('Tasks')\n self.tasks_api = TasksApi()\n\n if not self.options.job_id and not self.options.last_job:\n print 'You must specify a job ID or use the --last-job option.'\n sys.exit(1)\n\n if self.options.last_job:\n jobs = Jobs()\n job_list = jobs.all()\n if not job_list:\n print 'No jobs found.'\n sys.exit(1)\n self.options.job_id = job_list[-1].id\n\n try:\n result = self.tasks_api.query({ k: v for k, v in {\n 'job_id': self.options.job_id,\n 'state': self.options.state,\n 'order': self.options.order,\n 'order_by': self.options.order_by,\n 'page_size': self.options.page_size,\n 'page': self.options.page,\n }.iteritems() if v })\n except exceptions.ApiException as e:\n print e.message\n sys.exit(1)\n\n if result:\n tablefmt = TableFormat.JSON if self.options.json else TableFormat.TABLE\n print PrettyPrinter(result, columns=TasksApi.SORTABLE_COLUMNS, format=tablefmt).format()\n else:\n print 'No tasks found that match this query'\n sys.exit(1)", "metadata": "root.Tasks.run", "header": "['class', 'Tasks', '(', 'Command', ')', ':', '___EOS___']", "index": 47 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Tasks_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "=_", "log_", "._", "get", "\\u", "logger_", "(_", "'", "Task", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "s", "\\u", "api_", "=_", "Task", "s", "Api_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "options_", "._", "job", "\\u", "id_", "and_", "not_", "self_", "._", "options_", "._", "last", "\\u", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "You", " ", "must", " ", "speci", "fy", " ", "a", " ", "job", " ", "ID", " ", "or", " ", "use", " ", "the", " ", "--", "last", "-", "job", " ", "option", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "options_", "._", "last", "\\u", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobs_", "=_", "Jobs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "list_", "=_", "jobs_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "No", " ", "jobs", " ", "found", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "options_", "._", "job", "\\u", "id_", "=_", "job", "\\u", "list_", "[_", "-_", "1_", "]_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "task", "s", "\\u", "api_", "._", "query_", "(_", "{_", "k_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "job", "\\u", "id", "'_", ":_", "self_", "._", "options_", "._", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "self_", "._", "options_", "._", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "self_", "._", "options_", "._", "order_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "\\u", "by", "'_", ":_", "self_", "._", "options_", "._", "order", "\\u", "by_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "\\u", "size", "'_", ":_", "self_", "._", "options_", "._", "page", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "'_", ":_", "self_", "._", "options_", "._", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "iteritems_", "(_", ")_", "if_", "v_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "._", "Ap", "i", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "fmt_", "=_", "Table", "Format_", "._", "JSON_", "if_", "self_", "._", "options_", "._", "json_", "else_", "Table", "Format_", "._", "TABLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "Pret", "ty", "Printer_", "(_", "result_", ",_", "columns_", "=_", "Task", "s", "Api_", "._", "SORT", "AB", "LE", "\\u", "COLUMNS_", ",_", "format_", "=_", "table", "fmt_", ")_", "._", "format_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "No", " ", "task", "s", " ", "found", " ", "tha", "t", " ", "match", " ", "this", " ", "query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
bitxbay/BitXBay/electrum_main.py
[ { "content": "def main():\n global guiWindow\n parser = arg_parser()\n options, args = parser.parse_args()\n if options.portable and options.wallet_path is None:\n options.electrum_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')\n\n # config is an object passed to the various constructors (wallet, interface, gui)\n if is_android:\n config_options = {\n 'portable': True,\n 'verbose': True,\n 'gui': 'android',\n 'auto_cycle': True,\n }\n else:\n config_options = eval(str(options))\n for k, v in config_options.items():\n if v is None:\n config_options.pop(k)\n\n set_verbosity(config_options.get('verbose'))\n\n config = SimpleConfig(config_options)\n cmd = ''\n if len(args) == 0:\n url = None\n cmd = 'gui'\n elif len(args) == 1 and re.match('^bitcoin:', args[0]):\n url = args[0]\n cmd = 'gui'\n else:\n pass\n cmd = args[0]\n\n if cmd == 'gui':\n gui_name = 'stdio'#config.get('gui', 'classic')\n if gui_name in ['lite', 'classic']:\n gui_name = 'qt'\n try:\n gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui'])\n except ImportError:\n traceback.print_exc(file=sys.stdout)\n sys.exit()\n #sys.exit(\"Error: Unknown GUI: \" + gui_name )\n\n # network interface\n if not options.offline:\n network = Network(config)\n network.start()\n else:\n network = None\n\n guiWindow = gui = gui.ElectrumGui(config, network)\n gui.main(url)\n\n if network:\n network.stop()\n\n # we use daemon threads, their termination is enforced.\n # this sleep command gives them time to terminate cleanly.\n time.sleep(0.1)\n sys.exit(0)\n\n if cmd not in known_commands:\n cmd = 'help'\n\n cmd = known_commands[cmd]\n\n # instanciate wallet for command-line\n storage = WalletStorage(config)\n\n\n if cmd.name in ['create', 'restore']:\n if storage.file_exists:\n sys.exit(\"Error: Remove the existing wallet first!\")\n if options.password is not None:\n password = options.password\n elif cmd.name == 'restore' and options.mpk:\n password = None\n else:\n password = prompt_password(\"Password (hit return if you do not wish to encrypt your wallet):\")\n\n # if config.server is set, the user either passed the server on command line\n # or chose it previously already. if he didn't pass a server on the command line,\n # we just pick up a random one.\n if not config.get('server'):\n config.set_key('server', pick_random_server())\n\n #fee = options.tx_fee if options.tx_fee else raw_input(\"fee (default:%s):\" % (str(Decimal(wallet.fee)/100000000)))\n #gap = options.gap_limit if options.gap_limit else raw_input(\"gap limit (default 5):\")\n #if fee:\n # wallet.set_fee(float(fee)*100000000)\n #if gap:\n # wallet.change_gap_limit(int(gap))\n\n if cmd.name == 'restore':\n if options.mpk:\n wallet = Wallet.from_mpk(options.mpk, storage)\n else:\n import getpass\n seed = getpass.getpass(prompt=\"seed:\", stream=None) if options.concealed else raw_input(\"seed:\")\n wallet = Wallet.from_seed(str(seed),storage)\n if not wallet:\n sys.exit(\"Error: Invalid seed\")\n wallet.save_seed(password)\n\n if not options.offline:\n network = Network(config)\n network.start()\n wallet.start_threads(network)\n print_msg(\"Recovering wallet...\")\n wallet.restore(lambda x: x)\n if wallet.is_found():\n print_msg(\"Recovery successful\")\n else:\n print_msg(\"Warning: Found no history for this wallet\")\n else:\n wallet.synchronize()\n print_msg(\"Warning: This wallet was restored offline. It may contain more addresses than displayed.\")\n\n else:\n wallet = Wallet(storage)\n wallet.init_seed(None)\n wallet.save_seed(password)\n wallet.synchronize()\n print_msg(\"Your wallet generation seed is:\\n\\\"%s\\\"\" % wallet.get_mnemonic(password))\n print_msg(\"Please keep it in a safe place; if you lose it, you will not be able to restore your wallet.\")\n\n print_msg(\"Wallet saved in '%s'\" % wallet.storage.path)\n\n # terminate\n sys.exit(0)\n\n\n if cmd.name not in ['create', 'restore'] and cmd.requires_wallet and not storage.file_exists:\n print_msg(\"Error: Wallet file not found.\")\n print_msg(\"Type 'electrum create' to create a new wallet, or provide a path to a wallet with the -w option\")\n sys.exit(0)\n\n\n if cmd.requires_wallet:\n wallet = Wallet(storage)\n else:\n wallet = None\n\n\n # important warning\n if cmd.name in ['dumpprivkey', 'dumpprivkeys']:\n print_msg(\"WARNING: ALL your private keys are secret.\")\n print_msg(\"Exposing a single private key can compromise your entire wallet!\")\n print_msg(\"In particular, DO NOT use 'redeem private key' services proposed by third parties.\")\n\n # commands needing password\n if cmd.requires_password:\n if wallet.seed == '':\n seed = ''\n password = None\n elif wallet.use_encryption:\n password = prompt_password('Password:', False)\n if not password:\n print_msg(\"Error: Password required\")\n sys.exit(1)\n # check password\n try:\n seed = wallet.get_seed(password)\n except Exception:\n print_msg(\"Error: This password does not decode this wallet.\")\n sys.exit(1)\n else:\n password = None\n seed = wallet.get_seed(None)\n else:\n password = None\n\n # add missing arguments, do type conversions\n if cmd.name == 'importprivkey':\n # See if they specificed a key on the cmd line, if not prompt\n if len(args) == 1:\n args[1] = prompt_password('Enter PrivateKey (will not echo):', False)\n\n elif cmd.name == 'signrawtransaction':\n args = [cmd, args[1], json.loads(args[2]) if len(args) > 2 else [], json.loads(args[3]) if len(args) > 3 else []]\n\n elif cmd.name == 'createmultisig':\n args = [cmd, int(args[1]), json.loads(args[2])]\n\n elif cmd.name == 'createrawtransaction':\n args = [cmd, json.loads(args[1]), json.loads(args[2])]\n\n elif cmd.name == 'listaddresses':\n args = [cmd, options.show_all, options.show_labels]\n\n elif cmd.name in ['payto', 'mktx']:\n domain = [options.from_addr] if options.from_addr else None\n args = ['mktx', args[1], Decimal(args[2]), Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain]\n\n elif cmd.name in ['paytomany', 'mksendmanytx']:\n domain = [options.from_addr] if options.from_addr else None\n outputs = []\n for i in range(1, len(args), 2):\n if len(args) < i+2:\n print_msg(\"Error: Mismatched arguments.\")\n sys.exit(1)\n outputs.append((args[i], Decimal(args[i+1])))\n args = ['mksendmanytx', outputs, Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain]\n\n elif cmd.name == 'help':\n if len(args) < 2:\n print_help(parser)\n\n # check the number of arguments\n if len(args) - 1 < cmd.min_args:\n print_msg(\"Not enough arguments\")\n print_msg(\"Syntax:\", cmd.syntax)\n sys.exit(1)\n\n if cmd.max_args >= 0 and len(args) - 1 > cmd.max_args:\n print_msg(\"too many arguments\", args)\n print_msg(\"Syntax:\", cmd.syntax)\n sys.exit(1)\n\n if cmd.max_args < 0:\n if len(args) > cmd.min_args + 1:\n message = ' '.join(args[cmd.min_args:])\n print_msg(\"Warning: Final argument was reconstructed from several arguments:\", repr(message))\n args = args[0:cmd.min_args] + [message]\n\n\n\n # run the command\n if cmd.name == 'deseed':\n if not wallet.seed:\n print_msg(\"Error: This wallet has no seed\")\n else:\n ns = wallet.storage.path + '.seedless'\n print_msg(\"Warning: you are going to create a seedless wallet'\\nIt will be saved in '%s'\" % ns)\n if raw_input(\"Are you sure you want to continue? (y/n) \") in ['y', 'Y', 'yes']:\n wallet.storage.path = ns\n wallet.seed = ''\n wallet.storage.put('seed', '', True)\n wallet.use_encryption = False\n wallet.storage.put('use_encryption', wallet.use_encryption, True)\n for k in wallet.imported_keys.keys():\n wallet.imported_keys[k] = ''\n wallet.storage.put('imported_keys', wallet.imported_keys, True)\n print_msg(\"Done.\")\n else:\n print_msg(\"Action canceled.\")\n\n elif cmd.name == 'getconfig':\n key = args[1]\n out = config.get(key)\n print_msg(out)\n\n elif cmd.name == 'setconfig':\n key, value = args[1:3]\n try:\n value = ast.literal_eval(value)\n except:\n pass\n config.set_key(key, value, True)\n print_msg(True)\n\n elif cmd.name == 'password':\n new_password = prompt_password('New password:')\n wallet.update_password(password, new_password)\n\n else:\n run_command(cmd, password, args)\n\n\n time.sleep(0.1)\n sys.exit(0)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 135 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "gui", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "arg", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "portab", "le_", "and_", "options_", "._", "walle", "t", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "electr", "um", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "electr", "um", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "config", " ", "is", " ", "an", " ", "object", " ", "pass", "ed", " ", "to", " ", "the", " ", "vari", "ous", " ", "construct", "ors", " ", "(", "walle", "t", ",", " ", "interface", ",", " ", "gui", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "android", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "portab", "le", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verbo", "se", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gui", "'_", ":_", "'", "android", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auto", "\\u", "cycle", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "options_", "=_", "eval_", "(_", "str_", "(_", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "config", "\\u", "options_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "options_", "._", "pop_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "verbosity_", "(_", "config", "\\u", "options_", "._", "get_", "(_", "'", "verbo", "se", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Simple", "Config_", "(_", "config", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "gui", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "1_", "and_", "re_", "._", "match_", "(_", "'", "^", "bitcoin", ":'_", ",_", "args_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "gui", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "==_", "'", "gui", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui", "\\u", "name_", "=_", "'", "std", "io", "'_", "#", "config", ".", "get", "('", "gui", "',", " ", "'", "classic", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gui", "\\u", "name_", "in_", "[_", "'", "lite", "'_", ",_", "'", "classic", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui", "\\u", "name_", "=_", "'", "qt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "electr", "um", "\\u", "gui", ".'_", "+_", "gui", "\\u", "name_", ",_", "froml", "ist_", "=_", "[_", "'", "electr", "um", "\\u", "gui", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", "file_", "=_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sys", ".", "exit", "(\"", "Error", ":", " ", "Un", "know", "n", " ", "GU", "I", ":", " ", "\"", " ", "+", " ", "gui", "\\u", "name", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "network", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Network_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gui", "Window_", "=_", "gui_", "=_", "gui_", "._", "Elect", "rum", "Gui_", "(_", "config_", ",_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gui_", "._", "main_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "use", " ", "daemon", " ", "thread", "s", ",", " ", "thei", "r", " ", "termination", " ", "is", " ", "enforce", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "sleep", " ", "command", " ", "give", "s", " ", "them", " ", "time", " ", "to", " ", "terminate", " ", "clean", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "not_", "in_", "know", "n", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "help", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "know", "n", "\\u", "commands_", "[_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instan", "ciat", "e", " ", "walle", "t", " ", "for", " ", "command", "-", "line_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "=_", "Wall", "et", "Storage_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cmd_", "._", "name_", "in_", "[_", "'", "create", "'_", ",_", "'", "restore", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "storage_", "._", "file", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "\"", "Error", ":", " ", "Remove", " ", "the", " ", "exist", "ing", " ", "walle", "t", " ", "first", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "password_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "options_", "._", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "restore", "'_", "and_", "options_", "._", "mp", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "prompt", "\\u", "password_", "(_", "\"", "Passw", "ord", " ", "(", "hit", " ", "return", " ", "if", " ", "you", " ", "do", " ", "not", " ", "wish", " ", "to", " ", "encrypt", " ", "your", " ", "walle", "t", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "config", ".", "server", " ", "is", " ", "set", ",", " ", "the", " ", "user", " ", "eit", "her", " ", "pass", "ed", " ", "the", " ", "server", " ", "on", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "chos", "e", " ", "it", " ", "previ", "ously", " ", "alr", "ead", "y", ".", " ", "if", " ", "he", " ", "did", "n", "'", "t", " ", "pass", " ", "a", " ", "server", " ", "on", " ", "the", " ", "command", " ", "line", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "just", " ", "pick", " ", "up", " ", "a", " ", "random", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "config_", "._", "get_", "(_", "'", "server", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "set\\u", "key_", "(_", "'", "server", "'_", ",_", "pick", "\\u", "random", "\\u", "server_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fe", "e", " ", "=", " ", "options", ".", "tx", "\\u", "fe", "e", " ", "if", " ", "options", ".", "tx", "\\u", "fe", "e", " ", "else", " ", "raw", "\\u", "input", "(\"", "fe", "e", " ", "(", "default", ":", "%", "s", "):", "\"", " ", "%", " ", "(", "str", "(", "Deci", "mal", "(", "walle", "t", ".", "fe", "e", ")/", "100000000", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gap", " ", "=", " ", "options", ".", "gap", "\\u", "limit", " ", "if", " ", "options", ".", "gap", "\\u", "limit", " ", "else", " ", "raw", "\\u", "input", "(\"", "gap", " ", "limit", " ", "(", "default", " ", "5", "):", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "fe", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "walle", "t", ".", "set\\u", "fe", "e", "(", "float", "(", "fe", "e", ")*", "100000000", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "gap", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "walle", "t", ".", "change", "\\u", "gap", "\\u", "limit", "(", "int", "(", "gap", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "restore", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "mp", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "._", "from", "\\u", "mp", "k_", "(_", "options_", "._", "mp", "k_", ",_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "getpass_", "._", "getpass_", "(_", "prompt_", "=_", "\"", "seed", ":\"_", ",_", "stream_", "=_", "None_", ")_", "if_", "options_", "._", "conce", "ale", "d_", "else_", "raw", "\\u", "input_", "(_", "\"", "seed", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "=_", "Wallet_", "._", "from", "\\u", "seed_", "(_", "str_", "(_", "seed_", ")_", ",_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "wallet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sys_", "._", "exit_", "(_", "\"", "Error", ":", " ", "Inva", "lid", " ", "seed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wallet_", "._", "save", "\\u", "seed_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Network_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "start", "\\u", "threads_", "(_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Recover", "ing", " ", "walle", "t", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "restore_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wallet_", "._", "is", "\\u", "found_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "msg_", "(_", "\"", "Recover", "y", " ", "success", "ful", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Foun", "d", " ", "no", " ", "histo", "ry", " ", "for", " ", "this", " ", "walle", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "._", "synchronize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Thi", "s", " ", "walle", "t", " ", "was", " ", "restore", "d", " ", "offline", ".", " ", "It", " ", "may", " ", "contain", " ", "more", " ", "addresse", "s", " ", "than", " ", "displaye", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "init", "\\u", "seed_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "save", "\\u", "seed_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "synchronize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "You", "r", " ", "walle", "t", " ", "generat", "ion", " ", "seed", " ", "is", ":\\\\", "n", "\\\\\"", "%", "s", "\\\\\"\"_", "%_", "wallet_", "._", "get", "\\u", "mnemonic_", "(_", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Ple", "ase", " ", "keep", " ", "it", " ", "in", " ", "a", " ", "safe", " ", "place", ";", " ", "if", " ", "you", " ", "lose", " ", "it", ",", " ", "you", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "restore", " ", "your", " ", "walle", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Wall", "et", " ", "saved", " ", "in", " ", "'%", "s", "'\"_", "%_", "wallet_", "._", "storage_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "terminate_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "not_", "in_", "[_", "'", "create", "'_", ",_", "'", "restore", "'_", "]_", "and_", "cmd_", "._", "require", "s", "\\u", "wallet_", "and_", "not_", "storage_", "._", "file", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Wall", "et", " ", "file", " ", "not", " ", "found", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Type", " ", "'", "electr", "um", " ", "create", "'", " ", "to", " ", "create", " ", "a", " ", "new", " ", "walle", "t", ",", " ", "or", " ", "provide", " ", "a", " ", "path", " ", "to", " ", "a", " ", "walle", "t", " ", "with", " ", "the", " ", "-", "w", " ", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "require", "s", "\\u", "wallet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "importa", "nt", " ", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "in_", "[_", "'", "dump", "priv", "key", "'_", ",_", "'", "dump", "priv", "keys", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "WARN", "ING", ":", " ", "ALL", " ", "your", " ", "private", " ", "keys", " ", "are", " ", "secret", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Expos", "ing", " ", "a", " ", "single", " ", "private", " ", "key", " ", "can", " ", "compr", "omi", "se", " ", "your", " ", "entire", " ", "walle", "t", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "In", " ", "partic", "ular", ",", " ", "DO", " ", "NOT", " ", "use", " ", "'", "rede", "em", " ", "private", " ", "key", "'", " ", "service", "s", " ", "proposed", " ", "by", " ", "third", " ", "parties", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "command", "s", " ", "need", "ing", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "require", "s", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wallet_", "._", "seed_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seed_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "wallet_", "._", "use", "\\u", "encryption_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "prompt", "\\u", "password_", "(_", "'", "Passw", "ord", ":'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Passw", "ord", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seed_", "=_", "wallet_", "._", "get", "\\u", "seed_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Thi", "s", " ", "password", " ", "doe", "s", " ", "not", " ", "decode", " ", "this", " ", "walle", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "wallet_", "._", "get", "\\u", "seed_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "missi", "ng", " ", "argu", "ment", "s", ",", " ", "do", " ", "type", " ", "conversions", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "import", "priv", "key", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "the", "y", " ", "specific", "ed", " ", "a", " ", "key", " ", "on", " ", "the", " ", "cmd", " ", "line", ",", " ", "if", " ", "not", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "1_", "]_", "=_", "prompt", "\\u", "password_", "(_", "'", "Enter", " ", "Priva", "te", "Key", " ", "(", "will", " ", "not", " ", "echo", "):'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "sign", "rawt", "ransact", "ion", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "args_", "[_", "1_", "]_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "if_", "len_", "(_", "args_", ")_", ">_", "2_", "else_", "[_", "]_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "3_", "]_", ")_", "if_", "len_", "(_", "args_", ")_", ">_", "3_", "else_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "create", "multisi", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "int_", "(_", "args_", "[_", "1_", "]_", ")_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "create", "rawt", "ransact", "ion", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "1_", "]_", ")_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "lista", "ddress", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "options_", "._", "show", "\\u", "all_", ",_", "options_", "._", "show", "\\u", "labels_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "in_", "[_", "'", "pay", "to", "'_", ",_", "'", "mkt", "x", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "[_", "options_", "._", "from", "\\u", "addr_", "]_", "if_", "options_", "._", "from", "\\u", "addr_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "'", "mkt", "x", "'_", ",_", "args_", "[_", "1_", "]_", ",_", "Decimal_", "(_", "args_", "[_", "2_", "]_", ")_", ",_", "Decimal_", "(_", "options_", "._", "tx", "\\u", "fee_", ")_", "if_", "options_", "._", "tx", "\\u", "fee_", "else_", "None_", ",_", "options_", "._", "change", "\\u", "addr_", ",_", "domain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "in_", "[_", "'", "pay", "toma", "ny", "'_", ",_", "'", "mks", "end", "many", "tx", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "[_", "options_", "._", "from", "\\u", "addr_", "]_", "if_", "options_", "._", "from", "\\u", "addr_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outputs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "args_", ")_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "<_", "i_", "+_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Mismatch", "ed", " ", "argu", "ment", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outputs_", "._", "append_", "(_", "(_", "args_", "[_", "i_", "]_", ",_", "Decimal_", "(_", "args_", "[_", "i_", "+_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "'", "mks", "end", "many", "tx", "'_", ",_", "outputs_", ",_", "Decimal_", "(_", "options_", "._", "tx", "\\u", "fee_", ")_", "if_", "options_", "._", "tx", "\\u", "fee_", "else_", "None_", ",_", "options_", "._", "change", "\\u", "addr_", ",_", "domain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "help", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "number", " ", "of", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "-_", "1_", "<_", "cmd_", "._", "min", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Not", " ", "eno", "ugh", " ", "argu", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Syntax", ":\"_", ",_", "cmd_", "._", "syntax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "max", "\\u", "args_", ">=_", "0_", "and_", "len_", "(_", "args_", ")_", "-_", "1_", ">_", "cmd_", "._", "max", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Syntax", ":\"_", ",_", "cmd_", "._", "syntax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "max", "\\u", "args_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", ">_", "cmd_", "._", "min", "\\u", "args_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", " ", "'_", "._", "join_", "(_", "args_", "[_", "cmd_", "._", "min", "\\u", "args_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Final", " ", "argu", "ment", " ", "was", " ", "reconstruct", "ed", " ", "from", " ", "sever", "al", " ", "argu", "ment", "s", ":\"_", ",_", "repr_", "(_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "[_", "0_", ":_", "cmd_", "._", "min", "\\u", "args_", "]_", "+_", "[_", "message_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "dese", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "wallet_", "._", "seed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Thi", "s", " ", "walle", "t", " ", "has", " ", "no", " ", "seed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "=_", "wallet_", "._", "storage_", "._", "path_", "+_", "'.", "seed", "less", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "you", " ", "are", " ", "goi", "ng", " ", "to", " ", "create", " ", "a", " ", "seed", "less", " ", "walle", "t", "'\\\\", "n", "It", " ", "will", " ", "be", " ", "saved", " ", "in", " ", "'%", "s", "'\"_", "%_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raw", "\\u", "input_", "(_", "\"", "Are", " ", "you", " ", "sure", " ", "you", " ", "want", " ", "to", " ", "continue", "?", " ", "(", "y", "/", "n", ")", " ", "\"_", ")_", "in_", "[_", "'", "y", "'_", ",_", "'", "Y", "'_", ",_", "'", "ye", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "._", "storage_", "._", "path_", "=_", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "seed_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "seed", "'_", ",_", "''_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "use", "\\u", "encryption_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "use", "\\u", "encrypt", "ion", "'_", ",_", "wallet_", "._", "use", "\\u", "encryption_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "wallet_", "._", "import", "ed", "\\u", "keys_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "wallet_", "._", "import", "ed", "\\u", "keys_", "[_", "k_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "import", "ed", "\\u", "keys", "'_", ",_", "wallet_", "._", "import", "ed", "\\u", "keys_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Don", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Action", " ", "cancel", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "getcon", "fig", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "config_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "setc", "onfi", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "value_", "=_", "args_", "[_", "1_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "ast_", "._", "literal", "\\u", "eval_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "set\\u", "key_", "(_", "key_", ",_", "value_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "password", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "password_", "=_", "prompt", "\\u", "password_", "(_", "'", "New", " ", "password", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "update", "\\u", "password_", "(_", "password_", ",_", "new", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "\\u", "command_", "(_", "cmd_", ",_", "password_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Non-callable called
ipython/ipython-py3k/IPython/quarantine/ipy_jot.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n%jot magic for lightweight persistence.\n\nStores variables in Struct with some notes in PicleShare database\n\n\n\"\"\"\n\nfrom datetime import datetime \nfrom IPython.core import ipapi\nip = ipapi.get()\n\nimport pickleshare\n\nimport inspect,pickle,os,sys,textwrap\nfrom IPython.core.fakemodule import FakeModule\nfrom IPython.utils.ipstruct import Struct \nfrom IPython.utils.warn import error\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\nip.define_magic('jot',magic_jot)\nip.define_magic('read',magic_read)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def detail_variables(ip, key=None):\n db, get = ip.db, ip.db.get\n \n if key is None:\n keys = db.keys('jot/*')\n else:\n keys = db.keys('jot/'+key)\n if keys:\n size = max(list(map(len,keys)))\n else:\n size = 0\n\n fmthead = '%-'+str(size)+'s [%s]'\n fmtbody = 'Comment:\\n %s'\n fmtdata = 'Data:\\n %s, %s'\n for key in keys:\n v = get(key,'<unavailable>')\n justkey = os.path.basename(key)\n try: \n print(fmthead % (justkey, datetime.ctime(v.get('time','<unavailable>'))))\n print(fmtbody % (v.get('comment','<unavailable>')))\n d = v.get('val','unavailable')\n print(fmtdata % (repr(type(d)), ''))\n print(repr(d)[0:200])\n print()\n print()\n except AttributeError:\n print(fmt % (justkey, '<unavailable>', '<unavailable>', repr(v)[:50]))", "metadata": "root.detail_variables", "header": "['module', '___EOS___']", "index": 66 } ]
[]
[]
0
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "%", "jo", "t", " ", "magic", " ", "for", " ", "light", "weight", " ", "persiste", "nce", ".", "\\", "10", ";", "\\", "10", ";", "Stor", "es", " ", "variab", "les", " ", "in", " ", "Stru", "ct", " ", "with", " ", "some", " ", "note", "s", " ", "in", " ", "Pic", "le", "Share", " ", "databa", "se", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "import_", "ipa", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "ipa", "pi_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pickle", "share_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "inspect_", ",_", "pickle_", ",_", "os_", ",_", "sys_", ",_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "._", "fake", "module_", "import_", "Fake", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "utils_", "._", "ips", "truct", "_", "import_", "Struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "utils_", "._", "warn_", "import_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "ip_", "._", "defin", "e\\u", "magic_", "(_", "'", "jo", "t", "'_", ",_", "magic", "\\u", "jo", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "defin", "e\\u", "magic_", "(_", "'", "read", "'_", ",_", "magic", "\\u", "read_", ")_", "[SEP]_", "module_", "\\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_", "deta", "il", "\\u", "variables_", "(_", "ip_", ",_", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", ",_", "get_", "=_", "ip_", "._", "db_", ",_", "ip_", "._", "db_", "._", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "db_", "._", "keys_", "(_", "'", "jo", "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 ", " _", "keys_", "=_", "db_", "._", "keys_", "(_", "'", "jo", "t", "/'_", "+_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "max_", "(_", "list_", "(_", "map_", "(_", "len_", ",_", "keys_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fmt", "head_", "=_", "'%", "-'_", "+_", "str_", "(_", "size_", ")_", "+_", "'", "s", " ", "[", "%", "s", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "body_", "=_", "'", "Comme", "nt", ":\\\\", "n", " ", "%", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "data_", "=_", "'", "Data", ":\\\\", "n", " ", "%", "s", ",", " ", "%", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "get_", "(_", "key_", ",_", "'<", "unava", "ilab", "le", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "key_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "fmt", "head_", "%_", "(_", "just", "key_", ",_", "datetime_", "._", "ctime_", "(_", "v_", "._", "get_", "(_", "'", "time", "'_", ",_", "'<", "unava", "ilab", "le", ">'_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "fmt", "body_", "%_", "(_", "v_", "._", "get_", "(_", "'", "comment", "'_", ",_", "'<", "unava", "ilab", "le", ">'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "v_", "._", "get_", "(_", "'", "val", "'_", ",_", "'", "unava", "ilab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "fmt", "data_", "%_", "(_", "repr_", "(_", "type_", "(_", "d_", ")_", ")_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "repr_", "(_", "d_", ")_", "[_", "0_", ":_", "200_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\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 ", " _", "print_", "(_", "fmt_", "%_", "(_", "just", "key_", ",_", "'<", "unava", "ilab", "le", ">'_", ",_", "'<", "unava", "ilab", "le", ">'_", ",_", "repr_", "(_", "v_", ")_", "[_", ":_", "50_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mesonbuild/meson/test cases/python3/2 extmodule/blaster.py
[ { "content": "#!/usr/bin/env python3\n\nimport tachyon\nimport sys\n\nresult = tachyon.phaserize('shoot')\n\nif not isinstance(result, int):\n print('Returned result not an integer.')\n sys.exit(1)\n\nif result != 1:\n print('Returned result {} is not 1.'.format(result))\n sys.exit(1)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tach", "yon", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "tach", "yon", "_", "._", "phase", "rize", "_", "(_", "'", "shoot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "result_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Return", "ed", " ", "result", " ", "not", " ", "an", " ", "integ", "er", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Return", "ed", " ", "result", " ", "{}", " ", "is", " ", "not", " ", "1", ".'_", "._", "format_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
girishramnani/hacking-tools/pyhashcat/sre_yield/tests/test_cachingseq.py
[ { "content": " def testIncFunc(self):\n def first_func(x):\n assert x == 0\n return 1\n\n def inc_func(i, prev):\n return prev * 2\n\n c = cachingseq.CachingFuncSequence(first_func, 10, inc_func)\n self.assertEqual([1, 2, 4, 8, 16, 32, 64, 128, 256, 512], list(c))", "metadata": "root.CachingFuncSequenceTest.testIncFunc", "header": "['class', 'CachingFuncSequenceTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Caching", "Func", "Sequ", "ence", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Inc", "Func_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "first", "\\u", "func_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inc", "\\u", "func_", "(_", "i_", ",_", "prev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "prev_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "caching", "seq_", "._", "Caching", "Func", "Sequence_", "(_", "first", "\\u", "func_", ",_", "10_", ",_", "inc", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "1_", ",_", "2_", ",_", "4_", ",_", "8_", ",_", "16_", ",_", "32_", ",_", "64_", ",_", "128_", ",_", "256_", ",_", "512_", "]_", ",_", "list_", "(_", "c_", ")_", ")_" ]
[ 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 ]
Use of the return value of a procedure
mne-tools/mne-python/mne/tests/test_filter.py
[ { "content": "@slow_test\ndef test_filters():\n \"\"\"Test low-, band-, high-pass, and band-stop filters plus resampling\n \"\"\"\n sfreq = 500\n sig_len_secs = 30\n\n a = rng.randn(2, sig_len_secs * sfreq)\n\n # let's test our catchers\n for fl in ['blah', [0, 1], 1000.5, '10ss', '10']:\n assert_raises(ValueError, band_pass_filter, a, sfreq, 4, 8,\n filter_length=fl)\n for nj in ['blah', 0.5]:\n assert_raises(ValueError, band_pass_filter, a, sfreq, 4, 8, n_jobs=nj)\n # > Nyq/2\n assert_raises(ValueError, band_pass_filter, a, sfreq, 4, sfreq / 2.)\n assert_raises(ValueError, low_pass_filter, a, sfreq, sfreq / 2.)\n # check our short-filter warning:\n with warnings.catch_warnings(record=True) as w:\n # Warning for low attenuation\n band_pass_filter(a, sfreq, 1, 8, filter_length=1024)\n # Warning for too short a filter\n band_pass_filter(a, sfreq, 1, 8, filter_length='0.5s')\n assert_true(len(w) >= 2)\n\n # try new default and old default\n for fl in ['10s', '5000ms', None]:\n bp = band_pass_filter(a, sfreq, 4, 8, filter_length=fl)\n bs = band_stop_filter(a, sfreq, 4 - 0.5, 8 + 0.5, filter_length=fl)\n lp = low_pass_filter(a, sfreq, 8, filter_length=fl, n_jobs=2)\n hp = high_pass_filter(lp, sfreq, 4, filter_length=fl)\n assert_array_almost_equal(hp, bp, 2)\n assert_array_almost_equal(bp + bs, a, 1)\n\n # Overlap-add filtering with a fixed filter length\n filter_length = 8192\n bp_oa = band_pass_filter(a, sfreq, 4, 8, filter_length)\n bs_oa = band_stop_filter(a, sfreq, 4 - 0.5, 8 + 0.5, filter_length)\n lp_oa = low_pass_filter(a, sfreq, 8, filter_length)\n hp_oa = high_pass_filter(lp_oa, sfreq, 4, filter_length)\n assert_array_almost_equal(hp_oa, bp_oa, 2)\n # Our filters are no longer quite complementary with linear rolloffs :(\n # this is the tradeoff for stability of the filtering\n # obtained by directly using the result of firwin2 instead of\n # modifying it...\n assert_array_almost_equal(bp_oa + bs_oa, a, 1)\n\n # The two methods should give the same result\n # As filtering for short signals uses a circular convolution (FFT) and\n # the overlap-add filter implements a linear convolution, the signal\n # boundary will be slightly different and we ignore it\n n_edge_ignore = 0\n assert_array_almost_equal(hp[n_edge_ignore:-n_edge_ignore],\n hp_oa[n_edge_ignore:-n_edge_ignore], 2)\n\n # and since these are low-passed, downsampling/upsampling should be close\n n_resamp_ignore = 10\n bp_up_dn = resample(resample(bp_oa, 2, 1, n_jobs=2), 1, 2, n_jobs=2)\n assert_array_almost_equal(bp_oa[n_resamp_ignore:-n_resamp_ignore],\n bp_up_dn[n_resamp_ignore:-n_resamp_ignore], 2)\n # note that on systems without CUDA, this line serves as a test for a\n # graceful fallback to n_jobs=1\n bp_up_dn = resample(resample(bp_oa, 2, 1, n_jobs='cuda'), 1, 2,\n n_jobs='cuda')\n assert_array_almost_equal(bp_oa[n_resamp_ignore:-n_resamp_ignore],\n bp_up_dn[n_resamp_ignore:-n_resamp_ignore], 2)\n # test to make sure our resamling matches scipy's\n bp_up_dn = sp_resample(sp_resample(bp_oa, 2 * bp_oa.shape[-1], axis=-1,\n window='boxcar'),\n bp_oa.shape[-1], window='boxcar', axis=-1)\n assert_array_almost_equal(bp_oa[n_resamp_ignore:-n_resamp_ignore],\n bp_up_dn[n_resamp_ignore:-n_resamp_ignore], 2)\n\n # make sure we don't alias\n t = np.array(list(range(sfreq * sig_len_secs))) / float(sfreq)\n # make sinusoid close to the Nyquist frequency\n sig = np.sin(2 * np.pi * sfreq / 2.2 * t)\n # signal should disappear with 2x downsampling\n sig_gone = resample(sig, 1, 2)[n_resamp_ignore:-n_resamp_ignore]\n assert_array_almost_equal(np.zeros_like(sig_gone), sig_gone, 2)\n\n # let's construct some filters\n iir_params = dict(ftype='cheby1', gpass=1, gstop=20)\n iir_params = construct_iir_filter(iir_params, 40, 80, 1000, 'low')\n # this should be a third order filter\n assert_true(iir_params['a'].size - 1 == 3)\n assert_true(iir_params['b'].size - 1 == 3)\n iir_params = dict(ftype='butter', order=4)\n iir_params = construct_iir_filter(iir_params, 40, None, 1000, 'low')\n assert_true(iir_params['a'].size - 1 == 4)\n assert_true(iir_params['b'].size - 1 == 4)\n\n # check that picks work for 3d array with one channel and picks=[0]\n a = rng.randn(5 * sfreq, 5 * sfreq)\n b = a[:, None, :]\n\n with warnings.catch_warnings(record=True) as w:\n a_filt = band_pass_filter(a, sfreq, 4, 8)\n b_filt = band_pass_filter(b, sfreq, 4, 8, picks=[0])\n\n assert_array_equal(a_filt[:, None, :], b_filt)\n\n # check for n-dimensional case\n a = rng.randn(2, 2, 2, 2)\n assert_raises(ValueError, band_pass_filter, a, sfreq, Fp1=4, Fp2=8,\n picks=np.array([0, 1]))\n\n # test that our overlap-add filtering doesn't introduce strange\n # artifacts (from mne_analyze mailing list 2015/06/25)\n N = 300\n sfreq = 100.\n lp = 10.\n sine_freq = 1.\n x = np.ones(N)\n x += np.sin(2 * np.pi * sine_freq * np.arange(N) / sfreq)\n with warnings.catch_warnings(record=True): # filter attenuation\n x_filt = low_pass_filter(x, sfreq, lp, '1s')\n # the firwin2 function gets us this close\n assert_allclose(x, x_filt, rtol=1e-3, atol=1e-3)", "metadata": "root.test_filters", "header": "['module', '___EOS___']", "index": 180 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "slow", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "filters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "low", "-", ",", " ", "band", "-", ",", " ", "high", "-", "pass", ",", " ", "and", " ", "band", "-", "stop", " ", "filter", "s", " ", "plus", " ", "resa", "mpli", "ng", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sfr", "eq_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "\\u", "len", "\\u", "secs_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "rng_", "._", "randn_", "(_", "2_", ",_", "sig", "\\u", "len", "\\u", "secs_", "*_", "sfr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "test", " ", "our", " ", "catche", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fl_", "in_", "[_", "'", "bla", "h", "'_", ",_", "[_", "0_", ",_", "1_", "]_", ",_", "1000", ".5_", ",_", "'", "10", "ss", "'_", ",_", "'", "10", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "band", "\\u", "pass", "\\u", "filter_", ",_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "length_", "=_", "fl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "nj", "_", "in_", "[_", "'", "bla", "h", "'_", ",_", "0.5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "band", "\\u", "pass", "\\u", "filter_", ",_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ",_", "n", "\\u", "jobs_", "=_", "nj", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", ">", " ", "Ny", "q", "/", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "band", "\\u", "pass", "\\u", "filter_", ",_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "sfr", "eq_", "/_", "2._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "low", "\\u", "pass", "\\u", "filter_", ",_", "a_", ",_", "sfr", "eq_", ",_", "sfr", "eq_", "/_", "2._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "our", " ", "short", "-", "filter", " ", "warn", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Warn", "ing", " ", "for", " ", "low", " ", "atten", "uation", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "band", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "1_", ",_", "8_", ",_", "filter", "\\u", "length_", "=_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Warn", "ing", " ", "for", " ", "too", " ", "short", " ", "a", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "band", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "1_", ",_", "8_", ",_", "filter", "\\u", "length_", "=_", "'", "0.", "5", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "true_", "(_", "len_", "(_", "w_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "new", " ", "default", " ", "and", " ", "old", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fl_", "in_", "[_", "'", "10", "s", "'_", ",_", "'", "5000", "ms", "'_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bp_", "=_", "band", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ",_", "filter", "\\u", "length_", "=_", "fl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bs_", "=_", "band", "\\u", "stop", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "4_", "-_", "0.5_", ",_", "8_", "+_", "0.5_", ",_", "filter", "\\u", "length_", "=_", "fl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp_", "=_", "low", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "8_", ",_", "filter", "\\u", "length_", "=_", "fl_", ",_", "n", "\\u", "jobs_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "=_", "high", "\\u", "pass", "\\u", "filter_", "(_", "lp_", ",_", "sfr", "eq_", ",_", "4_", ",_", "filter", "\\u", "length_", "=_", "fl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "hp_", ",_", "bp_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "bp_", "+_", "bs_", ",_", "a_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Overlap", "-", "add", " ", "filtering", " ", "with", " ", "a", " ", "fixed", " ", "filter", " ", "length_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filter", "\\u", "length_", "=_", "8192_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp", "\\u", "oa", "_", "=_", "band", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ",_", "filter", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bs", "\\u", "oa", "_", "=_", "band", "\\u", "stop", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "4_", "-_", "0.5_", ",_", "8_", "+_", "0.5_", ",_", "filter", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp", "\\u", "oa", "_", "=_", "low", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "8_", ",_", "filter", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp", "\\u", "oa", "_", "=_", "high", "\\u", "pass", "\\u", "filter_", "(_", "lp", "\\u", "oa", "_", ",_", "sfr", "eq_", ",_", "4_", ",_", "filter", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "hp", "\\u", "oa", "_", ",_", "bp", "\\u", "oa", "_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ou", "r", " ", "filter", "s", " ", "are", " ", "no", " ", "long", "er", " ", "quite", " ", "complement", "ary", " ", "with", " ", "linear", " ", "rollo", "ffs", " ", ":(", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "the", " ", "trade", "off", " ", "for", " ", "stability", " ", "of", " ", "the", " ", "filtering", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "obtain", "ed", " ", "by", " ", "direct", "ly", " ", "usi", "ng", " ", "the", " ", "result", " ", "of", " ", "fir", "win", "2", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modif", "ying", " ", "it", "..._", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "bp", "\\u", "oa", "_", "+_", "bs", "\\u", "oa", "_", ",_", "a_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "two", " ", "method", "s", " ", "shou", "ld", " ", "give", " ", "the", " ", "same", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "filtering", " ", "for", " ", "short", " ", "signal", "s", " ", "use", "s", " ", "a", " ", "circular", " ", "convolution", " ", "(", "FFT", ")", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "overl", "ap", "-", "add", " ", "filter", " ", "implement", "s", " ", "a", " ", "linear", " ", "convolution", ",", " ", "the", " ", "signal_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bound", "ary", " ", "will", " ", "be", " ", "slight", "ly", " ", "different", " ", "and", " ", "we", " ", "ignore", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "edge", "\\u", "ignore_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "hp_", "[_", "n", "\\u", "edge", "\\u", "ignore_", ":_", "-_", "n", "\\u", "edge", "\\u", "ignore_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hp", "\\u", "oa", "_", "[_", "n", "\\u", "edge", "\\u", "ignore_", ":_", "-_", "n", "\\u", "edge", "\\u", "ignore_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "sinc", "e", " ", "these", " ", "are", " ", "low", "-", "pass", "ed", ",", " ", "downs", "ampling", "/", "upsampl", "ing", " ", "shou", "ld", " ", "be", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "=_", "resample_", "(_", "resample_", "(_", "bp", "\\u", "oa", "_", ",_", "2_", ",_", "1_", ",_", "n", "\\u", "jobs_", "=_", "2_", ")_", ",_", "1_", ",_", "2_", ",_", "n", "\\u", "jobs_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "bp", "\\u", "oa", "_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "on", " ", "system", "s", " ", "with", "out", " ", "CU", "DA", ",", " ", "this", " ", "line", " ", "serve", "s", " ", "as", " ", "a", " ", "test", " ", "for", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "graceful", " ", "fall", "back", " ", "to", " ", "n", "\\u", "jobs", "=", "1_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "=_", "resample_", "(_", "resample_", "(_", "bp", "\\u", "oa", "_", ",_", "2_", ",_", "1_", ",_", "n", "\\u", "jobs_", "=_", "'", "cud", "a", "'_", ")_", ",_", "1_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "jobs_", "=_", "'", "cud", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "bp", "\\u", "oa", "_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "to", " ", "make", " ", "sure", " ", "our", " ", "resa", "mlin", "g", " ", "matche", "s", " ", "sci", "py", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "=_", "sp", "\\u", "resample_", "(_", "sp", "\\u", "resample_", "(_", "bp", "\\u", "oa", "_", ",_", "2_", "*_", "bp", "\\u", "oa", "_", "._", "shape_", "[_", "-_", "1_", "]_", ",_", "axis_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "window_", "=_", "'", "box", "car", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "oa", "_", "._", "shape_", "[_", "-_", "1_", "]_", ",_", "window_", "=_", "'", "box", "car", "'_", ",_", "axis_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "bp", "\\u", "oa", "_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bp", "\\u", "up", "\\u", "dn_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "don", "'", "t", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "np_", "._", "array_", "(_", "list_", "(_", "range_", "(_", "sfr", "eq_", "*_", "sig", "\\u", "len", "\\u", "secs_", ")_", ")_", ")_", "/_", "float_", "(_", "sfr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sin", "uso", "id", " ", "close", " ", "to", " ", "the", " ", "Ny", "quis", "t", " ", "frequency_", "\\u\\u\\uNL\\u\\u\\u_", "sig_", "=_", "np_", "._", "sin_", "(_", "2_", "*_", "np_", "._", "pi_", "*_", "sfr", "eq_", "/_", "2.2_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "signal", " ", "shou", "ld", " ", "disapp", "ear", " ", "with", " ", "2x", " ", "downs", "ampling", "_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "\\u", "gone", "_", "=_", "resample_", "(_", "sig_", ",_", "1_", ",_", "2_", ")_", "[_", "n", "\\u", "resa", "mp", "\\u", "ignore_", ":_", "-_", "n", "\\u", "resa", "mp", "\\u", "ignore_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "np_", "._", "zero", "s", "\\u", "like_", "(_", "sig", "\\u", "gone", "_", ")_", ",_", "sig", "\\u", "gone", "_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "construct", " ", "some", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "ii", "r", "\\u", "params_", "=_", "dict_", "(_", "ftype_", "=_", "'", "cheb", "y1", "'_", ",_", "gpa", "ss_", "=_", "1_", ",_", "gst", "op_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "r", "\\u", "params_", "=_", "construct", "\\u", "ii", "r", "\\u", "filter_", "(_", "ii", "r", "\\u", "params_", ",_", "40_", ",_", "80_", ",_", "1000_", ",_", "'", "low", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "be", " ", "a", " ", "third", " ", "order", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "true_", "(_", "ii", "r", "\\u", "params_", "[_", "'", "a", "'_", "]_", "._", "size_", "-_", "1_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "ii", "r", "\\u", "params_", "[_", "'", "b", "'_", "]_", "._", "size_", "-_", "1_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "r", "\\u", "params_", "=_", "dict_", "(_", "ftype_", "=_", "'", "butte", "r", "'_", ",_", "order_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "r", "\\u", "params_", "=_", "construct", "\\u", "ii", "r", "\\u", "filter_", "(_", "ii", "r", "\\u", "params_", ",_", "40_", ",_", "None_", ",_", "1000_", ",_", "'", "low", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "ii", "r", "\\u", "params_", "[_", "'", "a", "'_", "]_", "._", "size_", "-_", "1_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "ii", "r", "\\u", "params_", "[_", "'", "b", "'_", "]_", "._", "size_", "-_", "1_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "picks", " ", "work", " ", "for", " ", "3d", " ", "array", " ", "with", " ", "one", " ", "channel", " ", "and", " ", "picks", "=[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "rng_", "._", "randn_", "(_", "5_", "*_", "sfr", "eq_", ",_", "5_", "*_", "sfr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "a_", "[_", ":_", ",_", "None_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "filt_", "=_", "band", "\\u", "pass", "\\u", "filter_", "(_", "a_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "filt_", "=_", "band", "\\u", "pass", "\\u", "filter_", "(_", "b_", ",_", "sfr", "eq_", ",_", "4_", ",_", "8_", ",_", "picks", "_", "=_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "array", "\\u", "equal_", "(_", "a", "\\u", "filt_", "[_", ":_", ",_", "None_", ",_", ":_", "]_", ",_", "b", "\\u", "filt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "n", "-", "dimension", "al", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "rng_", "._", "randn_", "(_", "2_", ",_", "2_", ",_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "band", "\\u", "pass", "\\u", "filter_", ",_", "a_", ",_", "sfr", "eq_", ",_", "Fp", "1_", "=_", "4_", ",_", "Fp", "2_", "=_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "picks", "_", "=_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "tha", "t", " ", "our", " ", "overl", "ap", "-", "add", " ", "filtering", " ", "doe", "sn", "'", "t", " ", "introduce", " ", "stran", "ge_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "artifact", "s", " ", "(", "from", " ", "mne", "\\u", "analyze", " ", "mailing", " ", "list", " ", "201", "5", "/", "0", "6", "/", "25", ")_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sfr", "eq_", "=_", "100._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp_", "=_", "10._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sine", "\\u", "freq_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "ones_", "(_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "+=_", "np_", "._", "sin_", "(_", "2_", "*_", "np_", "._", "pi_", "*_", "sine", "\\u", "freq_", "*_", "np_", "._", "arange_", "(_", "N_", ")_", "/_", "sfr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", ":_", "#", " ", "filter", " ", "atten", "uation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "filt_", "=_", "low", "\\u", "pass", "\\u", "filter_", "(_", "x_", ",_", "sfr", "eq_", ",_", "lp_", ",_", "'", "1s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "fir", "win", "2", " ", "function", " ", "gets", " ", "us", " ", "this", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "x_", ",_", "x", "\\u", "filt_", ",_", "rtol_", "=_", "1e-3_", ",_", "atol_", "=_", "1e-3_", ")_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
dpgaspar/Flask-AppBuilder/examples/extendsecurity/app/models.py
[ { "content": "def get_user_id(cls):\n try:\n return g.user.id\n except Exception as e:\n # log.warning(\"AuditMixin Get User ID {0}\".format(str(e)))\n return None", "metadata": "root.get_user_id", "header": "['module', '___EOS___']", "index": 39 } ]
[]
[]
0
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", "\\u", "user", "\\u", "id_", "(_", "cls_", ")_", ":_", "\\u\\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_", "g_", "._", "user_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "log", ".", "warn", "ing", "(\"", "Audi", "t", "Mix", "in", " ", "Get", " ", "User", " ", "ID", " ", "{", "0", "}\"", ".", "format", "(", "str", "(", "e", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openstack/sahara/sahara/plugins/vanilla/hadoop2/scaling.py
[ { "content": "# Copyright (c) 2014 Mirantis Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom sahara.i18n import _\nfrom sahara.plugins import utils as u\nfrom sahara.plugins.vanilla.hadoop2 import config\nfrom sahara.plugins.vanilla.hadoop2 import config_helper as c_helper\nfrom sahara.plugins.vanilla.hadoop2 import run_scripts as run\nfrom sahara.plugins.vanilla.hadoop2 import utils as pu\nfrom sahara.plugins.vanilla import utils as vu\nfrom sahara.swift import swift_helper\nfrom sahara.utils import cluster_progress_ops as cpo\nfrom sahara.utils import poll_utils\n\n\nHADOOP_CONF_DIR = config.HADOOP_CONF_DIR\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def scale_cluster(pctx, cluster, instances):\n config.configure_instances(pctx, instances)\n _update_include_files(cluster)\n run.refresh_hadoop_nodes(cluster)\n rm = vu.get_resourcemanager(cluster)\n if rm:\n run.refresh_yarn_nodes(cluster)\n\n config.configure_topology_data(pctx, cluster)\n run.start_dn_nm_processes(instances)\n swift_helper.install_ssl_certs(instances)", "metadata": "root.scale_cluster", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def _get_instances_with_service(instances, service):\n return [instance for instance in instances\n if service in instance.node_group.node_processes]", "metadata": "root._get_instances_with_service", "header": "['module', '___EOS___']", "index": 43 }, { "content": "@cpo.event_wrapper(True, step=_(\"Update include files\"), param=('cluster', 0))\ndef _update_include_files(cluster, dec_instances=None):\n dec_instances = dec_instances or []\n dec_instances_ids = [instance.id for instance in dec_instances]\n\n instances = u.get_instances(cluster)\n\n inst_filter = lambda inst: inst.id not in dec_instances_ids\n\n datanodes = filter(inst_filter, vu.get_datanodes(cluster))\n nodemanagers = filter(inst_filter, vu.get_nodemanagers(cluster))\n dn_hosts = u.generate_fqdn_host_names(datanodes)\n nm_hosts = u.generate_fqdn_host_names(nodemanagers)\n for instance in instances:\n with instance.remote() as r:\n r.execute_command(\n 'sudo su - -c \"echo \\'%s\\' > %s/dn-include\" hadoop' % (\n dn_hosts, HADOOP_CONF_DIR))\n r.execute_command(\n 'sudo su - -c \"echo \\'%s\\' > %s/nm-include\" hadoop' % (\n nm_hosts, HADOOP_CONF_DIR))", "metadata": "root._update_include_files", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def decommission_nodes(pctx, cluster, instances):\n datanodes = _get_instances_with_service(instances, 'datanode')\n nodemanagers = _get_instances_with_service(instances, 'nodemanager')\n _update_exclude_files(cluster, instances)\n\n run.refresh_hadoop_nodes(cluster)\n rm = vu.get_resourcemanager(cluster)\n if rm:\n run.refresh_yarn_nodes(cluster)\n\n _check_nodemanagers_decommission(cluster, nodemanagers)\n _check_datanodes_decommission(cluster, datanodes)\n\n _update_include_files(cluster, instances)\n _clear_exclude_files(cluster)\n run.refresh_hadoop_nodes(cluster)\n\n config.configure_topology_data(pctx, cluster)", "metadata": "root.decommission_nodes", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def _update_exclude_files(cluster, instances):\n datanodes = _get_instances_with_service(instances, 'datanode')\n nodemanagers = _get_instances_with_service(instances, 'nodemanager')\n dn_hosts = u.generate_fqdn_host_names(datanodes)\n nm_hosts = u.generate_fqdn_host_names(nodemanagers)\n for instance in u.get_instances(cluster):\n with instance.remote() as r:\n r.execute_command(\n 'sudo su - -c \"echo \\'%s\\' > %s/dn-exclude\" hadoop' % (\n dn_hosts, HADOOP_CONF_DIR))\n r.execute_command(\n 'sudo su - -c \"echo \\'%s\\' > %s/nm-exclude\" hadoop' % (\n nm_hosts, HADOOP_CONF_DIR))", "metadata": "root._update_exclude_files", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def _clear_exclude_files(cluster):\n for instance in u.get_instances(cluster):\n with instance.remote() as r:\n r.execute_command(\n 'sudo su - -c \"echo > %s/dn-exclude\" hadoop' % HADOOP_CONF_DIR)\n r.execute_command(\n 'sudo su - -c \"echo > %s/nm-exclude\" hadoop' % HADOOP_CONF_DIR)", "metadata": "root._clear_exclude_files", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def is_decommissioned(cluster, check_func, instances):\n statuses = check_func(cluster)\n for instance in instances:\n if statuses[instance.fqdn()] != 'decommissioned':\n return False\n return True", "metadata": "root.is_decommissioned", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def _check_decommission(cluster, instances, check_func, option):\n poll_utils.plugin_option_poll(\n cluster, is_decommissioned, option, _(\"Wait for decommissioning\"),\n 5, {'cluster': cluster, 'check_func': check_func,\n 'instances': instances})", "metadata": "root._check_decommission", "header": "['module', '___EOS___']", "index": 123 }, { "content": "@cpo.event_wrapper(\n True, step=_(\"Decommission %s\") % \"NodeManagers\", param=('cluster', 0))\ndef _check_nodemanagers_decommission(cluster, instances):\n _check_decommission(cluster, instances, pu.get_nodemanagers_status,\n c_helper.NODEMANAGERS_DECOMMISSIONING_TIMEOUT)", "metadata": "root._check_nodemanagers_decommission", "header": "['module', '___EOS___']", "index": 130 }, { "content": "@cpo.event_wrapper(\n True, step=_(\"Decommission %s\") % \"DataNodes\", param=('cluster', 0))\ndef _check_datanodes_decommission(cluster, instances):\n _check_decommission(cluster, instances, pu.get_datanodes_status,\n c_helper.DATANODES_DECOMMISSIONING_TIMEOUT)", "metadata": "root._check_datanodes_decommission", "header": "['module', '___EOS___']", "index": 137 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Mir", "anti", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or_", "\\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_", "from_", "sahara", "_", "._", "i18n_", "import_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "import_", "utils_", "as_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "._", "vanilla", "_", "._", "hadoop", "2_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "._", "vanilla", "_", "._", "hadoop", "2_", "import_", "config", "\\u", "helper_", "as_", "c\\u", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "._", "vanilla", "_", "._", "hadoop", "2_", "import_", "run", "\\u", "scripts_", "as_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "._", "vanilla", "_", "._", "hadoop", "2_", "import_", "utils_", "as_", "pu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "plugins_", "._", "vanilla", "_", "import_", "utils_", "as_", "vu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "swift_", "import_", "swift", "\\u", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "utils_", "import_", "cluster", "\\u", "progress", "\\u", "ops_", "as_", "cpo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "utils_", "import_", "poll", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", "=_", "config_", "._", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "scale", "\\u", "cluster_", "(_", "pct", "x_", ",_", "cluster_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "configur", "e\\u", "instances_", "(_", "pct", "x_", ",_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "update", "\\u", "include", "\\u", "files_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "._", "refre", "sh", "\\u", "hadoop", "\\u", "nodes_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm_", "=_", "vu", "_", "._", "get", "\\u", "resource", "manager_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "._", "refre", "sh", "\\u", "yarn", "\\u", "nodes_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "configur", "e\\u", "topo", "log", "y", "\\u", "data_", "(_", "pct", "x_", ",_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "._", "start", "\\u", "dn", "\\u", "nm", "\\u", "processes_", "(_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "swift", "\\u", "helper_", "._", "install", "\\u", "ssl", "\\u", "certs_", "(_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "instance", "s", "\\u", "with", "\\u", "service_", "(_", "instances_", ",_", "service_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "instance_", "for_", "instance_", "in_", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "service_", "in_", "instance_", "._", "node", "\\u", "group_", "._", "node", "\\u", "processes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cpo", "_", "._", "event", "\\u", "wrapper_", "(_", "True_", ",_", "step_", "=_", "\\u_", "(_", "\"", "Update", " ", "include", " ", "files", "\"_", ")_", ",_", "param_", "=_", "(_", "'", "cluster", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "update", "\\u", "include", "\\u", "files_", "(_", "cluster_", ",_", "dec", "\\u", "instances_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec", "\\u", "instances_", "=_", "dec", "\\u", "instances_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "instance", "s", "\\u", "ids_", "=_", "[_", "instance_", "._", "id_", "for_", "instance_", "in_", "dec", "\\u", "instances_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "u_", "._", "get", "\\u", "instances_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "filter_", "=_", "lambda_", "inst_", ":_", "inst_", "._", "id_", "not_", "in_", "dec", "\\u", "instance", "s", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datan", "odes_", "=_", "filter_", "(_", "inst", "\\u", "filter_", ",_", "vu", "_", "._", "get", "\\u", "datan", "odes_", "(_", "cluster_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "managers_", "=_", "filter_", "(_", "inst", "\\u", "filter_", ",_", "vu", "_", "._", "get", "\\u", "node", "managers_", "(_", "cluster_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "\\u", "hosts_", "=_", "u_", "._", "generat", "e\\u", "fq", "dn", "\\u", "host", "\\u", "names_", "(_", "datan", "odes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nm", "\\u", "hosts_", "=_", "u_", "._", "generat", "e\\u", "fq", "dn", "\\u", "host", "\\u", "names_", "(_", "node", "managers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "instance_", "._", "remote_", "(_", ")_", "as_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", "\\\\'", "%", "s", "\\\\'", " ", ">", " ", "%", "s", "/", "dn", "-", "include", "\"", " ", "hadoop", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dn", "\\u", "hosts_", ",_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", "\\\\'", "%", "s", "\\\\'", " ", ">", " ", "%", "s", "/", "nm", "-", "include", "\"", " ", "hadoop", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nm", "\\u", "hosts_", ",_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deco", "mmi", "ssion", "\\u", "nodes_", "(_", "pct", "x_", ",_", "cluster_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datan", "odes_", "=_", "\\u", "get", "\\u", "instance", "s", "\\u", "with", "\\u", "service_", "(_", "instances_", ",_", "'", "datan", "ode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "managers_", "=_", "\\u", "get", "\\u", "instance", "s", "\\u", "with", "\\u", "service_", "(_", "instances_", ",_", "'", "node", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "update", "\\u", "exclu", "de", "\\u", "files_", "(_", "cluster_", ",_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "._", "refre", "sh", "\\u", "hadoop", "\\u", "nodes_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm_", "=_", "vu", "_", "._", "get", "\\u", "resource", "manager_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "._", "refre", "sh", "\\u", "yarn", "\\u", "nodes_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "check", "\\u", "node", "manage", "rs", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "node", "managers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "datan", "odes", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "datan", "odes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "update", "\\u", "include", "\\u", "files_", "(_", "cluster_", ",_", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "clear", "\\u", "exclu", "de", "\\u", "files_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "._", "refre", "sh", "\\u", "hadoop", "\\u", "nodes_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "configur", "e\\u", "topo", "log", "y", "\\u", "data_", "(_", "pct", "x_", ",_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "exclu", "de", "\\u", "files_", "(_", "cluster_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datan", "odes_", "=_", "\\u", "get", "\\u", "instance", "s", "\\u", "with", "\\u", "service_", "(_", "instances_", ",_", "'", "datan", "ode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "managers_", "=_", "\\u", "get", "\\u", "instance", "s", "\\u", "with", "\\u", "service_", "(_", "instances_", ",_", "'", "node", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "\\u", "hosts_", "=_", "u_", "._", "generat", "e\\u", "fq", "dn", "\\u", "host", "\\u", "names_", "(_", "datan", "odes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nm", "\\u", "hosts_", "=_", "u_", "._", "generat", "e\\u", "fq", "dn", "\\u", "host", "\\u", "names_", "(_", "node", "managers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "u_", "._", "get", "\\u", "instances_", "(_", "cluster_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "instance_", "._", "remote_", "(_", ")_", "as_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", "\\\\'", "%", "s", "\\\\'", " ", ">", " ", "%", "s", "/", "dn", "-", "exclu", "de", "\"", " ", "hadoop", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dn", "\\u", "hosts_", ",_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", "\\\\'", "%", "s", "\\\\'", " ", ">", " ", "%", "s", "/", "nm", "-", "exclu", "de", "\"", " ", "hadoop", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nm", "\\u", "hosts_", ",_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "clear", "\\u", "exclu", "de", "\\u", "files_", "(_", "cluster_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "instance_", "in_", "u_", "._", "get", "\\u", "instances_", "(_", "cluster_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "instance_", "._", "remote_", "(_", ")_", "as_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", ">", " ", "%", "s", "/", "dn", "-", "exclu", "de", "\"", " ", "hadoop", "'_", "%_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "execute", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sudo", " ", "su", " ", "-", " ", "-", "c", " ", "\"", "echo", " ", ">", " ", "%", "s", "/", "nm", "-", "exclu", "de", "\"", " ", "hadoop", "'_", "%_", "HA", "DOO", "P", "\\u", "CONF", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "deco", "mmi", "ssion", "ed_", "(_", "cluster_", ",_", "check", "\\u", "func_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "statuses_", "=_", "check", "\\u", "func_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "statuses_", "[_", "instance_", "._", "fqdn_", "(_", ")_", "]_", "!=_", "'", "deco", "mmi", "ssion", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "instances_", ",_", "check", "\\u", "func_", ",_", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "utils_", "._", "plugin", "\\u", "option", "\\u", "poll_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", ",_", "is", "\\u", "deco", "mmi", "ssion", "ed_", ",_", "option_", ",_", "\\u_", "(_", "\"", "Wait", " ", "for", " ", "deco", "mmi", "ssion", "ing", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ",_", "{_", "'", "cluster", "'_", ":_", "cluster_", ",_", "'", "check", "\\u", "func", "'_", ":_", "check", "\\u", "func_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "s", "'_", ":_", "instances_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cpo", "_", "._", "event", "\\u", "wrapper_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "step_", "=_", "\\u_", "(_", "\"", "Deco", "mmi", "ssion", " ", "%", "s", "\"_", ")_", "%_", "\"", "Node", "Manager", "s", "\"_", ",_", "param_", "=_", "(_", "'", "cluster", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "node", "manage", "rs", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "check", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "instances_", ",_", "pu_", "._", "get", "\\u", "node", "manage", "rs", "\\u", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "helper_", "._", "NODE", "MANAGER", "S", "\\u", "DECO", "MM", "ISS", "ION", "ING", "\\u", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cpo", "_", "._", "event", "\\u", "wrapper_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "step_", "=_", "\\u_", "(_", "\"", "Deco", "mmi", "ssion", " ", "%", "s", "\"_", ")_", "%_", "\"", "Data", "Node", "s", "\"_", ",_", "param_", "=_", "(_", "'", "cluster", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "datan", "odes", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "instances_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "check", "\\u", "deco", "mmi", "ssion_", "(_", "cluster_", ",_", "instances_", ",_", "pu_", "._", "get", "\\u", "datan", "odes", "\\u", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "helper_", "._", "DATA", "NODES", "\\u", "DECO", "MM", "ISS", "ION", "ING", "\\u", "TIMEOUT_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Flask app is run in debug mode
miguelgrinberg/Flask-HTTPAuth/examples/multi_auth.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Multiple authentication example\n\nThis example demonstrates how to combine two authentication methods using the\n\"MultiAuth\" class.\n\nThe root URL for this application can be accessed via basic auth, providing\nusername and password, or via token auth, providing a bearer JWT token.\n\"\"\"\nfrom flask import Flask, g\nfrom flask_httpauth import HTTPBasicAuth, HTTPTokenAuth, MultiAuth\nfrom werkzeug.security import generate_password_hash, check_password_hash\nfrom itsdangerous import TimedJSONWebSignatureSerializer as JWT\n\n\napp = Flask(__name__)\napp.config['SECRET_KEY'] = 'top secret!'\njwt = JWT(app.config['SECRET_KEY'], expires_in=3600)\n\nbasic_auth = HTTPBasicAuth()\ntoken_auth = HTTPTokenAuth('Bearer')\nmulti_auth = MultiAuth(basic_auth, token_auth)\n\n\nusers = {\n \"john\": generate_password_hash(\"hello\"),\n \"susan\": generate_password_hash(\"bye\")\n}\n\nfor user in users.keys():\n token = jwt.dumps({'username': user})\n print('*** token for {}: {}\\n'.format(user, token))\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n app.run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Flask_", "app_", "is_", "run_", "in_", "debug_", "mode_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Multipl", "e", " ", "authenticat", "ion", " ", "example", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "example", " ", "demonstrat", "es", " ", "how", " ", "to", " ", "combin", "e", " ", "two", " ", "authenticat", "ion", " ", "method", "s", " ", "usi", "ng", " ", "the", "\\", "10", ";", "\"", "Multi", "Auth", "\"", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "root", " ", "URL", " ", "for", " ", "this", " ", "applica", "tion", " ", "can", " ", "be", " ", "accesse", "d", " ", "via", " ", "basic", " ", "auth", ",", " ", "provi", "ding", "\\", "10", ";", "user", "name", " ", "and", " ", "password", ",", " ", "or", " ", "via", " ", "token", " ", "auth", ",", " ", "provi", "ding", " ", "a", " ", "bear", "er", " ", "JW", "T", " ", "token", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "http", "auth_", "import_", "HTTP", "Basic", "Auth_", ",_", "HTTP", "Token", "Auth_", ",_", "Multi", "Auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "security_", "import_", "generat", "e\\u", "password", "\\u", "hash_", ",_", "check", "\\u", "password", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "its", "danger", "ous_", "import_", "Time", "d", "JSO", "NW", "eb", "Sign", "ature", "Serializer_", "as_", "JW", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", "=_", "'", "top", " ", "secret", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jwt_", "=_", "JW", "T_", "(_", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ",_", "expir", "es", "\\u", "in_", "=_", "3600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "basic", "\\u", "auth_", "=_", "HTTP", "Basic", "Auth_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "auth_", "=_", "HTTP", "Token", "Auth_", "(_", "'", "Bear", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multi", "\\u", "auth_", "=_", "Multi", "Auth_", "(_", "basic", "\\u", "auth_", ",_", "token", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "john", "\"_", ":_", "generat", "e\\u", "password", "\\u", "hash_", "(_", "\"", "hell", "o", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sus", "an", "\"_", ":_", "generat", "e\\u", "password", "\\u", "hash_", "(_", "\"", "bye", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "users_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "jwt_", "._", "dumps_", "(_", "{_", "'", "user", "name", "'_", ":_", "user_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'**", "*", " ", "token", " ", "for", " ", "{}:", " ", "{}", "\\\\", "n", "'_", "._", "format_", "(_", "user_", ",_", "token_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "app_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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rom struct import pack, unpack\nimport sys\nimport autopep8\n\nPORT = 10011\n\nsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nserver_address = ('localhost', 10011)\nsock.bind(server_address)\nsock.listen(1)\n#print('Format server up on %s port %s' % server_address, file=sys.stderr)\nwhile True:\n connection, client_address = sock.accept()\n try:\n buf = b''\n while len(buf) < 4:\n buf += connection.recv(4 - len(buf))\n (size,) = unpack('>i', buf)\n if size == -1:\n #print('Format server exiting.', file=sys.stderr)\n sys.exit(0)\n src = b''\n while len(src) < size:\n src += connection.recv(4096)\n src = src.decode('utf-8')\n reformatted = autopep8.fix_code(\n src,\n options=autopep8.parse_args(['--ignore', 'E302', '']))\n encoded = reformatted.encode('utf-8')\n connection.sendall(pack('>i', len(encoded)))\n connection.sendall(encoded)\n finally:\n connection.close()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "struct_", "import_", "pack_", ",_", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "autop", "ep", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PORT_", "=_", "10011", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "address_", "=_", "(_", "'", "local", "host", "'_", ",_", "10011", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "bind_", "(_", "server", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "listen_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "('", "Format", " ", "server", " ", "up", " ", "on", " ", "%", "s", " ", "port", " ", "%", "s", "'", " ", "%", " ", "server", "\\u", "address", ",", " ", "file", "=", "sys", ".", "std", "err", ")_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", ",_", "client", "\\u", "address_", "=_", "sock_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "buf_", ")_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "+=_", "connection_", "._", "recv_", "(_", "4_", "-_", "len_", "(_", "buf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "size_", ",_", ")_", "=_", "unpack_", "(_", "'>", "i", "'_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "('", "Format", " ", "server", " ", "exit", "ing", ".'", ",", " ", "file", "=", "sys", ".", "std", "err", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "src_", ")_", "<_", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "+=_", "connection_", "._", "recv_", "(_", "4096_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "src_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reformat", "ted_", "=_", "autop", "ep", "8_", "._", "fix", "\\u", "code_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "src_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "autop", "ep", "8_", "._", "parse", "\\u", "args_", "(_", "[_", "'--", "ignore", "'_", ",_", "'", "E3", "02", "'_", ",_", "''_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoded_", "=_", "reformat", "ted_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "sendall_", "(_", "pack_", "(_", "'>", "i", "'_", ",_", "len_", "(_", "encoded_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "sendall_", "(_", "encoded_", ")_", "\\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 ", " _", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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import sys\n\nimport coverage\nfrom coverage.report import Reporter\n\nfrom pulsar import new_event_loop\nfrom pulsar.apps.http import HttpClient\nfrom pulsar.utils.system import json\nfrom pulsar.utils.version import gitrepo\n\n\nCOVERALLS_URL = 'https://coveralls.io/api/v1/jobs'\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CoverallsReporter(Reporter):\n\n\n", "metadata": "root.CoverallsReporter", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def report(self, morfs):\n self.ret = []\n self.report_files(self._coverall, morfs)\n return self.ret", "metadata": "root.CoverallsReporter.report", "header": "['class', 'CoverallsReporter', '(', 'Reporter', ')', ':', '___EOS___']", "index": 17 }, { "content": " def _coverall(self, fr, analysis):\n try:\n with open(fr.filename) as fp:\n source = fp.readlines()\n except IOError:\n if not self.config.ignore_errors:\n raise\n\n if self.config.strip_dirs:\n filename = fr.filename\n for dir in self.config.strip_dirs:\n if filename.startswith(dir):\n filename = filename.replace(dir, '').lstrip('/')\n break\n else:\n filename = fr.relname\n\n self.ret.append({\n 'name': filename,\n 'source': ''.join(source).rstrip(),\n 'coverage': list(self._coverage_list(source, analysis)),\n })", "metadata": "root.CoverallsReporter._coverall", "header": "['class', 'CoverallsReporter', '(', 'Reporter', ')', ':', '___EOS___']", "index": 22 }, { "content": " def _coverage_list(self, source, analysis):\n for lineno, line in enumerate(source, 1):\n if lineno in analysis.statements:\n yield int(lineno not in analysis.missing)\n else:\n yield None", "metadata": "root.CoverallsReporter._coverage_list", "header": "['class', 'CoverallsReporter', '(', 'Reporter', ')', ':', '___EOS___']", "index": 45 }, { "content": "class Coverage(coverage.Coverage):\n", "metadata": "root.Coverage", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def coveralls(self, morfs=None, strip_dirs=None, **kw):\n self.config.from_args(**kw)\n self.config.strip_dirs = strip_dirs\n reporter = CoverallsReporter(self, self.config)\n return reporter.report(morfs)", "metadata": "root.Coverage.coveralls", "header": "['class', 'Coverage', '(', 'coverage', '.', 'Coverage', ')', ':', '___EOS___']", "index": 55 }, { "content": "def coveralls(http=None, url=None,\n data_file=None, repo_token=None,\n git=None, service_name=None,\n service_job_id=None, strip_dirs=None,\n ignore_errors=False, stream=None):\n '''Send a coverage report to coveralls.io.\n\n :param http: optional http client\n :param url: optional url to send data to. It defaults to ``coveralls``\n api url.\n :param data_file: optional data file to load coverage data from. By\n default, coverage uses ``.coverage``.\n :param repo_token: required when not submitting from travis.\n\n https://coveralls.io/docs/api\n '''\n if repo_token is None and os.path.isfile('.coveralls-repo-token'):\n with open('.coveralls-repo-token') as f:\n repo_token = f.read().strip()\n\n if strip_dirs is None:\n strip_dirs = [os.getcwd()]\n\n stream = stream or sys.stdout\n coverage = Coverage(data_file=data_file)\n coverage.load()\n if http is None:\n http = HttpClient(loop=new_event_loop())\n\n if not git:\n try:\n git = gitrepo()\n except Exception: # pragma nocover\n pass\n\n data = {'source_files': coverage.coveralls(strip_dirs=strip_dirs,\n ignore_errors=ignore_errors)}\n\n if git:\n data['git'] = git\n\n if os.environ.get('TRAVIS'):\n data['service_name'] = service_name or 'travis-ci'\n data['service_job_id'] = os.environ.get('TRAVIS_JOB_ID')\n else:\n assert repo_token, 'Requires repo_token if not submitting from travis'\n\n if repo_token:\n data['repo_token'] = repo_token\n url = url or COVERALLS_URL\n stream.write('Submitting coverage report to %s\\n' % url)\n response = http.post(url, files={'json_file': json.dumps(data)})\n stream.write('Response code: %s\\n' % response.status_code)\n try:\n info = response.json()\n code = 0\n if 'error' in info:\n stream.write('An error occured while sending coverage'\n ' report to coverall.io')\n code = 1\n stream.write('\\n%s\\n' % info['message'])\n except Exception:\n code = 1\n stream.write('Critical error %s\\n' % response.status_code)\n return code", "metadata": "root.coveralls", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
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_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "coverage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "coverage_", "._", "report_", "import_", "Reporter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "puls", "ar_", "import_", "new", "\\u", "event", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "puls", "ar_", "._", "apps_", "._", "http_", "import_", "Http", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "puls", "ar_", "._", "utils_", "._", "system_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "puls", "ar_", "._", "utils_", "._", "version_", "import_", "git", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COVER", "ALLS", "\\u", "URL_", "=_", "'", "https", "://", "covera", "lls", ".", "io", "/", "api", "/", "v1", "/", "jobs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cover", "alls", "Reporter_", "(_", "Reporter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cover", "alls", "Reporter_", "(_", "Reporter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "report_", "(_", "self_", ",_", "mor", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report", "\\u", "files_", "(_", "self_", "._", "\\u", "covera", "ll_", ",_", "mor", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cover", "alls", "Reporter_", "(_", "Reporter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "covera", "ll_", "(_", "self_", ",_", "fr_", ",_", "analysis_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "fr_", "._", "filename_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "fp_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "config_", "._", "ignore", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "config_", "._", "strip", "\\u", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "fr_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dir_", "in_", "self_", "._", "config_", "._", "strip", "\\u", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "startswith_", "(_", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "filename_", "=_", "filename_", "._", "replace_", "(_", "dir_", ",_", "''_", ")_", "._", "lstrip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "fr_", "._", "rel", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ret_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "''_", "._", "join_", "(_", "source_", ")_", "._", "rstrip_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "covera", "ge", "'_", ":_", "list_", "(_", "self_", "._", "\\u", "covera", "ge", "\\u", "list_", "(_", "source_", ",_", "analysis_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cover", "alls", "Reporter_", "(_", "Reporter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "covera", "ge", "\\u", "list_", "(_", "self_", ",_", "source_", ",_", "analysis_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lineno_", ",_", "line_", "in_", "enumerate_", "(_", "source_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lineno_", "in_", "analysis_", "._", "statements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "int_", "(_", "lineno_", "not_", "in_", "analysis_", "._", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Coverage", "_", "(_", "coverage_", "._", "Coverage", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Coverage", "_", "(_", "coverage_", "._", "Coverage", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "covera", "lls_", "(_", "self_", ",_", "mor", "fs_", "=_", "None_", ",_", "strip", "\\u", "dirs_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "from", "\\u", "args_", "(_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "strip", "\\u", "dirs_", "=_", "strip", "\\u", "dirs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reporter_", "=_", "Cover", "alls", "Reporter_", "(_", "self_", ",_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reporter_", "._", "report_", "(_", "mor", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "covera", "lls_", "(_", "http_", "=_", "None_", ",_", "url_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "file_", "=_", "None_", ",_", "repo", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "=_", "None_", ",_", "service", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "job", "\\u", "id_", "=_", "None_", ",_", "strip", "\\u", "dirs_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "False_", ",_", "stream_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Sen", "d", " ", "a", " ", "covera", "ge", " ", "report", " ", "to", " ", "covera", "lls", ".", "io", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "http", ":", " ", "option", "al", " ", "http", " ", "client", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "url", ":", " ", "option", "al", " ", "url", " ", "to", " ", "send", " ", "data", " ", "to", ".", " ", "It", " ", "default", "s", " ", "to", " ", "``", "covera", "lls", "``", "\\", "10", ";", " ", " ", " ", " ", "api", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "data\\u", "file", ":", " ", "option", "al", " ", "data", " ", "file", " ", "to", " ", "load", " ", "covera", "ge", " ", "data", " ", "from", ".", " ", "By", "\\", "10", ";", " ", " ", " ", " ", "default", ",", " ", "covera", "ge", " ", "use", "s", " ", "``.", "covera", "ge", "``.", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "repo", "\\u", "token", ":", " ", "require", "d", " ", "whe", "n", " ", "not", " ", "submit", "ting", " ", "from", " ", "travis", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "covera", "lls", ".", "io", "/", "docs", "/", "api", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "repo", "\\u", "token_", "is_", "None_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "'.", "covera", "lls", "-", "repo", "-", "token", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'.", "covera", "lls", "-", "repo", "-", "token", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "token_", "=_", "f_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\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_", "strip", "\\u", "dirs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strip", "\\u", "dirs_", "=_", "[_", "os_", "._", "getcwd_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "stream_", "or_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coverage_", "=_", "Coverage", "_", "(_", "data\\u", "file_", "=_", "data\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coverage_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "http_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http_", "=_", "Http", "Client_", "(_", "loop_", "=_", "new", "\\u", "event", "\\u", "loop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "git_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "git", "repo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "#", " ", "pragma", " ", " ", " ", " ", "noco", "ver_", "\\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_", "data_", "=_", "{_", "'", "source", "\\u", "files", "'_", ":_", "coverage_", "._", "covera", "lls_", "(_", "strip", "\\u", "dirs_", "=_", "strip", "\\u", "dirs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "ignore", "\\u", "errors_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "git_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "git", "'_", "]_", "=_", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "environ_", "._", "get_", "(_", "'", "TRAV", "IS", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "service", "\\u", "name", "'_", "]_", "=_", "service", "\\u", "name_", "or_", "'", "travis", "-", "ci", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "service", "\\u", "job", "\\u", "id", "'_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "TRAV", "IS", "\\u", "JOB", "\\u", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "repo", "\\u", "token_", ",_", "'", "Requ", "ires", " ", "repo", "\\u", "token", " ", "if", " ", "not", " ", "submit", "ting", " ", "from", " ", "travis", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "repo", "\\u", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "repo", "\\u", "token", "'_", "]_", "=_", "repo", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "url_", "or_", "COVER", "ALLS", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "write_", "(_", "'", "Submit", "ting", " ", "covera", "ge", " ", "report", " ", "to", " ", "%", "s", "\\\\", "n", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "http_", "._", "post_", "(_", "url_", ",_", "files_", "=_", "{_", "'", "json", "\\u", "file", "'_", ":_", "json_", "._", "dumps_", "(_", "data_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "write_", "(_", "'", "Respons", "e", " ", "code", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "response_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream_", "._", "write_", "(_", "'", "An", " ", "error", " ", "occure", "d", " ", "whi", "le", " ", "sendin", "g", " ", "covera", "ge", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "report", " ", "to", " ", "covera", "ll", ".", "io", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "._", "write_", "(_", "'\\\\", "n", "%", "s", "\\\\", "n", "'_", "%_", "info_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "write_", "(_", "'", "Crit", "ical", " ", "error", " ", "%", "s", "\\\\", "n", "'_", "%_", "response_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "code_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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 ]
First parameter of a method is not named 'self'
cloudera/hue/desktop/core/ext-py/South-1.0.2/south/tests/circular_a/migrations/0001_first.py
[ { "content": " def forwards(self):\n pass", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', ':', '___EOS___']", "index": 7 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Migration_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "forwards_", "(_", "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, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
home-assistant/home-assistant/homeassistant/components/device_tracker/tplink.py
[ { "content": " @Throttle(MIN_TIME_BETWEEN_SCANS)\n def _update_info(self):\n \"\"\"Ensure the information from the TP-Link router is up to date.\n\n Return boolean if scanning successful.\n \"\"\"\n with self.lock:\n _LOGGER.info(\"Loading wireless clients...\")\n\n url = 'http://{}/userRpm/WlanStationRpm.htm'.format(self.host)\n referer = 'http://{}'.format(self.host)\n page = requests.get(url, auth=(self.username, self.password),\n headers={'referer': referer})\n\n result = self.parse_macs.findall(page.text)\n\n if result:\n self.last_results = [mac.replace(\"-\", \":\") for mac in result]\n return True\n\n return False", "metadata": "root.TplinkDeviceScanner._update_info", "header": "['class', 'TplinkDeviceScanner', '(', 'object', ')', ':', '___EOS___']", "index": 76 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tp", "link", "Dev", "ice", "Scanner_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Throttle", "_", "(_", "MIN", "\\u", "TIME", "\\u", "BETWEEN", "\\u", "SCAN", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "update", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "the", " ", "informati", "on", " ", "from", " ", "the", " ", "TP", "-", "Link", " ", "router", " ", "is", " ", "up", " ", "to", " ", "date", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "boolean", " ", "if", " ", "scanning", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "LOGGER_", "._", "info_", "(_", "\"", "Load", "ing", " ", "wireless", " ", "clients", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://{}", "/", "user", "Rp", "m", "/", "Wl", "an", "Station", "Rp", "m", ".", "ht", "m", "'_", "._", "format_", "(_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referer_", "=_", "'", "http", "://{}", "'_", "._", "format_", "(_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "requests_", "._", "get_", "(_", "url_", ",_", "auth_", "=_", "(_", "self_", "._", "username_", ",_", "self_", "._", "password_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "refere", "r", "'_", ":_", "referer_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "parse", "\\u", "macs", "_", "._", "findall_", "(_", "page_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "\\u", "results_", "=_", "[_", "mac_", "._", "replace_", "(_", "\"-\"_", ",_", "\":\"_", ")_", "for_", "mac_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused import
sensepost/Snoopy/snoopy/server/bin/snoopy_server.py
[ { "content": "#!/usr/bin/python\n# glenn@sensepost.com \n# Snoopy // 2012\n# By using this code you agree to abide by the supplied LICENSE.txt\n\n# Don't run directly, but via snoopy.sh\n# This Script starts various Snoopy components\n\n#ToDo: Incorporate all Snoopy components into a single snoopy.py file.\n\nimport logging\nimport prox_guid\nimport pytail\nimport facebook\nimport ssid_to_loc\n\nimport os\nimport time\nimport sys\nimport signal\nfrom multiprocessing import Process\n\nsnoopyBinPath=os.path.dirname(os.path.realpath(__file__))\n\nsys.path.append(\"%s/snoopy/src/snoopy\"%snoopyBinPath)\nfrom snoopy.web import main as webmain\nwebmain.app.root_path = \"%s/snoopy/src/snoopy/\"%snoopyBinPath\n\ngoFlag=True\n\nsignal.signal(signal.SIGINT, signal_handler)\n\n\nif __name__ == \"__main__\":\n\tsnoopyDir=sys.argv[1]\n\ttry:\n \tmain(snoopyDir)\n\texcept Exception, e:\n\t\tlogging.error(\"Main Snoopy thread exception: %s\" %str(e))\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def signal_handler(signal, frame):\n\tglobal goFlag\n logging.debug('Caught SIGINT, ending.')\n\tgoFlag=False", "metadata": "root.signal_handler", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def main(snoopyDir):\n\n\tglobal goFlag\n\twhile ( goFlag ):\n\n\t\tlogging.basicConfig(filename=\"%s/logs/snoopy.log\"%(snoopyDir),level=logging.INFO,format='%(asctime)s %(levelname)s %(filename)s: %(message)s',datefmt='%Y-%m-%d %H:%M:%S')\n\t\tlogging.info(\"\\n--------------------------------------------------------------\")\n\t\tlogging.info(\"Main Snoopy Process starting. Divert all power to the engines!\")\n\t\tpool=[]\n\t\tpool.append( Process(target=prox_guid.main) )\n\t\tpool.append( Process(target=facebook.main, args=('%s'%(snoopyDir),)) )\n\t\tpool.append( Process(target=pytail.main, args=('%s/uploads/'%(snoopyDir),)) )\t\n\t\tpool.append(Process(target=ssid_to_loc.main) )\n\t\tpool.append(Process(target=webmain.start))\n\t\n\t\tfor p in pool:\n\t\t\tp.start()\n\t\n\t\tall_good=True\n\t\twhile all_good and goFlag:\n\t\t\tfor p in pool:\n\t\t\t\tif not p.is_alive():\n\t\t\t\t\tall_good = False\n\t\t\ttime.sleep(2)\n\t\n\t\tfor p in pool:\n\t\t\tp.terminate()\n\t\n\t\tif( goFlag ):\n\t\t\tlogging.warning(\"One of my processes died, I'll restart all\")\n\t\t\tmain(snoopyDir)\n\t\n\tlogging.debug(\"Process ended\")", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 36 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gle", "nn", "@", "sense", "post", ".", "com", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sn", "oop", "y", " ", "//", " ", "2012_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "usi", "ng", " ", "this", " ", "code", " ", "you", " ", "agree", " ", "to", " ", "abi", "de", " ", "by", " ", "the", " ", "supplie", "d", " ", "LICENSE", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "run", " ", "direct", "ly", ",", " ", "but", " ", "via", " ", "sno", "opy", ".", "sh_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "Script", " ", "starts", " ", "vari", "ous", " ", "Sn", "oop", "y", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "To", "Do", ":", " ", "Inco", "rpor", "ate", " ", "all", " ", "Sn", "oop", "y", " ", "component", "s", " ", "int", "o", " ", "a", " ", "single", " ", "sno", "opy", ".", "py", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prox", "\\u", "guid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyt", "ail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "facebook", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ssid", "\\u", "to", "\\u", "loc_", "\\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_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multiprocessing_", "import_", "Process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sno", "opy", "Bin", "Path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "\"%", "s", "/", "sno", "opy", "/", "src", "/", "sno", "opy", "\"_", "%_", "sno", "opy", "Bin", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sno", "opy_", "._", "web_", "import_", "main_", "as_", "webm", "ain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webm", "ain_", "._", "app_", "._", "root", "\\u", "path_", "=_", "\"%", "s", "/", "sno", "opy", "/", "src", "/", "sno", "opy", "/\"_", "%_", "sno", "opy", "Bin", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "go", "Flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "signal", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "sno", "opy", "Dir_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "main_", "(_", "sno", "opy", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "logging_", "._", "error_", "(_", "\"", "Main", " ", "Sn", "oop", "y", " ", "thread", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "signal", "\\u", "handler_", "(_", "signal_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "go", "Flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "Cau", "ght", " ", "SIG", "INT", ",", " ", "ending", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "go", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "sno", "opy", "Dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "go", "Flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "go", "Flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "logging_", "._", "basic", "Config_", "(_", "filename_", "=_", "\"%", "s", "/", "logs", "/", "sno", "opy", ".", "log", "\"_", "%_", "(_", "sno", "opy", "Dir_", ")_", ",_", "level_", "=_", "logging_", "._", "INFO_", ",_", "format_", "=_", "'%", "(", "asc", "time", ")", "s", " ", "%", "(", "level", "name", ")", "s", " ", "%", "(", "filename", ")", "s", ":", " ", "%", "(", "message", ")", "s", "'_", ",_", "datefmt_", "=_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"\\\\", "n", "--------------", "--------------", "--------------", "--------------", "------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Main", " ", "Sn", "oop", "y", " ", "Process", " ", "startin", "g", ".", " ", "Dive", "rt", " ", "all", " ", "power", " ", "to", " ", "the", " ", "engines", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "append_", "(_", "Process_", "(_", "target_", "=_", "prox", "\\u", "guid_", "._", "main_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "append_", "(_", "Process_", "(_", "target_", "=_", "facebook", "_", "._", "main_", ",_", "args_", "=_", "(_", "'%", "s", "'_", "%_", "(_", "sno", "opy", "Dir_", ")_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "append_", "(_", "Process_", "(_", "target_", "=_", "pyt", "ail", "_", "._", "main_", ",_", "args_", "=_", "(_", "'%", "s", "/", "uploads", "/'_", "%_", "(_", "sno", "opy", "Dir_", ")_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "append_", "(_", "Process_", "(_", "target_", "=_", "ssid", "\\u", "to", "\\u", "loc_", "._", "main_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "append_", "(_", "Process_", "(_", "target_", "=_", "webm", "ain_", "._", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", "in_", "pool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "p_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "good_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "all", "\\u", "good_", "and_", "go", "Flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "p_", "in_", "pool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "p_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "all", "\\u", "good_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "pool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "p_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "go", "Flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "logging_", "._", "warning_", "(_", "\"", "One", " ", "of", " ", "my", " ", "process", "es", " ", "die", "d", ",", " ", "I", "'", "ll", " ", "restart", " ", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main_", "(_", "sno", "opy", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Process", " ", "ende", "d", "\"_", ")_", "\\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, 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', '___EOS___']", "index": 33 }, { "content": " def __init__(self, project_name, server=None, plugin_name=None, cache=None):\n self.project_name = project_name\n self.plugin_name = plugin_name\n self.server = server\n self.cache = self.prepare_cache(cache)\n self.crawl_config = None\n self.data = {}\n self.documents = []\n self.template_dict = None", "metadata": "root.CrawlPlugin.__init__", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 35 }, { "content": " def prepare_cache(self, cache):\n if cache is not None:\n cache.plugin_name = self.plugin_name\n cache.project_name = self.project_name\n cache.setup()\n return cache", "metadata": "root.CrawlPlugin.prepare_cache", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 45 }, { "content": " def get_default_plugin(self):\n pass", "metadata": "root.CrawlPlugin.get_default_plugin", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 52 }, { "content": " def get_specific_plugin(self):\n pass", "metadata": "root.CrawlPlugin.get_specific_plugin", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 55 }, { "content": " def start_crawl(self):\n crawl.start(self.crawl_config, cache=self.cache)", "metadata": "root.CrawlPlugin.start_crawl", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 58 }, { "content": " def scrape_data(self):\n # Create boilerplate recognizer\n skindex = Scraper(self.crawl_config)\n\n skindex.load_local_pages()\n skindex.add_template_elements()\n\n # Process all by removing boilerplate and extracting information\n return skindex.process_all(exclude_data=['cleaned', 'author'])", "metadata": "root.CrawlPlugin.scrape_data", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 61 }, { "content": " def get_documents(self, maximum_number_of_documents=10000):\n pass", "metadata": "root.CrawlPlugin.get_documents", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 71 }, { "content": " def save_bulk_data(self, data):\n pass", "metadata": "root.CrawlPlugin.save_bulk_data", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 74 }, { "content": " def run(self, delete_existing_documents=False):\n # get default plugin\n self.crawl_config = self.get_default_plugin()\n self.start_crawl()\n self.data = self.scrape_data()\n self.save_bulk_data(self.data)", "metadata": "root.CrawlPlugin.run", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 77 }, { "content": " def get_bad_summary(self, force_get_documents=False, n=5):\n if not self.documents or force_get_documents:\n self.documents = self.get_documents()\n title_sort = sorted(self.documents, key=lambda doc: len(doc['title']))\n body_sort = sorted(self.documents, key=lambda doc: len(' '.join(doc['body'])))\n date_sort = sorted(self.documents, key=lambda doc: len(doc['publish_date']))\n url_sort = sorted(self.documents, key=lambda doc: len(doc['url']))\n return {k: [(d['url'], d[k]) for d in sorted_type][:n]\n for k, sorted_type in zip(['title', 'body', 'publish_date', 'url'],\n [title_sort, body_sort, date_sort, url_sort])}", "metadata": "root.CrawlPlugin.get_bad_summary", "header": "['class', 'CrawlPlugin', ':', '___EOS___']", "index": 84 }, { "content": "class CrawlFilePlugin(CrawlPlugin):\n\n\n\n\n\n", "metadata": "root.CrawlFilePlugin", "header": "['module', '___EOS___']", "index": 96 }, { "content": " def get_default_plugin(self):\n with open(os.path.join(self.server['plugins'], 'default')) as f:\n return json.load(f)", "metadata": "root.CrawlFilePlugin.get_default_plugin", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 98 }, { "content": " def get_specific_plugin(self):\n with open(os.path.join(self.server['plugins'], self.plugin_name)) as f:\n specific_config = json.load(f)\n return specific_config", "metadata": "root.CrawlFilePlugin.get_specific_plugin", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 102 }, { "content": " def save_bulk_data(self, data):\n for row in data:\n with open(os.path.join(self.server['documents'], slugify(data[row]['url'])), 'w') as f:\n json.dump(data[row], f)", "metadata": "root.CrawlFilePlugin.save_bulk_data", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 107 }, { "content": " def get_documents(self, maximum_number_of_documents=1000000):\n slugged_url = slugify(self.plugin_name)\n results = {}\n for num, fn in enumerate(os.listdir(self.server['documents'])):\n if num == maximum_number_of_documents:\n break\n if slugged_url in fn:\n with open(os.path.join(self.server['documents'], fn)) as f:\n results[slugged_url] = json.load(f)\n return results", "metadata": "root.CrawlFilePlugin.get_documents", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 112 }, { "content": " def get_seen_urls(self):\n slugged_url = slugify(self.plugin_name)\n seen_urls = set()\n for fn in os.listdir(self.server['documents']):\n if slugged_url in fn:\n with open(os.path.join(self.server['documents'], fn)) as f:\n seen_urls.add(json.load(f)['url'])\n return seen_urls", "metadata": "root.CrawlFilePlugin.get_seen_urls", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 123 }, { "content": " def save_config(self, config):\n with open(os.path.join(self.server['plugins'], self.plugin_name), 'w') as f:\n json.dump(config, f)", "metadata": "root.CrawlFilePlugin.save_config", "header": "['class', 'CrawlFilePlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 132 }, { "content": "class CrawlCloudantPlugin(CrawlPlugin):\n\n\n\n\n\n\n\n", "metadata": "root.CrawlCloudantPlugin", "header": "['module', '___EOS___']", "index": 137 }, { "content": " def __init__(self, project_name, server, plugin_name, cache):\n super(CrawlCloudantPlugin, self).__init__(project_name, server, plugin_name, cache)\n self.dbs = {x: self.server.database(self.project_name + '-crawler-' + x) for x in\n ['plugins', 'documents', 'template_dict']}", "metadata": "root.CrawlCloudantPlugin.__init__", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 139 }, { "content": " def get_default_plugin(self):\n return self.dbs['plugins'].get('default').result().json()", "metadata": "root.CrawlCloudantPlugin.get_default_plugin", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 144 }, { "content": " def get_specific_plugin(self):\n return self.dbs['plugins'].get(self.plugin_name).result().json()", "metadata": "root.CrawlCloudantPlugin.get_specific_plugin", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 147 }, { "content": " def save_bulk_data(self, data):\n for url_id in data:\n data[url_id]['_id'] = slugify(url_id)\n # save bulk per max 10k per time\n for chunk in chunker(data.values(), 10000):\n if not chunk:\n return\n self.dbs['documents'].bulk_docs(*[x for x in chunk if x is not None]).result()", "metadata": "root.CrawlCloudantPlugin.save_bulk_data", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 150 }, { "content": " def get_documents(self, maximum_number_of_documents=1000000):\n # now just to add the host thing ??????????????\n query = 'query={}'.format(self.plugin_name)\n params = '?include_docs=true&limit={}&{}'.format(maximum_number_of_documents, query)\n return {x['doc']['_id']: x['doc'] for x in\n self.dbs['documents'].all_docs().get(params).result().json()['rows']\n if 'url' in x['doc'] and self.plugin_name in x['doc']['url']}", "metadata": "root.CrawlCloudantPlugin.get_documents", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 159 }, { "content": " def delete_existing_documents(self):\n docs = self.get_documents()\n for x in docs:\n docs[x]['_deleted'] = True\n self.dbs['documents'].bulk_docs(*[docs[x] for x in docs]).result()", "metadata": "root.CrawlCloudantPlugin.delete_existing_documents", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 167 }, { "content": " def get_seen_urls(self):\n # params = '?query={}'.format(self.plugin_name) # werkt niet\n params = ''\n udocs = self.dbs['documents'].design('urlview').view('view1').get(params).result().json()\n if 'rows' in udocs:\n return set([udoc['key'] for udoc in udocs['rows'] if self.plugin_name in udoc['key']])\n else:\n print(\"no seen urls for plugin\", self.plugin_name)\n return set()", "metadata": "root.CrawlCloudantPlugin.get_seen_urls", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 173 }, { "content": " def save_config(self, config):\n doc = self.dbs['plugins'].get(self.plugin_name).result().json()\n if 'error' not in doc:\n config['_id'] = doc['_id']\n config['_rev'] = doc['_rev']\n self.dbs['plugins'][self.plugin_name] = config", "metadata": "root.CrawlCloudantPlugin.save_config", "header": "['class', 'CrawlCloudantPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 183 }, { "content": "class CrawlElasticSearchPlugin(CrawlPlugin):\n\n\n\n\n\n\n", "metadata": "root.CrawlElasticSearchPlugin", "header": "['module', '___EOS___']", "index": 191 }, { "content": " def __init__(self, project_name, server, plugin_name, cache):\n super(CrawlElasticSearchPlugin, self).__init__(project_name, server, plugin_name, cache)\n self.es = server", "metadata": "root.CrawlElasticSearchPlugin.__init__", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 193 }, { "content": " def get_default_plugin(self):\n return self.es.get(id='default', doc_type='plugin',\n index=self.project_name + \"-crawler-plugins\")['_source']", "metadata": "root.CrawlElasticSearchPlugin.get_default_plugin", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 197 }, { "content": " def get_specific_plugin(self):\n return self.es.get(id=self.plugin_name, doc_type='plugin',\n index=self.project_name + \"-crawler-plugins\")['_source']", "metadata": "root.CrawlElasticSearchPlugin.get_specific_plugin", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 201 }, { "content": " def save_bulk_data(self, data):\n for url_id in data:\n doc_id = slugify(url_id)\n self.es.index(id=doc_id, body=data[url_id], doc_type='document',\n index=self.project_name + \"-crawler-documents\")", "metadata": "root.CrawlElasticSearchPlugin.save_bulk_data", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 205 }, { "content": " def get_documents(self, maximum_number_of_documents=1000000):\n query = {\"query\": {\"wildcard\": {\"url\": \"*{}*\".format(self.plugin_name)}}}\n res = self.es.search(body=query, doc_type='document',\n index=self.project_name + \"-crawler-documents\")\n return res['hits']['hits']", "metadata": "root.CrawlElasticSearchPlugin.get_documents", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 211 }, { "content": " def get_seen_urls(self):\n query = {\"query\": {\"wildcard\": {\"url\": \"*{}*\".format(self.plugin_name)}}, \"fields\": \"url\"}\n res = self.es.search(body=query, doc_type='document',\n index=self.project_name + \"-crawler-documents\")\n return set([x['fields']['url'][0] for x in res['hits']['hits']])", "metadata": "root.CrawlElasticSearchPlugin.get_seen_urls", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 217 }, { "content": " def save_config(self, config):\n self.es.index(id=self.plugin_name, body=config, doc_type='plugin',\n index=self.project_name + \"-crawler-plugins\")", "metadata": "root.CrawlElasticSearchPlugin.save_config", "header": "['class', 'CrawlElasticSearchPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 223 }, { "content": "class CrawlZODBPlugin(CrawlPlugin):\n\n\n\n\n\n\n", "metadata": "root.CrawlZODBPlugin", "header": "['module', '___EOS___']", "index": 228 }, { "content": " def get_default_plugin(self):\n return self.server['plugins']['default']", "metadata": "root.CrawlZODBPlugin.get_default_plugin", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 230 }, { "content": " def get_specific_plugin(self):\n return self.server['plugins'][self.plugin_name]", "metadata": "root.CrawlZODBPlugin.get_specific_plugin", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 233 }, { "content": " def save_bulk_data(self, data):\n for url_id in data:\n self.server['documents'][slugify(url_id)] = data[url_id]\n transaction.commit()", "metadata": "root.CrawlZODBPlugin.save_bulk_data", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 236 }, { "content": " def get_documents(self, maximum_number_of_documents=1000000):\n return self.server['documents']", "metadata": "root.CrawlZODBPlugin.get_documents", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 241 }, { "content": " def delete_existing_documents(self):\n self.server['documents'] = OOBTree()\n transaction.commit()", "metadata": "root.CrawlZODBPlugin.delete_existing_documents", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 244 }, { "content": " def get_seen_urls(self):\n return set([self.server['documents'][s]['url'] for s in self.server['documents']\n if self.plugin_name in self.server['documents'][s]['url']])", "metadata": "root.CrawlZODBPlugin.get_seen_urls", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 248 }, { "content": " def save_config(self, config):\n self.server['plugins'][self.plugin_name] = config\n transaction.commit()", "metadata": "root.CrawlZODBPlugin.save_config", "header": "['class', 'CrawlZODBPlugin', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 252 }, { "content": "class CrawlPluginNews(CrawlPlugin):\n import ast\n\n\n\n\n\n", "metadata": "root.CrawlPluginNews", "header": "['module', '___EOS___']", "index": 257 }, { "content": " def save_data(self, data):\n raise NotImplementedError('save_data required')", "metadata": "root.CrawlPluginNews.save_data", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 260 }, { "content": " def get_template_dict(self):\n raise NotImplementedError('get_template_dict required')", "metadata": "root.CrawlPluginNews.get_template_dict", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 263 }, { "content": " def save_template_dict(self, templated_dict):\n raise NotImplementedError('save_template_dict required')", "metadata": "root.CrawlPluginNews.save_template_dict", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 266 }, { "content": " def get_seen_urls(self):\n raise NotImplementedError('seen_urls required')", "metadata": "root.CrawlPluginNews.get_seen_urls", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 269 }, { "content": " def delete_existing_documents(self):\n raise NotImplementedError('delete_existing_documents required')", "metadata": "root.CrawlPluginNews.delete_existing_documents", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 272 }, { "content": " def run(self, delete_existing_documents=False):\n # get default plugin\n print(\"getting crawl plugin info\")\n self.crawl_config = self.get_default_plugin()\n\n # apply this specific plugin\n self.crawl_config.update(self.get_specific_plugin())\n\n # delete existing documents\n if delete_existing_documents:\n print(\"deleting documents before crawling\")\n self.delete_existing_documents()\n seen_urls = []\n # add the already visited urls to the config\n else:\n print(\"getting seen urls\")\n seen_urls = self.get_seen_urls()\n self.crawl_config['seen_urls'] = seen_urls\n\n print(\"getting template dict\")\n # add the template for this crawl_plugin to the scraping config\n self.crawl_config['template_dict'] = self.get_template_dict()\n\n print(\"starting crawl\")\n # separate out the save data while crawling and the newscraler\n if 'logging_level' in self.crawl_config:\n logging_level = int(self.crawl_config['logging_level'])\n else:\n logging_level = 3\n templated_dict = crawl.start(\n self.crawl_config, NewsCrawler, self.save_data, self.save_bulk_data,\n logging_level=logging_level, cache=self.cache)\n\n print('saving template..')\n self.save_template_dict(templated_dict)\n print('crawling/scraping', self.project_name, self.plugin_name, \"DONE\")", "metadata": "root.CrawlPluginNews.run", "header": "['class', 'CrawlPluginNews', '(', 'CrawlPlugin', ')', ':', '___EOS___']", "index": 275 }, { "content": "class CrawlFilePluginNews(CrawlFilePlugin, CrawlPluginNews):\n\n\n", "metadata": "root.CrawlFilePluginNews", "header": "['module', '___EOS___']", "index": 313 }, { "content": " def save_data(self, data):\n with open(os.path.join(self.server['documents'], slugify(data['url'])), 'w') as f:\n json.dump(data, f)", "metadata": "root.CrawlFilePluginNews.save_data", "header": "['class', 'CrawlFilePluginNews', '(', 'CrawlFilePlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 315 }, { "content": " def get_template_dict(self):\n temp_dict_fn = os.path.join(self.server['template_dict'], self.plugin_name)\n if os.path.isfile(temp_dict_fn):\n with open(temp_dict_fn) as f:\n template_dict = {self.ast.literal_eval(k): v for k, v in json.load(f).items()\n if not k.startswith('_')}\n else:\n template_dict = {}\n\n return template_dict", "metadata": "root.CrawlFilePluginNews.get_template_dict", "header": "['class', 'CrawlFilePluginNews', '(', 'CrawlFilePlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 319 }, { "content": " def save_template_dict(self, templated_dict):\n if templated_dict:\n temp_dict_fn = os.path.join(self.server['template_dict'], self.plugin_name)\n with open(temp_dict_fn, 'w') as f:\n json.dump({repr(k): v for k, v in templated_dict.items()}, f)", "metadata": "root.CrawlFilePluginNews.save_template_dict", "header": "['class', 'CrawlFilePluginNews', '(', 'CrawlFilePlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 330 }, { "content": "class CrawlZODBPluginNews(CrawlZODBPlugin, CrawlPluginNews):\n\n\n", "metadata": "root.CrawlZODBPluginNews", "header": "['module', '___EOS___']", "index": 337 }, { "content": " def save_data(self, data):\n self.server['documents'][slugify(data['url'])] = data\n transaction.commit()", "metadata": "root.CrawlZODBPluginNews.save_data", "header": "['class', 'CrawlZODBPluginNews', '(', 'CrawlZODBPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 339 }, { "content": " def get_template_dict(self):\n if ('template_dict' not in self.server or\n self.plugin_name not in self.server['template_dict']):\n template_dict = OOBTree()\n else:\n template_dict = self.server['template_dict'][self.plugin_name]\n return template_dict", "metadata": "root.CrawlZODBPluginNews.get_template_dict", "header": "['class', 'CrawlZODBPluginNews', '(', 'CrawlZODBPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 343 }, { "content": " def save_template_dict(self, templated_dict):\n if templated_dict:\n self.server['template_dict'][self.plugin_name] = OOBTree(templated_dict)\n transaction.commit()", "metadata": "root.CrawlZODBPluginNews.save_template_dict", "header": "['class', 'CrawlZODBPluginNews', '(', 'CrawlZODBPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 351 }, { "content": "class CrawlElasticSearchPluginNews(CrawlElasticSearchPlugin, CrawlPluginNews):\n\n\n", "metadata": "root.CrawlElasticSearchPluginNews", "header": "['module', '___EOS___']", "index": 357 }, { "content": " def save_data(self, data):\n self.es.index(index=self.project_name + \"-crawler-documents\", doc_type='document',\n id=slugify(data['url']), body=data)", "metadata": "root.CrawlElasticSearchPluginNews.save_data", "header": "['class', 'CrawlElasticSearchPluginNews', '(', 'CrawlElasticSearchPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 359 }, { "content": " def get_template_dict(self):\n try:\n templ_dict = self.es.get(index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict',\n id=self.plugin_name)['_source']\n templ_dict = {self.ast.literal_eval(k): v for k, v in templ_dict.items()}\n # In acually catching the NotFoundError (for which I do not want to depend\n # on importing the elasticsearch package)\n # pylint: disable=bare-except\n except:\n templ_dict = {}\n return templ_dict", "metadata": "root.CrawlElasticSearchPluginNews.get_template_dict", "header": "['class', 'CrawlElasticSearchPluginNews', '(', 'CrawlElasticSearchPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 363 }, { "content": " def save_template_dict(self, templ_dict):\n if templ_dict:\n try:\n self.es.index(index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict', id=self.plugin_name,\n body=json.dumps({repr(k): v for k, v in templ_dict.items()}))\n # In acually catching the NotFoundError (for which I do not want to depend\n # on importing the elasticsearch package)\n # pylint: disable=bare-except\n except:\n self.es.update(\n index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict', id=self.plugin_name,\n body=json.dumps({\"doc\": {repr(k): v for k, v in templ_dict.items()}}))", "metadata": "root.CrawlElasticSearchPluginNews.save_template_dict", "header": "['class', 'CrawlElasticSearchPluginNews', '(', 'CrawlElasticSearchPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 376 }, { "content": "class CrawlCloudantPluginNews(CrawlCloudantPlugin, CrawlPluginNews):\n\n\n", "metadata": "root.CrawlCloudantPluginNews", "header": "['module', '___EOS___']", "index": 392 }, { "content": " def save_data(self, data):\n try:\n self.dbs['documents'][slugify(data['url'])] = data\n except requests.exceptions.HTTPError:\n print('conflict error', slugify(data['url']))", "metadata": "root.CrawlCloudantPluginNews.save_data", "header": "['class', 'CrawlCloudantPluginNews', '(', 'CrawlCloudantPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 394 }, { "content": " def get_template_dict(self):\n template_dict = self.dbs['template_dict'].get(self.plugin_name).result().json()\n if 'error' in template_dict:\n template_dict = {}\n else:\n template_dict = {self.ast.literal_eval(k): v for k, v in template_dict.items()\n if not k.startswith('_')}\n return template_dict", "metadata": "root.CrawlCloudantPluginNews.get_template_dict", "header": "['class', 'CrawlCloudantPluginNews', '(', 'CrawlCloudantPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 400 }, { "content": " def save_template_dict(self, templated_dict):\n if templated_dict:\n doc = self.dbs['template_dict'].get(self.plugin_name).result().json()\n if 'error' in doc:\n doc = {}\n doc.update({repr(k): v for k, v in templated_dict.items()})\n self.dbs['template_dict'][self.plugin_name] = doc", "metadata": "root.CrawlCloudantPluginNews.save_template_dict", "header": "['class', 'CrawlCloudantPluginNews', '(', 'CrawlCloudantPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 409 } ]
[]
[]
0
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Plugin_", ":_", "\\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_", ",_", "project", "\\u", "name_", ",_", "server_", "=_", "None_", ",_", "plugin", "\\u", "name_", "=_", "None_", ",_", "cache_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "project", "\\u", "name_", "=_", "project", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plugin", "\\u", "name_", "=_", "plugin", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache_", "=_", "self_", "._", "prepar", "e\\u", "cache_", "(_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "documents_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "template", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "cache_", "(_", "self_", ",_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cache_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "plugin", "\\u", "name_", "=_", "self_", "._", "plugin", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "project", "\\u", "name_", "=_", "self_", "._", "project", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "specific", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "crawl", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crawl", "_", "._", "start_", "(_", "self_", "._", "crawl", "\\u", "config_", ",_", "cache_", "=_", "self_", "._", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scrape", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "boiler", "plate", " ", "recognize", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skin", "dex_", "=_", "Scraper_", "(_", "self_", "._", "crawl", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "skin", "dex_", "._", "load", "\\u", "local", "\\u", "pages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skin", "dex_", "._", "add", "\\u", "template", "\\u", "elements_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "all", " ", "by", " ", "remo", "ving", " ", "boiler", "plate", " ", "and", " ", "extracti", "ng", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "skin", "dex_", "._", "process", "\\u", "all_", "(_", "exclu", "de", "\\u", "data_", "=_", "[_", "'", "clean", "ed", "'_", ",_", "'", "author", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "documents_", "(_", "self_", ",_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", "=_", "10000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "delete", "\\u", "exist", "ing", "\\u", "documents_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "default", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "crawl", "\\u", "config_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "plugin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "crawl", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "self_", "._", "scrape", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plugin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "bad", "\\u", "summary_", "(_", "self_", ",_", "force", "\\u", "get", "\\u", "documents_", "=_", "False_", ",_", "n_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "documents_", "or_", "force", "\\u", "get", "\\u", "documents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "documents_", "=_", "self_", "._", "get", "\\u", "documents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "title", "\\u", "sort_", "=_", "sorted_", "(_", "self_", "._", "documents_", ",_", "key_", "=_", "lambda_", "doc_", ":_", "len_", "(_", "doc_", "[_", "'", "title", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "sort_", "=_", "sorted_", "(_", "self_", "._", "documents_", ",_", "key_", "=_", "lambda_", "doc_", ":_", "len_", "(_", "'", " ", "'_", "._", "join_", "(_", "doc_", "[_", "'", "body", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "sort_", "=_", "sorted_", "(_", "self_", "._", "documents_", ",_", "key_", "=_", "lambda_", "doc_", ":_", "len_", "(_", "doc_", "[_", "'", "publi", "sh", "\\u", "date", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "sort_", "=_", "sorted_", "(_", "self_", "._", "documents_", ",_", "key_", "=_", "lambda_", "doc_", ":_", "len_", "(_", "doc_", "[_", "'", "url", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "k_", ":_", "[_", "(_", "d_", "[_", "'", "url", "'_", "]_", ",_", "d_", "[_", "k_", "]_", ")_", "for_", "d_", "in_", "sorte", "d\\u", "type_", "]_", "[_", ":_", "n_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "sorte", "d\\u", "type_", "in_", "zip_", "(_", "[_", "'", "title", "'_", ",_", "'", "body", "'_", ",_", "'", "publi", "sh", "\\u", "date", "'_", ",_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "title", "\\u", "sort_", ",_", "body", "\\u", "sort_", ",_", "date", "\\u", "sort_", ",_", "url", "\\u", "sort_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "default", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", ",_", "'", "default", "'_", ")_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\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", "specific", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", ",_", "self_", "._", "plugin", "\\u", "name_", ")_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specific", "\\u", "config_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "specific", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ",_", "slugify_", "(_", "data_", "[_", "row_", "]_", "[_", "'", "url", "'_", "]_", ")_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "data_", "[_", "row_", "]_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "documents_", "(_", "self_", ",_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", "=_", "1000000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slug", "ged", "\\u", "url_", "=_", "slugify_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "num_", ",_", "fn_", "in_", "enumerate_", "(_", "os_", "._", "listdir_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "num_", "==_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", ":_", "\\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_", "slug", "ged", "\\u", "url_", "in_", "fn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ",_", "fn_", ")_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "[_", "slug", "ged", "\\u", "url_", "]_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "see", "n", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slug", "ged", "\\u", "url_", "=_", "slugify_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "see", "n", "\\u", "urls_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fn_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "slug", "ged", "\\u", "url_", "in_", "fn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ",_", "fn_", ")_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "see", "n", "\\u", "urls_", "._", "add_", "(_", "json_", "._", "load_", "(_", "f_", ")_", "[_", "'", "url", "'_", "]_", ")_", "\\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_", "see", "n", "\\u", "urls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "config_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", ",_", "self_", "._", "plugin", "\\u", "name_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "config_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\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_", ",_", "project", "\\u", "name_", ",_", "server_", ",_", "plugin", "\\u", "name_", ",_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Crawl", "Cloud", "ant", "Plugin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "project", "\\u", "name_", ",_", "server_", ",_", "plugin", "\\u", "name_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbs_", "=_", "{_", "x_", ":_", "self_", "._", "server_", "._", "database_", "(_", "self_", "._", "project", "\\u", "name_", "+_", "'-", "crawle", "r", "-'_", "+_", "x_", ")_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "plugin", "s", "'_", ",_", "'", "document", "s", "'_", ",_", "'", "template", "\\u", "dict", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbs_", "[_", "'", "plugin", "s", "'_", "]_", "._", "get_", "(_", "'", "default", "'_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "specific", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbs_", "[_", "'", "plugin", "s", "'_", "]_", "._", "get_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url", "\\u", "id_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "url", "\\u", "id_", "]_", "[_", "'\\u", "id", "'_", "]_", "=_", "slugify_", "(_", "url", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "bul", "k", " ", "per", " ", "max", " ", "10", "k", " ", "per", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "chunk_", "in_", "chunk", "er_", "(_", "data_", "._", "values_", "(_", ")_", ",_", "10000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "chunk_", ":_", "\\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_", "._", "dbs_", "[_", "'", "document", "s", "'_", "]_", "._", "bul", "k", "\\u", "docs_", "(_", "*_", "[_", "x_", "for_", "x_", "in_", "chunk_", "if_", "x_", "is_", "not_", "None_", "]_", ")_", "._", "result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\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", "documents_", "(_", "self_", ",_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", "=_", "1000000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "just", " ", "to", " ", "add", " ", "the", " ", "host", " ", "thing", " ", "??????", "??????", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "'", "query", "={}'_", "._", "format_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "'?", "include", "\\u", "docs", "=", "true", "&", "limit", "={}", "&", "{}'_", "._", "format_", "(_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "x_", "[_", "'", "doc", "'_", "]_", "[_", "'\\u", "id", "'_", "]_", ":_", "x_", "[_", "'", "doc", "'_", "]_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dbs_", "[_", "'", "document", "s", "'_", "]_", "._", "all", "\\u", "docs_", "(_", ")_", "._", "get_", "(_", "params_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "[_", "'", "rows", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "url", "'_", "in_", "x_", "[_", "'", "doc", "'_", "]_", "and_", "self_", "._", "plugin", "\\u", "name_", "in_", "x_", "[_", "'", "doc", "'_", "]_", "[_", "'", "url", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "exist", "ing", "\\u", "documents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docs_", "=_", "self_", "._", "get", "\\u", "documents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docs_", "[_", "x_", "]_", "[_", "'\\u", "delete", "d", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dbs_", "[_", "'", "document", "s", "'_", "]_", "._", "bul", "k", "\\u", "docs_", "(_", "*_", "[_", "docs_", "[_", "x_", "]_", "for_", "x_", "in_", "docs_", "]_", ")_", "._", "result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "see", "n", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "params", " ", "=", " ", "'?", "query", "={}", "'.", "format", "(", "self", ".", "plugin", "\\u", "name", ")", " ", "#", " ", "werk", "t", " ", "nie", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "udo", "cs_", "=_", "self_", "._", "dbs_", "[_", "'", "document", "s", "'_", "]_", "._", "design_", "(_", "'", "url", "view", "'_", ")_", "._", "view_", "(_", "'", "view", "1", "'_", ")_", "._", "get_", "(_", "params_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "rows", "'_", "in_", "udo", "cs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set_", "(_", "[_", "udo", "c_", "[_", "'", "key", "'_", "]_", "for_", "udo", "c_", "in_", "udo", "cs_", "[_", "'", "rows", "'_", "]_", "if_", "self_", "._", "plugin", "\\u", "name_", "in_", "udo", "c_", "[_", "'", "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 ", " _", "print_", "(_", "\"", "no", " ", "see", "n", " ", "urls", " ", "for", " ", "plugin", "\"_", ",_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "config_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "self_", "._", "dbs_", "[_", "'", "plugin", "s", "'_", "]_", "._", "get_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "'_", "not_", "in_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "[_", "'\\u", "id", "'_", "]_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "[_", "'\\u", "rev", "'_", "]_", "=_", "doc_", "[_", "'\\u", "rev", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dbs_", "[_", "'", "plugin", "s", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\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_", ",_", "project", "\\u", "name_", ",_", "server_", ",_", "plugin", "\\u", "name_", ",_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "project", "\\u", "name_", ",_", "server_", ",_", "plugin", "\\u", "name_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "es_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "es_", "._", "get_", "(_", "id_", "=_", "'", "default", "'_", ",_", "doc", "\\u", "type_", "=_", "'", "plugin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "plugin", "s", "\"_", ")_", "[_", "'\\u", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "specific", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "es_", "._", "get_", "(_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "doc", "\\u", "type_", "=_", "'", "plugin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "plugin", "s", "\"_", ")_", "[_", "'\\u", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url", "\\u", "id_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc", "\\u", "id_", "=_", "slugify_", "(_", "url", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "es_", "._", "index_", "(_", "id_", "=_", "doc", "\\u", "id_", ",_", "body_", "=_", "data_", "[_", "url", "\\u", "id_", "]_", ",_", "doc", "\\u", "type_", "=_", "'", "document", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "document", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\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", "documents_", "(_", "self_", ",_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", "=_", "1000000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "\"", "query", "\"_", ":_", "{_", "\"", "wild", "card", "\"_", ":_", "{_", "\"", "url", "\"_", ":_", "\"*", "{}", "*\"_", "._", "format_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "es_", "._", "search_", "(_", "body_", "=_", "query_", ",_", "doc", "\\u", "type_", "=_", "'", "document", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "document", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "[_", "'", "hits", "'_", "]_", "[_", "'", "hits", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "see", "n", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "\"", "query", "\"_", ":_", "{_", "\"", "wild", "card", "\"_", ":_", "{_", "\"", "url", "\"_", ":_", "\"*", "{}", "*\"_", "._", "format_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "}_", "}_", ",_", "\"", "fields", "\"_", ":_", "\"", "url", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "es_", "._", "search_", "(_", "body_", "=_", "query_", ",_", "doc", "\\u", "type_", "=_", "'", "document", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "document", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "set_", "(_", "[_", "x_", "[_", "'", "fields", "'_", "]_", "[_", "'", "url", "'_", "]_", "[_", "0_", "]_", "for_", "x_", "in_", "res_", "[_", "'", "hits", "'_", "]_", "[_", "'", "hits", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "config_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es_", "._", "index_", "(_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "body_", "=_", "config_", ",_", "doc", "\\u", "type_", "=_", "'", "plugin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "plugin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "default", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", "[_", "'", "default", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "specific", "\\u", "plugin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "bul", "k", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url", "\\u", "id_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "[_", "slugify_", "(_", "url", "\\u", "id_", ")_", "]_", "=_", "data_", "[_", "url", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "documents_", "(_", "self_", ",_", "maxim", "um", "\\u", "number", "\\u", "of", "\\u", "documents_", "=_", "1000000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "exist", "ing", "\\u", "documents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "=_", "OO", "BT", "ree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "see", "n", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set_", "(_", "[_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "[_", "s_", "]_", "[_", "'", "url", "'_", "]_", "for_", "s_", "in_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "plugin", "\\u", "name_", "in_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "[_", "s_", "]_", "[_", "'", "url", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plugin_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "config_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server_", "[_", "'", "plugin", "s", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "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_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ast_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "save", "\\u", "data", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "template", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "get", "\\u", "template", "\\u", "dict", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "template", "d\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "save", "\\u", "template", "\\u", "dict", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "see", "n", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "see", "n", "\\u", "urls", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "exist", "ing", "\\u", "documents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "delete", "\\u", "exist", "ing", "\\u", "document", "s", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Plug", "in", "News", "_", "(_", "Crawl", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "delete", "\\u", "exist", "ing", "\\u", "documents_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "default", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "getti", "ng", " ", "crawl", " ", "plugin", " ", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "plugin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appl", "y", " ", "this", " ", "specific", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", "._", "update_", "(_", "self_", "._", "get", "\\u", "specific", "\\u", "plugin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "exist", "ing", " ", "documents_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delete", "\\u", "exist", "ing", "\\u", "documents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "delet", "ing", " ", "document", "s", " ", "bef", "ore", " ", "crawl", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delete", "\\u", "exist", "ing", "\\u", "documents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "see", "n", "\\u", "urls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "alr", "ead", "y", " ", "visit", "ed", " ", "urls", " ", "to", " ", "the", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "getti", "ng", " ", "see", "n", " ", "urls", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "see", "n", "\\u", "urls_", "=_", "self_", "._", "get", "\\u", "see", "n", "\\u", "urls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", "[_", "'", "see", "n", "\\u", "urls", "'_", "]_", "=_", "see", "n", "\\u", "urls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "getti", "ng", " ", "template", " ", "dict", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "template", " ", "for", " ", "this", " ", "crawl", "\\u", "plugin", " ", "to", " ", "the", " ", "scrap", "ing", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "=_", "self_", "._", "get", "\\u", "template", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "startin", "g", " ", "crawl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "separate", " ", "out", " ", "the", " ", "save", " ", "data", " ", "whi", "le", " ", "crawl", "ing", " ", "and", " ", "the", " ", "news", "cra", "ler_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "logg", "ing", "\\u", "level", "'_", "in_", "self_", "._", "crawl", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "ing", "\\u", "level_", "=_", "int_", "(_", "self_", "._", "crawl", "\\u", "config_", "[_", "'", "logg", "ing", "\\u", "level", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "ing", "\\u", "level_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "template", "d\\u", "dict_", "=_", "crawl", "_", "._", "start_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "crawl", "\\u", "config_", ",_", "News", "Crawler", "_", ",_", "self_", "._", "save", "\\u", "data_", ",_", "self_", "._", "save", "\\u", "bul", "k", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "ing", "\\u", "level_", "=_", "logg", "ing", "\\u", "level_", ",_", "cache_", "=_", "self_", "._", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "saving", " ", "template", "..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "template", "\\u", "dict_", "(_", "template", "d\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "crawl", "ing", "/", "scrap", "ing", "'_", ",_", "self_", "._", "project", "\\u", "name_", ",_", "self_", "._", "plugin", "\\u", "name_", ",_", "\"", "DON", "E", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "File", "Plug", "in", "News", "_", "(_", "Crawl", "File", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "File", "Plug", "in", "News", "_", "(_", "Crawl", "File", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "save", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", ",_", "slugify_", "(_", "data_", "[_", "'", "url", "'_", "]_", ")_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "data_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plug", "in", "News", "_", "(_", "Crawl", "File", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\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", "template", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "dict", "\\u", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "template", "\\u", "dict", "'_", "]_", ",_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "temp", "\\u", "dict", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "temp", "\\u", "dict", "\\u", "fn_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "=_", "{_", "self_", "._", "ast_", "._", "literal", "\\u", "eval_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "json_", "._", "load_", "(_", "f_", ")_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "k_", "._", "startswith_", "(_", "'\\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 ", " _", "template", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "template", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "File", "Plug", "in", "News", "_", "(_", "Crawl", "File", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "template", "d\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "d\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "dict", "\\u", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "server_", "[_", "'", "template", "\\u", "dict", "'_", "]_", ",_", "self_", "._", "plugin", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "temp", "\\u", "dict", "\\u", "fn_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "template", "d\\u", "dict_", "._", "items_", "(_", ")_", "}_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "ZO", "DB", "Plug", "in", "News", "_", "(_", "Crawl", "ZO", "DB", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "ZO", "DB", "Plug", "in", "News", "_", "(_", "Crawl", "ZO", "DB", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "save", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server_", "[_", "'", "document", "s", "'_", "]_", "[_", "slugify_", "(_", "data_", "[_", "'", "url", "'_", "]_", ")_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plug", "in", "News", "_", "(_", "Crawl", "ZO", "DB", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "template", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "'", "template", "\\u", "dict", "'_", "not_", "in_", "self_", "._", "server_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "plugin", "\\u", "name_", "not_", "in_", "self_", "._", "server_", "[_", "'", "template", "\\u", "dict", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "=_", "OO", "BT", "ree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "=_", "self_", "._", "server_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "template", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "ZO", "DB", "Plug", "in", "News", "_", "(_", "Crawl", "ZO", "DB", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "template", "d\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "d\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "=_", "OO", "BT", "ree_", "(_", "template", "d\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "save", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es_", "._", "index_", "(_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "document", "s", "\"_", ",_", "doc", "\\u", "type_", "=_", "'", "document", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "slugify_", "(_", "data_", "[_", "'", "url", "'_", "]_", ")_", ",_", "body_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "template", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "templ", "\\u", "dict_", "=_", "self_", "._", "es_", "._", "get_", "(_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ")_", "[_", "'\\u", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "templ", "\\u", "dict_", "=_", "{_", "self_", "._", "ast_", "._", "literal", "\\u", "eval_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "acu", "ally", " ", "catch", "ing", " ", "the", " ", "Not", "Foun", "d", "Error", " ", "(", "for", " ", "whi", "ch", " ", "I", " ", "do", " ", "not", " ", "want", " ", "to", " ", "depend", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "import", "ing", " ", "the", " ", "elastic", "search", " ", "package", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "bare", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "templ", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "templ", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "templ", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "templ", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es_", "._", "index_", "(_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "acu", "ally", " ", "catch", "ing", " ", "the", " ", "Not", "Foun", "d", "Error", " ", "(", "for", " ", "whi", "ch", " ", "I", " ", "do", " ", "not", " ", "want", " ", "to", " ", "depend", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "import", "ing", " ", "the", " ", "elastic", "search", " ", "package", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "bare", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "{_", "\"", "doc", "\"_", ":_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Crawl", "Cloud", "ant", "Plug", "in", "News", "_", "(_", "Crawl", "Cloud", "ant", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Crawl", "Cloud", "ant", "Plug", "in", "News", "_", "(_", "Crawl", "Cloud", "ant", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "save", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dbs_", "[_", "'", "document", "s", "'_", "]_", "[_", "slugify_", "(_", "data_", "[_", "'", "url", "'_", "]_", ")_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "requests_", "._", "exceptions_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "confl", "ict", " ", "error", "'_", ",_", "slugify_", "(_", "data_", "[_", "'", "url", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plug", "in", "News", "_", "(_", "Crawl", "Cloud", "ant", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\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", "template", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "=_", "self_", "._", "dbs_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "._", "get_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "'_", "in_", "template", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\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 ", " _", "template", "\\u", "dict_", "=_", "{_", "self_", "._", "ast_", "._", "literal", "\\u", "eval_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "template", "\\u", "dict_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "k_", "._", "startswith_", "(_", "'\\u'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "template", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Cloud", "ant", "Plug", "in", "News", "_", "(_", "Crawl", "Cloud", "ant", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "template", "d\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "d\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "self_", "._", "dbs_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "._", "get_", "(_", "self_", "._", "plugin", "\\u", "name_", ")_", "._", "result_", "(_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "'_", "in_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "._", "update_", "(_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "template", "d\\u", "dict_", "._", "items_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbs_", "[_", "'", "template", "\\u", "dict", "'_", "]_", "[_", "self_", "._", "plugin", "\\u", "name_", "]_", "=_", "doc_" ]
[ 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pybrain/pybrain/pybrain/rl/environments/twoplayergames/tasks/relativegomokutask.py
[ { "content": " def _globalWarming(self):\n \"\"\" increase temperature \"\"\"\n if self.temp == 0:\n self.temp = 0.02\n else:\n self.temp *= 1.2\n if self.temp > self.maxTemperature:\n return False\n elif self._setTemperature() == False:\n # not adjustable, keep it fixed then.\n self.temp = self.minTemperature\n return False\n return True", "metadata": "root.RelativeGomokuTask._globalWarming", "header": "['class', 'RelativeGomokuTask', '(', 'GomokuTask', ')', ':', '___EOS___']", "index": 71 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Relative", "Go", "mo", "ku", "Task_", "(_", "Go", "mo", "ku", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "global", "War", "ming", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "increase", " ", "tempe", "ratur", "e", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "temp_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "temp_", "=_", "0.02_", "\\u\\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_", "._", "temp_", "*=_", "1.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "temp_", ">_", "self_", "._", "max", "Temperature_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "set", "Temperature_", "(_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "adjust", "able", ",", " ", "keep", " ", "it", " ", "fixed", " ", "then", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "temp_", "=_", "self_", "._", "min", "Temperature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused local variable
victor-gil-sepulveda/pyProCT/pyproct/data/matrix/protein/test/TestDihedralAnglesRMSD.py
[ { "content": " def test_calc_matrix(self):\n pdb_structure = prody.parsePDB(\"data/3_models.pdb\")\n expected = [ 35.01002624, 47.60315215, 88.64981522, 32.90471145, 87.13023459, 85.76106107]\n product_matrix = DihedralRMSDMatrixCalculator.build(pdb_structure)\n# print \"out\", product_matrix.get_data()\n# print \"out\", product_matrix.get_data()\n# print product_matrix.get_data()[0]\n# print product_matrix[0,1]\n numpy.testing.assert_almost_equal(expected, product_matrix.get_data(),8)", "metadata": "root.Test.test_calc_matrix", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "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", "calc", "\\u", "matrix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdb", "\\u", "structure_", "=_", "prod", "y_", "._", "parse", "PDB", "_", "(_", "\"", "data", "/", "3", "\\u", "model", "s", ".", "pdb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "35.", "0100", "262", "4_", ",_", "47.", "603", "152", "15_", ",_", "88", ".6", "498", "152", "2_", ",_", "32.", "904", "711", "45_", ",_", "87", ".1", "302", "345", "9_", ",_", "85", ".7", "610", "610", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "matrix_", "=_", "Di", "hedr", "al", "RMS", "DM", "atrix", "Calculator_", "._", "build_", "(_", "pdb", "\\u", "structure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "out", "\",", " ", "product", "\\u", "matrix", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "\"", "out", "\",", " ", "product", "\\u", "matrix", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "product", "\\u", "matrix", ".", "get", "\\u", "data", "()[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "product", "\\u", "matrix", "[", "0", ",", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "testing_", "._", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "expected_", ",_", "product", "\\u", "matrix_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "8_", ")_", "\\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 ]
Unused local variable
praekelt/django-setuptest/setuptest/setuptest.py
[ { "content": " def resolve_packages(self):\n \"\"\"\n Frame hack to determine packages contained in module for testing.\n We ignore submodules (those containing '.')\n \"\"\"\n f = sys._getframe()\n while f:\n if 'self' in f.f_locals:\n locals_self = f.f_locals['self']\n py_modules = getattr(locals_self, 'py_modules', None)\n packages = getattr(locals_self, 'packages', None)\n\n top_packages = []\n if py_modules or packages:\n if py_modules:\n for module in py_modules:\n if '.' not in module:\n top_packages.append(module)\n if packages:\n for package in packages:\n if '.' not in package:\n top_packages.append(package)\n\n return list(set(top_packages))\n f = f.f_back", "metadata": "root.SetupTestSuite.resolve_packages", "header": "['class', 'SetupTestSuite', '(', 'unittest', '.', 'TestSuite', ')', ':', '___EOS___']", "index": 187 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Set", "up", "Test", "Suite_", "(_", "unittest_", "._", "Test", "Suite_", ")_", ":_", "\\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_", "resolve", "\\u", "packages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Frame", " ", "hack", " ", "to", " ", "dete", "rmin", "e", " ", "package", "s", " ", "contain", "ed", " ", "in", " ", "module", " ", "for", " ", "testi", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "ignore", " ", "submodules", " ", "(", "tho", "se", " ", "contain", "ing", " ", "'.'", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "sys_", "._", "\\u", "getframe_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "self", "'_", "in_", "f_", "._", "f", "\\u", "locals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals", "\\u", "self_", "=_", "f_", "._", "f", "\\u", "locals_", "[_", "'", "self", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py", "\\u", "modules_", "=_", "getattr_", "(_", "locals", "\\u", "self_", ",_", "'", "py", "\\u", "module", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "packages_", "=_", "getattr_", "(_", "locals", "\\u", "self_", ",_", "'", "package", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top", "\\u", "packages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "py", "\\u", "modules_", "or_", "packages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "py", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "module_", "in_", "py", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'.'_", "not_", "in_", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "top", "\\u", "packages_", "._", "append_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "packages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "package_", "in_", "packages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'.'_", "not_", "in_", "package_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "top", "\\u", "packages_", "._", "append_", "(_", "package_", ")_", "\\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_", "list_", "(_", "set_", "(_", "top", "\\u", "packages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\u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test/imports/child.py
[ { "content": "class Child(imports.parent.Parent):\n pass", "metadata": "root.Child", "header": "['module', '___EOS___']", "index": 3 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Child_", "(_", "imports_", "._", "parent_", "._", "Parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ellmetha/django-machina/machina/apps/forum_permission/viewmixins.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom collections import Iterable\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.exceptions import PermissionDenied\nfrom django.contrib.auth.decorators import REDIRECT_FIELD_NAME\nfrom django.http import HttpResponseRedirect\nfrom django.utils.http import urlquote\nfrom django.utils.six import string_types\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PermissionRequiredMixin(object):\n \"\"\"\n This view mixin verifies if the current user has the permissions specified by the\n 'permission_required' attribute. This 'permissions check' behavior can be updated\n in the 'perform_permissions_check()' method.\n\n It provides the following workflow:\n\n The mixin try to see if the view and the current user passes the permission check.\n\n If the permission check fails and if the user isn't logged in, redirect to\n settings.LOGIN_URL passing the current absolute path in the qyery string. Example:\n /accounts/login/?next=/forum/3/\n\n If the permission check fails and if the user is logged in, return a 403 error\n page.\n\n The permissions will be tested against a specific instance provided either by a\n `get_object()` method or by an `object` attribute. In the case where the permissions\n should be checked against an instance that is not the one associated with a specific\n DetailView, it is possible to write a `get_controlled_object` method to which it will\n be given priority over the methods and attributes mentioned previously.\n \"\"\"\n login_url = settings.LOGIN_URL\n permission_required = None\n redirect_field_name = REDIRECT_FIELD_NAME\n\n\n\n", "metadata": "root.PermissionRequiredMixin", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def get_required_permissions(self, request):\n \"\"\"\n Returns the required permissions to access the considered object.\n \"\"\"\n perms = []\n\n if not self.permission_required:\n return perms\n\n if isinstance(self.permission_required, string_types):\n perms = [self.permission_required, ]\n elif isinstance(self.permission_required, Iterable):\n perms = [perm for perm in self.permission_required]\n else:\n raise ImproperlyConfigured(\n '\\'PermissionRequiredMixin\\' requires \\'permission_required\\' '\n 'attribute to be set to \\'<app_label>.<permission codename>\\' but is set to {} '\n 'instead'.format(self.permission_required)\n )\n return perms", "metadata": "root.PermissionRequiredMixin.get_required_permissions", "header": "['class', 'PermissionRequiredMixin', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def perform_permissions_check(self, user, obj, perms):\n \"\"\"\n Performs a permissions check in order to tell if the passed user\n can access the current view for the given object.\n By default, this method checks whether the given user has all the\n considered permissions in order to grant access. This behavior can\n be overridden in any subclass.\n \"\"\"\n # Initializes a permission checker\n checker = self.request.forum_permission_handler._get_checker(user)\n # Check permissions\n return all(checker.has_perm(perm, obj) for perm in perms)", "metadata": "root.PermissionRequiredMixin.perform_permissions_check", "header": "['class', 'PermissionRequiredMixin', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def check_permissions(self, request):\n \"\"\"\n Retrieve the controlled object and perform the permissions check.\n \"\"\"\n obj = (hasattr(self, 'get_controlled_object') and self.get_controlled_object() or\n hasattr(self, 'get_object') and self.get_object() or getattr(self, 'object', None))\n user = request.user\n\n # Get the permissions to check\n perms = self.get_required_permissions(self)\n\n # Check permissions\n has_permissions = self.perform_permissions_check(user, obj, perms)\n\n if not has_permissions and not user.is_authenticated():\n return HttpResponseRedirect('{}?{}={}'.format(\n self.login_url,\n self.redirect_field_name,\n urlquote(request.get_full_path())\n ))\n elif not has_permissions:\n raise PermissionDenied", "metadata": "root.PermissionRequiredMixin.check_permissions", "header": "['class', 'PermissionRequiredMixin', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def dispatch(self, request, *args, **kwargs):\n self.request = request\n self.args = args\n self.kwargs = kwargs\n response = self.check_permissions(request)\n if response:\n return response\n return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)", "metadata": "root.PermissionRequiredMixin.dispatch", "header": "['class', 'PermissionRequiredMixin', '(', 'object', ')', ':', '___EOS___']", "index": 98 } ]
[]
[]
0
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_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "REDIRECT", "\\u", "FIE", "LD", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "http_", "import_", "url", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "six_", "import_", "string", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Permi", "ssion", "Requ", "ired", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "view", " ", "mix", "in", " ", "verifie", "s", " ", "if", " ", "the", " ", "current", " ", "user", " ", "has", " ", "the", " ", "permissi", "ons", " ", "specified", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "'", "permissi", "on", "\\u", "require", "d", "'", " ", "attribute", ".", " ", "Thi", "s", " ", "'", "permissi", "ons", " ", "check", "'", " ", "behavior", " ", "can", " ", "be", " ", "update", "d", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "'", "perform", "\\u", "permissi", "ons", "\\u", "check", "()'", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "provide", "s", " ", "the", " ", "follow", "ing", " ", "workf", "low", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mix", "in", " ", "try", " ", "to", " ", "see", " ", "if", " ", "the", " ", "view", " ", "and", " ", "the", " ", "current", " ", "user", " ", "pass", "es", " ", "the", " ", "permissi", "on", " ", "check", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "permissi", "on", " ", "check", " ", "fail", "s", " ", "and", " ", "if", " ", "the", " ", "user", " ", "isn", "'", "t", " ", "logged", " ", "in", ",", " ", "redirec", "t", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "settings", ".", "LOGIN", "\\u", "URL", " ", "passi", "ng", " ", "the", " ", "current", " ", "abs", "olute", " ", "path", " ", "in", " ", "the", " ", "qy", "ery", " ", "string", ".", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", "/", "account", "s", "/", "login", "/?", "next", "=", "/", "forum", "/", "3", "/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "permissi", "on", " ", "check", " ", "fail", "s", " ", "and", " ", "if", " ", "the", " ", "user", " ", "is", " ", "logged", " ", "in", ",", " ", "return", " ", "a", " ", "403", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "page", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "permissi", "ons", " ", "will", " ", "be", " ", "tested", " ", "against", " ", "a", " ", "specific", " ", "instance", " ", "provided", " ", "eit", "her", " ", "by", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "`", "get", "\\u", "object", "()`", " ", "method", " ", "or", " ", "by", " ", "an", " ", "`", "object", "`", " ", "attribute", ".", " ", "In", " ", "the", " ", "case", " ", "where", " ", "the", " ", "permissi", "ons", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "checke", "d", " ", "against", " ", "an", " ", "instance", " ", "tha", "t", " ", "is", " ", "not", " ", "the", " ", "one", " ", "associate", "d", " ", "with", " ", "a", " ", "specific", "\\", "10", ";", " ", " ", " ", " ", "Det", "ail", "View", ",", " ", "it", " ", "is", " ", "possib", "le", " ", "to", " ", "write", " ", "a", " ", "`", "get", "\\u", "controlle", "d\\u", "object", "`", " ", "method", " ", "to", " ", "whi", "ch", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "give", "n", " ", "priorit", "y", " ", "over", " ", "the", " ", "method", "s", " ", "and", " ", "attribute", "s", " ", "mentioned", " ", "previ", "ously", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login", "\\u", "url_", "=_", "settings_", "._", "LOGIN", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "required_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "field", "\\u", "name_", "=_", "REDIRECT", "\\u", "FIE", "LD", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Permi", "ssion", "Requ", "ired", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "require", "d\\u", "permissions_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "require", "d", " ", "permissi", "ons", " ", "to", " ", "access", " ", "the", " ", "consider", "ed", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "permissi", "on", "\\u", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "permissi", "on", "\\u", "required_", ",_", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "=_", "[_", "self_", "._", "permissi", "on", "\\u", "required_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "self_", "._", "permissi", "on", "\\u", "required_", ",_", "Iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "=_", "[_", "perm_", "for_", "perm_", "in_", "self_", "._", "permissi", "on", "\\u", "required_", "]_", "\\u\\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_", "Impro", "perl", "y", "Configured_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\'", "Permi", "ssion", "Requ", "ired", "Mix", "in", "\\\\'", " ", "require", "s", " ", "\\\\'", "permissi", "on", "\\u", "require", "d", "\\\\'", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "attribute", " ", "to", " ", "be", " ", "set", " ", "to", " ", "\\\\'", "<", "app", "\\u", "label", ">.", "<", "permissi", "on", " ", "code", "name", ">\\\\", "'", " ", "but", " ", "is", " ", "set", " ", "to", " ", "{}", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inst", "ead", "'_", "._", "format_", "(_", "self_", "._", "permissi", "on", "\\u", "required_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "perms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permi", "ssion", "Requ", "ired", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "\\u", "permissi", "ons", "\\u", "check_", "(_", "self_", ",_", "user_", ",_", "obj_", ",_", "perms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", "s", " ", "a", " ", "permissi", "ons", " ", "check", " ", "in", " ", "order", " ", "to", " ", "tell", " ", "if", " ", "the", " ", "pass", "ed", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "access", " ", "the", " ", "current", " ", "view", " ", "for", " ", "the", " ", "give", "n", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "this", " ", "method", " ", "checks", " ", "whe", "ther", " ", "the", " ", "give", "n", " ", "user", " ", "has", " ", "all", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "consider", "ed", " ", "permissi", "ons", " ", "in", " ", "order", " ", "to", " ", "grant", " ", "access", ".", " ", "Thi", "s", " ", "behavior", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "overrid", "den", " ", "in", " ", "any", " ", "subclass", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initializ", "es", " ", "a", " ", "permissi", "on", " ", "checker_", "\\u\\u\\uNL\\u\\u\\u_", "checker_", "=_", "self_", "._", "request_", "._", "forum", "\\u", "permissi", "on", "\\u", "handler_", "._", "\\u", "get", "\\u", "checker_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "all_", "(_", "checker_", "._", "has", "\\u", "perm_", "(_", "perm_", ",_", "obj_", ")_", "for_", "perm_", "in_", "perms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permi", "ssion", "Requ", "ired", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "permissions_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "the", " ", "controlle", "d", " ", "object", " ", "and", " ", "perform", " ", "the", " ", "permissi", "ons", " ", "check", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "(_", "hasattr_", "(_", "self_", ",_", "'", "get", "\\u", "controlle", "d\\u", "object", "'_", ")_", "and_", "self_", "._", "get", "\\u", "controlle", "d\\u", "object_", "(_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "hasattr_", "(_", "self_", ",_", "'", "get", "\\u", "object", "'_", ")_", "and_", "self_", "._", "get", "\\u", "object_", "(_", ")_", "or_", "getattr_", "(_", "self_", ",_", "'", "object", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "permissi", "ons", " ", "to", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "perms_", "=_", "self_", "._", "get", "\\u", "require", "d\\u", "permissions_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "permissions_", "=_", "self_", "._", "perform", "\\u", "permissi", "ons", "\\u", "check_", "(_", "user_", ",_", "obj_", ",_", "perms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "has", "\\u", "permissions_", "and_", "not_", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'{}", "?", "{}", "={}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "login", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "redirec", "t", "\\u", "field", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "quote_", "(_", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "has", "\\u", "permissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permi", "ssion", "Requ", "ired", "Mixin_", "(_", "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_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kwargs_", "=_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "check", "\\u", "permissions_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Permi", "ssion", "Requ", "ired", "Mixin_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
cjerdonek/open-rcv/openrcv/scripts/run.py
[ { "content": " def filter(self, record):\n parts = record.name.split(\".\")\n if len(parts) <= 3:\n display_name = record.name\n else:\n # For example, \"a.b.c.d\" becomes \"a.b...d\".\n display_name = '.'.join(parts[:2] + ['.', parts[-1]])\n record.display_name = display_name\n return True", "metadata": "root.TruncatedDisplayNameFilter.filter", "header": "['class', 'TruncatedDisplayNameFilter', '(', 'object', ')', ':', '___EOS___']", "index": 58 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Truncate", "d", "Display", "Name", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "record_", "._", "name_", "._", "split_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "<=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "record_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "example", ",", " ", "\"", "a", ".", "b", ".", "c", ".", "d", "\"", " ", "bec", "ome", "s", " ", "\"", "a", ".", "b", "...", "d", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "'.'_", "._", "join_", "(_", "parts_", "[_", ":_", "2_", "]_", "+_", "[_", "'.'_", ",_", "parts_", "[_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record_", "._", "display", "\\u", "name_", "=_", "display", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
4degrees/lucidity/source/lucidity/__init__.py
[ { "content": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nimport os\nimport uuid\nimport imp\n\nfrom ._version import __version__\nfrom .template import Template, Resolver\nfrom .error import ParseError, FormatError, NotFound\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def discover_templates(paths=None, recursive=True):\n '''Search *paths* for mount points and load templates from them.\n\n *paths* should be a list of filesystem paths to search for mount points.\n If not specified will try to use value from environment variable\n :envvar:`LUCIDITY_TEMPLATE_PATH`.\n\n A mount point is a Python file that defines a 'register' function. The\n function should return a list of instantiated\n :py:class:`~lucidity.template.Template` objects.\n\n If *recursive* is True (the default) then all directories under a path\n will also be searched.\n\n '''\n templates = []\n\n if paths is None:\n paths = os.environ.get('LUCIDITY_TEMPLATE_PATH', '').split(os.pathsep)\n\n for path in paths:\n for base, directories, filenames in os.walk(path):\n for filename in filenames:\n _, extension = os.path.splitext(filename)\n if extension != '.py':\n continue\n\n module_path = os.path.join(base, filename)\n module_name = uuid.uuid4().hex\n module = imp.load_source(module_name, module_path)\n try:\n registered = module.register()\n except AttributeError:\n pass\n else:\n if registered:\n templates.extend(registered)\n\n if not recursive:\n del directories[:]\n\n return templates", "metadata": "root.discover_templates", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def parse(path, templates):\n '''Parse *path* against *templates*.\n\n *path* should be a string to parse.\n\n *templates* should be a list of :py:class:`~lucidity.template.Template`\n instances in the order that they should be tried.\n\n Return ``(data, template)`` from first successful parse.\n\n Raise :py:class:`~lucidity.error.ParseError` if *path* is not\n parseable by any of the supplied *templates*.\n\n '''\n for template in templates:\n try:\n data = template.parse(path)\n except ParseError:\n continue\n else:\n return (data, template)\n\n raise ParseError(\n 'Path {0!r} did not match any of the supplied template patterns.'\n .format(path)\n )", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def format(data, templates): # @ReservedAssignment\n '''Format *data* using *templates*.\n\n *data* should be a dictionary of data to format into a path.\n\n *templates* should be a list of :py:class:`~lucidity.template.Template`\n instances in the order that they should be tried.\n\n Return ``(path, template)`` from first successful format.\n\n Raise :py:class:`~lucidity.error.FormatError` if *data* is not\n formattable by any of the supplied *templates*.\n\n\n '''\n for template in templates:\n try:\n path = template.format(data)\n except FormatError:\n continue\n else:\n return (path, template)\n\n raise FormatError(\n 'Data {0!r} was not formattable by any of the supplied templates.'\n .format(data)\n )", "metadata": "root.format", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def get_template(name, templates):\n '''Retrieve a template from *templates* by *name*.\n\n Raise :py:exc:`~lucidity.error.NotFound` if no matching template with\n *name* found in *templates*.\n\n '''\n for template in templates:\n if template.name == name:\n return template\n\n raise NotFound(\n '{0} template not found in specified templates.'.format(name)\n )", "metadata": "root.get_template", "header": "['module', '___EOS___']", "index": 114 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", ":", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ":", "copyr", "ight", ":", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Mart", "in", " ", "Pen", "gel", "ly", "-", "Phil", "lip", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ":", "license", ":", " ", "See", " ", "LICENSE", ".", "txt", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "\\u", "version_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "template_", "import_", "Template_", ",_", "Resolver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "error_", "import_", "Pars", "e", "Error_", ",_", "Format", "Error_", ",_", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "discove", "r", "\\u", "templates_", "(_", "paths_", "=_", "None_", ",_", "recursive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Sear", "ch", " ", "*", "path", "s", "*", " ", "for", " ", "mount", " ", "points", " ", "and", " ", "load", " ", "template", "s", " ", "from", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "path", "s", "*", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "of", " ", "filesystem", " ", "path", "s", " ", "to", " ", "search", " ", "for", " ", "mount", " ", "points", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "not", " ", "specified", " ", "will", " ", "try", " ", "to", " ", "use", " ", "value", " ", "from", " ", "environ", "ment", " ", "variab", "le", "\\", "10", ";", " ", " ", " ", " ", ":", "envvar", ":`", "LUC", "IDI", "TY", "\\u", "TEMPL", "ATE", "\\u", "PATH", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "mount", " ", "point", " ", "is", " ", "a", " ", "Pyth", "on", " ", "file", " ", "tha", "t", " ", "defin", "es", " ", "a", " ", "'", "register", "'", " ", "function", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "shou", "ld", " ", "return", " ", "a", " ", "list", " ", "of", " ", "instantiate", "d", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "~", "luc", "idi", "ty", ".", "template", ".", "Templa", "te", "`", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "*", "recurs", "ive", "*", " ", "is", " ", "Tru", "e", " ", "(", "the", " ", "default", ")", " ", "then", " ", "all", " ", "director", "ies", " ", "under", " ", "a", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "als", "o", " ", "be", " ", "searche", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "templates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "paths_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paths_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "LUC", "IDI", "TY", "\\u", "TEMPL", "ATE", "\\u", "PATH", "'_", ",_", "''_", ")_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "path_", "in_", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "base_", ",_", "directories_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "extension_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extension_", "!=_", "'.", "py", "'_", ":_", "\\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_", "module", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "base_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "name_", "=_", "uuid_", "._", "uuid4_", "(_", ")_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "imp_", "._", "load", "\\u", "source_", "(_", "module", "\\u", "name_", ",_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "registered_", "=_", "module_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "registered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "templates_", "._", "extend_", "(_", "registered_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "recursive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "directories_", "[_", ":_", "]_", "\\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_", "templates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "path_", ",_", "templates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Pars", "e", " ", "*", "path", "*", " ", "against", " ", "*", "template", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "path", "*", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", " ", "to", " ", "parse", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "template", "s", "*", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "of", " ", ":", "py", ":", "class", ":`", "~", "luc", "idi", "ty", ".", "template", ".", "Templa", "te", "`", "\\", "10", ";", " ", " ", " ", " ", "instance", "s", " ", "in", " ", "the", " ", "order", " ", "tha", "t", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "trie", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "``", "(", "data", ",", " ", "template", ")`", "`", " ", "from", " ", "first", " ", "success", "ful", " ", "parse", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", ":", "py", ":", "class", ":`", "~", "luc", "idi", "ty", ".", "error", ".", "Pars", "e", "Error", "`", " ", "if", " ", "*", "path", "*", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "parse", "able", " ", "by", " ", "any", " ", "of", " ", "the", " ", "supplie", "d", " ", "*", "template", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "template_", "in_", "templates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "template_", "._", "parse_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Pars", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "data_", ",_", "template_", ")_", "\\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_", "Pars", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "{", "0", "!", "r", "}", " ", "did", " ", "not", " ", "match", " ", "any", " ", "of", " ", "the", " ", "supplie", "d", " ", "template", " ", "pattern", "s", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "path_", ")_", "\\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_", "format_", "(_", "data_", ",_", "templates_", ")_", ":_", "#", " ", "@", "Reserve", "d", "Assignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Format", " ", "*", "data", "*", " ", "usi", "ng", " ", "*", "template", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "data", "*", " ", "shou", "ld", " ", "be", " ", "a", " ", "dictionar", "y", " ", "of", " ", "data", " ", "to", " ", "format", " ", "int", "o", " ", "a", " ", "path", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "template", "s", "*", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "of", " ", ":", "py", ":", "class", ":`", "~", "luc", "idi", "ty", ".", "template", ".", "Templa", "te", "`", "\\", "10", ";", " ", " ", " ", " ", "instance", "s", " ", "in", " ", "the", " ", "order", " ", "tha", "t", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "trie", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "``", "(", "path", ",", " ", "template", ")`", "`", " ", "from", " ", "first", " ", "success", "ful", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", ":", "py", ":", "class", ":`", "~", "luc", "idi", "ty", ".", "error", ".", "Format", "Error", "`", " ", "if", " ", "*", "data", "*", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "format", "table", " ", "by", " ", "any", " ", "of", " ", "the", " ", "supplie", "d", " ", "*", "template", "s", "*.", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "template_", "in_", "templates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "template_", "._", "format_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Format", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "path_", ",_", "template_", ")_", "\\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_", "Format", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Data", " ", "{", "0", "!", "r", "}", " ", "was", " ", "not", " ", "format", "table", " ", "by", " ", "any", " ", "of", " ", "the", " ", "supplie", "d", " ", "template", "s", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "data_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "template_", "(_", "name_", ",_", "templates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Retrieve", " ", "a", " ", "template", " ", "from", " ", "*", "template", "s", "*", " ", "by", " ", "*", "name", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", ":", "py", ":", "exc", ":`", "~", "luc", "idi", "ty", ".", "error", ".", "Not", "Foun", "d", "`", " ", "if", " ", "no", " ", "matchi", "ng", " ", "template", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "*", "name", "*", " ", "found", " ", "in", " ", "*", "template", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "template_", "in_", "templates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template_", "._", "name_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "template_", "\\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_", "Not", "Found_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}", " ", "template", " ", "not", " ", "found", " ", "in", " ", "specified", " ", "template", "s", ".'_", "._", "format_", "(_", "name_", ")_", "\\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, 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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 ]
Variable defined multiple times
scipy/scipy/scipy/fftpack/tests/test_real_transforms.py
[ { "content": " def setUp(self):\n self.rdt = int\n self.dec = 5\n self.type = 3", "metadata": "root.TestIDCTIIIInt.setUp", "header": "['class', 'TestIDCTIIIInt', '(', '_TestIDCTBase', ')', ':', '___EOS___']", "index": 285 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "ID", "CT", "III", "Int_", "(_", "\\u", "Test", "ID", "CT", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rdt", "_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dec_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type_", "=_", "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 ]
Unused local variable
randy3k/Project-Manager/pm.py
[ { "content": " def get_info_from_project_file(self, pfile):\n pdir = self.which_project_dir(pfile)\n if pdir:\n pname = os.path.relpath(pfile, pdir).replace(\".sublime-project\", \"\")\n else:\n pname = os.path.basename(pfile).replace(\".sublime-project\", \"\")\n pd = JsonFile(pfile).load()\n if pd and \"folders\" in pd and pd[\"folders\"]:\n folder = pd[\"folders\"][0].get(\"path\", \"\")\n else:\n folder = \"\"\n star = False\n for w in sublime.windows():\n if w.project_file_name() == pfile:\n star = True\n break\n return {\n pname: {\n \"folder\": expand_folder(folder, pfile),\n \"file\": pfile,\n \"star\": star\n }\n }", "metadata": "root.Manager.get_info_from_project_file", "header": "['class', 'Manager', ':', '___EOS___']", "index": 141 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Manager_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "info", "\\u", "from", "\\u", "project", "\\u", "file_", "(_", "self_", ",_", "pfile", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdi", "r_", "=_", "self_", "._", "whi", "ch", "\\u", "project", "\\u", "dir_", "(_", "pfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pdi", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pname_", "=_", "os_", "._", "path_", "._", "relpath_", "(_", "pfile", "_", ",_", "pdi", "r_", ")_", "._", "replace_", "(_", "\".", "sublim", "e-", "project", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pname_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "pfile", "_", ")_", "._", "replace_", "(_", "\".", "sublim", "e-", "project", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pd_", "=_", "Js", "on", "File_", "(_", "pfile", "_", ")_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pd_", "and_", "\"", "folder", "s", "\"_", "in_", "pd_", "and_", "pd_", "[_", "\"", "folder", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "pd_", "[_", "\"", "folder", "s", "\"_", "]_", "[_", "0_", "]_", "._", "get_", "(_", "\"", "path", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "star_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w_", "in_", "sublime_", "._", "windows_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w_", "._", "project", "\\u", "file", "\\u", "name_", "(_", ")_", "==_", "pfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "star_", "=_", "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_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "pname_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "folder", "\"_", ":_", "expand", "\\u", "folder_", "(_", "folder_", ",_", "pfile", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", "\"_", ":_", "pfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "star", "\"_", ":_", "star_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
airbnb/airflow/airflow/operators/http_operator.py
[ { "content": " def execute(self, context):\n http = HttpHook(self.method, http_conn_id=self.http_conn_id)\n logging.info(\"Calling HTTP method\")\n response = http.run(self.endpoint,\n self.data,\n self.headers,\n self.extra_options)\n if self.response_check:\n if not self.response_check(response):\n raise AirflowException(\"Response check returned False.\")", "metadata": "root.SimpleHttpOperator.execute", "header": "['class', 'SimpleHttpOperator', '(', 'BaseOperator', ')', ':', '___EOS___']", "index": 55 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Simple", "Http", "Operator_", "(_", "Base", "Operator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http_", "=_", "Http", "Hook_", "(_", "self_", "._", "method_", ",_", "http", "\\u", "conn", "\\u", "id_", "=_", "self_", "._", "http", "\\u", "conn", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Call", "ing", " ", "HTTP", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "http_", "._", "run_", "(_", "self_", "._", "endpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "extra", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "response", "\\u", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "response", "\\u", "check_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Air", "flow", "Exception_", "(_", "\"", "Respons", "e", " ", "check", " ", "return", "ed", " ", "Fal", "se", ".\"_", ")_" ]
[ 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 ]
Unused local variable
kobotoolbox/kobocat/onadata/apps/main/tests/test_user_login.py
[ { "content": " @unittest.skip('Kobocat is now case sensitive')\n def test_username_is_made_lower_case(self):\n username = 'ROBERT'\n password = 'bobbob'\n self._create_user(username, password)\n self._login('robert', password)", "metadata": "root.TestUserLogin.test_username_is_made_lower_case", "header": "['class', 'TestUserLogin', '(', 'TestBase', ')', ':', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "User", "Login_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "'", "Ko", "bo", "cat", " ", "is", " ", "now", " ", "case", " ", "sensi", "tiv", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "user", "name", "\\u", "is", "\\u", "made", "\\u", "lower", "\\u", "case_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "'", "ROB", "ERT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "'", "bobb", "ob", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "user_", "(_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "login_", "(_", "'", "robe", "rt", "'_", ",_", "password_", ")_", "\\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 ]
First parameter of a method is not named 'self'
MirantisWorkloadMobility/CloudFerry/tests/test.py
[ { "content": " def cloud_config(self, position):\n return cloud.Cloud.make_cloud_config(self.cfg, position)", "metadata": "root.TestCase.cloud_config", "header": "['class', 'TestCase', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 36 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "Case_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cloud", "\\u", "config_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cloud_", "._", "Cloud_", "._", "make", "\\u", "cloud", "\\u", "config_", "(_", "self_", "._", "cfg_", ",_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
allegro/ralph/src/ralph/dns/dnsaas.py
[ { "content": "# -*- coding: utf-8 -*-\nimport logging\nfrom urllib.parse import urlencode, urljoin\n\nimport requests\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom ralph.dns.forms import RecordType\nfrom ralph.helpers import cache\n\nlogger = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DNSaaS:\n\n\n\n\n\n\n", "metadata": "root.DNSaaS", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, headers=None):\n self.session = requests.Session()\n _headers = {\n 'Authorization': 'Token {}'.format(settings.DNSAAS_TOKEN)\n }\n if headers is not None:\n _headers.update(headers)\n self.session.headers.update(_headers)", "metadata": "root.DNSaaS.__init__", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 16 }, { "content": " def get_api_result(self, url):\n \"\"\"\n Returns 'results' from DNSAAS API.\n\n Args:\n url: Url to API\n\n Returns:\n list of records\n \"\"\"\n request = self.session.get(url)\n json_data = request.json()\n api_results = json_data.get('results', [])\n if json_data.get('next', None):\n _api_results = self.get_api_result(json_data['next'])\n api_results.extend(_api_results)\n return api_results", "metadata": "root.DNSaaS.get_api_result", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 25 }, { "content": " def get_dns_records(self, ipaddresses):\n \"\"\"Gets DNS Records for `ipaddresses` by API call\"\"\"\n dns_records = []\n ipaddresses = [('ip', i) for i in ipaddresses]\n url = urljoin(\n settings.DNSAAS_URL,\n 'api/records/?{}'.format(\n urlencode([\n ('limit', 100),\n ('offset', 0)\n ] + ipaddresses)\n )\n )\n api_results = self.get_api_result(url)\n ptrs = set([i['content'] for i in api_results if i['type'] == 'PTR'])\n\n for item in api_results:\n if item['type'] in {'A', 'CNAME', 'TXT'}:\n dns_records.append({\n 'pk': item['id'],\n 'name': item['name'],\n 'type': RecordType.from_name(item['type'].lower()).id,\n 'content': item['content'],\n 'ptr': item['name'] in ptrs and item['type'] == 'A',\n 'owner': settings.DNSAAS_OWNER\n })\n return sorted(dns_records, key=lambda x: x['type'])", "metadata": "root.DNSaaS.get_dns_records", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 43 }, { "content": " def update_dns_record(self, record):\n \"\"\"\n Update DNS Record in DNSAAS\n\n Args:\n record: record cleaned data\n\n Returns:\n Validation error from API or None if update correct\n \"\"\"\n url = urljoin(\n settings.DNSAAS_URL, 'api/records/{}/'.format(record['pk'])\n )\n data = {\n 'name': record['name'],\n 'type': RecordType.raw_from_id(int(record['type'])),\n 'content': record['content'],\n 'auto_ptr': (\n settings.DNSAAS_AUTO_PTR_ALWAYS if record['ptr'] and\n record['type'] == str(RecordType.a.id)\n else settings.DNSAAS_AUTO_PTR_NEVER\n ),\n 'owner': settings.DNSAAS_OWNER\n }\n request = self.session.patch(url, data=data)\n if request.status_code == 500:\n return {\n 'non_field_errors': [_('Internal Server Error from DNSAAS')]\n }\n elif request.status_code != 200:\n return request.json()", "metadata": "root.DNSaaS.update_dns_record", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 71 }, { "content": " @cache(skip_first=True)\n def get_domain(self, domain_name):\n \"\"\"\n Return domain URL base on record name.\n\n Args:\n domain_name: Domain name\n\n Return:\n Domain URL from API or False if not exists\n \"\"\"\n url = urljoin(\n settings.DNSAAS_URL, 'api/domains/?'.format(\n urlencode([('name', domain_name)])\n )\n )\n result = self.get_api_result(url)\n if result:\n return result[0]['url']", "metadata": "root.DNSaaS.get_domain", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 103 }, { "content": " def create_dns_record(self, record):\n \"\"\"\n Create new DNS record.\n\n Args:\n records: Record cleaned data\n\n Returns:\n Validation error from API or None if create correct\n \"\"\"\n\n url = urljoin(settings.DNSAAS_URL, 'api/records/')\n domain_name = record['name'].split('.', 1)\n domain = self.get_domain(domain_name[-1])\n if not domain:\n logger.error(\n 'Domain not found for record {}'.format(record)\n )\n return {'name': [_('Domain not found.')]}\n\n data = {\n 'name': record['name'],\n 'type': RecordType.raw_from_id(int(record['type'])),\n 'content': record['content'],\n 'auto_ptr': (\n settings.DNSAAS_AUTO_PTR_ALWAYS if record['ptr'] and\n record['type'] == RecordType.a.id\n else settings.DNSAAS_AUTO_PTR_NEVER\n ),\n 'domain': domain,\n 'owner': settings.DNSAAS_OWNER\n }\n request = self.session.post(url, data=data)\n if request.status_code == 500:\n return {\n 'non_field_errors': [_('Internal Server Error from DNSAAS')]\n }\n elif request.status_code != 201:\n return request.json()", "metadata": "root.DNSaaS.create_dns_record", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 123 }, { "content": " def delete_dns_record(self, record_id):\n \"\"\"\n Delete record in DNSAAS\n\n Args:\n record_ids: ID's to delete\n\n Returns:\n Validation error from API or None if delete correct\n \"\"\"\n url = urljoin(\n settings.DNSAAS_URL, 'api/records/{}/'.format(record_id)\n )\n request = self.session.delete(url)\n if request.status_code == 500:\n return {\n 'non_field_errors': [_('Internal Server Error from DNSAAS')]\n }\n elif request.status_code != 204:\n return request.json()", "metadata": "root.DNSaaS.delete_dns_record", "header": "['class', 'DNSaaS', ':', '___EOS___']", "index": 163 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlencode_", ",_", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ral", "ph_", "._", "dns_", "._", "forms_", "import_", "Record", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ral", "ph_", "._", "helpers_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DNS", "aa", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\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_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "=_", "requests_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Authoriz", "ation", "'_", ":_", "'", "Token", " ", "{}'_", "._", "format_", "(_", "settings_", "._", "DNS", "AA", "S", "\\u", "TOKEN_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "headers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "headers_", "._", "update_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "headers_", "._", "update_", "(_", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "result_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "'", "results", "'", " ", "from", " ", "DNS", "AA", "S", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "url", ":", " ", "Ur", "l", " ", "to", " ", "API", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "record", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "session_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "data_", "=_", "request_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "results_", "=_", "json", "\\u", "data_", "._", "get_", "(_", "'", "results", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "json", "\\u", "data_", "._", "get_", "(_", "'", "next", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "api", "\\u", "results_", "=_", "self_", "._", "get", "\\u", "api", "\\u", "result_", "(_", "json", "\\u", "data_", "[_", "'", "next", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "results_", "._", "extend_", "(_", "\\u", "api", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "api", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "dns", "\\u", "records_", "(_", "self_", ",_", "ipaddress", "es_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "DNS", " ", "Record", "s", " ", "for", " ", "`", "ipaddress", "es", "`", " ", "by", " ", "API", " ", "call", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "\\u", "records_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipaddress", "es_", "=_", "[_", "(_", "'", "ip", "'_", ",_", "i_", ")_", "for_", "i_", "in_", "ipaddress", "es_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "urljoin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "URL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "/", "record", "s", "/?", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "urlencode_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "limit", "'_", ",_", "100_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "offset", "'_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "ipaddress", "es_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "results_", "=_", "self_", "._", "get", "\\u", "api", "\\u", "result_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptr", "s_", "=_", "set_", "(_", "[_", "i_", "[_", "'", "content", "'_", "]_", "for_", "i_", "in_", "api", "\\u", "results_", "if_", "i_", "[_", "'", "type", "'_", "]_", "==_", "'", "PTR", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "api", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "type", "'_", "]_", "in_", "{_", "'", "A", "'_", ",_", "'", "CNA", "ME", "'_", ",_", "'", "TXT", "'_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "\\u", "records_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "item_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "item_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "Record", "Type_", "._", "from", "\\u", "name_", "(_", "item_", "[_", "'", "type", "'_", "]_", "._", "lower_", "(_", ")_", ")_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "item_", "[_", "'", "content", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ptr", "'_", ":_", "item_", "[_", "'", "name", "'_", "]_", "in_", "ptr", "s_", "and_", "item_", "[_", "'", "type", "'_", "]_", "==_", "'", "A", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "settings_", "._", "DNS", "AA", "S", "\\u", "OWNER", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sorted_", "(_", "dns", "\\u", "records_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "'", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "dns", "\\u", "record_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "DNS", " ", "Record", " ", "in", " ", "DNS", "AA", "S", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "record", ":", " ", "record", " ", "clean", "ed", " ", "data", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Validat", "ion", " ", "error", " ", "from", " ", "API", " ", "or", " ", "Non", "e", " ", "if", " ", "update", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "urljoin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "URL_", ",_", "'", "api", "/", "record", "s", "/{}/", "'_", "._", "format_", "(_", "record_", "[_", "'", "pk", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "record_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "Record", "Type_", "._", "raw", "\\u", "from", "\\u", "id_", "(_", "int_", "(_", "record_", "[_", "'", "type", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "record_", "[_", "'", "content", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auto", "\\u", "ptr", "'_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "AUTO", "\\u", "PTR", "\\u", "ALWAYS", "_", "if_", "record_", "[_", "'", "ptr", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "record_", "[_", "'", "type", "'_", "]_", "==_", "str_", "(_", "Record", "Type_", "._", "a_", "._", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "settings_", "._", "DNS", "AA", "S", "\\u", "AUTO", "\\u", "PTR", "\\u", "NE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "settings_", "._", "DNS", "AA", "S", "\\u", "OWNER", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "session_", "._", "patch_", "(_", "url_", ",_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "status", "\\u", "code_", "==_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "non", "\\u", "field", "\\u", "error", "s", "'_", ":_", "[_", "\\u_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", " ", "from", " ", "DNS", "AA", "S", "'_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "status", "\\u", "code_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cache_", "(_", "skip", "\\u", "first_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "domain_", "(_", "self_", ",_", "domain", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "domain", " ", "URL", " ", "base", " ", "on", " ", "record", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "domain", "\\u", "name", ":", " ", "Doma", "in", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", ":", "\\", "10", ";", " ", " ", " ", " ", "Doma", "in", " ", "URL", " ", "from", " ", "API", " ", "or", " ", "Fal", "se", " ", "if", " ", "not", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "urljoin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "URL_", ",_", "'", "api", "/", "domains", "/?", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "urlencode_", "(_", "[_", "(_", "'", "name", "'_", ",_", "domain", "\\u", "name_", ")_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "get", "\\u", "api", "\\u", "result_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "[_", "0_", "]_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "dns", "\\u", "record_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "new", " ", "DNS", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "record", "s", ":", " ", "Record", " ", "clean", "ed", " ", "data", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Validat", "ion", " ", "error", " ", "from", " ", "API", " ", "or", " ", "Non", "e", " ", "if", " ", "create", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "urljoin_", "(_", "settings_", "._", "DNS", "AA", "S", "\\u", "URL_", ",_", "'", "api", "/", "record", "s", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "name_", "=_", "record_", "[_", "'", "name", "'_", "]_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "self_", "._", "get", "\\u", "domain_", "(_", "domain", "\\u", "name_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Doma", "in", " ", "not", " ", "found", " ", "for", " ", "record", " ", "{}'_", "._", "format_", "(_", "record_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "name", "'_", ":_", "[_", "\\u_", "(_", "'", "Doma", "in", " ", "not", " ", "found", ".'_", ")_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "record_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "Record", "Type_", "._", "raw", "\\u", "from", "\\u", "id_", "(_", "int_", "(_", "record_", "[_", "'", "type", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "record_", "[_", "'", "content", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auto", "\\u", "ptr", "'_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "AUTO", "\\u", "PTR", "\\u", "ALWAYS", "_", "if_", "record_", "[_", "'", "ptr", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "record_", "[_", "'", "type", "'_", "]_", "==_", "Record", "Type_", "._", "a_", "._", "id_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "settings_", "._", "DNS", "AA", "S", "\\u", "AUTO", "\\u", "PTR", "\\u", "NE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domain", "'_", ":_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "settings_", "._", "DNS", "AA", "S", "\\u", "OWNER", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "session_", "._", "post_", "(_", "url_", ",_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "status", "\\u", "code_", "==_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "non", "\\u", "field", "\\u", "error", "s", "'_", ":_", "[_", "\\u_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", " ", "from", " ", "DNS", "AA", "S", "'_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "status", "\\u", "code_", "!=_", "201_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DNS", "aa", "S_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "dns", "\\u", "record_", "(_", "self_", ",_", "record", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "record", " ", "in", " ", "DNS", "AA", "S", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "record", "\\u", "ids", ":", " ", "ID", "'", "s", " ", "to", " ", "delete", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Validat", "ion", " ", "error", " ", "from", " ", "API", " ", "or", " ", "Non", "e", " ", "if", " ", "delete", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "urljoin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DNS", "AA", "S", "\\u", "URL_", ",_", "'", "api", "/", "record", "s", "/{}/", "'_", "._", "format_", "(_", "record", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "session_", "._", "delete_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "status", "\\u", "code_", "==_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "non", "\\u", "field", "\\u", "error", "s", "'_", ":_", "[_", "\\u_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", " ", "from", " ", "DNS", "AA", "S", "'_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "status", "\\u", "code_", "!=_", "204_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request_", "._", "json_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
pypa/pip/tests/unit/test_wheel.py
[ { "content": " @patch('sys.platform', 'darwin')\n @patch('pip.pep425tags.get_abbr_impl', lambda: 'cp')\n @patch('pip.pep425tags.get_platform', lambda: 'macosx_10_9_intel')\n def test_supported_osx_version(self):\n \"\"\"\n Wheels built for OS X 10.6 are supported on 10.9\n \"\"\"\n tags = pep425tags.get_supported(['27'], False)\n w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_6_intel.whl')\n assert w.supported(tags=tags)\n w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_9_intel.whl')\n assert w.supported(tags=tags)", "metadata": "root.TestWheelFile.test_supported_osx_version", "header": "['class', 'TestWheelFile', '(', 'object', ')', ':', '___EOS___']", "index": 152 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Whe", "el", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "sys", ".", "platform", "'_", ",_", "'", "dar", "win", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "patch_", "(_", "'", "pip", ".", "pep", "425", "tags", ".", "get", "\\u", "abb", "r", "\\u", "impl", "'_", ",_", "lambda_", ":_", "'", "cp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "patch_", "(_", "'", "pip", ".", "pep", "425", "tags", ".", "get", "\\u", "platform", "'_", ",_", "lambda_", ":_", "'", "macos", "x", "\\u", "10", "\\u", "9", "\\u", "intel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "support", "ed", "\\u", "os", "x", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "el", "s", " ", "bui", "lt", " ", "for", " ", "OS", " ", "X", " ", "10.", "6", " ", "are", " ", "support", "ed", " ", "on", " ", "10.", "9", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "pep", "425", "tags_", "._", "get", "\\u", "supported_", "(_", "[_", "'", "2", "7", "'_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "wheel_", "._", "Whe", "el_", "(_", "'", "simple", "-0", ".1", "-", "cp", "2", "7", "-", "none", "-", "macos", "x", "\\u", "10", "\\u", "6", "\\u", "intel", ".", "wh", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "supported_", "(_", "tags_", "=_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "wheel_", "._", "Whe", "el_", "(_", "'", "simple", "-0", ".1", "-", "cp", "2", "7", "-", "none", "-", "macos", "x", "\\u", "10", "\\u", "9", "\\u", "intel", ".", "wh", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "w_", "._", "supported_", "(_", "tags_", "=_", "tags_", ")_", "\\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 ]
NotImplemented is not an Exception
gbeced/pyalgotrade/pyalgotrade/barfeed/csvfeed.py
[ { "content": " def includeBar(self, bar_):\n raise NotImplementedError()", "metadata": "root.BarFilter.includeBar", "header": "['class', 'BarFilter', '(', 'object', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "class_", "Bar", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "include", "Bar_", "(_", "self_", ",_", "bar", "\\u_", ")_", ":_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kivy/audiostream/examples/sinslider/main.py
[ { "content": "from kivy.config import Config\nConfig.set('graphics', 'maxfps', '30')\n\nfrom audiostream import get_output\nfrom audiostream.sources.wave import SineSource\n\nCHANNELS = 2\nBUFSIZE = 2048\nINCSIZE = 512\n\nfrom kivy.app import App\nfrom kivy.uix.slider import Slider\n\n\n\nAudioApp().run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AudioApp(App):\n", "metadata": "root.AudioApp", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def build(self):\n self.stream = get_output(channels=CHANNELS, buffersize=BUFSIZE, rate=22050)\n self.slider = Slider(min=110, max=880, value=440)\n self.slider.bind(value=self.update_freq)\n\n self.source = SineSource(self.stream, 440)\n self.source.start()\n\n return self.slider", "metadata": "root.AudioApp.build", "header": "['class', 'AudioApp', '(', 'App', ')', ':', '___EOS___']", "index": 14 }, { "content": " def update_freq(self, slider, value):\n #value = int(value / 50) * 50\n if value != self.source.frequency:\n self.source.frequency = value", "metadata": "root.AudioApp.update_freq", "header": "['class', 'AudioApp', '(', 'App', ')', ':', '___EOS___']", "index": 24 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "kivy_", "._", "config_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Config_", "._", "set_", "(_", "'", "graphic", "s", "'_", ",_", "'", "maxf", "ps", "'_", ",_", "'", "30", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "audio", "stream_", "import_", "get", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "audio", "stream_", "._", "sources_", "._", "wave_", "import_", "Sin", "e", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CHANNELS", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BUF", "SIZE_", "=_", "2048_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INC", "SIZE_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kivy_", "._", "app_", "import_", "App_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kivy_", "._", "uix_", "._", "slider_", "import_", "Slider_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Audi", "o", "App_", "(_", ")_", "._", "run_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Audi", "o", "App_", "(_", "App_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Audi", "o", "App_", "(_", "App_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stream_", "=_", "get", "\\u", "output_", "(_", "channels_", "=_", "CHANNELS", "_", ",_", "buffer", "size_", "=_", "BUF", "SIZE_", ",_", "rate_", "=_", "220", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slider_", "=_", "Slider_", "(_", "min_", "=_", "110_", ",_", "max_", "=_", "880", "_", ",_", "value_", "=_", "440_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slider_", "._", "bind_", "(_", "value_", "=_", "self_", "._", "update", "\\u", "freq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source_", "=_", "Sin", "e", "Source_", "(_", "self_", "._", "stream_", ",_", "440_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "slider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Audi", "o", "App_", "(_", "App_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "freq_", "(_", "self_", ",_", "slider_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "value", " ", "=", " ", "int", "(", "value", " ", "/", " ", "50", ")", " ", "*", " ", "50_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "!=_", "self_", "._", "source_", "._", "frequency_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "._", "frequency_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Deprecated slice method
OneDrive/onedrive-sdk-python/src/python2/request/permissions_collection.py
[ { "content": " def __getitem__(self, key):\n \"\"\"Get the PermissionRequestBuilder with the specified key\n \n Args:\n key (str): The key to get a PermissionRequestBuilder for\n \n Returns: \n :class:`PermissionRequestBuilder<onedrivesdk.request.permission_request_builder.PermissionRequestBuilder>`:\n A PermissionRequestBuilder for that key\n \"\"\"\n return PermissionRequestBuilder(self.append_to_request_url(str(key)), self._client)", "metadata": "root.PermissionsCollectionRequestBuilder.__getitem__", "header": "['class', 'PermissionsCollectionRequestBuilder', '(', 'RequestBuilderBase', ')', ':', '___EOS___']", "index": 60 } ]
[]
[]
0
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "Permi", "ssion", "s", "Collecti", "on", "Request", "Builder_", "(_", "Request", "Build", "er", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "Permi", "ssion", "Request", "Build", "er", " ", "with", " ", "the", " ", "specified", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "key", " ", "(", "str", "):", " ", "The", " ", "key", " ", "to", " ", "get", " ", "a", " ", "Permi", "ssion", "Request", "Build", "er", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "Permi", "ssion", "Request", "Build", "er", "<", "oned", "rive", "sd", "k", ".", "request", ".", "permissi", "on", "\\u", "request", "\\u", "builde", "r", ".", "Permi", "ssion", "Request", "Build", "er", ">`", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Permi", "ssion", "Request", "Build", "er", " ", "for", " ", "tha", "t", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Permi", "ssion", "Request", "Builder_", "(_", "self_", "._", "append", "\\u", "to", "\\u", "request", "\\u", "url_", "(_", "str_", "(_", "key_", ")_", ")_", ",_", "self_", "._", "\\u", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
douglasmiranda/douglasmiranda.com/utils/middlewares/removeWWW.py
[ { "content": "from django.conf import settings\nfrom django import http\nfrom django.utils.http import urlquote\nfrom django.core import urlresolvers\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UrlMiddleware(object):\n \"\"\"\n Middleware for removing the WWW from a URL if the users sets settings.REMOVE_WWW.\n Based on Django CommonMiddleware.\n \"\"\"\n", "metadata": "root.UrlMiddleware", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def process_request(self, request):\n host = request.get_host()\n old_url = [host, request.path]\n new_url = old_url[:]\n\n if (settings.REMOVE_WWW and old_url[0] and old_url[0].startswith('www.')):\n new_url[0] = old_url[0][4:]\n\n if new_url != old_url:\n try:\n urlresolvers.resolve(new_url[1])\n except urlresolvers.Resolver404:\n pass\n else:\n if new_url[0]:\n newurl = \"%s://%s%s\" % (\n request.is_secure() and 'https' or 'http',\n new_url[0], urlquote(new_url[1]))\n else:\n newurl = urlquote(new_url[1])\n if request.GET:\n newurl += '?' + request.GET.urlencode()\n return http.HttpResponsePermanentRedirect(newurl)\n return None", "metadata": "root.UrlMiddleware.process_request", "header": "['class', 'UrlMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 12 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "http_", "import_", "url", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "urlresolvers_", "\\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_", "Ur", "l", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mid", "dle", "ware", " ", "for", " ", "remo", "ving", " ", "the", " ", "WW", "W", " ", "from", " ", "a", " ", "URL", " ", "if", " ", "the", " ", "users", " ", "sets", " ", "settings", ".", "REMOVE", "\\u", "WW", "W", ".", "\\", "10", ";", " ", " ", " ", " ", "Base", "d", " ", "on", " ", "Dj", "ang", "o", " ", "Common", "Mid", "dle", "ware", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ur", "l", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "request_", "._", "get", "\\u", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "url_", "=_", "[_", "host_", ",_", "request_", "._", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "url_", "=_", "old", "\\u", "url_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "settings_", "._", "REMOVE", "\\u", "WW", "W_", "and_", "old", "\\u", "url_", "[_", "0_", "]_", "and_", "old", "\\u", "url_", "[_", "0_", "]_", "._", "startswith_", "(_", "'", "www", ".'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "url_", "[_", "0_", "]_", "=_", "old", "\\u", "url_", "[_", "0_", "]_", "[_", "4_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "url_", "!=_", "old", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlresolvers_", "._", "resolve_", "(_", "new", "\\u", "url_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urlresolvers_", "._", "Resolv", "er", "404_", ":_", "\\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_", "new", "\\u", "url_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "newu", "rl_", "=_", "\"%", "s", "://", "%", "s", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "is", "\\u", "secure_", "(_", ")_", "and_", "'", "https", "'_", "or_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "url_", "[_", "0_", "]_", ",_", "url", "quote_", "(_", "new", "\\u", "url_", "[_", "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 ", " ", "_", "newu", "rl_", "=_", "url", "quote_", "(_", "new", "\\u", "url_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "newu", "rl_", "+=_", "'?'_", "+_", "request_", "._", "GET_", "._", "urlencode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "http_", "._", "Http", "Respons", "e", "Permanent", "Redirect_", "(_", "newu", "rl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
douban/ellen/ellen/git/format_patch.py
[ { "content": "def format_patch(repository, ref, from_ref=None):\n git = git_with_repo(repository)\n rev_range = '%s...%s' % (from_ref, ref) if from_ref else ref\n git_format_patch = git.bake('format-patch', stdout=True)\n if not from_ref:\n git_format_patch = git_format_patch.bake('-1')\n ret = git_format_patch(rev_range)\n return ret['stdout']", "metadata": "root.format_patch", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "format\\u", "patch_", "(_", "repository_", ",_", "ref_", ",_", "from", "\\u", "ref_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "git", "\\u", "with", "\\u", "repo_", "(_", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rev", "\\u", "range_", "=_", "'%", "s", "...", "%", "s", "'_", "%_", "(_", "from", "\\u", "ref_", ",_", "ref_", ")_", "if_", "from", "\\u", "ref_", "else_", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "format\\u", "patch_", "=_", "git_", "._", "bake", "_", "(_", "'", "format", "-", "patch", "'_", ",_", "stdout_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "from", "\\u", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "\\u", "format\\u", "patch_", "=_", "git", "\\u", "format\\u", "patch_", "._", "bake", "_", "(_", "'-", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "git", "\\u", "format\\u", "patch_", "(_", "rev", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "[_", "'", "stdout", "'_", "]_" ]
[ 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 ]
Unreachable code
amrdraz/kodr/app/brython/www/src/Lib/_collections.py
[ { "content": " def __delitem__(self, index):\n length = len(self)\n if index >= 0:\n if index >= length:\n raise IndexError(\"deque index out of range\")\n self.rotate(-index)\n self.popleft()\n self.rotate(index)\n else:\n #index = ~index #todo until bit wise operators are in bython\n index= index^(2**31)\n if index >= length:\n raise IndexError(\"deque index out of range\")\n self.rotate(index)\n self.pop()\n self.rotate(-index)", "metadata": "root.deque.__delitem__", "header": "['class', 'deque', ':', '___EOS___']", "index": 304 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", ">=_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "deq", "ue", " ", "index", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rotate_", "(_", "-_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "index", " ", "=", " ", "~", "index", " ", " ", "#", "todo", " ", "unti", "l", " ", "bit", " ", "wis", "e", " ", "opera", "tors", " ", "are", " ", "in", " ", "byt", "hon", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "index_", "^_", "(_", "2_", "**_", "31_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "deq", "ue", " ", "index", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rotate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotate_", "(_", "-_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tobspr/RenderPipeline/rpcore/pynative/pointer_slot_storage.py
[ { "content": "\"\"\"\n\nRenderPipeline\n\nCopyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\"\"\"\n\nfrom rplibs.six.moves import range # pylint: disable=import-error\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PointerSlotStorage(object):\n\n \"\"\" Please refer to the native C++ implementation for docstrings and comments.\n This is just the python implementation, which does not contain documentation! \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PointerSlotStorage", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, max_size):\n self._data = [None] * max_size\n self._max_index = 0\n self._num_entries = 0", "metadata": "root.PointerSlotStorage.__init__", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def get_max_index(self):\n return self._max_index", "metadata": "root.PointerSlotStorage.get_max_index", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def get_num_entries(self):\n return self._num_entries", "metadata": "root.PointerSlotStorage.get_num_entries", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def find_slot(self):\n # Notice: returns None in case of no free slot, and the slot otherwise, this\n # is different to the C++ Module\n for i, value in enumerate(self._data):\n if not value:\n return i\n return -1", "metadata": "root.PointerSlotStorage.find_slot", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def find_consecutive_slots(self, num_consecutive):\n if num_consecutive == 1:\n return self.find_slot()\n\n for i in range(len(self._data)):\n any_taken = False\n for k in range(num_consecutive):\n if self._data[i + k]:\n any_taken = True\n break\n if not any_taken:\n return i\n return -1", "metadata": "root.PointerSlotStorage.find_consecutive_slots", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def free_slot(self, slot):\n self._data[slot] = None\n self._num_entries -= 1\n if slot == self._max_index:\n while self._max_index >= 0 and not self._data[self._max_index]:\n self._max_index -= 1", "metadata": "root.PointerSlotStorage.free_slot", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def free_consecutive_slots(self, slot, num_consecutive):\n for i in range(num_consecutive):\n self.free_slot(slot + i)", "metadata": "root.PointerSlotStorage.free_consecutive_slots", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " def reserve_slot(self, slot, ptr):\n self._max_index = max(self._max_index, slot)\n self._data[slot] = ptr\n self._num_entries += 1", "metadata": "root.PointerSlotStorage.reserve_slot", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " def begin(self):\n for i in range(self._max_index + 1):\n if self._data[i]:\n yield self._data[i]", "metadata": "root.PointerSlotStorage.begin", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def end(self):\n raise NotImplementedError(\"Use .begin() as iterator when using the python side!\")", "metadata": "root.PointerSlotStorage.end", "header": "['class', 'PointerSlotStorage', '(', 'object', ')', ':', '___EOS___']", "index": 88 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Render", "Pipe", "line", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2014", "-", "2016", " ", "tob", "spr", " ", "<", "tob", "ias", ".", "spring", "er1", "@", "gma", "il", ".", "com", ">", "\\", "10", ";", "\\", "10", ";", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy", "\\", "10", ";", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "\\", "10", ";", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", "\\", "10", ";", "to", " ", "use", ",", " ", "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", " ", "Sof", "twa", "re", " ", "is", "\\", "10", ";", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", "\\", "10", ";", "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", ",", " ", "EXPR", "ESS", " ", "OR", "\\", "10", ";", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", "\\", "10", ";", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "\\", "10", ";", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "\\", "10", ";", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", "\\", "10", ";", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", "\\", "10", ";", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rpl", "ibs_", "._", "six_", "._", "moves_", "import_", "range_", "#", " ", "pylint", ":", " ", "disable", "=", "import", "-", "error_", "\\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_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Ple", "ase", " ", "refer", " ", "to", " ", "the", " ", "nativ", "e", " ", "C", "++", " ", "implementation", " ", "for", " ", "docstrings", " ", "and", " ", "comment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "just", " ", "the", " ", "python", " ", "implementation", ",", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "contain", " ", "documentation", "!", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "data_", "=_", "[_", "None_", "]_", "*_", "max", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "max", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "entries_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "max", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "max", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "num", "\\u", "entries_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "num", "\\u", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "slot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Noti", "ce", ":", " ", "return", "s", " ", "Non", "e", " ", "in", " ", "case", " ", "of", " ", "no", " ", "free", " ", "slot", ",", " ", "and", " ", "the", " ", "slot", " ", "other", "wis", "e", ",", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "different", " ", "to", " ", "the", " ", "C", "++", " ", "Module_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "value_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "i_", "\\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]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "consec", "uti", "ve", "\\u", "slots_", "(_", "self_", ",_", "num", "\\u", "consec", "uti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "num", "\\u", "consec", "uti", "ve_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "find", "\\u", "slot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "\\u", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "any", "\\u", "taken_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "num", "\\u", "consec", "uti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "data_", "[_", "i_", "+_", "k_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "any", "\\u", "taken_", "=_", "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_", "not_", "any", "\\u", "taken_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "i_", "\\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]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "free", "\\u", "slot_", "(_", "self_", ",_", "slot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "data_", "[_", "slot_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "entries_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "slot_", "==_", "self_", "._", "\\u", "max", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "\\u", "max", "\\u", "index_", ">=_", "0_", "and_", "not_", "self_", "._", "\\u", "data_", "[_", "self_", "._", "\\u", "max", "\\u", "index_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "max", "\\u", "index_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "free", "\\u", "consec", "uti", "ve", "\\u", "slots_", "(_", "self_", ",_", "slot_", ",_", "num", "\\u", "consec", "uti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "consec", "uti", "ve_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "free", "\\u", "slot_", "(_", "slot_", "+_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "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_", "reserve", "\\u", "slot_", "(_", "self_", ",_", "slot_", ",_", "ptr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "max", "\\u", "index_", "=_", "max_", "(_", "self_", "._", "\\u", "max", "\\u", "index_", ",_", "slot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "data_", "[_", "slot_", "]_", "=_", "ptr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "entries_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "begin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "self_", "._", "\\u", "max", "\\u", "index_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "data_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "\\u", "data_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "er", "Slot", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "end_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Us", "e", " ", ".", "begin", "()", " ", "as", " ", "iter", "ator", " ", "whe", "n", " ", "usi", "ng", " ", "the", " ", "python", " ", "side", "!\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
uwdata/termite-data-server/web2py/gluon/globals.py
[ { "content": " def parse_all_vars(self):\n \"\"\"Merges get_vars and post_vars to vars\n \"\"\"\n self._vars = copy.copy(self.get_vars)\n for key,value in self.post_vars.iteritems():\n if not key in self._vars:\n self._vars[key] = value\n else:\n if not isinstance(self._vars[key],list):\n self._vars[key] = [self._vars[key]]\n self._vars[key] += value if isinstance(value,list) else [value]", "metadata": "root.Request.parse_all_vars", "header": "['class', 'Request', '(', 'Storage', ')', ':', '___EOS___']", "index": 262 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Request_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "all", "\\u", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", "s", " ", "get", "\\u", "vars", " ", "and", " ", "post", "\\u", "vars", " ", "to", " ", "vars", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vars_", "=_", "copy_", "._", "copy_", "(_", "self_", "._", "get", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "post", "\\u", "vars_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", "in_", "self_", "._", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vars_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "self_", "._", "\\u", "vars_", "[_", "key_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "vars_", "[_", "key_", "]_", "=_", "[_", "self_", "._", "\\u", "vars_", "[_", "key_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vars_", "[_", "key_", "]_", "+=_", "value_", "if_", "isinstance_", "(_", "value_", ",_", "list_", ")_", "else_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of identical values
rlpy/rlpy/rlpy/Domains/PacmanPackage/reinforcementTestClasses.py
[ { "content": "def followPath(policy, start, numSteps=100):\n state = start\n path = []\n for i in range(numSteps):\n if state not in policy:\n break\n action = policy[state]\n path.append(\"(%s,%s)\" % state)\n if action == 'north':\n nextState = state[0], state[1] + 1\n if action == 'south':\n nextState = state[0], state[1] - 1\n if action == 'east':\n nextState = state[0] + 1, state[1]\n if action == 'west':\n nextState = state[0] - 1, state[1]\n if action == 'exit' or action is None:\n path.append('TERMINAL_STATE')\n break\n state = nextState\n\n return path", "metadata": "root.followPath", "header": "['module', '___EOS___']", "index": 903 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "identical_", "values_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "follow", "Path_", "(_", "policy_", ",_", "start_", ",_", "num", "Steps_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "not_", "in_", "policy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", "=_", "policy_", "[_", "state_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "._", "append_", "(_", "\"(", "%", "s", ",%", "s", ")\"_", "%_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "==_", "'", "north", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", ",_", "state_", "[_", "1_", "]_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "south", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", ",_", "state_", "[_", "1_", "]_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "east", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", "+_", "1_", ",_", "state_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "west", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", "-_", "1_", ",_", "state_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "exit", "'_", "or_", "action_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "._", "append_", "(_", "'", "TERM", "INAL", "\\u", "STATE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "=_", "next", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
stopstalk/stopstalk-deployment/controllers/default.py
[ { "content": "def leaderboard():\n \"\"\"\n Get a table with users sorted by rating\n \"\"\"\n\n specific_institute = False\n atable = db.auth_user\n cftable = db.custom_friend\n\n global_leaderboard = False\n if request.vars.has_key(\"global\"):\n if request.vars[\"global\"] == \"True\":\n global_leaderboard = True\n else:\n if session.user_id is None:\n response.flash = \"Login to see Friends Leaderboard\"\n global_leaderboard = True\n else:\n if session.user_id is None:\n global_leaderboard = True\n\n heading = \"Global Leaderboard\"\n afields = [\"first_name\", \"last_name\", \"stopstalk_handle\",\n \"institute\", \"per_day\", \"rating\"]\n cfields = afields + [\"duplicate_cu\"]\n\n aquery = (atable.id > 0)\n cquery = (cftable.id > 0)\n if global_leaderboard is False:\n if session.user_id:\n heading = \"Friends Leaderboard\"\n friends, cusfriends = utilities.get_friends(session.user_id)\n custom_friends = [x[0] for x in cusfriends]\n\n # Add logged-in user to leaderboard\n friends.append(session.user_id)\n aquery &= (atable.id.belongs(friends))\n cquery &= (cftable.id.belongs(custom_friends))\n else:\n aquery &= (1 == 0)\n cquery &= (1 == 0)\n\n if request.vars.has_key(\"q\"):\n heading = \"Institute Leaderboard\"\n institute = request.vars[\"q\"]\n\n if institute != \"\":\n specific_institute = True\n aquery &= (atable.institute == institute)\n cquery &= (cftable.institute == institute)\n reg_users = db(aquery).select(*afields)\n custom_users = db(cquery).select(*cfields)\n\n if specific_institute is False:\n reg_users = db(aquery).select(*afields)\n custom_users = db(cquery).select(*cfields)\n\n # Find the total solved problems(Lesser than total accepted)\n solved_count = {}\n sql = \"\"\"\n SELECT stopstalk_handle, COUNT(DISTINCT(problem_name))\n FROM submission\n WHERE status = 'AC'\n GROUP BY user_id, custom_user_id;\n \"\"\"\n tmplist = db.executesql(sql)\n for user in tmplist:\n solved_count[user[0]] = user[1]\n\n complete_dict = {}\n # Prepare a list of stopstalk_handles of the\n # users relevant to the requested leaderboard\n friends_stopstalk_handles = []\n for x in reg_users:\n friends_stopstalk_handles.append(\"'\" + x.stopstalk_handle + \"'\")\n complete_dict[x.stopstalk_handle] = []\n\n for custom_user in custom_users:\n stopstalk_handle = custom_user.stopstalk_handle\n if custom_user.duplicate_cu:\n stopstalk_handle = cftable(custom_user.duplicate_cu).stopstalk_handle\n friends_stopstalk_handles.append(\"'\" + stopstalk_handle + \"'\")\n complete_dict[stopstalk_handle] = []\n\n if friends_stopstalk_handles == []:\n friends_stopstalk_handles = [\"-1\"]\n\n # Build the complex SQL query\n sql_query = \"\"\"\n SELECT stopstalk_handle, DATE(time_stamp), COUNT(*) as cnt\n FROM submission\n WHERE stopstalk_handle in (%s)\n GROUP BY stopstalk_handle, DATE(submission.time_stamp)\n ORDER BY time_stamp;\n \"\"\" % (\", \".join(friends_stopstalk_handles))\n\n user_rows = db.executesql(sql_query)\n for user in user_rows:\n if complete_dict[user[0]] != []:\n complete_dict[user[0]].append((user[1], user[2]))\n else:\n complete_dict[user[0]] = [(user[1], user[2])]\n\n users = []\n for user in reg_users:\n try:\n solved = solved_count[user.stopstalk_handle]\n except KeyError:\n solved = 0\n\n tup = utilities.compute_row(user, complete_dict, solved)\n if tup is not ():\n users.append(tup)\n\n for user in custom_users:\n try:\n if user.duplicate_cu:\n orig_user = cftable(user.duplicate_cu)\n solved = solved_count[orig_user.stopstalk_handle]\n else:\n solved = solved_count[user.stopstalk_handle]\n except KeyError:\n solved = 0\n tup = utilities.compute_row(user, complete_dict, solved, True)\n if tup is not ():\n users.append(tup)\n\n # Sort users according to the rating\n users = sorted(users, key=lambda x: x[3], reverse=True)\n\n table = TABLE(_class=\"centered striped\")\n table.append(THEAD(TR(TH(\"Rank\"),\n TH(\"Name\"),\n TH(\"StopStalk Handle\"),\n TH(\"Institute\"),\n TH(\"StopStalk Rating\"),\n TH(\"Rating Changes\"),\n TH(\"Per Day Changes\"))))\n\n tbody = TBODY()\n rank = 1\n for i in users:\n\n if i[5]:\n span = SPAN(_class=\"orange tooltipped\",\n data={\"position\": \"right\",\n \"delay\": \"50\",\n \"tooltip\": \"Custom User\"},\n _style=\"cursor: pointer; \" + \\\n \"float:right; \" + \\\n \"height:10px; \" + \\\n \"width:10px; \" + \\\n \"border-radius: 50%;\")\n else:\n span = SPAN()\n\n tr = TR()\n tr.append(TD(str(rank) + \".\"))\n tr.append(TD(DIV(span, DIV(i[0]))))\n tr.append(TD(A(i[1],\n _href=URL(\"user\", \"profile\", args=[i[1]]),\n _target=\"_blank\")))\n tr.append(TD(A(i[2],\n _href=URL(\"default\",\n \"leaderboard\",\n vars={\"q\": i[2],\n \"global\": global_leaderboard}))))\n tr.append(TD(i[3]))\n if i[6] > 0:\n tr.append(TD(B(\"+%s\" % str(i[6])),\n _class=\"green-text text-darken-2\"))\n elif i[6] < 0:\n tr.append(TD(B(i[6]), _class=\"red-text text-darken-2\"))\n else:\n tr.append(TD(i[6], _class=\"blue-text text-darken-2\"))\n\n diff = \"{:1.5f}\".format(i[4])\n\n if float(diff) == 0.0:\n tr.append(TD(\"+\" + diff, \" \",\n I(_class=\"fa fa-minus\")))\n elif i[4] > 0:\n tr.append(TD(\"+\" + str(diff), \" \",\n I(_class=\"fa fa-chevron-circle-up\",\n _style=\"color: #0f0;\")))\n elif i[4] < 0:\n tr.append(TD(diff, \" \",\n I(_class=\"fa fa-chevron-circle-down\",\n _style=\"color: #f00;\")))\n\n tbody.append(tr)\n rank += 1\n\n table.append(tbody)\n switch = DIV(LABEL(H6(\"Friends' Submissions\",\n INPUT(_type=\"checkbox\", _id=\"submission-switch\"),\n SPAN(_class=\"lever pink accent-3\"),\n \"Global Submissions\")),\n _class=\"switch\")\n div = TAG[\"\"](switch, table)\n return dict(div=div,\n heading=heading,\n global_leaderboard=global_leaderboard)", "metadata": "root.leaderboard", "header": "['module', '___EOS___']", "index": 430 } ]
[]
[]
0
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_", "leader", "board_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "a", " ", "table", " ", "with", " ", "users", " ", "sorte", "d", " ", "by", " ", "rati", "ng", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "specific", "\\u", "institu", "te_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atab", "le_", "=_", "db_", "._", "auth", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf", "table_", "=_", "db_", "._", "custom", "\\u", "friend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "leader", "board_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "vars_", "._", "has", "\\u", "key_", "(_", "\"", "global", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "vars_", "[_", "\"", "global", "\"_", "]_", "==_", "\"", "Tru", "e", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "leader", "board_", "=_", "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 ", " _", "if_", "session_", "._", "user", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "flash_", "=_", "\"", "Logi", "n", " ", "to", " ", "see", " ", "Friends", " ", "Leader", "board", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "leader", "board_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "session_", "._", "user", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "leader", "board_", "=_", "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_", "heading_", "=_", "\"", "Global", " ", "Leader", "board", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "afi", "elds", "_", "=_", "[_", "\"", "first", "\\u", "name", "\"_", ",_", "\"", "last", "\\u", "name", "\"_", ",_", "\"", "stop", "stal", "k", "\\u", "handle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "institu", "te", "\"_", ",_", "\"", "per", "\\u", "day", "\"_", ",_", "\"", "rati", "ng", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfi", "elds", "_", "=_", "afi", "elds", "_", "+_", "[_", "\"", "duplicat", "e\\u", "cu", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aqu", "ery", "_", "=_", "(_", "atab", "le_", "._", "id_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cq", "uery_", "=_", "(_", "cf", "table_", "._", "id_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "global", "\\u", "leader", "board_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "session_", "._", "user", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "heading_", "=_", "\"", "Friends", " ", "Leader", "board", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends_", ",_", "cus", "friends_", "=_", "utilities_", "._", "get", "\\u", "friends_", "(_", "session_", "._", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "friends_", "=_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "cus", "friends_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "logged", "-", "in", " ", "user", " ", "to", " ", "leader", "board_", "\\u\\u\\uNL\\u\\u\\u_", "friends_", "._", "append_", "(_", "session_", "._", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aqu", "ery", "_", "&=_", "(_", "atab", "le_", "._", "id_", "._", "belo", "ngs_", "(_", "friends_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cq", "uery_", "&=_", "(_", "cf", "table_", "._", "id_", "._", "belo", "ngs_", "(_", "custom", "\\u", "friends_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aqu", "ery", "_", "&=_", "(_", "1_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cq", "uery_", "&=_", "(_", "1_", "==_", "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_", "request_", "._", "vars_", "._", "has", "\\u", "key_", "(_", "\"", "q", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "heading_", "=_", "\"", "Institut", "e", " ", "Leader", "board", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "institu", "te_", "=_", "request_", "._", "vars_", "[_", "\"", "q", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "institu", "te_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specific", "\\u", "institu", "te_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aqu", "ery", "_", "&=_", "(_", "atab", "le_", "._", "institu", "te_", "==_", "institu", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cq", "uery_", "&=_", "(_", "cf", "table_", "._", "institu", "te_", "==_", "institu", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg", "\\u", "users_", "=_", "db_", "(_", "aqu", "ery", "_", ")_", "._", "select_", "(_", "*_", "afi", "elds", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "users_", "=_", "db_", "(_", "cq", "uery_", ")_", "._", "select_", "(_", "*_", "cfi", "elds", "_", ")_", "\\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_", "specific", "\\u", "institu", "te_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg", "\\u", "users_", "=_", "db_", "(_", "aqu", "ery", "_", ")_", "._", "select_", "(_", "*_", "afi", "elds", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "users_", "=_", "db_", "(_", "cq", "uery_", ")_", "._", "select_", "(_", "*_", "cfi", "elds", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "total", " ", "solved", " ", "problem", "s", "(", "Less", "er", " ", "than", " ", "total", " ", "accept", "ed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "solved", "\\u", "count_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", " ", "SELECT", " ", "stop", "stal", "k", "\\u", "handle", ",", " ", "COUNT", "(", "DIST", "INC", "T", "(", "problem", "\\u", "name", "))\\", "10", ";", " ", " ", " ", " ", " ", "FROM", " ", "subm", "ission", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "status", " ", "=", " ", "'", "AC", "'", "\\", "10", ";", " ", " ", " ", " ", " ", "GROU", "P", " ", "BY", " ", "user", "\\u", "id", ",", " ", "custom", "\\u", "user", "\\u", "id", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpl", "ist_", "=_", "db_", "._", "execute", "sql_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "tmpl", "ist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "solved", "\\u", "count_", "[_", "user_", "[_", "0_", "]_", "]_", "=_", "user_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "complete", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prepare", " ", "a", " ", "list", " ", "of", " ", "stop", "stal", "k", "\\u", "handle", "s", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "users", " ", "rele", "van", "t", " ", "to", " ", "the", " ", "request", "ed", " ", "leader", "board_", "\\u\\u\\uNL\\u\\u\\u_", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "reg", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", "._", "append_", "(_", "\"'\"_", "+_", "x_", "._", "stop", "stal", "k", "\\u", "handle_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u", "dict_", "[_", "x_", "._", "stop", "stal", "k", "\\u", "handle_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "custom", "\\u", "user_", "in_", "custom", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop", "stal", "k", "\\u", "handle_", "=_", "custom", "\\u", "user_", "._", "stop", "stal", "k", "\\u", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "custom", "\\u", "user_", "._", "duplicat", "e\\u", "cu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop", "stal", "k", "\\u", "handle_", "=_", "cf", "table_", "(_", "custom", "\\u", "user_", "._", "duplicat", "e\\u", "cu_", ")_", "._", "stop", "stal", "k", "\\u", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", "._", "append_", "(_", "\"'\"_", "+_", "stop", "stal", "k", "\\u", "handle_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u", "dict_", "[_", "stop", "stal", "k", "\\u", "handle_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", "=_", "[_", "\"-", "1", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "complex", " ", "SQL", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql", "\\u", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", "SELECT", " ", "stop", "stal", "k", "\\u", "handle", ",", " ", "DAT", "E", "(", "time", "\\u", "stamp", "),", " ", "COUNT", "(*", ")", " ", "as", " ", "cnt", "\\", "10", ";", " ", " ", "FROM", " ", "subm", "ission", "\\", "10", ";", " ", " ", "WHE", "RE", " ", "stop", "stal", "k", "\\u", "handle", " ", "in", " ", "(%", "s", ")", "\\", "10", ";", " ", " ", "GROU", "P", " ", "BY", " ", "stop", "stal", "k", "\\u", "handle", ",", " ", "DAT", "E", "(", "subm", "ission", ".", "time", "\\u", "stamp", ")", "\\", "10", ";", " ", " ", "ORDE", "R", " ", "BY", " ", "time", "\\u", "stamp", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "friends", "\\u", "stop", "stal", "k", "\\u", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "rows_", "=_", "db_", "._", "execute", "sql_", "(_", "sql", "\\u", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "user", "\\u", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "complete", "\\u", "dict_", "[_", "user_", "[_", "0_", "]_", "]_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "complete", "\\u", "dict_", "[_", "user_", "[_", "0_", "]_", "]_", "._", "append_", "(_", "(_", "user_", "[_", "1_", "]_", ",_", "user_", "[_", "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 ", " _", "complete", "\\u", "dict_", "[_", "user_", "[_", "0_", "]_", "]_", "=_", "[_", "(_", "user_", "[_", "1_", "]_", ",_", "user_", "[_", "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_", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "reg", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "solved", "_", "=_", "solved", "\\u", "count_", "[_", "user_", "._", "stop", "stal", "k", "\\u", "handle_", "]_", "\\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 ", " _", "solved", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tup_", "=_", "utilities_", "._", "compute", "\\u", "row_", "(_", "user_", ",_", "complete", "\\u", "dict_", ",_", "solved", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tup_", "is_", "not_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "._", "append_", "(_", "tup_", ")_", "\\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_", "user_", "in_", "custom", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "._", "duplicat", "e\\u", "cu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "\\u", "user_", "=_", "cf", "table_", "(_", "user_", "._", "duplicat", "e\\u", "cu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "solved", "_", "=_", "solved", "\\u", "count_", "[_", "orig", "\\u", "user_", "._", "stop", "stal", "k", "\\u", "handle_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "solved", "_", "=_", "solved", "\\u", "count_", "[_", "user_", "._", "stop", "stal", "k", "\\u", "handle_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "solved", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tup_", "=_", "utilities_", "._", "compute", "\\u", "row_", "(_", "user_", ",_", "complete", "\\u", "dict_", ",_", "solved", "_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tup_", "is_", "not_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "._", "append_", "(_", "tup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sort", " ", "users", " ", "according", " ", "to", " ", "the", " ", "rating_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "users_", "=_", "sorted_", "(_", "users_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "3_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\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_", "table_", "._", "append_", "(_", "THE", "AD_", "(_", "TR_", "(_", "TH_", "(_", "\"", "Rank", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Name", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Sto", "p", "Sta", "lk", " ", "Handle", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Institut", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Sto", "p", "Sta", "lk", " ", "Rati", "ng", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Rati", "ng", " ", "Change", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TH_", "(_", "\"", "Per", " ", "Day", " ", "Change", "s", "\"_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tbo", "dy_", "=_", "TB", "OD", "Y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rank_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "span_", "=_", "SPAN", "_", "(_", "\\u", "class_", "=_", "\"", "orange", " ", "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", "\"_", ":_", "\"", "Custom", " ", "User", "\"_", "}_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "span_", "=_", "SPAN", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tr_", "=_", "TR_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "str_", "(_", "rank_", ")_", "+_", "\".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "DIV_", "(_", "span_", ",_", "DIV_", "(_", "i_", "[_", "0_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "A_", "(_", "i_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "URL_", "(_", "\"", "user", "\"_", ",_", "\"", "profile", "\"_", ",_", "args_", "=_", "[_", "i_", "[_", "1_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "target_", "=_", "\"\\u", "blank", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "A_", "(_", "i_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "URL_", "(_", "\"", "default", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "leader", "board", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "{_", "\"", "q", "\"_", ":_", "i_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "global", "\"_", ":_", "global", "\\u", "leader", "board_", "}_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "[_", "6_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "B_", "(_", "\"+", "%", "s", "\"_", "%_", "str_", "(_", "i_", "[_", "6_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "green", "-", "text", " ", "text", "-", "dark", "en", "-", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "[_", "6_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "B_", "(_", "i_", "[_", "6_", "]_", ")_", ",_", "\\u", "class_", "=_", "\"", "red", "-", "text", " ", "text", "-", "dark", "en", "-", "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 ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "i_", "[_", "6_", "]_", ",_", "\\u", "class_", "=_", "\"", "blue", "-", "text", " ", "text", "-", "dark", "en", "-", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff_", "=_", "\"{:", "1.5", "f", "}\"_", "._", "format_", "(_", "i_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "float_", "(_", "diff_", ")_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "\"+\"_", "+_", "diff_", ",_", "\"", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "minu", "s", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "[_", "4_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "\"+\"_", "+_", "str_", "(_", "diff_", ")_", ",_", "\"", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "che", "vro", "n", "-", "circle", "-", "up", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "style_", "=_", "\"", "color", ":", " ", "#", "0f", "0", ";\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "[_", "4_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "._", "append_", "(_", "TD_", "(_", "diff_", ",_", "\"", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "(_", "\\u", "class_", "=_", "\"", "fa", " ", "fa", "-", "che", "vro", "n", "-", "circle", "-", "down", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "style_", "=_", "\"", "color", ":", " ", "#", "f0", "0", ";\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tbo", "dy_", "._", "append_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rank_", "+=_", "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_", "switch_", "=_", "DIV_", "(_", "LABEL_", "(_", "H", "6_", "(_", "\"", "Friends", "'", " ", "Subm", "ission", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "INPUT_", "(_", "\\u", "type_", "=_", "\"", "checkb", "ox", "\"_", ",_", "\\u", "id_", "=_", "\"", "subm", "ission", "-", "switch", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SPAN", "_", "(_", "\\u", "class_", "=_", "\"", "leve", "r", " ", "pin", "k", " ", "accent", "-", "3", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Global", " ", "Subm", "ission", "s", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "switch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div_", "=_", "TAG_", "[_", "\"\"_", "]_", "(_", "switch_", ",_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "div_", "=_", "div_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heading_", "=_", "heading_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "leader", "board_", "=_", "global", "\\u", "leader", "board_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused local variable
nielsmadan/venom/autoload/vim_ext/__init__.py
[ { "content": "def extend_vim():\n import vim_ext.vim_g\n import vim_ext.vim_map\n import vim_ext.vim_fn\n import vim_ext.vim_opt\n import vim_ext.vim_win\n import vim_ext.vim_regs\n import vim_ext.vim_buf\n import vim_ext.vim_highlight", "metadata": "root.extend_vim", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "extend", "\\u", "vim_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "opt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "win_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "regs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "buf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vim", "\\u", "ext_", "._", "vim", "\\u", "highlight_" ]
[ 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 ]
Except block handles 'BaseException'
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/modes/occurences.py
[ { "content": " @delay.setter\n def delay(self, value):\n self.timer.delay = value\n if self.editor:\n for clone in self.editor.clones:\n try:\n clone.modes.get(self.__class__).delay = value\n except KeyError:\n # this should never happen since we're working with clones\n pass", "metadata": "root.OccurrencesHighlighterMode.delay", "header": "['class', 'OccurrencesHighlighterMode', '(', 'Mode', ')', ':', '___EOS___']", "index": 22 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Occurrence", "s", "Highlight", "er", "Mode_", "(_", "Mode_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "delay_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delay_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timer_", "._", "delay_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "editor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "clone_", "in_", "self_", "._", "editor_", "._", "clone", "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 ", " ", "_", "clone_", "._", "modes_", "._", "get_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "._", "delay_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", " ", "sinc", "e", " ", "we", "'", "re", " ", "working", " ", "with", " ", "clone", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
enthought/envisage/envisage/tests/extension_point_test_case.py
[ { "content": "\"\"\" Tests for extension points. \"\"\"\n\n\n# Enthought library imports.\nfrom envisage.api import Application, ExtensionPoint\nfrom envisage.api import ExtensionRegistry\nfrom traits.api import HasTraits, Int, List, TraitError\nfrom traits.testing.unittest_tools import unittest\n\n\n\n\n\n\n# Entry point for stand-alone testing.\nif __name__ == '__main__':\n unittest.main()\n\n#### EOF ######################################################################\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestBase(HasTraits):\n \"\"\" Base class for all test classes that use the 'ExtensionPoint' type. \"\"\"\n\n extension_registry = None", "metadata": "root.TestBase", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class ExtensionPointTestCase(unittest.TestCase):\n \"\"\" Tests for extension points. \"\"\"\n\n ###########################################################################\n # 'TestCase' interface.\n ###########################################################################\n\n\n\n ###########################################################################\n # Tests.\n ###########################################################################\n\n\n\n\n\n\n\n\n\n\n ###########################################################################\n # Private interface.\n ###########################################################################\n", "metadata": "root.ExtensionPointTestCase", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def setUp(self):\n \"\"\" Prepares the test fixture before each test method is called. \"\"\"\n\n # We do all of the testing via the application to make sure it offers\n # the same interface!\n self.registry = Application(extension_registry=ExtensionRegistry())\n\n # Set the extension registry used by the test classes.\n TestBase.extension_registry = self.registry\n\n return", "metadata": "root.ExtensionPointTestCase.setUp", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def tearDown(self):\n \"\"\" Called immediately after each test method has been called. \"\"\"\n\n return", "metadata": "root.ExtensionPointTestCase.tearDown", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_invalid_extension_point_type(self):\n \"\"\" invalid extension point type \"\"\"\n\n # Extension points currently have to be 'List's of something! The\n # default is a list of anything.\n self.failUnlessRaises(TypeError, ExtensionPoint, Int, 'my.ep')\n\n return", "metadata": "root.ExtensionPointTestCase.test_invalid_extension_point_type", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_no_reference_to_extension_registry(self):\n \"\"\" no reference to extension registry \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Set the extensions.\n registry.set_extensions('my.ep', 'xxx')\n\n # Declare a class that consumes the extension.\n class Foo(HasTraits):\n x = ExtensionPoint(List(Int), id='my.ep')\n\n # We should get an exception because the object does not have an\n # 'extension_registry' trait.\n f = Foo()\n self.failUnlessRaises(ValueError, getattr, f, 'x')\n\n return", "metadata": "root.ExtensionPointTestCase.test_no_reference_to_extension_registry", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_extension_point_changed(self):\n \"\"\" extension point changed \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(id='my.ep')\n\n def _x_changed(self):\n \"\"\" Static trait change handler. \"\"\"\n\n self.x_changed_called = True\n\n return\n\n f = Foo()\n\n # Connect the extension points on the object so that it can listen\n # for changes.\n ExtensionPoint.connect_extension_point_traits(f)\n\n # Set the extensions.\n registry.set_extensions('my.ep', [42, 'a string', True])\n\n # Make sure that instances of the class pick up the extensions.\n self.assertEqual(3, len(f.x))\n self.assertEqual([42, 'a string', True], f.x)\n\n # Make sure the trait change handler was called.\n self.assert_(f.x_changed_called)\n\n # Reset the change handler flag.\n f.x_changed_called = False\n\n # Disconnect the extension points on the object.\n ExtensionPoint.disconnect_extension_point_traits(f)\n\n # Set the extensions.\n registry.set_extensions('my.ep', [98, 99, 100])\n\n # Make sure the trait change handler was *not* called.\n self.assertEqual(False, f.x_changed_called)\n\n return", "metadata": "root.ExtensionPointTestCase.test_extension_point_changed", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_untyped_extension_point(self):\n \"\"\" untyped extension point \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Set the extensions.\n registry.set_extensions('my.ep', [42, 'a string', True])\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(id='my.ep')\n\n # Make sure that instances of the class pick up the extensions.\n f = Foo()\n self.assertEqual(3, len(f.x))\n self.assertEqual([42, 'a string', True], f.x)\n\n g = Foo()\n self.assertEqual(3, len(g.x))\n self.assertEqual([42, 'a string', True], g.x)\n\n return", "metadata": "root.ExtensionPointTestCase.test_untyped_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_typed_extension_point(self):\n \"\"\" typed extension point \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Set the extensions.\n registry.set_extensions('my.ep', [42, 43, 44])\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(List(Int), id='my.ep')\n\n # Make sure that instances of the class pick up the extensions.\n f = Foo()\n self.assertEqual(3, len(f.x))\n self.assertEqual([42, 43, 44], f.x)\n\n g = Foo()\n self.assertEqual(3, len(g.x))\n self.assertEqual([42, 43, 44], g.x)\n\n return", "metadata": "root.ExtensionPointTestCase.test_typed_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_invalid_extension_point(self):\n \"\"\" invalid extension point \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Set the extensions.\n registry.set_extensions('my.ep', 'xxx')\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(List(Int), id='my.ep')\n\n # Make sure we get a trait error because the type of the extension\n # doesn't match that of the extension point.\n f = Foo()\n self.failUnlessRaises(TraitError, getattr, f, 'x')\n\n return", "metadata": "root.ExtensionPointTestCase.test_invalid_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": " def test_extension_point_with_no_id(self):\n \"\"\" extension point with no Id \"\"\"\n\n def factory():\n class Foo(TestBase):\n x = ExtensionPoint(List(Int))\n\n self.failUnlessRaises(ValueError, factory)\n\n return", "metadata": "root.ExtensionPointTestCase.test_extension_point_with_no_id", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 198 }, { "content": " def test_set_untyped_extension_point(self):\n \"\"\" set untyped extension point \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(id='my.ep')\n\n # Make sure that when we set the trait the extension registry gets\n # updated.\n f = Foo()\n f.x = [42]\n\n self.assertEqual([42], registry.get_extensions('my.ep'))\n\n return", "metadata": "root.ExtensionPointTestCase.test_set_untyped_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 209 }, { "content": " def test_set_typed_extension_point(self):\n \"\"\" set typed extension point \"\"\"\n\n registry = self.registry\n\n # Add an extension point.\n registry.add_extension_point(self._create_extension_point('my.ep'))\n\n # Declare a class that consumes the extension.\n class Foo(TestBase):\n x = ExtensionPoint(List(Int), id='my.ep')\n\n # Make sure that when we set the trait the extension registry gets\n # updated.\n f = Foo()\n f.x = [42]\n\n self.assertEqual([42], registry.get_extensions('my.ep'))\n\n return", "metadata": "root.ExtensionPointTestCase.test_set_typed_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 230 }, { "content": " def _create_extension_point(self, id, trait_type=List, desc=''):\n \"\"\" Create an extension point. \"\"\"\n\n return ExtensionPoint(id=id, trait_type=trait_type, desc=desc)", "metadata": "root.ExtensionPointTestCase._create_extension_point", "header": "['class', 'ExtensionPointTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 255 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Test", "s", " ", "for", " ", "extensi", "on", " ", "points", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ent", "hou", "ght", " ", "librar", "y", " ", "import", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "envi", "sage", "_", "._", "api_", "import_", "Application_", ",_", "Ext", "ensi", "on", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "envi", "sage", "_", "._", "api_", "import_", "Ext", "ensi", "on", "Registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traits_", "._", "api_", "import_", "Has", "Trait", "s_", ",_", "Int_", ",_", "List_", ",_", "Trait", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traits_", "._", "testing_", "._", "unittest", "\\u", "tools_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Entr", "y", " ", "point", " ", "for", " ", "stand", "-", "alo", "ne", " ", "testi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "EO", "F", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\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_", "Test", "Base_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Base", " ", "class", " ", "for", " ", "all", " ", "test", " ", "classe", "s", " ", "tha", "t", " ", "use", " ", "the", " ", "'", "Ext", "ensi", "on", "Point", "'", " ", "type", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "registry_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ext", "ensi", "on", "Point", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", "s", " ", "for", " ", "extensi", "on", " ", " ", "points", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "Test", "Case", "'", " ", "interface", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Priva", "te", " ", "interface", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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 ", " _", "\"\"\"", " ", "Prepare", "s", " ", "the", " ", "test", " ", "fixture", " ", "bef", "ore", " ", "each", " ", "test", " ", "method", " ", "is", " ", "call", "ed", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "do", " ", "all", " ", "of", " ", "the", " ", "testi", "ng", " ", "via", " ", "the", " ", "applica", "tion", " ", "to", " ", "make", " ", "sure", " ", "it", " ", "offers", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "interface", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "registry_", "=_", "Application_", "(_", "extensi", "on", "\\u", "registry_", "=_", "Ext", "ensi", "on", "Registry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "on", " ", "registr", "y", " ", "used", " ", "by", " ", "the", " ", "test", " ", "classe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Base_", "._", "extensi", "on", "\\u", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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 ", " _", "\"\"\"", " ", "Call", "ed", " ", "immediate", "ly", " ", "after", " ", "each", " ", "test", " ", "method", " ", "has", " ", "bee", "n", " ", "call", "ed", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "invalid", "\\u", "extensi", "on", "\\u", "point", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "invalid", " ", "extensi", "on", " ", "point", " ", "type", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ext", "ensi", "on", " ", "points", " ", "currentl", "y", " ", "have", " ", "to", " ", "be", " ", "'", "List", "'", "s", " ", "of", " ", "somet", "hing", "!", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "is", " ", "a", " ", "list", " ", "of", " ", "anyt", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Type", "Error_", ",_", "Ext", "ensi", "on", "Point_", ",_", "Int_", ",_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "reference", "\\u", "to", "\\u", "extensi", "on", "\\u", "registry_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "no", " ", "reference", " ", "to", " ", "extensi", "on", " ", "registr", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "'", "xxx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "List_", "(_", "Int_", ")_", ",_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "an", " ", "exception", " ", "bec", "aus", "e", " ", "the", " ", "object", " ", "doe", "s", " ", "not", " ", "have", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "extensi", "on", "\\u", "registr", "y", "'", " ", "tra", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "getattr_", ",_", "f_", ",_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "extensi", "on", "\\u", "point", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "extensi", "on", " ", "point", " ", "change", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "x", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Static", " ", "tra", "it", " ", "change", " ", "handler", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "x", "\\u", "change", "d\\u", "called_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", " ", "the", " ", "extensi", "on", " ", "points", " ", "on", " ", "the", " ", "object", " ", "so", " ", "tha", "t", " ", "it", " ", "can", " ", "listen_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "change", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "Ext", "ensi", "on", "Point_", "._", "connect", "\\u", "extensi", "on", "\\u", "point", "\\u", "traits_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "[_", "42_", ",_", "'", "a", " ", "string", "'_", ",_", "True_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "instance", "s", " ", "of", " ", "the", " ", "class", " ", "pick", " ", "up", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "f_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", ",_", "'", "a", " ", "string", "'_", ",_", "True_", "]_", ",_", "f_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "tra", "it", " ", "change", " ", "handler", " ", "was", " ", "call", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "f_", "._", "x", "\\u", "change", "d\\u", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "the", " ", "change", " ", "handler", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "x", "\\u", "change", "d\\u", "called_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disconnect", " ", "the", " ", "extensi", "on", " ", "points", " ", "on", " ", "the", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "Ext", "ensi", "on", "Point_", "._", "discon", "nect", "\\u", "extensi", "on", "\\u", "point", "\\u", "traits_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "[_", "98_", ",_", "99_", ",_", "100_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "tra", "it", " ", "change", " ", "handler", " ", "was", " ", "*", "not", "*", " ", "call", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", ",_", "f_", "._", "x", "\\u", "change", "d\\u", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "unt", "ype", "d\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "unt", "ype", "d", " ", "extensi", "on", " ", "point", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "[_", "42_", ",_", "'", "a", " ", "string", "'_", ",_", "True_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "instance", "s", " ", "of", " ", "the", " ", "class", " ", "pick", " ", "up", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "f_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", ",_", "'", "a", " ", "string", "'_", ",_", "True_", "]_", ",_", "f_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "g_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", ",_", "'", "a", " ", "string", "'_", ",_", "True_", "]_", ",_", "g_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "typed", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "typed", " ", "extensi", "on", " ", "point", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "[_", "42_", ",_", "43_", ",_", "44_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "List_", "(_", "Int_", ")_", ",_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "instance", "s", " ", "of", " ", "the", " ", "class", " ", "pick", " ", "up", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "f_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", ",_", "43_", ",_", "44_", "]_", ",_", "f_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "g_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", ",_", "43_", ",_", "44_", "]_", ",_", "g_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "invalid", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "invalid", " ", "extensi", "on", " ", "point", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "set\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ",_", "'", "xxx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "List_", "(_", "Int_", ")_", ",_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "get", " ", "a", " ", "tra", "it", " ", "error", " ", "bec", "aus", "e", " ", "the", " ", "type", " ", "of", " ", "the", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "match", " ", "tha", "t", " ", "of", " ", "the", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Trait", "Error_", ",_", "getattr_", ",_", "f_", ",_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "extensi", "on", "\\u", "point", "\\u", "with", "\\u", "no", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "extensi", "on", " ", "point", " ", "with", " ", "no", " ", "Id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "List_", "(_", "Int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "set\\u", "unt", "ype", "d\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "set", " ", "unt", "ype", "d", " ", "extensi", "on", " ", "point", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "whe", "n", " ", "we", " ", "set", " ", "the", " ", "tra", "it", " ", "the", " ", "extensi", "on", " ", "registr", "y", " ", "gets", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "x_", "=_", "[_", "42_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", "]_", ",_", "registry_", "._", "get", "\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "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", "set\\u", "typed", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "set", " ", "typed", " ", "extensi", "on", " ", "point", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "=_", "self_", "._", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "extensi", "on", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "add", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", "._", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Declar", "e", " ", "a", " ", "class", " ", "tha", "t", " ", "consume", "s", " ", "the", " ", "extensi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Ext", "ensi", "on", "Point_", "(_", "List_", "(_", "Int_", ")_", ",_", "id_", "=_", "'", "my", ".", "ep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "whe", "n", " ", "we", " ", "set", " ", "the", " ", "tra", "it", " ", "the", " ", "extensi", "on", " ", "registr", "y", " ", "gets", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "Foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "x_", "=_", "[_", "42_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "42_", "]_", ",_", "registry_", "._", "get", "\\u", "extensions_", "(_", "'", "my", ".", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Point", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "extensi", "on", "\\u", "point_", "(_", "self_", ",_", "id_", ",_", "tra", "it", "\\u", "type_", "=_", "List_", ",_", "desc_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "an", " ", "extensi", "on", " ", "point", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Ext", "ensi", "on", "Point_", "(_", "id_", "=_", "id_", ",_", "tra", "it", "\\u", "type_", "=_", "tra", "it", "\\u", "type_", ",_", "desc_", "=_", "desc_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bolme/pyvision/src/pyvision/face/PCA.py
[ { "content": "# PyVision License\n#\n# Copyright (c) 2006-2008 David S. Bolme\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n# \n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# \n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# \n# 3. Neither name of copyright holders nor the names of its contributors\n# may be used to endorse or promote products derived from this software\n# without specific prior written permission.\n# \n# \n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#import os.path\n#from PIL.Image import ANTIALIAS\n#import scipy as sp\nimport numpy as np\nimport os\nimport unittest\n#from scipy.signal import fft2\n\nfrom pyvision.face.FaceRecognizer import FaceRecognizer\nfrom pyvision.analysis.FaceAnalysis import FaceRecognitionTest\nimport pyvision.vector.PCA\n#from pyvision.other.normalize import *\n#from pyvision.types.img import Image\n#from pyvision.types.Point import Point\nfrom pyvision.analysis.face import EyesFile\n#from pyvision.analysis.roc import *\n#from pyvision.types.Affine import *\n\nimport pyvision as pv\n\nPCA_L1 = 1\nPCA_L2 = 2\nPCA_COS = 3\n\nPCA_NO_NORM = 1\nPCA_MEAN_STD_NORM = 2\nPCA_MEAN_UNIT_NORM = 3\nPCA_UNIT_NORM = 4\n\n \n \n\nSCRAPS_FACE_DATA = os.path.join(pyvision.__path__[0],\"data\",\"csuScrapShots\")\n\nPCA_SIZE = (64,64)\n\n \n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PCA(FaceRecognizer):\n ''' This is a basic implementation of PCA'''\n \n\n \n #def addTraining(self,img,rect=None,eyes=None):\n # ''' '''\n # assert not self.trained\n # \n # img = self.cropFace(img,eyes) \n # vec = self.computeVector(img)\n # self.pca.addFeature(vec)\n\n \n \n \n \n \n ", "metadata": "root.PCA", "header": "['module', '___EOS___']", "index": 62 }, { "content": " def __init__(self, face_size=(128,128), left_eye=pv.Point(32,52), right_eye=pv.Point(96,52), normalize=PCA_MEAN_STD_NORM, measure=PCA_COS, whiten=True, drop_front=2, basis_vectors=100):\n '''Crate a PCA classifier'''\n FaceRecognizer.__init__(self)\n \n self.face_size = face_size\n self.pca = pyvision.vector.PCA.PCA()\n self.norm = normalize\n self.trained = False\n \n self.whiten = whiten\n self.drop_front = drop_front\n self.basis_vectors = basis_vectors\n self.measure = measure\n self.left_eye = left_eye\n self.right_eye = right_eye", "metadata": "root.PCA.__init__", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 65 }, { "content": " def cropFace(self,im,eyes):\n left,right = eyes\n affine = pv.AffineFromPoints(left,right,self.left_eye,self.right_eye,self.face_size)\n im = affine.transformImage(im)\n return im", "metadata": "root.PCA.cropFace", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 81 }, { "content": " def computeFaceRecord(self,img,rect=None,eyes=None):\n '''Given an image and face detection box, compute a face identification record'''\n assert self.trained\n \n img = self.cropFace(img,eyes) \n vec = self.computeVector(img)\n fir = self.pca.project(vec,whiten=True)\n if self.measure == PCA_COS:\n scale = np.sqrt((fir*fir).sum())\n fir = (1.0/scale)*fir\n return fir", "metadata": "root.PCA.computeFaceRecord", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 95 }, { "content": " def computeVector(self,img):\n '''Creates a vector from a face'''\n #face = img.asPIL().crop(rect.box()).resize(self.face_size,ANTIALIAS)\n vec = img.asMatrix2D().flatten()\n \n if self.norm == PCA_MEAN_STD_NORM:\n vec = pv.meanStd(vec)\n if self.norm == PCA_MEAN_UNIT_NORM:\n vec = pv.meanUnit(vec)\n if self.norm == PCA_UNIT_NORM:\n vec = pv.unit(vec)\n \n return vec", "metadata": "root.PCA.computeVector", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 107 }, { "content": " def train(self):\n '''Train the PCA classifier'''\n assert self.trained == False\n \n for img,_,eyes,_ in self.training_data:\n img = self.cropFace(img,eyes) \n vec = self.computeVector(img)\n self.pca.addFeature(vec)\n \n self.pca.train( drop_front=self.drop_front, number=self.basis_vectors)\n \n self.trained = True", "metadata": "root.PCA.train", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 121 }, { "content": " def similarity(self,fir1,fir2):\n '''Compute the similarity of two faces'''\n assert self.trained == True\n\n if self.measure == PCA_L1:\n return (np.abs(fir1-fir2)).sum()\n\n if self.measure == PCA_L2:\n return np.sqrt(((fir1-fir2)*(fir1-fir2)).sum())\n\n if self.measure == PCA_COS:\n return (fir1*fir2).sum()\n \n raise NotImplementedError(\"Unknown distance measure: %d\"%self.measure)", "metadata": "root.PCA.similarity", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 135 }, { "content": " def getBasis(self):\n basis = self.pca.getBasis()\n images = []\n \n print basis.shape\n r,_ = basis.shape\n for i in range(r):\n im = basis[i,:]\n im = im.reshape(self.face_size)\n im = pv.Image(im)\n images.append(im)\n print len(images)\n return images", "metadata": "root.PCA.getBasis", "header": "['class', 'PCA', '(', 'FaceRecognizer', ')', ':', '___EOS___']", "index": 151 }, { "content": "class _TestFacePCA(unittest.TestCase):\n \n\n ", "metadata": "root._TestFacePCA", "header": "['module', '___EOS___']", "index": 171 }, { "content": " def setUp(self):\n self.images = []\n self.names = []\n \n self.eyes = EyesFile(os.path.join(SCRAPS_FACE_DATA,\"coords.txt\"))\n for filename in self.eyes.files():\n img = pv.Image(os.path.join(SCRAPS_FACE_DATA, filename + \".pgm\"))\n self.images.append(img)\n self.names.append(filename)\n \n self.assert_( len(self.images) == 173 )", "metadata": "root._TestFacePCA.setUp", "header": "['class', '_TestFacePCA', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_pca_scraps(self):\n face_test = FaceRecognitionTest.FaceRecognitionTest(name='PCA_CSUScraps',score_type=FaceRecognitionTest.SCORE_TYPE_HIGH)\n pca = PCA(drop_front=2,basis_vectors=55)\n \n for im_name in self.eyes.files():\n im = pv.Image(os.path.join(SCRAPS_FACE_DATA, im_name + \".pgm\"))\n rect = self.eyes.getFaces(im_name)\n eyes = self.eyes.getEyes(im_name)\n pca.addTraining(im,rect=rect[0],eyes=eyes[0])\n\n pca.train()\n \n face_records = {}\n for im_name in self.eyes.files():\n im = pv.Image(os.path.join(SCRAPS_FACE_DATA, im_name + \".pgm\"))\n rect = self.eyes.getFaces(im_name)\n eyes = self.eyes.getEyes(im_name)\n fr = pca.computeFaceRecord(im,rect=rect[0],eyes=eyes[0])\n face_records[im_name] = fr\n \n for i_name in face_records.keys():\n scores = []\n for j_name in face_records.keys():\n similarity = pca.similarity(face_records[i_name],face_records[j_name])\n scores.append((j_name,similarity))\n face_test.addSample(i_name,scores)\n \n #print face_test.rank1_bounds\n self.assertAlmostEqual(face_test.rank1_rate,0.43930635838150289)\n self.assertAlmostEqual(face_test.rank1_bounds[0],0.3640772723094895)\n self.assertAlmostEqual(face_test.rank1_bounds[1],0.51665118592791259)\n\n roc = face_test.getROCAnalysis() \n\n # Test based of fpr=0.01\n _ = roc.getFAR(far=0.01)\n #TODO: does not work... \n #self.assertAlmostEqual(1.0-roc_point.frr,0.16481069042316257)\n\n # Test the equal error rate\n #fp,tp,th = roc.findEqualError()\n #self.assertAlmostEqual(tp,0.68819599109131402)", "metadata": "root._TestFacePCA.test_pca_scraps", "header": "['class', '_TestFacePCA', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 186 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Py", "Vis", "ion", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2008", " ", "Dav", "id", " ", "S", ".", " ", "Bol", "me_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "conditions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", "Nei", "ther", " ", "name", " ", "of", " ", "copyr", "ight", " ", "holder", "s", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "``", "AS", " ", "IS", "''", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "REG", "ENT", "S", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "os", ".", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "PI", "L", ".", "Image", " ", "import", " ", "ANTI", "ALIAS_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "sci", "py", " ", "as", " ", "sp_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "signal", " ", "import", " ", "fft", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyv", "isi", "on_", "._", "face_", "._", "Face", "Recognize", "r_", "import_", "Face", "Recognize", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyv", "isi", "on_", "._", "analysis_", "._", "Face", "Analysis_", "import_", "Face", "Reco", "gni", "tion", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyv", "isi", "on_", "._", "vector_", "._", "PCA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyv", "isi", "on", ".", "other", ".", "normali", "ze", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "pyv", "isi", "on", ".", "types", ".", "img", " ", "import", " ", "Image_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "pyv", "isi", "on", ".", "types", ".", "Point", " ", "import", " ", "Point_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyv", "isi", "on_", "._", "analysis_", "._", "face_", "import_", "Ey", "es", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyv", "isi", "on", ".", "analys", "is", ".", "roc", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "pyv", "isi", "on", ".", "types", ".", "Affi", "ne", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyv", "isi", "on_", "as_", "pv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PCA", "\\u", "L1_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PCA", "\\u", "L2_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PCA", "\\u", "COS", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PCA", "\\u", "NO", "\\u", "NORM_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PCA", "\\u", "MEAN", "\\u", "STD", "\\u", "NORM_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PCA", "\\u", "MEAN", "\\u", "UNIT", "\\u", "NORM_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PCA", "\\u", "UNIT", "\\u", "NORM_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SCR", "APS", "\\u", "FACE", "\\u", "DATA_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pyv", "isi", "on_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "\"", "data", "\"_", ",_", "\"", "csu", "Scra", "p", "Shot", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PCA", "\\u", "SIZE_", "=_", "(_", "64_", ",_", "64_", ")_", "\\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_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Thi", "s", " ", "is", " ", "a", " ", "basic", " ", "implementation", " ", "of", " ", "PCA", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", " ", "add", "Train", "ing", "(", "self", ",", "img", ",", "rect", "=", "Non", "e", ",", "eyes", "=", "Non", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'''", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "assert", " ", "not", " ", "self", ".", "trained", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "img", " ", "=", " ", "self", ".", "crop", "Face", "(", "img", ",", "eyes", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vec", " ", "=", " ", "self", ".", "compute", "Vector", "(", "img", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "pca", ".", "add", "Feature", "(", "vec", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "face", "\\u", "size_", "=_", "(_", "128_", ",_", "128_", ")_", ",_", "left", "\\u", "eye_", "=_", "pv_", "._", "Point_", "(_", "32_", ",_", "52_", ")_", ",_", "right", "\\u", "eye_", "=_", "pv_", "._", "Point_", "(_", "96_", ",_", "52_", ")_", ",_", "normalize_", "=_", "PCA", "\\u", "MEAN", "\\u", "STD", "\\u", "NORM_", ",_", "measure_", "=_", "PCA", "\\u", "COS", "_", ",_", "whiten", "_", "=_", "True_", ",_", "drop", "\\u", "front_", "=_", "2_", ",_", "basi", "s", "\\u", "vectors_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Cra", "te", " ", "a", " ", "PCA", " ", "classif", "ier", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Face", "Recognize", "r_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "face", "\\u", "size_", "=_", "face", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pca_", "=_", "pyv", "isi", "on_", "._", "vector_", "._", "PCA", "_", "._", "PCA", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "norm_", "=_", "normalize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "trained", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "whiten", "_", "=_", "whiten", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "drop", "\\u", "front_", "=_", "drop", "\\u", "front_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basi", "s", "\\u", "vectors_", "=_", "basi", "s", "\\u", "vectors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "measure_", "=_", "measure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "\\u", "eye_", "=_", "left", "\\u", "eye_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "\\u", "eye_", "=_", "right", "\\u", "eye_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "crop", "Face_", "(_", "self_", ",_", "im_", ",_", "eyes", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "eyes", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "affine_", "=_", "pv_", "._", "Affi", "ne", "Fro", "m", "Points_", "(_", "left_", ",_", "right_", ",_", "self_", "._", "left", "\\u", "eye_", ",_", "self_", "._", "right", "\\u", "eye_", ",_", "self_", "._", "face", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "affine_", "._", "transform", "Image_", "(_", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Face", "Record_", "(_", "self_", ",_", "img_", ",_", "rect_", "=_", "None_", ",_", "eyes", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Give", "n", " ", "an", " ", "image", " ", "and", " ", "face", " ", "detect", "ion", " ", "box", ",", " ", "compute", " ", "a", " ", "face", " ", "identifica", "tion", " ", "record", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "trained", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "=_", "self_", "._", "crop", "Face_", "(_", "img_", ",_", "eyes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vec_", "=_", "self_", "._", "compute", "Vector_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fir", "_", "=_", "self_", "._", "pca_", "._", "project_", "(_", "vec_", ",_", "whiten", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "measure_", "==_", "PCA", "\\u", "COS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "np_", "._", "sqrt_", "(_", "(_", "fir", "_", "*_", "fir", "_", ")_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fir", "_", "=_", "(_", "1.0_", "/_", "scale_", ")_", "*_", "fir", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fir", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Vector_", "(_", "self_", ",_", "img_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Creat", "es", " ", "a", " ", "vector", " ", "from", " ", "a", " ", "face", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "face", " ", "=", " ", "img", ".", "as", "PI", "L", "()", ".", "crop", "(", "rect", ".", "box", "())", ".", "resiz", "e", "(", "self", ".", "face", "\\u", "size", ",", "ANTI", "ALIAS", ")_", "\\u\\u\\uNL\\u\\u\\u_", "vec_", "=_", "img_", "._", "as", "Matrix", "2", "D_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "norm_", "==_", "PCA", "\\u", "MEAN", "\\u", "STD", "\\u", "NORM_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vec_", "=_", "pv_", "._", "mean", "Std", "_", "(_", "vec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "norm_", "==_", "PCA", "\\u", "MEAN", "\\u", "UNIT", "\\u", "NORM_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vec_", "=_", "pv_", "._", "mean", "Unit_", "(_", "vec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "norm_", "==_", "PCA", "\\u", "UNIT", "\\u", "NORM_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vec_", "=_", "pv_", "._", "unit_", "(_", "vec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Train", " ", "the", " ", "PCA", " ", "classif", "ier", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "trained", "_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "img_", ",_", "\\u_", ",_", "eyes", "_", ",_", "\\u_", "in_", "self_", "._", "train", "ing", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "self_", "._", "crop", "Face_", "(_", "img_", ",_", "eyes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vec_", "=_", "self_", "._", "compute", "Vector_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pca_", "._", "add", "Feature_", "(_", "vec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pca_", "._", "train_", "(_", "drop", "\\u", "front_", "=_", "self_", "._", "drop", "\\u", "front_", ",_", "number_", "=_", "self_", "._", "basi", "s", "\\u", "vectors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "trained", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "similarity_", "(_", "self_", ",_", "fir", "1_", ",_", "fir", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Compute", " ", "the", " ", "similar", "it", "y", " ", "of", " ", "two", " ", "face", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "trained", "_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "measure_", "==_", "PCA", "\\u", "L1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "np_", "._", "abs_", "(_", "fir", "1_", "-_", "fir", "2_", ")_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "measure_", "==_", "PCA", "\\u", "L2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "sqrt_", "(_", "(_", "(_", "fir", "1_", "-_", "fir", "2_", ")_", "*_", "(_", "fir", "1_", "-_", "fir", "2_", ")_", ")_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "measure_", "==_", "PCA", "\\u", "COS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "fir", "1_", "*_", "fir", "2_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Un", "know", "n", " ", "distance", " ", "measure", ":", " ", "%", "d", "\"_", "%_", "self_", "._", "measure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "Face", "Recognize", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Basi", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basis_", "=_", "self_", "._", "pca_", "._", "get", "Basi", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "basis_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", ",_", "\\u_", "=_", "basis_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "basis_", "[_", "i_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "im_", "._", "reshape_", "(_", "self_", "._", "face", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "pv_", "._", "Image_", "(_", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "._", "append_", "(_", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "len_", "(_", "images_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Test", "Face", "PCA", "_", "(_", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Test", "Face", "PCA", "_", "(_", "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 ", " _", "self_", "._", "images_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "eyes", "_", "=_", "Ey", "es", "File_", "(_", "os_", "._", "path_", "._", "join_", "(_", "SCR", "APS", "\\u", "FACE", "\\u", "DATA_", ",_", "\"", "coords", ".", "txt", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filename_", "in_", "self_", "._", "eyes", "_", "._", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "pv_", "._", "Image_", "(_", "os_", "._", "path_", "._", "join_", "(_", "SCR", "APS", "\\u", "FACE", "\\u", "DATA_", ",_", "filename_", "+_", "\".", "pgm", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "images_", "._", "append_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "names_", "._", "append_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "len_", "(_", "self_", "._", "images_", ")_", "==_", "173_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Test", "Face", "PCA", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pca", "\\u", "scrap", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "face", "\\u", "test_", "=_", "Face", "Reco", "gni", "tion", "Test_", "._", "Face", "Reco", "gni", "tion", "Test_", "(_", "name_", "=_", "'", "PCA", "\\u", "CS", "US", "cra", "ps", "'_", ",_", "score", "\\u", "type_", "=_", "Face", "Reco", "gni", "tion", "Test_", "._", "SCORE", "\\u", "TYPE", "\\u", "HIGH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "=_", "PCA", "_", "(_", "drop", "\\u", "front_", "=_", "2_", ",_", "basi", "s", "\\u", "vectors_", "=_", "55_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "im", "\\u", "name_", "in_", "self_", "._", "eyes", "_", "._", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "pv_", "._", "Image_", "(_", "os_", "._", "path_", "._", "join_", "(_", "SCR", "APS", "\\u", "FACE", "\\u", "DATA_", ",_", "im", "\\u", "name_", "+_", "\".", "pgm", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rect_", "=_", "self_", "._", "eyes", "_", "._", "get", "Faces_", "(_", "im", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eyes", "_", "=_", "self_", "._", "eyes", "_", "._", "get", "Ey", "es_", "(_", "im", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "._", "add", "Train", "ing_", "(_", "im_", ",_", "rect_", "=_", "rect_", "[_", "0_", "]_", ",_", "eyes", "_", "=_", "eyes", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pca_", "._", "train_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "face", "\\u", "records_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im", "\\u", "name_", "in_", "self_", "._", "eyes", "_", "._", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "pv_", "._", "Image_", "(_", "os_", "._", "path_", "._", "join_", "(_", "SCR", "APS", "\\u", "FACE", "\\u", "DATA_", ",_", "im", "\\u", "name_", "+_", "\".", "pgm", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rect_", "=_", "self_", "._", "eyes", "_", "._", "get", "Faces_", "(_", "im", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eyes", "_", "=_", "self_", "._", "eyes", "_", "._", "get", "Ey", "es_", "(_", "im", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fr_", "=_", "pca_", "._", "compute", "Face", "Record_", "(_", "im_", ",_", "rect_", "=_", "rect_", "[_", "0_", "]_", ",_", "eyes", "_", "=_", "eyes", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "face", "\\u", "records_", "[_", "im", "\\u", "name_", "]_", "=_", "fr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i", "\\u", "name_", "in_", "face", "\\u", "records_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scores_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j", "\\u", "name_", "in_", "face", "\\u", "records_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "similarity_", "=_", "pca_", "._", "similarity_", "(_", "face", "\\u", "records_", "[_", "i", "\\u", "name_", "]_", ",_", "face", "\\u", "records_", "[_", "j", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "._", "append_", "(_", "(_", "j", "\\u", "name_", ",_", "similarity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "face", "\\u", "test_", "._", "add", "Sample_", "(_", "i", "\\u", "name_", ",_", "scores_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "face", "\\u", "test", ".", "rank", "1", "\\u", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "face", "\\u", "test_", "._", "rank", "1", "\\u", "rate_", ",_", "0.43", "930", "635", "838", "1502", "89_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "face", "\\u", "test_", "._", "rank", "1", "\\u", "bounds_", "[_", "0_", "]_", ",_", "0.36", "407", "727", "230", "948", "95_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "face", "\\u", "test_", "._", "rank", "1", "\\u", "bounds_", "[_", "1_", "]_", ",_", "0.51", "665", "118", "592", "791", "259_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "roc_", "=_", "face", "\\u", "test_", "._", "get", "ROC", "Analysis_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "based", " ", "of", " ", "fpr", "=", "0.01_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "roc_", "._", "get", "FAR", "_", "(_", "far_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "doe", "s", " ", "not", " ", "work", "...", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Al", "most", "Equal", "(", "1.0", "-", "roc", "\\u", "point", ".", "fr", "r", ",", "0.16", "481", "069", "042", "316", "257", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "equal", " ", "error", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fp", ",", "tp", ",", "th", " ", "=", " ", "roc", ".", "find", "Equal", "Error", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Al", "most", "Equal", "(", "tp", ",", "0.68", "819", "599", "1091", "314", "02", ")_", "\\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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
tooxie/shiva-server/var/restideas.py
[ { "content": " def __resource_url__(self):\n from flask import request\n\n return request.base_url", "metadata": "root.SongResource.__resource_url__", "header": "['class', 'SongResource', '(', 'object', ')', ':', '___EOS___']", "index": 190 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Son", "g", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "resource", "\\u", "url", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "flask_", "import_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "request_", "._", "base", "\\u", "url_", "\\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 ]
First argument to super() is not enclosing class
GoogleCloudPlatform/appengine-mapreduce/python/test/mapreduce/tools/gcs_file_seg_reader_test.py
[ { "content": " def setUp(self):\n super(GCSFileSegReaderTest, self).setUp()\n\n self.testbed = testbed.Testbed()\n self.testbed.activate()\n\n self.testbed.init_app_identity_stub()\n self.testbed.init_blobstore_stub()\n # HRD with no eventual consistency.\n policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)\n self.testbed.init_datastore_v3_stub(consistency_policy=policy)\n self.testbed.init_memcache_stub()\n self.testbed.init_urlfetch_stub()\n\n self.writer_cls = output_writers._GoogleCloudStorageOutputWriter\n\n self.seg_prefix = \"/bucket/prefix-\"", "metadata": "root.GCSFileSegReaderTest.setUp", "header": "['class', 'GCSFileSegReaderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "GC", "SF", "ile", "Seg", "Read", "er", "Test_", "(_", "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 ", " _", "super_", "(_", "GC", "SF", "ile", "Seg", "Read", "er", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "testbed_", "=_", "testbed_", "._", "Test", "bed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "testbed_", "._", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "testbed_", "._", "init", "\\u", "app", "\\u", "identi", "ty", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "testbed_", "._", "init", "\\u", "blobs", "tore\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "HR", "D", " ", "with", " ", "no", " ", "eventual", " ", "consiste", "nc", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "datast", "ore", "\\u", "stub", "\\u", "util_", "._", "Pse", "udo", "Random", "HR", "Cons", "iste", "nc", "y", "Policy_", "(_", "probability_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "testbed_", "._", "init", "\\u", "datast", "ore", "\\u", "v", "3", "\\u", "stub_", "(_", "consiste", "nc", "y", "\\u", "policy_", "=_", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "testbed_", "._", "init", "\\u", "memc", "ache", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "testbed_", "._", "init", "\\u", "urlf", "etch", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "writer", "\\u", "cls_", "=_", "output", "\\u", "writers_", "._", "\\u", "Goo", "gle", "Cloud", "Stor", "age", "Output", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seg", "\\u", "prefix_", "=_", "\"/", "bucket", "/", "prefix", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
saltstack/salt/tests/unit/modules/nova_test.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Rahul Handay <rahulha@saltstack.com>`\n'''\n\n# Import Python Libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing Libs\nfrom salttesting import TestCase, skipIf\nfrom salttesting.mock import (\n MagicMock,\n patch,\n NO_MOCK,\n NO_MOCK_REASON\n)\n\n# Import Salt Libs\nfrom salt.modules import nova\n\n# Globals\nnova.__grains__ = {}\nnova.__salt__ = {}\nnova.__context__ = {}\nnova.__opts__ = {}\n\n\n\n\nif __name__ == '__main__':\n from integration import run_tests\n run_tests(NovaTestCase, needs_daemon=False)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@skipIf(NO_MOCK, NO_MOCK_REASON)\nclass NovaTestCase(TestCase):\n '''\n Test cases for salt.modules.nova\n '''\n\n\n\n\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.NovaTestCase", "header": "['module', '___EOS___']", "index": 27 }, { "content": " @patch('salt.modules.nova._auth')\n def test_boot(self, mock_auth):\n '''\n Test for Boot (create) a new instance\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'boot', MagicMock(return_value='A')):\n self.assertTrue(nova.boot('name'))", "metadata": "root.NovaTestCase.test_boot", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_list(self, mock_auth):\n '''\n Test for List storage volumes\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_list', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_list())", "metadata": "root.NovaTestCase.test_volume_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_show(self, mock_auth):\n '''\n Test for Create a block storage volume\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_show', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_show('name'))", "metadata": "root.NovaTestCase.test_volume_show", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_create(self, mock_auth):\n '''\n Test for Create a block storage volume\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_create', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_create('name'))", "metadata": "root.NovaTestCase.test_volume_create", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_delete(self, mock_auth):\n '''\n Test for Destroy the volume\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_delete', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_delete('name'))", "metadata": "root.NovaTestCase.test_volume_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 72 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_detach(self, mock_auth):\n '''\n Test for Attach a block storage volume\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_detach', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_detach('name'))", "metadata": "root.NovaTestCase.test_volume_detach", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 82 }, { "content": " @patch('salt.modules.nova._auth')\n def test_volume_attach(self, mock_auth):\n '''\n Test for Attach a block storage volume\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'volume_attach', MagicMock(return_value='A')):\n self.assertTrue(nova.volume_attach('name', 'serv_name'))", "metadata": "root.NovaTestCase.test_volume_attach", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " @patch('salt.modules.nova._auth')\n def test_suspend(self, mock_auth):\n '''\n Test for Suspend an instance\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'suspend', MagicMock(return_value='A')):\n self.assertTrue(nova.suspend('instance_id'))", "metadata": "root.NovaTestCase.test_suspend", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 102 }, { "content": " @patch('salt.modules.nova._auth')\n def test_resume(self, mock_auth):\n '''\n Test for Resume an instance\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'resume', MagicMock(return_value='A')):\n self.assertTrue(nova.resume('instance_id'))", "metadata": "root.NovaTestCase.test_resume", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " @patch('salt.modules.nova._auth')\n def test_lock(self, mock_auth):\n '''\n Test for Lock an instance\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'lock', MagicMock(return_value='A')):\n self.assertTrue(nova.lock('instance_id'))", "metadata": "root.NovaTestCase.test_lock", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " @patch('salt.modules.nova._auth')\n def test_delete(self, mock_auth):\n '''\n Test for Delete an instance\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'delete', MagicMock(return_value='A')):\n self.assertTrue(nova.delete('instance_id'))", "metadata": "root.NovaTestCase.test_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " @patch('salt.modules.nova._auth')\n def test_flavor_list(self, mock_auth):\n '''\n Test for Return a list of available flavors (nova flavor-list)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'flavor_list', MagicMock(return_value='A')):\n self.assertTrue(nova.flavor_list())", "metadata": "root.NovaTestCase.test_flavor_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 142 }, { "content": " @patch('salt.modules.nova._auth')\n def test_flavor_create(self, mock_auth):\n '''\n Test for Add a flavor to nova (nova flavor-create)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'flavor_create', MagicMock(return_value='A')):\n self.assertTrue(nova.flavor_create('name'))", "metadata": "root.NovaTestCase.test_flavor_create", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " @patch('salt.modules.nova._auth')\n def test_flavor_delete(self, mock_auth):\n '''\n Test for Delete a flavor from nova by id (nova flavor-delete)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'flavor_delete', MagicMock(return_value='A')):\n self.assertTrue(nova.flavor_delete('flavor_id'))", "metadata": "root.NovaTestCase.test_flavor_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " @patch('salt.modules.nova._auth')\n def test_keypair_list(self, mock_auth):\n '''\n Test for Return a list of available keypairs (nova keypair-list)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'keypair_list', MagicMock(return_value='A')):\n self.assertTrue(nova.keypair_list())", "metadata": "root.NovaTestCase.test_keypair_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 172 }, { "content": " @patch('salt.modules.nova._auth')\n def test_keypair_add(self, mock_auth):\n '''\n Test for Add a keypair to nova (nova keypair-add)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'keypair_add', MagicMock(return_value='A')):\n self.assertTrue(nova.keypair_add('name'))", "metadata": "root.NovaTestCase.test_keypair_add", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 182 }, { "content": " @patch('salt.modules.nova._auth')\n def test_keypair_delete(self, mock_auth):\n '''\n Test for Add a keypair to nova (nova keypair-delete)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'keypair_delete', MagicMock(return_value='A')):\n self.assertTrue(nova.keypair_delete('name'))", "metadata": "root.NovaTestCase.test_keypair_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " @patch('salt.modules.nova._auth')\n def test_image_list(self, mock_auth):\n '''\n Test for Return a list of available images\n (nova images-list + nova image-show)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'image_list', MagicMock(return_value='A')):\n self.assertTrue(nova.image_list())", "metadata": "root.NovaTestCase.test_image_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 202 }, { "content": " @patch('salt.modules.nova._auth')\n def test_image_meta_set(self, mock_auth):\n '''\n Test for Sets a key=value pair in the\n metadata for an image (nova image-meta set)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'image_meta_set', MagicMock(return_value='A')):\n self.assertTrue(nova.image_meta_set())", "metadata": "root.NovaTestCase.test_image_meta_set", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " @patch('salt.modules.nova._auth')\n def test_image_meta_delete(self, mock_auth):\n '''\n Test for Delete a key=value pair from the metadata for an image\n (nova image-meta set)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'image_meta_delete', MagicMock(return_value='A')):\n self.assertTrue(nova.image_meta_delete())", "metadata": "root.NovaTestCase.test_image_meta_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def test_list_(self):\n '''\n Test for To maintain the feel of the nova command line,\n this function simply calls\n the server_list function.\n '''\n with patch.object(nova, 'server_list', return_value=['A']):\n self.assertEqual(nova.list_(), ['A'])", "metadata": "root.NovaTestCase.test_list_", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 235 }, { "content": " @patch('salt.modules.nova._auth')\n def test_server_list(self, mock_auth):\n '''\n Test for Return list of active servers\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'server_list', MagicMock(return_value='A')):\n self.assertTrue(nova.server_list())", "metadata": "root.NovaTestCase.test_server_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 244 }, { "content": " def test_show(self):\n '''\n Test for To maintain the feel of the nova command line,\n this function simply calls\n the server_show function.\n '''\n with patch.object(nova, 'server_show', return_value=['A']):\n self.assertEqual(nova.show('server_id'), ['A'])", "metadata": "root.NovaTestCase.test_show", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 254 }, { "content": " @patch('salt.modules.nova._auth')\n def test_server_list_detailed(self, mock_auth):\n '''\n Test for Return detailed list of active servers\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'server_list_detailed', MagicMock(return_value='A')):\n self.assertTrue(nova.server_list_detailed())", "metadata": "root.NovaTestCase.test_server_list_detailed", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 263 }, { "content": " @patch('salt.modules.nova._auth')\n def test_server_show(self, mock_auth):\n '''\n Test for Return detailed information for an active server\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'server_show', MagicMock(return_value='A')):\n self.assertTrue(nova.server_show('serv_id'))", "metadata": "root.NovaTestCase.test_server_show", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 273 }, { "content": " @patch('salt.modules.nova._auth')\n def test_secgroup_create(self, mock_auth):\n '''\n Test for Add a secgroup to nova (nova secgroup-create)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'server_list_detailed', MagicMock(return_value='A')):\n self.assertTrue(nova.secgroup_create('name', 'desc'))", "metadata": "root.NovaTestCase.test_secgroup_create", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " @patch('salt.modules.nova._auth')\n def test_secgroup_delete(self, mock_auth):\n '''\n Test for Delete a secgroup to nova (nova secgroup-delete)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'secgroup_delete', MagicMock(return_value='A')):\n self.assertTrue(nova.secgroup_delete('name'))", "metadata": "root.NovaTestCase.test_secgroup_delete", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 293 }, { "content": " @patch('salt.modules.nova._auth')\n def test_secgroup_list(self, mock_auth):\n '''\n Test for Return a list of available security groups (nova items-list)\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'secgroup_list', MagicMock(return_value='A')):\n self.assertTrue(nova.secgroup_list())", "metadata": "root.NovaTestCase.test_secgroup_list", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 303 }, { "content": " @patch('salt.modules.nova._auth')\n def test_server_by_name(self, mock_auth):\n '''\n Test for Return information about a server\n '''\n mock_auth.side_effect = MagicMock()\n with patch.object(mock_auth,\n 'server_by_name', MagicMock(return_value='A')):\n self.assertTrue(nova.server_by_name('name'))", "metadata": "root.NovaTestCase.test_server_by_name", "header": "['class', 'NovaTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 313 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", ":", "code", "author", ":", " ", ":", "email", ":`", "Ra", "hu", "l", " ", "Hand", "ay", " ", "<", "rah", "ul", "ha", "@", "salt", "stack", ".", "com", ">`", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Pyth", "on", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Sal", "t", " ", "Test", "ing", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "salt", "testing_", "import_", "Test", "Case_", ",_", "skip", "If_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt", "testing_", "._", "mock_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ic", "Mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "patch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NO", "\\u", "MOC", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NO", "\\u", "MOC", "K", "\\u", "REASON", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Sal", "t", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "salt_", "._", "modules_", "import_", "nova_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "nova_", "._", "\\u\\u", "grains", "\\u\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nova_", "._", "\\u\\u", "salt\\u\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nova_", "._", "\\u\\u", "context", "\\u\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nova_", "._", "\\u\\u", "opts", "\\u\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "integration_", "import_", "run", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "tests_", "(_", "Nov", "a", "Test", "Case_", ",_", "need", "s", "\\u", "daemon_", "=_", "False_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "skip", "If_", "(_", "NO", "\\u", "MOC", "K_", ",_", "NO", "\\u", "MOC", "K", "\\u", "REASON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Nov", "a", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "case", "s", " ", "for", " ", "salt", ".", "module", "s", ".", "nova", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Nov", "a", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "boot_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Boot", " ", "(", "create", ")", " ", "a", " ", "new", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "boot", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "boot_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "List", " ", "storage", " ", "volume", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "show_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Creat", "e", " ", "a", " ", "block", " ", "storage", " ", "volume", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "show", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "show_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "create_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Creat", "e", " ", "a", " ", "block", " ", "storage", " ", "volume", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "create", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "create_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Destr", "oy", " ", "the", " ", "volume", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "delete_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "detach_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Attach", " ", "a", " ", "block", " ", "storage", " ", "volume", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "deta", "ch", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "detach_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume", "\\u", "attach_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Attach", " ", "a", " ", "block", " ", "storage", " ", "volume", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "attach", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "volume", "\\u", "attach_", "(_", "'", "name", "'_", ",_", "'", "serv", "\\u", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "suspend", "_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Suspend", " ", "an", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suspend", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "suspend", "_", "(_", "'", "instance", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "resume_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Resu", "me", " ", "an", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resum", "e", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "resume_", "(_", "'", "instance", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "lock_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Lock", " ", "an", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lock", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "lock_", "(_", "'", "instance", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Delete", " ", "an", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "delete_", "(_", "'", "instance", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "flavor", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "avail", "able", " ", "flavor", "s", " ", "(", "nova", " ", "flavor", "-", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flavor", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "flavor", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "flavor", "\\u", "create_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Add", " ", "a", " ", "flavor", " ", "to", " ", "nova", " ", "(", "nova", " ", "flavor", "-", "create", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flavor", "\\u", "create", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "flavor", "\\u", "create_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "flavor", "\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Delete", " ", "a", " ", "flavor", " ", "from", " ", "nova", " ", "by", " ", "id", " ", "(", "nova", " ", "flavor", "-", "delete", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flavor", "\\u", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "flavor", "\\u", "delete_", "(_", "'", "flavor", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "keypa", "ir", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "avail", "able", " ", "keypairs", " ", "(", "nova", " ", "keypa", "ir", "-", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keypa", "ir", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "keypa", "ir", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "keypa", "ir", "\\u", "add_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Add", " ", "a", " ", "keypa", "ir", " ", "to", " ", "nova", " ", "(", "nova", " ", "keypa", "ir", "-", "add", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keypa", "ir", "\\u", "add", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "keypa", "ir", "\\u", "add_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "keypa", "ir", "\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Add", " ", "a", " ", "keypa", "ir", " ", "to", " ", "nova", " ", "(", "nova", " ", "keypa", "ir", "-", "delete", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keypa", "ir", "\\u", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "keypa", "ir", "\\u", "delete_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "image", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "avail", "able", " ", "images", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "nova", " ", "images", "-", "list", " ", "+", " ", "nova", " ", "image", "-", "show", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "image", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "image", "\\u", "meta", "\\u", "set_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Set", "s", " ", "a", " ", "key", "=", "value", " ", "pair", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "metadata", " ", "for", " ", "an", " ", "image", " ", "(", "nova", " ", "image", "-", "meta", " ", "set", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "meta", "\\u", "set", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "image", "\\u", "meta", "\\u", "set_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "image", "\\u", "meta", "\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Delete", " ", "a", " ", "key", "=", "value", " ", "pair", " ", "from", " ", "the", " ", "metadata", " ", "for", " ", "an", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "(", "nova", " ", "image", "-", "meta", " ", "set", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "meta", "\\u", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "image", "\\u", "meta", "\\u", "delete_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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", "list\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "To", " ", "maintain", " ", "the", " ", "feel", " ", "of", " ", "the", " ", "nova", " ", "command", " ", "line", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "this", " ", "function", " ", "simp", "ly", " ", "calls", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "server", "\\u", "list", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "nova_", ",_", "'", "server", "\\u", "list", "'_", ",_", "return", "\\u", "value_", "=_", "[_", "'", "A", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "nova_", "._", "list\\u_", "(_", ")_", ",_", "[_", "'", "A", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "server", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "list", " ", "of", " ", "active", " ", "server", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "server", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "To", " ", "maintain", " ", "the", " ", "feel", " ", "of", " ", "the", " ", "nova", " ", "command", " ", "line", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "this", " ", "function", " ", "simp", "ly", " ", "calls", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "server", "\\u", "show", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "nova_", ",_", "'", "server", "\\u", "show", "'_", ",_", "return", "\\u", "value_", "=_", "[_", "'", "A", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "nova_", "._", "show_", "(_", "'", "server", "\\u", "id", "'_", ")_", ",_", "[_", "'", "A", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "server", "\\u", "list", "\\u", "detailed", "_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "detailed", " ", "list", " ", "of", " ", "active", " ", "server", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "list", "\\u", "detailed", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "server", "\\u", "list", "\\u", "detailed", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "server", "\\u", "show_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "detailed", " ", "informati", "on", " ", "for", " ", "an", " ", "active", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "show", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "server", "\\u", "show_", "(_", "'", "serv", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "secgr", "oup", "\\u", "create_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Add", " ", "a", " ", "secgr", "oup", " ", "to", " ", "nova", " ", "(", "nova", " ", "secgr", "oup", "-", "create", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "list", "\\u", "detailed", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "secgr", "oup", "\\u", "create_", "(_", "'", "name", "'_", ",_", "'", "desc", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "secgr", "oup", "\\u", "delete_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Delete", " ", "a", " ", "secgr", "oup", " ", "to", " ", "nova", " ", "(", "nova", " ", "secgr", "oup", "-", "delete", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secgr", "oup", "\\u", "delete", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "secgr", "oup", "\\u", "delete_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "secgr", "oup", "\\u", "list_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "avail", "able", " ", "security", " ", "group", "s", " ", "(", "nova", " ", "items", "-", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secgr", "oup", "\\u", "list", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "secgr", "oup", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nov", "a", "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_", "@_", "patch_", "(_", "'", "salt", ".", "module", "s", ".", "nova", ".\\u", "auth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "server", "\\u", "by", "\\u", "name_", "(_", "self_", ",_", "mock", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "for", " ", "Return", " ", "informati", "on", " ", "abo", "ut", " ", "a", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "auth_", "._", "side", "\\u", "effect_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "patch_", "._", "object_", "(_", "mock", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "by", "\\u", "name", "'_", ",_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "A", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "nova_", "._", "server", "\\u", "by", "\\u", "name_", "(_", "'", "name", "'_", ")_", ")_", "\\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,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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 ]
Unused import
swcarpentry/amy/workshops/test/test_invoice_requests.py
[ { "content": "from datetime import date\n\nfrom .base import TestBase\nfrom ..models import InvoiceRequest, Event, Host\nfrom ..forms import InvoiceRequestForm\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestInvoiceRequestForm(TestBase):\n", "metadata": "root.TestInvoiceRequestForm", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def setUp(self):\n self._setUpUsersAndLogin()", "metadata": "root.TestInvoiceRequestForm.setUp", "header": "['class', 'TestInvoiceRequestForm', '(', 'TestBase', ')', ':', '___EOS___']", "index": 8 }, { "content": " def test_adding_minimal(self):\n \"\"\"Test submitting a minimalistic form ends up in\n Event.invoicerequest_set.\"\"\"\n event = Event.objects.create(\n slug='invoiceable-event', host=Host.objects.first(),\n start='2016-02-09', admin_fee=2500,\n venue='School of Science',\n )\n data = {\n 'organization': event.host.pk,\n 'reason': 'admin-fee',\n 'date': event.start,\n 'event': event.pk,\n 'event_location': event.venue,\n 'contact_name': 'dr Jane Smith',\n 'contact_email': 'jane.smith@ufl.edu',\n 'full_address': 'dr Jane Smith, University of Florida',\n 'amount': event.admin_fee,\n 'vendor_form_required': 'no',\n 'receipts_sent': 'not-yet',\n }\n form = InvoiceRequestForm(data)\n self.assertTrue(form.is_valid())\n self.assertEqual(event.invoicerequest_set.count(), 0)\n form.save()\n self.assertEqual(event.invoicerequest_set.count(), 1)", "metadata": "root.TestInvoiceRequestForm.test_adding_minimal", "header": "['class', 'TestInvoiceRequestForm', '(', 'TestBase', ')', ':', '___EOS___']", "index": 11 }, { "content": "class TestInvoiceRequest(TestBase):\n", "metadata": "root.TestInvoiceRequest", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def setUp(self):\n self._setUpUsersAndLogin()", "metadata": "root.TestInvoiceRequest.setUp", "header": "['class', 'TestInvoiceRequest', '(', 'TestBase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_status_repr(self):\n \"\"\"Test if InvoiceRequest long status representation is fine.\"\"\"\n day = date(2016, 2, 9)\n event = Event.objects.create(\n slug='invoiceable-event', host=Host.objects.first(),\n start=day, admin_fee=2500,\n venue='School of Science',\n )\n request = InvoiceRequest.objects.create(\n organization=event.host, date=event.start,\n event=event, event_location=event.venue,\n contact_name='dr Jane Smith', contact_email='jane.smith@ufl.edu',\n full_address='dr Jane Smith, University of Florida',\n amount=event.admin_fee, form_W9=False,\n sent_date=day, paid_date=day,\n )\n\n tests = [\n ('not-invoiced', 'Not invoiced'),\n ('sent', 'Sent out on 2016-02-09'),\n ('paid', 'Paid on 2016-02-09'),\n ]\n\n for status, long_status in tests:\n with self.subTest(status=status):\n request.status = status\n # request.save()\n self.assertEqual(request.long_status, long_status)", "metadata": "root.TestInvoiceRequest.test_status_repr", "header": "['class', 'TestInvoiceRequest', '(', 'TestBase', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "base_", "import_", "Test", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "models_", "import_", "Invoice", "Request_", ",_", "Event_", ",_", "Host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "forms_", "import_", "Invoice", "Request", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Invoice", "Request", "Form_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Invoice", "Request", "Form_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set", "Up", "User", "s", "And", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Invoice", "Request", "Form_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "addin", "g", "\\u", "minima", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "submit", "ting", " ", "a", " ", "minima", "listi", "c", " ", "form", " ", "ends", " ", "up", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "Event", ".", "invoic", "ere", "quest", "\\u", "set", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "'", "invoic", "eab", "le", "-", "event", "'_", ",_", "host_", "=_", "Host_", "._", "objects_", "._", "first_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "'", "2016", "-0", "2", "-0", "9", "'_", ",_", "admin", "\\u", "fee_", "=_", "2500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "venue", "_", "=_", "'", "Scho", "ol", " ", "of", " ", "Sci", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "organization", "'_", ":_", "event_", "._", "host_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "admin", "-", "fe", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "event_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "'_", ":_", "event_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "\\u", "location", "'_", ":_", "event_", "._", "venue", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "\\u", "name", "'_", ":_", "'", "dr", " ", "Jan", "e", " ", "Smi", "th", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "\\u", "email", "'_", ":_", "'", "jane", ".", "smit", "h", "@", "ufl", ".", "edu", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "address", "'_", ":_", "'", "dr", " ", "Jan", "e", " ", "Smi", "th", ",", " ", "Univers", "it", "y", " ", "of", " ", "Flor", "ida", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "amo", "unt", "'_", ":_", "event_", "._", "admin", "\\u", "fee_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vendor", "\\u", "form", "\\u", "require", "d", "'_", ":_", "'", "no", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "receipt", "s", "\\u", "sent", "'_", ":_", "'", "not", "-", "ye", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Invoice", "Request", "Form_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", "._", "invoic", "ere", "quest", "\\u", "set_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", "._", "invoic", "ere", "quest", "\\u", "set_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Invoice", "Request_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Invoice", "Request_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set", "Up", "User", "s", "And", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Invoice", "Request_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "status", "\\u", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "if", " ", "Invoice", "Request", " ", "long", " ", "status", " ", "represent", "ation", " ", "is", " ", "fine", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "date_", "(_", "2016_", ",_", "2_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "Event_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "'", "invoic", "eab", "le", "-", "event", "'_", ",_", "host_", "=_", "Host_", "._", "objects_", "._", "first_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "day_", ",_", "admin", "\\u", "fee_", "=_", "2500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "venue", "_", "=_", "'", "Scho", "ol", " ", "of", " ", "Sci", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Invoice", "Request_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "organization_", "=_", "event_", "._", "host_", ",_", "date_", "=_", "event_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "event_", ",_", "event", "\\u", "location_", "=_", "event_", "._", "venue", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "name_", "=_", "'", "dr", " ", "Jan", "e", " ", "Smi", "th", "'_", ",_", "contact", "\\u", "email_", "=_", "'", "jane", ".", "smit", "h", "@", "ufl", ".", "edu", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "address_", "=_", "'", "dr", " ", "Jan", "e", " ", "Smi", "th", ",", " ", "Univers", "it", "y", " ", "of", " ", "Flor", "ida", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "amount_", "=_", "event_", "._", "admin", "\\u", "fee_", ",_", "form", "\\u", "W", "9_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sent", "\\u", "date_", "=_", "day_", ",_", "paid", "\\u", "date_", "=_", "day_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "not", "-", "invoic", "ed", "'_", ",_", "'", "Not", " ", "invoic", "ed", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "sent", "'_", ",_", "'", "Sent", " ", "out", " ", "on", " ", "2016", "-0", "2", "-0", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "paid", "'_", ",_", "'", "Pai", "d", " ", "on", " ", "2016", "-0", "2", "-0", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "status_", ",_", "long", "\\u", "status_", "in_", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "sub", "Test_", "(_", "status_", "=_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "status_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "request", ".", "save", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "long", "\\u", "status_", ",_", "long", "\\u", "status_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Import of deprecated module
AppScale/appscale/AppServer/lib/webob-1.2.3/webob/compat.py
[ { "content": "# code stolen from \"six\"\n\nimport sys\nimport types\n\n# True if we are running on Python 3.\nPY3 = sys.version_info[0] == 3\n\nif PY3: # pragma: no cover\n string_types = str,\n integer_types = int,\n class_types = type,\n text_type = str\n long = int\nelse:\n string_types = basestring,\n integer_types = (int, long)\n class_types = (type, types.ClassType)\n text_type = unicode\n long = long\n\n# TODO check if errors is ever used\n\n\n\nif PY3: # pragma: no cover\nelse:\n\ntry:\n from queue import Queue, Empty\nexcept ImportError:\n from Queue import Queue, Empty\n\nif PY3: # pragma: no cover\n from urllib import parse\n urlparse = parse\n from urllib.parse import quote as url_quote\n from urllib.parse import urlencode as url_encode, quote_plus\n from urllib.request import urlopen as url_open\nelse:\n import urlparse\n from urllib import quote_plus\n from urllib import quote as url_quote\n from urllib import unquote as url_unquote\n from urllib import urlencode as url_encode\n from urllib2 import urlopen as url_open\n\nif PY3: # pragma: no cover\nelse: # pragma: no cover\n exec(\"def reraise(exc): raise exc[0], exc[1], exc[2]\")\n\n\nif PY3: # pragma: no cover\nelse:\n\n\nif PY3: # pragma: no cover\n\n\n\nelse:\n from urlparse import parse_qsl\n\n\n\nif PY3: # pragma no cover\n from html import escape\nelse:\n from cgi import escape\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "code", " ", "sto", "len", " ", "from", " ", "\"", "si", "x", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "we", " ", "are", " ", "runn", "ing", " ", "on", " ", "Pyth", "on", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "PY", "3_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "types_", "=_", "str_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "int_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "types_", "=_", "type_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "types_", "=_", "basestring_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "(_", "int_", ",_", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "types_", "=_", "(_", "type_", ",_", "types_", "._", "Class", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "check", " ", "if", " ", "error", "s", " ", "is", " ", "ever", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "queue_", "import_", "Queue_", ",_", "Empty_", "\\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_", "Queue_", "import_", "Queue_", ",_", "Empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "import_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlparse_", "=_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "quote_", "as_", "url", "\\u", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlencode_", "as_", "url", "\\u", "encode_", ",_", "quote", "\\u", "plus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "request_", "import_", "urlopen_", "as_", "url", "\\u", "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 ", " _", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote", "\\u", "plus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "as_", "url", "\\u", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "unquote_", "as_", "url", "\\u", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "as_", "url", "\\u", "encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "urlopen_", "as_", "url", "\\u", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "def", " ", "reraise", "(", "exc", "):", " ", "raise", " ", "exc", "[", "0", "],", " ", "exc", "[", "1", "],", " ", "exc", "[", "2", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "html_", "import_", "escape_", "\\u\\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_", "cgi_", "import_", "escape_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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