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
Variable defined multiple times
Workiva/furious/furious/tests/test_config.py
[ { "content": " def test_get_configured_persistence_exists(self):\n \"\"\"Ensure a chosen persistence module is selected.\"\"\"\n from furious.config import _parse_yaml_config\n\n example_yaml = str('secret_key: \"blah\"\\n'\n 'persistence: bubble\\n'\n 'task_system: flah\\n')\n\n my_config = _parse_yaml_config(example_yaml)\n\n from furious import config\n\n config._config = my_config\n\n persistence_module = config.get_default_persistence_engine(\n {'bubble': 'furious.config'})\n\n self.assertEqual(persistence_module, config)", "metadata": "root.TestConfigurationLoading.test_get_configured_persistence_exists", "header": "['class', 'TestConfigurationLoading', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Configura", "tion", "Load", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "configur", "ed", "\\u", "persiste", "nce", "\\u", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "a", " ", "chosen", " ", "persiste", "nce", " ", "module", " ", "is", " ", "selecte", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fur", "ious", "_", "._", "config_", "import_", "\\u", "parse", "\\u", "yaml", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example", "\\u", "yaml_", "=_", "str_", "(_", "'", "secret", "\\u", "key", ":", " ", "\"", "bla", "h", "\"\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "persiste", "nce", ":", " ", "bubble", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "\\u", "system", ":", " ", "fla", "h", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "config_", "=_", "\\u", "parse", "\\u", "yaml", "\\u", "config_", "(_", "example", "\\u", "yaml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fur", "ious", "_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "\\u", "config_", "=_", "my", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "persiste", "nce", "\\u", "module_", "=_", "config_", "._", "get", "\\u", "default", "\\u", "persiste", "nce", "\\u", "engine_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "bubble", "'_", ":_", "'", "fur", "ious", ".", "config", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "persiste", "nce", "\\u", "module_", ",_", "config_", ")_", "\\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 ]
Module is imported more than once
StackStorm/st2contrib/packs/trello/actions/view_boards.py
[ { "content": "from lib import action\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "lib_", "import_", "action_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
saltstack/salt/salt/pillar/consul_pillar.py
[ { "content": "def _resolve_datacenter(dc, pillarenv):\n '''\n If ``dc`` is a string - return it as is.\n\n If it's a dict then sort it in descending order by key length and try\n to use keys as RegEx patterns to match against ``pillarenv``.\n The value for matched pattern should be a string (that can use\n ``str.format`` syntax togetehr with captured variables from pattern)\n pointing to targe data center to use.\n\n If none patterns matched return ``None`` which meanse us datacenter of\n conencted Consul agent.\n '''\n log.debug(\"Resolving Consul datacenter based on: {dc}\".format(dc=dc))\n\n try:\n mappings = dc.items() # is it a dict?\n except AttributeError:\n log.debug('Using pre-defined DC: {dc!r}'.format(dc=dc))\n return dc\n\n log.debug(\n 'Selecting DC based on pillarenv using {num} pattern(s)'.format(\n num=len(mappings)\n )\n )\n log.debug('Pillarenv set to {env!r}'.format(env=pillarenv))\n\n # sort in reverse based on pattern length\n # but use alphabetic order within groups of patterns of same length\n sorted_mappings = sorted(mappings, key=lambda m: (-len(m[0]), m[0]))\n\n for pattern, target in sorted_mappings:\n match = re.match(pattern, pillarenv)\n if match:\n log.debug('Matched pattern: {pattern!r}'.format(pattern=pattern))\n result = target.format(**match.groupdict())\n log.debug('Resolved datacenter: {result!r}'.format(result=result))\n return result\n\n log.debug(\n 'None of following patterns matched pillarenv={env}: {lst}'.format(\n env=pillarenv, lst=', '.join(repr(x) for x in mappings)\n )\n )", "metadata": "root._resolve_datacenter", "header": "['module', '___EOS___']", "index": 268 } ]
[]
[]
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_", "\\u", "resolve", "\\u", "datacenter", "_", "(_", "dc_", ",_", "pillar", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "dc", "``", " ", "is", " ", "a", " ", "string", " ", "-", " ", "return", " ", "it", " ", "as", " ", "is", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "it", "'", "s", " ", "a", " ", "dict", " ", "then", " ", "sort", " ", "it", " ", "in", " ", "descend", "ing", " ", "order", " ", "by", " ", "key", " ", "length", " ", "and", " ", "try", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "use", " ", "keys", " ", "as", " ", "Reg", "Ex", " ", "pattern", "s", " ", "to", " ", "match", " ", "against", " ", "``", "pillar", "env", "``.", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "value", " ", "for", " ", "matche", "d", " ", "pattern", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", " ", "(", "tha", "t", " ", "can", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "``", "str", ".", "format", "``", " ", "synta", "x", " ", "tog", "ete", "hr", " ", "with", " ", "captured", " ", "variab", "les", " ", "from", " ", "pattern", ")", "\\", "10", ";", " ", " ", " ", " ", "pointi", "ng", " ", "to", " ", "targ", "e", " ", "data", " ", "center", " ", "to", " ", "use", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "none", " ", "pattern", "s", " ", "matche", "d", " ", "return", " ", "``", "Non", "e", "``", " ", "whi", "ch", " ", "means", "e", " ", "us", " ", "datacenter", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "cone", "nct", "ed", " ", "Consu", "l", " ", "agent", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Resolv", "ing", " ", "Consu", "l", " ", "datacenter", " ", "based", " ", "on", ":", " ", "{", "dc", "}\"_", "._", "format_", "(_", "dc_", "=_", "dc_", ")_", ")_", "\\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 ", " _", "mappings_", "=_", "dc_", "._", "items_", "(_", ")_", "#", " ", "is", " ", "it", " ", "a", " ", "dict", "?", "_", "\\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 ", " _", "log_", "._", "debug_", "(_", "'", "Us", "ing", " ", "pre", "-", "defin", "ed", " ", "DC", ":", " ", "{", "dc", "!", "r", "}'_", "._", "format_", "(_", "dc_", "=_", "dc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Selecti", "ng", " ", "DC", " ", "based", " ", "on", " ", "pillar", "env", " ", "usi", "ng", " ", "{", "num", "}", " ", "pattern", "(", "s", ")'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "num_", "=_", "len_", "(_", "mappings_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Pil", "lar", "env", " ", "set", " ", "to", " ", "{", "env", "!", "r", "}'_", "._", "format_", "(_", "env_", "=_", "pillar", "env_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sort", " ", "in", " ", "reverse", " ", "based", " ", "on", " ", "pattern", " ", "length_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "use", " ", "alphabetic", " ", "order", " ", "within", " ", "group", "s", " ", "of", " ", "pattern", "s", " ", "of", " ", "same", " ", "length_", "\\u\\u\\uNL\\u\\u\\u_", "sorte", "d\\u", "mappings_", "=_", "sorted_", "(_", "mappings_", ",_", "key_", "=_", "lambda_", "m_", ":_", "(_", "-_", "len_", "(_", "m_", "[_", "0_", "]_", ")_", ",_", "m_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pattern_", ",_", "target_", "in_", "sorte", "d\\u", "mappings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "match_", "(_", "pattern_", ",_", "pillar", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Matched", " ", "pattern", ":", " ", "{", "pattern", "!", "r", "}'_", "._", "format_", "(_", "pattern_", "=_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "target_", "._", "format_", "(_", "**_", "match_", "._", "groupdict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Resolved", " ", "datacenter", ":", " ", "{", "result", "!", "r", "}'_", "._", "format_", "(_", "result_", "=_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Non", "e", " ", "of", " ", "follow", "ing", " ", "pattern", "s", " ", "matche", "d", " ", "pillar", "env", "={", "env", "}:", " ", "{", "lst", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "pillar", "env_", ",_", "lst_", "=_", "',", " ", "'_", "._", "join_", "(_", "repr_", "(_", "x_", ")_", "for_", "x_", "in_", "mappings_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
django/django/django/contrib/admin/options.py
[ { "content": " def has_change_permission(self, request, obj=None):\n opts = self.opts\n if opts.auto_created:\n # The model was auto-created as intermediary for a\n # ManyToMany-relationship, find the target model\n for field in opts.fields:\n if field.remote_field and field.remote_field.model != self.parent_model:\n opts = field.remote_field.model._meta\n break\n codename = get_permission_codename('change', opts)\n return request.user.has_perm(\"%s.%s\" % (opts.app_label, codename))", "metadata": "root.InlineModelAdmin.has_change_permission", "header": "['class', 'InlineModelAdmin', '(', 'BaseModelAdmin', ')', ':', '___EOS___']", "index": 1971 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "In", "line", "Model", "Admin_", "(_", "Base", "Model", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "change", "\\u", "permission_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "self_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "auto", "\\u", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "model", " ", "was", " ", "auto", "-", "created", " ", "as", " ", "interm", "edia", "ry", " ", "for", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Many", "To", "Many", "-", "relation", "ship", ",", " ", "find", " ", "the", " ", "target", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "opts_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "remote", "\\u", "field_", "and_", "field_", "._", "remote", "\\u", "field_", "._", "model_", "!=_", "self_", "._", "parent", "\\u", "model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "opts_", "=_", "field_", "._", "remote", "\\u", "field_", "._", "model_", "._", "\\u", "meta_", "\\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_", "codename_", "=_", "get", "\\u", "permissi", "on", "\\u", "codename_", "(_", "'", "change", "'_", ",_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "._", "user_", "._", "has", "\\u", "perm_", "(_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "opts_", "._", "app", "\\u", "label_", ",_", "codename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tjguk/winsys/winsys/utils.py
[ { "content": "def size_as_mb(n_bytes):\n \"\"\"Convert a size in bytes to a human-readable form as follows:\n\n If < kb return the number unchanged\n If >= kb and < mb return number of kb\n If >= mb and < gb return number of mb\n Otherwise return number of gb\n \"\"\"\n n_kb, n_b = divmod(n_bytes, 1024)\n n_mb, n_kb = divmod(n_kb, 1024)\n n_gb, n_mb = divmod(n_mb, 1024)\n if n_gb > 0:\n return \"%3.2fGb\" % (n_bytes / 1024.0 / 1024.0 / 1024.0)\n elif n_mb > 0:\n return \"%3.2fMb\" % (n_bytes / 1024.0 / 1024.0)\n elif n_kb > 0:\n return \"%3.2fkb\" % (n_bytes / 1024.0)\n else:\n return \"%d\" % n_bytes", "metadata": "root.size_as_mb", "header": "['module', '___EOS___']", "index": 63 } ]
[]
[]
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_", "size", "\\u", "as", "\\u", "mb_", "(_", "n", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "size", " ", "in", " ", "bytes", " ", "to", " ", "a", " ", "human", "-", "reada", "ble", " ", "form", " ", "as", " ", "follow", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "<", " ", "kb", " ", "return", " ", "the", " ", "number", " ", "unchanged", "\\", "10", ";", " ", " ", " ", " ", "If", " ", ">=", " ", "kb", " ", "and", " ", "<", " ", "mb", " ", "return", " ", "number", " ", "of", " ", "kb", "\\", "10", ";", " ", " ", " ", " ", "If", " ", ">=", " ", "mb", " ", "and", " ", "<", " ", "gb", " ", "return", " ", "number", " ", "of", " ", "mb", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", " ", "return", " ", "number", " ", "of", " ", "gb", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "kb_", ",_", "n", "\\u", "b_", "=_", "divmod_", "(_", "n", "\\u", "bytes_", ",_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "mb_", ",_", "n", "\\u", "kb_", "=_", "divmod_", "(_", "n", "\\u", "kb_", ",_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "gb_", ",_", "n", "\\u", "mb_", "=_", "divmod_", "(_", "n", "\\u", "mb_", ",_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n", "\\u", "gb_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "3.2", "f", "Gb", "\"_", "%_", "(_", "n", "\\u", "bytes_", "/_", "1024.", "0_", "/_", "1024.", "0_", "/_", "1024.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n", "\\u", "mb_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "3.2", "f", "Mb", "\"_", "%_", "(_", "n", "\\u", "bytes_", "/_", "1024.", "0_", "/_", "1024.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n", "\\u", "kb_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "3.2", "fk", "b", "\"_", "%_", "(_", "n", "\\u", "bytes_", "/_", "1024.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "d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
[ { "content": " def __init__(self, restype, parameters):\n if parameters and parameters[-1] == '...':\n # XXX Hmm, how to handle VARARGS with ctypes? For now,\n # drop it off (will cause errors).\n parameters = parameters[:-1]\n \n self.restype = restype\n\n # Don't allow POINTER(None) (c_void_p) as a restype... causes errors\n # when ctypes automagically returns it as an int.\n # Instead, convert to POINTER(c_void). c_void is not a ctypes type,\n # you can make it any arbitrary type.\n if type(self.restype) == CtypesPointer and \\\n type(self.restype.destination) == CtypesType and \\\n self.restype.destination.name == 'None':\n self.restype = CtypesPointer(CtypesType('c_void'), ())\n\n self.argtypes = [remove_function_pointer(\n get_ctypes_type(p.type, p.declarator)) \\\n for p in parameters]", "metadata": "root.CtypesFunction.__init__", "header": "['class', 'CtypesFunction', '(', 'CtypesType', ')', ':', '___EOS___']", "index": 158 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ct", "ype", "s", "Function_", "(_", "Ct", "ype", "s", "Type_", ")_", ":_", "\\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_", ",_", "restype_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parameters_", "and_", "parameters_", "[_", "-_", "1_", "]_", "==_", "'...'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "Hm", "m", ",", " ", "how", " ", "to", " ", "handle", " ", "VAR", "ARG", "S", " ", "with", " ", "ctype", "s", "?", " ", " ", "For", " ", "now", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "it", " ", "off", " ", "(", "will", " ", "caus", "e", " ", "error", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "=_", "parameters_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "restype_", "=_", "restype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "allow", " ", "POINTER", "(", "Non", "e", ")", " ", "(", "c\\u", "voi", "d\\u", "p", ")", " ", "as", " ", "a", " ", "rest", "ype", "...", " ", "caus", "es", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "ctype", "s", " ", "autom", "agi", "call", "y", " ", "return", "s", " ", "it", " ", "as", " ", "an", " ", "int", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ins", "tea", "d", ",", " ", "convert", " ", "to", " ", "POINTER", "(", "c\\u", "voi", "d", ").", " ", " ", "c\\u", "voi", "d", " ", "is", " ", "not", " ", "a", " ", "ctype", "s", " ", "type", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "can", " ", "make", " ", "it", " ", "any", " ", "arbitra", "ry", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "self_", "._", "restype_", ")_", "==_", "Ct", "ype", "s", "Pointer_", "and_", "type_", "(_", "self_", "._", "restype_", "._", "destination_", ")_", "==_", "Ct", "ype", "s", "Type_", "and_", "self_", "._", "restype_", "._", "destination_", "._", "name_", "==_", "'", "Non", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "restype_", "=_", "Ct", "ype", "s", "Pointer_", "(_", "Ct", "ype", "s", "Type_", "(_", "'", "c\\u", "voi", "d", "'_", ")_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "argtypes_", "=_", "[_", "remove", "\\u", "function", "\\u", "pointer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "ctype", "s", "\\u", "type_", "(_", "p_", "._", "type_", ",_", "p_", "._", "declar", "ator_", ")_", ")_", "for_", "p_", "in_", "parameters_", "]_", "\\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 ]
Variable defined multiple times
albatrossandco/brubeck_cms/brubeck/blogs/search_indexes.py
[ { "content": "class EntryIndex(indexes.SearchIndex):\n text = indexes.CharField(document=True, use_template=True)\n# title = indexes.CharField(model_attr='title')\n pub_date = indexes.DateTimeField(model_attr='pub_date')\n blog = indexes.CharField(model_attr='blog')\n blog_exact = indexes.CharField(model_attr='blog', indexed=False)\n byline = indexes.CharField(null=True)\n byline_exact = indexes.CharField(null=True, indexed=False)\n static_byline = indexes.CharField(model_attr='blog', null=True)\n# body = indexes.CharField(model_attr='body')\n tags = indexes.MultiValueField()\n tags_exact = indexes.MultiValueField(indexed=False)\n publication = indexes.CharField()\n publication_exact = indexes.CharField(indexed=False)\n\n rendered = indexes.CharField(use_template=True, indexed=False,)\n\n \n\n\n \n \n\n", "metadata": "root.EntryIndex", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Entr", "y", "Index_", "(_", "indexes_", "._", "Sear", "ch", "Index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "indexes_", "._", "Char", "Field_", "(_", "document_", "=_", "True_", ",_", "use", "\\u", "template_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "title", " ", "=", " ", "indexe", "s", ".", "Char", "Field", "(", "model", "\\u", "attr", "='", "title", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "date_", "=_", "indexes_", "._", "Date", "Time", "Field_", "(_", "model", "\\u", "attr_", "=_", "'", "pub", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blog_", "=_", "indexes_", "._", "Char", "Field_", "(_", "model", "\\u", "attr_", "=_", "'", "blog", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blog", "\\u", "exact_", "=_", "indexes_", "._", "Char", "Field_", "(_", "model", "\\u", "attr_", "=_", "'", "blog", "'_", ",_", "indexed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "by", "line_", "=_", "indexes_", "._", "Char", "Field_", "(_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "by", "line", "\\u", "exact_", "=_", "indexes_", "._", "Char", "Field_", "(_", "null_", "=_", "True_", ",_", "indexed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static", "\\u", "by", "line_", "=_", "indexes_", "._", "Char", "Field_", "(_", "model", "\\u", "attr_", "=_", "'", "blog", "'_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "body", " ", "=", " ", "indexe", "s", ".", "Char", "Field", "(", "model", "\\u", "attr", "='", "body", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "indexes_", "._", "Multi", "Value", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags", "\\u", "exact_", "=_", "indexes_", "._", "Multi", "Value", "Field_", "(_", "indexed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publicat", "ion_", "=_", "indexes_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publicat", "ion", "\\u", "exact_", "=_", "indexes_", "._", "Char", "Field_", "(_", "indexed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rendered_", "=_", "indexes_", "._", "Char", "Field_", "(_", "use", "\\u", "template_", "=_", "True_", ",_", "indexed_", "=_", "False_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 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 ]
Modification of parameter with default
django/django/django/db/models/fields/related_descriptors.py
[ { "content": " def __init__(self, rel):\n self.rel = rel\n self.field = rel.field", "metadata": "root.ReverseManyToOneDescriptor.__init__", "header": "['class', 'ReverseManyToOneDescriptor', '(', 'object', ')', ':', '___EOS___']", "index": 433 } ]
[]
[]
0
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "class_", "Revers", "e", "Many", "To", "One", "Descriptor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "rel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rel_", "=_", "rel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "field_", "=_", "rel_", "._", "field_", "\\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 ]
First parameter of a method is not named 'self'
st4lk/django-rest-social-auth/tests/test_social.py
[ { "content": " def test_login_social_oauth1_token(self):\n \"\"\"\n Currently oauth1 works only if session is enabled.\n Probably it is possible to make it work without session, but\n it will be needed to change the logic in python-social-auth.\n \"\"\"\n resp = self.client.post(reverse('login_social_token_user'),\n data={'provider': 'twitter'})\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.data, parse_qs(self.request_token_body))\n resp = self.client.post(reverse('login_social_token_user'), data={\n 'provider': 'twitter',\n 'oauth_token': 'foobar',\n 'oauth_verifier': 'overifier'\n })\n self.assertEqual(resp.status_code, 200)", "metadata": "root.TestSocialAuth1.test_login_social_oauth1_token", "header": "['class', 'TestSocialAuth1', '(', 'APITestCase', ',', 'BaseTwitterApiTestCase', ')', ':', '___EOS___']", "index": 136 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "Soci", "al", "Auth", "1_", "(_", "API", "Test", "Case_", ",_", "Base", "Twit", "ter", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "login", "\\u", "social", "\\u", "oauth", "1", "\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", "ly", " ", "oauth", "1", " ", "works", " ", "only", " ", "if", " ", "session", " ", "is", " ", "enable", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "Prob", "abl", "y", " ", "it", " ", "is", " ", "possib", "le", " ", "to", " ", "make", " ", "it", " ", "work", " ", "with", "out", " ", "session", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "will", " ", "be", " ", "need", "ed", " ", "to", " ", "change", " ", "the", " ", "logic", " ", "in", " ", "python", "-", "social", "-", "auth", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "'", "login", "\\u", "social", "\\u", "token", "\\u", "user", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "'", "provide", "r", "'_", ":_", "'", "twit", "ter", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "data_", ",_", "parse", "\\u", "qs_", "(_", "self_", "._", "request", "\\u", "token", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "'", "login", "\\u", "social", "\\u", "token", "\\u", "user", "'_", ")_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provide", "r", "'_", ":_", "'", "twit", "ter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oauth", "\\u", "token", "'_", ":_", "'", "fooba", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oauth", "\\u", "verifier", "'_", ":_", "'", "over", "ifie", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
exosite-labs/pyexompp/exompp/xmppchat.py
[ { "content": " def run ( self ):\n global kill_threads\n lastcik = ''\n lastringsize = 0\n message_output = True\n print \"Buffering started...\"\n while False == kill_threads:\n if self.ringItems > 0:\n device_cik = self.ring[self.ringTail]['device_cik']\n try:\n self.datasources[device_cik]\n except:\n self.datasources[device_cik] = self.exompp.listdatasources(device_cik)\n res_name = self.ring[self.ringTail]['res_name']\n res_value = self.ring[self.ringTail]['res_value']\n if self.ringTail + 1 > self.ringSize:\n #wrap tail\n self.ringTail = 0\n else: self.ringTail += 1\n # note interlocked vulnerability here - TODO figure out python\n # interlocked calls/mutexes\n if self.ringItems > 0: #just in case we overflowed in the meantime\n self.ringItems -= 1\n #set up device channel\n if lastcik != device_cik: \n lastcik = device_cik\n if -1 == self.exompp.setcik(device_cik):\n message_output = True\n print \"Failed to set CIK %s\" % device_cik\n lastcik = ''\n continue\n #find resource number from resource name\n try:\n res_number = self.datasources[device_cik][res_name]\n except:\n message_output = True\n print \"No datasource named %s, creating...\" % res_name\n res_number = 0\n try: \n for a,b in self.datasources[device_cik].iteritems():\n if int(b) > int(res_number): res_number = int(b)\n res_number += 1\n except:\n res_number = 1\n if -1 == self.exompp.createdatasource(res_name,res_number):\n print \"Data source problem (%s) - check limits, check name & resource # pairing\" % res_name\n continue\n else:\n self.datasources[device_cik] = self.exompp.listdatasources(device_cik)\n #write nfo. if write fails, try re-sending cik next go-around\n if -1 == self.exompp.write(res_number, res_value):\n message_output = True\n lastcik=''\n continue\n else: \n #all of this is just to create a buffer size indicator on stdout\n if True == message_output:\n print \"======================\"\n sys.stdout.write('BUFFER: ')\n message_output = False\n currentringitems = self.ringItems\n if lastringsize != currentringitems:\n bufstring = ''\n rewstring = ''\n if lastringsize < currentringitems:\n sizediff = currentringitems - lastringsize\n while sizediff > 0:\n bufstring += '*'\n sizediff -= 1\n sys.stdout.write(bufstring)\n else:\n sizediff = lastringsize - currentringitems\n while sizediff > 0:\n bufstring += ' '\n rewstring += '\\x08'\n sizediff -= 1\n sys.stdout.write(rewstring)\n sys.stdout.write(bufstring)\n sys.stdout.write(rewstring)\n lastringsize = currentringitems\n sys.stdout.flush()\n else: # if self.ringItems > 0\n time.sleep(1) # go to sleep for a second before looking again", "metadata": "root.PublishToExosite.run", "header": "['class', 'PublishToExosite', '(', 'threading', '.', 'Thread', ')', ':', '___NEWLINE___', '#===============================================================================', '___NL___', '#-------------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 73 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Publish", "To", "Exo", "site_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "kill", "\\u", "threads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastc", "ik_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastr", "ings", "ize_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Buffer", "ing", " ", "start", "ed", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "False_", "==_", "kill", "\\u", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ring", "Items_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "device", "\\u", "ci", "k_", "=_", "self_", "._", "ring_", "[_", "self_", "._", "ring", "Tail", "_", "]_", "[_", "'", "device", "\\u", "ci", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "datasources", "_", "[_", "device", "\\u", "ci", "k_", "]_", "\\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_", "._", "datasources", "_", "[_", "device", "\\u", "ci", "k_", "]_", "=_", "self_", "._", "exo", "mpp", "_", "._", "listd", "ata", "sources_", "(_", "device", "\\u", "ci", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "name_", "=_", "self_", "._", "ring_", "[_", "self_", "._", "ring", "Tail", "_", "]_", "[_", "'", "res", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "value_", "=_", "self_", "._", "ring_", "[_", "self_", "._", "ring", "Tail", "_", "]_", "[_", "'", "res", "\\u", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ring", "Tail", "_", "+_", "1_", ">_", "self_", "._", "ring", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "wrap", " ", "tail_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ring", "Tail", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "self_", "._", "ring", "Tail", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", " ", "interl", "ock", "ed", " ", "vulnerability", " ", "here", " ", "-", " ", "TOD", "O", " ", "figure", " ", "out", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interl", "ock", "ed", " ", "calls", "/", "mute", "xes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "ring", "Items_", ">_", "0_", ":_", "#", "just", " ", "in", " ", "case", " ", "we", " ", "overflow", "ed", " ", "in", " ", "the", " ", "mean", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ring", "Items_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "set", " ", "up", " ", "device", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lastc", "ik_", "!=_", "device", "\\u", "ci", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lastc", "ik_", "=_", "device", "\\u", "ci", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", "==_", "self_", "._", "exo", "mpp", "_", "._", "setc", "ik_", "(_", "device", "\\u", "ci", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Fail", "ed", " ", "to", " ", "set", " ", "CI", "K", " ", "%", "s", "\"_", "%_", "device", "\\u", "ci", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastc", "ik_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "find", " ", "resource", " ", "number", " ", "from", " ", "resource", " ", "name_", "\\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 ", " _", "res", "\\u", "number_", "=_", "self_", "._", "datasources", "_", "[_", "device", "\\u", "ci", "k_", "]_", "[_", "res", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "No", " ", "datas", "ource", " ", "named", " ", "%", "s", ",", " ", "creati", "ng", "...\"_", "%_", "res", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "number_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a_", ",_", "b_", "in_", "self_", "._", "datasources", "_", "[_", "device", "\\u", "ci", "k_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "b_", ")_", ">_", "int_", "(_", "res", "\\u", "number_", ")_", ":_", "res", "\\u", "number_", "=_", "int_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "number_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "number_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "-_", "1_", "==_", "self_", "._", "exo", "mpp", "_", "._", "created", "ata", "source_", "(_", "res", "\\u", "name_", ",_", "res", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Data", " ", "source", " ", "problem", " ", "(%", "s", ")", " ", "-", " ", "check", " ", "limit", "s", ",", " ", "check", " ", "name", " ", "&", " ", "resource", " ", "#", " ", "pairing", "\"_", "%_", "res", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "datasources", "_", "[_", "device", "\\u", "ci", "k_", "]_", "=_", "self_", "._", "exo", "mpp", "_", "._", "listd", "ata", "sources_", "(_", "device", "\\u", "ci", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "write", " ", "nfo", ".", " ", "if", " ", "write", " ", "fail", "s", ",", " ", "try", " ", "re", "-", "sendin", "g", " ", "ci", "k", " ", "next", " ", "go", "-", "around_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "-_", "1_", "==_", "self_", "._", "exo", "mpp", "_", "._", "write_", "(_", "res", "\\u", "number_", ",_", "res", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastc", "ik_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "all", " ", "of", " ", "this", " ", "is", " ", "just", " ", "to", " ", "create", " ", "a", " ", "buffer", " ", "size", " ", "indicat", "or", " ", "on", " ", "stdout_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "True_", "==_", "message", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"====", "==============", "====", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "BUFF", "ER", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "output_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "ring", "items_", "=_", "self_", "._", "ring", "Items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lastr", "ings", "ize_", "!=_", "current", "ring", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf", "string_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rew", "string_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lastr", "ings", "ize_", "<_", "current", "ring", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sized", "iff_", "=_", "current", "ring", "items_", "-_", "lastr", "ings", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "sized", "iff_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf", "string_", "+=_", "'*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sized", "iff_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "buf", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sized", "iff_", "=_", "lastr", "ings", "ize_", "-_", "current", "ring", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "sized", "iff_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf", "string_", "+=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rew", "string_", "+=_", "'\\\\", "x0", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sized", "iff_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "rew", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "buf", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "rew", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lastr", "ings", "ize_", "=_", "current", "ring", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "if", " ", "self", ".", "ring", "Item", "s", " ", ">", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "1_", ")_", "#", " ", "go", " ", "to", " ", "sleep", " ", "for", " ", "a", " ", "second", " ", "bef", "ore", " ", "look", "ing", " ", "again", "_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
django-notifications/django-notifications/notifications/tests/tests.py
[ { "content": " @override_settings(USE_TZ=False)\n @override_settings(TIME_ZONE='Asia/Shanghai')\n def test_disable_timezone(self):\n from_user = User.objects.create(username=\"from2\", password=\"pwd\", email=\"example@example.com\")\n to_user = User.objects.create(username=\"to2\", password=\"pwd\", email=\"example@example.com\")\n notify.send(from_user, recipient=to_user, verb='commented', action_object=from_user)\n notification = Notification.objects.get(recipient=to_user)\n delta = timezone.now() - notification.timestamp\n self.assertTrue(delta.seconds < 60)", "metadata": "root.NotificationTest.test_disable_timezone", "header": "['class', 'NotificationTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 42 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Notifi", "cation", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "override", "\\u", "settings_", "(_", "USE", "\\u", "TZ_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "override", "\\u", "settings_", "(_", "TIME", "\\u", "ZONE_", "=_", "'", "Asi", "a", "/", "Shang", "hai", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "disable", "\\u", "timezone_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "user_", "=_", "User_", "._", "objects_", "._", "create_", "(_", "username_", "=_", "\"", "from", "2", "\"_", ",_", "password_", "=_", "\"", "pwd", "\"_", ",_", "email_", "=_", "\"", "example", "@", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "user_", "=_", "User_", "._", "objects_", "._", "create_", "(_", "username_", "=_", "\"", "to", "2", "\"_", ",_", "password_", "=_", "\"", "pwd", "\"_", ",_", "email_", "=_", "\"", "example", "@", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notify_", "._", "send_", "(_", "from", "\\u", "user_", ",_", "recipient_", "=_", "to", "\\u", "user_", ",_", "verb_", "=_", "'", "commente", "d", "'_", ",_", "action", "\\u", "object_", "=_", "from", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notification_", "=_", "Notification_", "._", "objects_", "._", "get_", "(_", "recipient_", "=_", "to", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "timezone_", "._", "now_", "(_", ")_", "-_", "notification_", "._", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "delta_", "._", "seconds_", "<_", "60_", ")_", "\\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 ]
Unused import
VisTrails/VisTrails/vistrails/core/mashup/component.py
[ { "content": "###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: contact@vistrails.org\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\nfrom __future__ import division\n\nimport urllib\nfrom vistrails.core.mashup import conv_from_bool, conv_to_bool, convert_symbols\nfrom vistrails.db.domain import DBMashupComponent\n\nimport unittest\nfrom vistrails.db.domain import IdScope\nimport copy\n\n################################################################################\n \n################################################################################\n\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Component(DBMashupComponent):\n\n id = DBMashupComponent.db_id\n vttype = DBMashupComponent.db_vttype\n vtid = DBMashupComponent.db_vtid\n vtparent_type = DBMashupComponent.db_vtparent_type\n vtparent_id = DBMashupComponent.db_vtparent_id\n vtmid = DBMashupComponent.db_vtmid\n vtpos = DBMashupComponent.db_vtpos\n pos = DBMashupComponent.db_pos\n type = DBMashupComponent.db_type\n minVal = DBMashupComponent.db_minVal\n maxVal = DBMashupComponent.db_maxVal\n stepSize = DBMashupComponent.db_stepSize\n parent = DBMashupComponent.db_parent\n widget = DBMashupComponent.db_widget\n strvaluelist = DBMashupComponent.db_strvaluelist\n \n seq = property(_get_seq,_set_seq)\n \n val = property(_get_val,_set_val)\n \n valueList = property(_get_valuelist,_set_valuelist)\n\n \n \n \n ##########################################################################\n # Serialization / Unserialization\n \n# def toXml(self, node=None):\n# \"\"\"toXml(node: ElementTree.Element) -> ElementTree.Element\n# writes itself to xml\n# \"\"\"\n# if node is None:\n# node = ElementTree.Element('component')\n# #set attributes\n# node.set('id', self.convert_to_str(self.id,'long'))\n# node.set('vttype', self.convert_to_str(self.vttype,'str'))\n# node.set('vtid', self.convert_to_str(self.vtid,'long'))\n# node.set('vtparent_type', self.convert_to_str(self.vtparent_type,'str'))\n# node.set('vtparent_id', self.convert_to_str(self.vtparent_id,'long'))\n# node.set('vtmid', self.convert_to_str(self.vtmid,'long'))\n# node.set('vtpos', self.convert_to_str(self.vtpos,'long'))\n# \n# node.set('pos', self.convert_to_str(self.pos,'long'))\n# node.set('type', self.convert_to_str(self.type,'str'))\n# \n# node.set('val', self.convert_to_str(self.val, 'str'))\n# node.set('minVal', self.convert_to_str(self.minVal,'str'))\n# node.set('maxVal', self.convert_to_str(self.maxVal,'str'))\n# node.set('stepSize', self.convert_to_str(self.stepSize,'str'))\n# node.set('valueList',self.convert_to_str(self.strvaluelist,'str'))\n# node.set('parent', self.convert_to_str(self.parent,'str'))\n# node.set('seq', self.convert_to_str(self.seq,'bool'))\n# node.set('widget',self.convert_to_str(self.widget,'str'))\n# return node\n#\n# @staticmethod\n# def fromXml(node):\n# if node.tag != 'component':\n# return None\n#\n# #read attributes\n# data = node.get('id', None)\n# id = Component.convert_from_str(data, 'long')\n# data = node.get('vttype', None)\n# vttype = Component.convert_from_str(data, 'str')\n# data = node.get('vtid', None)\n# vtid = Component.convert_from_str(data, 'long')\n# data = node.get('vtparent_type', None)\n# vtparent_type = Component.convert_from_str(data, 'str')\n# data = node.get('vtparent_id', None)\n# vtparent_id = Component.convert_from_str(data, 'long')\n# data = node.get('vtmid', None)\n# vtmid = Component.convert_from_str(data, 'long')\n# data = node.get('vtpos', None)\n# vtpos = Component.convert_from_str(data, 'long')\n# data = node.get('pos', None)\n# pos = Component.convert_from_str(data, 'long')\n# data = node.get('type', None)\n# type = Component.convert_from_str(data, 'str')\n# data = node.get('val', None)\n# val = Component.convert_from_str(data, 'str')\n# val = val.replace(\"&lt;\", \"<\")\n# val = val.replace(\"&gt;\", \">\")\n# val = val.replace(\"&amp;\",\"&\")\n# data = node.get('minVal', None)\n# minVal = Component.convert_from_str(data, 'str')\n# data = node.get('maxVal', None)\n# maxVal = Component.convert_from_str(data, 'str')\n# data = node.get('stepSize', None)\n# stepSize = Component.convert_from_str(data, 'str')\n# data = node.get('valueList', None)\n# values = Component.convert_from_str(data, 'str')\n# values = values.replace(\"&lt;\", \"<\")\n# values = values.replace(\"&gt;\", \">\")\n# values = values.replace(\"&amp;\",\"&\")\n# data = node.get('parent', None)\n# parent = Component.convert_from_str(data, 'str')\n# data = node.get('seq', None)\n# seq = Component.convert_from_str(data, 'bool')\n# data = node.get('widget', None)\n# widget = Component.convert_from_str(data, 'str')\n# \n# component = Component(id=id, vttype=vttype, param_id=vtid, \n# parent_vttype=vtparent_type, \n# parent_id=vtparent_id, mid=vtmid, type=type,\n# value=val, p_pos=vtpos, pos=pos,\n# minVal=minVal,\n# maxVal=maxVal,\n# stepSize=stepSize,\n# strvaluelist=values,\n# parent=parent,\n# seq=seq,\n# widget=widget)\n# return component\n\n ##########################################################################\n # Operators\n\n\n", "metadata": "root.Component", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def __init__(self, id, vttype, param_id, parent_vttype, parent_id, mid, \n type, value, p_pos, pos, strvaluelist, minVal=\"0\",\n maxVal=\"1\", stepSize=\"1\", parent='', seq=0, widget=\"text\"):\n \n \"\"\"Component() \n widget can be: text, slider, combobox, numericstepper, checkbox\n\n \"\"\"\n DBMashupComponent.__init__(self, id, param_id, vttype, parent_vttype, \n parent_id, p_pos, mid, pos, type, value, \n minVal, maxVal, stepSize, strvaluelist, \n widget, seq, parent)\n if isinstance(seq, bool):\n self.seq = seq", "metadata": "root.Component.__init__", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 47 }, { "content": " def _get_seq(self):\n return conv_to_bool(self.db_seq)", "metadata": "root.Component._get_seq", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 78 }, { "content": " def _set_seq(self, s):\n self.db_seq = conv_from_bool(s)", "metadata": "root.Component._set_seq", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 80 }, { "content": " def _get_val(self):\n self.db_val = convert_symbols(self.db_val)\n return self.db_val", "metadata": "root.Component._get_val", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 84 }, { "content": " def _set_val(self, v):\n self.db_val = v", "metadata": "root.Component._set_val", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 87 }, { "content": " def _get_valuelist(self):\n self.strvaluelist = convert_symbols(self.strvaluelist)\n data = self.strvaluelist.split(',')\n result = []\n for d in data:\n result.append(urllib.unquote_plus(d))\n return result", "metadata": "root.Component._get_valuelist", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 91 }, { "content": " def _set_valuelist(self, valuelist):\n q = []\n for v in valuelist:\n q.append(urllib.quote_plus(v))\n self.strvaluelist = \",\".join(q)", "metadata": "root.Component._set_valuelist", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 98 }, { "content": " @staticmethod\n def convert(_component):\n _component.__class__ = Component", "metadata": "root.Component.convert", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 105 }, { "content": " def __copy__(self):\n return Component.do_copy(self)", "metadata": "root.Component.__copy__", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 109 }, { "content": " def do_copy(self, new_ids=False, id_scope=None, id_remap=None):\n \"\"\"do_copy() -> Component \n returns a clone of itself\"\"\"\n cp = DBMashupComponent.do_copy(self, new_ids, id_scope, id_remap) \n Component.convert(cp)\n return cp", "metadata": "root.Component.do_copy", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 112 }, { "content": " def __str__(self):\n \"\"\" __str__() -> str - Returns a string representation of itself \"\"\"\n \n return (\"(Component id='%s' vttype='%s' vtid='%s' vtparent_type='%s' \\\nvtparent_id='%s' vtmid='%s' vtpos='%s' type='%s' pos='%s' val='%s' minVal='%s' \\\nmaxVal='%s' stepSize='%s' strvaluelist='%s' parent='%s' seq='%s' widget='%s')@%X\" %\n (self.id,\n self.vttype,\n self.vtid,\n self.vtparent_type,\n self.vtparent_id,\n self.vtmid,\n self.vtpos,\n self.type,\n self.pos,\n self.val,\n self.minVal,\n self.maxVal,\n self.stepSize,\n self.strvaluelist,\n self.parent,\n self.seq,\n self.widget,\n id(self)))", "metadata": "root.Component.__str__", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 213 }, { "content": " def __eq__(self, other):\n \"\"\" __eq__(other: Component) -> boolean\n Returns True if self and other have the same attributes. Used by == \n operator. \n \n \"\"\"\n if type(self) != type(other):\n return False\n if self.vttype != other.vttype:\n return False\n if self.vtid != other.vtid:\n return False\n if self.vtparent_type != other.vtparent_type:\n return False\n if self.vtparent_id != other.vtparent_id:\n return False\n if self.vtmid != other.vtmid:\n return False\n if self.vtpos != other.vtpos:\n return False\n if self.type != other.type:\n return False\n if self.pos != other.pos:\n return False\n if self.val != other.val:\n return False\n if self.minVal != other.minVal:\n return False\n if self.maxVal != other.maxVal:\n return False\n if self.stepSize != other.stepSize:\n return False\n if self.strvaluelist != other.strvaluelist:\n return False\n if self.parent != other.parent:\n return False\n if self.seq != other.seq:\n return False\n if self.widget != other.widget:\n return False\n return True", "metadata": "root.Component.__eq__", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 238 }, { "content": " def __ne__(self, other):\n \"\"\" __ne__(other: Component) -> boolean\n Returns True if self and other don't have the same attributes. \n Used by != operator. \n \n \"\"\"\n return not self.__eq__(other)", "metadata": "root.Component.__ne__", "header": "['class', 'Component', '(', 'DBMashupComponent', ')', ':', '___EOS___']", "index": 280 }, { "content": "class TestComponent(unittest.TestCase):\n \n \n \n# #testing values with , after serialization\n# c1.valueList = ['a,b,c', '123', ',as']\n# c2 = Component.fromXml(c1.toXml())\n# self.assertEqual(c1.strvaluelist, c2.strvaluelist)\n# self.assertEqual(c1.valueList, c2.valueList)\n# self.assertEqual(c2.valueList, ['a,b,c', '123', ',as'])\n ", "metadata": "root.TestComponent", "header": "['module', '___EOS___']", "index": 291 }, { "content": " def create_component(self, id_scope=IdScope()):\n c = Component(id=id_scope.getNewId('mashup_component'),\n vttype='parameter', param_id=15L, \n parent_vttype='function', parent_id=3L, mid=4L,\n type='String', value='test', p_pos=0, pos=1, \n strvaluelist='test1,test2', widget=\"text\")\n return c", "metadata": "root.TestComponent.create_component", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def test_copy(self):\n id_scope = IdScope()\n c1 = self.create_component(id_scope)\n c2 = copy.copy(c1)\n self.assertEqual(c1, c2)\n self.assertEqual(c1.id, c2.id)\n c3 = c2.do_copy(True, id_scope, {})\n self.assertEqual(c1,c3)\n self.assertNotEqual(c1.id, c3.id)", "metadata": "root.TestComponent.test_copy", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def test_valuelist(self):\n c1 = self.create_component()\n c1.strvaluelist = \"1,2,3\"\n self.assertEqual(['1','2','3'], c1.valueList)\n c1.valueList = ['1','2','3']\n self.assertEqual(c1.strvaluelist,\"1,2,3\")", "metadata": "root.TestComponent.test_valuelist", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 310 }, { "content": " def test_str(self):\n c1 = self.create_component()\n str(c1)", "metadata": "root.TestComponent.test_str", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 324 } ]
[]
[]
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_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", "-", "2016", ",", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2014", ",", " ", "NY", "U", "-", "Poly", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2011", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Conta", "ct", ":", " ", "contact", "@", "vist", "rail", "s", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\"", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "mas", "hu", "p_", "import_", "conv", "\\u", "from", "\\u", "bool_", ",_", "conv", "\\u", "to", "\\u", "bool_", ",_", "convert", "\\u", "symbols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "domain_", "import_", "DB", "Mas", "hu", "p", "Component_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "domain_", "import_", "Id", "Scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\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_", "id_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "type_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "id_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "parent", "\\u", "type_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "parent", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "parent", "\\u", "id_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "parent", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "mid_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "mid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt", "pos_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "vt", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Val_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "min", "Val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Val_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "max", "Val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Size_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "step", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str", "value", "list_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "db", "\\u", "str", "value", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seq_", "=_", "property_", "(_", "\\u", "get", "\\u", "seq_", ",_", "\\u", "set\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "property_", "(_", "\\u", "get", "\\u", "val_", ",_", "\\u", "set\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value", "List_", "=_", "property_", "(_", "\\u", "get", "\\u", "value", "list_", ",_", "\\u", "set\\u", "value", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Serializa", "tion", " ", "/", " ", "Unse", "rial", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "to", "Xm", "l", "(", "self", ",", " ", "node", "=", "Non", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"", "to", "Xm", "l", "(", "node", ":", " ", "Element", "Tree", ".", "Element", ")", " ", "->", " ", "Element", "Tree", ".", "Element_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "writes", " ", "its", "elf", " ", "to", " ", "xml_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "node", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", " ", "=", " ", "Element", "Tree", ".", "Element", "('", "component", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "set", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "id", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "id", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "type", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "type", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "id", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "id", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "parent", "\\u", "type", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "parent", "\\u", "type", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "parent", "\\u", "id", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "parent", "\\u", "id", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "mid", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "mid", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "vt", "pos", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "vt", "pos", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "pos", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "pos", ",'", "long", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "type", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "type", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "val", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "val", ",", " ", "'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "min", "Val", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "min", "Val", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "max", "Val", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "max", "Val", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "step", "Size", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "step", "Size", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "value", "List", "',", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "str", "value", "list", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "parent", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "parent", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "seq", "',", " ", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "seq", ",'", "bool", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "set", "('", "widget", "',", "self", ".", "convert", "\\u", "to", "\\u", "str", "(", "self", ".", "widget", ",'", "str", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "@", "staticmethod_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "from", "Xm", "l", "(", "node", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "node", ".", "tag", " ", "!=", " ", "'", "component", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "read", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "id", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "id", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "type", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "type", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "id", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "id", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "parent", "\\u", "type", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "parent", "\\u", "type", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "parent", "\\u", "id", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "parent", "\\u", "id", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "mid", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "mid", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "vt", "pos", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vt", "pos", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "pos", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pos", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "long", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "type", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "type", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "val", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "val", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "val", " ", "=", " ", "val", ".", "replace", "(\"", "&", "lt", ";", "\",", " ", "\"<", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "val", " ", "=", " ", "val", ".", "replace", "(\"", "&", "gt", ";", "\",", " ", "\">", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "val", " ", "=", " ", "val", ".", "replace", "(\"", "&", "amp", ";", "\",\"", "&", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "min", "Val", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "min", "Val", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "max", "Val", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "max", "Val", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "step", "Size", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "step", "Size", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "value", "List", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "values", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "values", " ", "=", " ", "values", ".", "replace", "(\"", "&", "lt", ";", "\",", " ", "\"<", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "values", " ", "=", " ", "values", ".", "replace", "(\"", "&", "gt", ";", "\",", " ", "\">", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "values", " ", "=", " ", "values", ".", "replace", "(\"", "&", "amp", ";", "\",\"", "&", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "parent", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "parent", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "seq", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "seq", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "bool", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", " ", "=", " ", "node", ".", "get", "('", "widget", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "widget", " ", "=", " ", "Compo", "nent", ".", "convert", "\\u", "from", "\\u", "str", "(", "data", ",", " ", "'", "str", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "component", " ", "=", " ", "Compo", "nent", "(", "id", "=", "id", ",", " ", "vt", "type", "=", "vt", "type", ",", " ", "param", "\\u", "id", "=", "vt", "id", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "parent", "\\u", "vt", "type", "=", "vt", "parent", "\\u", "type", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "parent", "\\u", "id", "=", "vt", "parent", "\\u", "id", ",", " ", "mid", "=", "vt", "mid", ",", " ", "type", "=", "type", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "value", "=", "val", ",", " ", "p", "\\u", "pos", "=", "vt", "pos", ",", " ", "pos", "=", "pos", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "min", "Val", "=", "min", "Val", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "max", "Val", "=", "max", "Val", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "step", "Size", "=", "step", "Size", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "str", "value", "list", "=", "values", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "parent", "=", "parent", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "seq", "=", "seq", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "widget", "=", "widget", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Operators", "_", "\\u\\u\\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_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\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_", ",_", "id_", ",_", "vt", "type_", ",_", "param", "\\u", "id_", ",_", "parent", "\\u", "vt", "type_", ",_", "parent", "\\u", "id_", ",_", "mid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", ",_", "value_", ",_", "p", "\\u", "pos_", ",_", "pos_", ",_", "str", "value", "list_", ",_", "min", "Val_", "=_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Val_", "=_", "\"", "1", "\"_", ",_", "step", "Size_", "=_", "\"", "1", "\"_", ",_", "parent_", "=_", "''_", ",_", "seq_", "=_", "0_", ",_", "widget_", "=_", "\"", "text", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compo", "nent", "()", " ", "\\", "10", ";", " ", " ", " ", " ", "widget", " ", "can", " ", "be", ":", " ", "text", ",", " ", "slide", "r", ",", " ", "combobox", ",", " ", "numeri", "cst", "ep", "per", ",", " ", "checkb", "ox", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DB", "Mas", "hu", "p", "Component_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", ",_", "param", "\\u", "id_", ",_", "vt", "type_", ",_", "parent", "\\u", "vt", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u", "id_", ",_", "p", "\\u", "pos_", ",_", "mid_", ",_", "pos_", ",_", "type_", ",_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "Val_", ",_", "max", "Val_", ",_", "step", "Size_", ",_", "str", "value", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", ",_", "seq_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "seq_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "seq_", "=_", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "seq_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "conv", "\\u", "to", "\\u", "bool_", "(_", "self_", "._", "db", "\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "seq_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db", "\\u", "seq_", "=_", "conv", "\\u", "from", "\\u", "bool_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "val_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db", "\\u", "val_", "=_", "convert", "\\u", "symbols_", "(_", "self_", "._", "db", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "db", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "val_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db", "\\u", "val_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "value", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "value", "list_", "=_", "convert", "\\u", "symbols_", "(_", "self_", "._", "str", "value", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "str", "value", "list_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "urllib_", "._", "unqu", "ote", "\\u", "plus_", "(_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "value", "list_", "(_", "self_", ",_", "value", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "value", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "._", "append_", "(_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "str", "value", "list_", "=_", "\",\"_", "._", "join_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "convert_", "(_", "\\u", "component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "component_", "._", "\\u\\u", "class\\u\\u_", "=_", "Component_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "copy", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Component_", "._", "do", "\\u", "copy_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "copy_", "(_", "self_", ",_", "new", "\\u", "ids_", "=_", "False_", ",_", "id", "\\u", "scope_", "=_", "None_", ",_", "id", "\\u", "remap", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "do", "\\u", "copy", "()", " ", "->", " ", "Compo", "nent", " ", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "a", " ", "clone", " ", "of", " ", "its", "elf", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cp_", "=_", "DB", "Mas", "hu", "p", "Component_", "._", "do", "\\u", "copy_", "(_", "self_", ",_", "new", "\\u", "ids_", ",_", "id", "\\u", "scope_", ",_", "id", "\\u", "remap", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Component_", "._", "convert_", "(_", "cp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\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 ", " _", "\"\"\"", " ", "\\u\\u", "str", "\\u\\u()", " ", "->", " ", "str", " ", "-", " ", "Return", "s", " ", "a", " ", "string", " ", "represent", "ation", " ", "of", " ", "its", "elf", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "\"(", "Compo", "nent", " ", "id", "='", "%", "s", "'", " ", "vt", "type", "='", "%", "s", "'", " ", "vt", "id", "='", "%", "s", "'", " ", "vt", "parent", "\\u", "type", "='", "%", "s", "'", " ", "\\\\", "\\", "10", ";", "vt", "parent", "\\u", "id", "='", "%", "s", "'", " ", "vt", "mid", "='", "%", "s", "'", " ", "vt", "pos", "='", "%", "s", "'", " ", "type", "='", "%", "s", "'", " ", "pos", "='", "%", "s", "'", " ", "val", "='", "%", "s", "'", " ", "min", "Val", "='", "%", "s", "'", " ", "\\\\", "\\", "10", ";", "max", "Val", "='", "%", "s", "'", " ", "step", "Size", "='", "%", "s", "'", " ", "str", "value", "list", "='", "%", "s", "'", " ", "parent", "='", "%", "s", "'", " ", "seq", "='", "%", "s", "'", " ", "widget", "='", "%", "s", "')", "@", "%", "X", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "parent", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "parent", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "mid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vt", "pos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "min", "Val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "step", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "str", "value", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seq_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "(_", "self_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\u\\u", "eq", "\\u\\u", "(", "other", ":", " ", "Compo", "nent", ")", " ", "->", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "self", " ", "and", " ", "other", " ", "have", " ", "the", " ", "same", " ", "attribute", "s", ".", " ", "Us", "ed", " ", "by", " ", "==", " ", "\\", "10", ";", " ", " ", " ", " ", "opera", "tor", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "self_", ")_", "!=_", "type_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "type_", "!=_", "other_", "._", "vt", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "id_", "!=_", "other_", "._", "vt", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "parent", "\\u", "type_", "!=_", "other_", "._", "vt", "parent", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "parent", "\\u", "id_", "!=_", "other_", "._", "vt", "parent", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "mid_", "!=_", "other_", "._", "vt", "mid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vt", "pos_", "!=_", "other_", "._", "vt", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "type_", "!=_", "other_", "._", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "pos_", "!=_", "other_", "._", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "val_", "!=_", "other_", "._", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "min", "Val_", "!=_", "other_", "._", "min", "Val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "Val_", "!=_", "other_", "._", "max", "Val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "step", "Size_", "!=_", "other_", "._", "step", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "str", "value", "list_", "!=_", "other_", "._", "str", "value", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "!=_", "other_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "seq_", "!=_", "other_", "._", "seq_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "widget_", "!=_", "other_", "._", "widget_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Component_", "(_", "DB", "Mas", "hu", "p", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\u\\u", "ne", "\\u\\u", "(", "other", ":", " ", "Compo", "nent", ")", " ", "->", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "self", " ", "and", " ", "other", " ", "don", "'", "t", " ", "have", " ", "the", " ", "same", " ", "attribute", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "by", " ", "!=", " ", " ", "opera", "tor", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Component_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "testi", "ng", " ", "values", " ", "with", " ", ",", " ", "after", " ", "serialization_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "c1", ".", "value", "List", " ", "=", " ", "['", "a", ",", "b", ",", "c", "',", " ", "'", "123", "',", " ", "',", "as", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "c2", " ", "=", " ", "Compo", "nent", ".", "from", "Xm", "l", "(", "c1", ".", "to", "Xm", "l", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "c1", ".", "str", "value", "list", ",", " ", "c2", ".", "str", "value", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "c1", ".", "value", "List", ",", " ", "c2", ".", "value", "List", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "c2", ".", "value", "List", ",", " ", "['", "a", ",", "b", ",", "c", "',", " ", "'", "123", "',", " ", "',", "as", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Component_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create", "\\u", "component_", "(_", "self_", ",_", "id", "\\u", "scope_", "=_", "Id", "Scope_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Component_", "(_", "id_", "=_", "id", "\\u", "scope_", "._", "get", "New", "Id_", "(_", "'", "mas", "hu", "p", "\\u", "component", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vt", "type_", "=_", "'", "parameter", "'_", ",_", "param", "\\u", "id_", "=_", "15_", "L_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u", "vt", "type_", "=_", "'", "function", "'_", ",_", "parent", "\\u", "id_", "=_", "3_", "L_", ",_", "mid_", "=_", "4_", "L_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "String", "'_", ",_", "value_", "=_", "'", "test", "'_", ",_", "p", "\\u", "pos_", "=_", "0_", ",_", "pos_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str", "value", "list_", "=_", "'", "test", "1", ",", "test", "2", "'_", ",_", "widget_", "=_", "\"", "text", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Component_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "\\u", "scope_", "=_", "Id", "Scope_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "self_", "._", "create", "\\u", "component_", "(_", "id", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "copy_", "._", "copy_", "(_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c1_", ",_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c1_", "._", "id_", ",_", "c2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "c2_", "._", "do", "\\u", "copy_", "(_", "True_", ",_", "id", "\\u", "scope_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c1_", ",_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "c1_", "._", "id_", ",_", "c3_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Component_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "value", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "self_", "._", "create", "\\u", "component_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "._", "str", "value", "list_", "=_", "\"", "1", ",", "2", ",", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "'", "1", "'_", ",_", "'", "2", "'_", ",_", "'", "3", "'_", "]_", ",_", "c1_", "._", "value", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "._", "value", "List_", "=_", "[_", "'", "1", "'_", ",_", "'", "2", "'_", ",_", "'", "3", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c1_", "._", "str", "value", "list_", ",_", "\"", "1", ",", "2", ",", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Component_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/email/generator.py
[ { "content": " def _dispatch(self, msg):\n # Get the Content-Type: for the message, then try to dispatch to\n # self._handle_<maintype>_<subtype>(). If there's no handler for the\n # full MIME type, then dispatch to self._handle_<maintype>(). If\n # that's missing too, then dispatch to self._writeBody().\n main = msg.get_content_maintype()\n sub = msg.get_content_subtype()\n specific = UNDERSCORE.join((main, sub)).replace('-', '_')\n meth = getattr(self, '_handle_' + specific, None)\n if meth is None:\n generic = main.replace('-', '_')\n meth = getattr(self, '_handle_' + generic, None)\n if meth is None:\n meth = self._writeBody\n meth(msg)", "metadata": "root.Generator._dispatch", "header": "['class', 'Generator', '(', 'object', ')', ':', '___EOS___']", "index": 194 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dispatch_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "Conten", "t", "-", "Type", ":", " ", "for", " ", "the", " ", "message", ",", " ", "then", " ", "try", " ", "to", " ", "dispatch", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".\\u", "handle", "\\u", "<", "maint", "ype", ">\\u", "<", "subt", "ype", ">(", ").", " ", " ", "If", " ", "there", "'", "s", " ", "no", " ", "handler", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "full", " ", "MIME", " ", "type", ",", " ", "then", " ", "dispatch", " ", "to", " ", "self", ".\\u", "handle", "\\u", "<", "maint", "ype", ">(", ").", " ", " ", "If_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", "'", "s", " ", "missi", "ng", " ", "too", ",", " ", "then", " ", "dispatch", " ", "to", " ", "self", ".\\u", "write", "Bod", "y", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "=_", "msg_", "._", "get", "\\u", "content", "\\u", "maint", "ype_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "msg_", "._", "get", "\\u", "content", "\\u", "subtype_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "specific_", "=_", "UNDER", "SCORE", "_", "._", "join_", "(_", "(_", "main_", ",_", "sub_", ")_", ")_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meth_", "=_", "getattr_", "(_", "self_", ",_", "'\\u", "handle", "\\u'_", "+_", "specific_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "meth_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generic_", "=_", "main_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meth_", "=_", "getattr_", "(_", "self_", ",_", "'\\u", "handle", "\\u'_", "+_", "generic_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "meth_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meth_", "=_", "self_", "._", "\\u", "write", "Body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meth_", "(_", "msg_", ")_", "\\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 ]
Unused import
DNX/django-fagungis/setup.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\nimport os\n\nCLASSIFIERS = [\n 'Development Status :: 3 - Alpha',\n 'Environment :: Console',\n 'Framework :: Django',\n 'Intended Audience :: Developers',\n 'Intended Audience :: System Administrators',\n 'Operating System :: MacOS :: MacOS X',\n 'Operating System :: Unix',\n 'Operating System :: POSIX',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2.5',\n 'Programming Language :: Python :: 2.6',\n 'Topic :: Software Development',\n 'Topic :: Software Development :: Build Tools',\n 'Topic :: Software Development :: Libraries',\n 'Topic :: Software Development :: Libraries :: Python Modules',\n 'Topic :: System :: Clustering',\n 'Topic :: System :: Software Distribution',\n 'Topic :: System :: Systems Administration',\n]\n\nsetup(\n name=\"django-fagungis\",\n version=__import__('fagungis').get_version(),\n url='https://bitbucket.org/DNX/django-fagungis/wiki/Home',\n download_url='http://bitbucket.org/DNX/django-fagungis/downloads',\n license='BSD License',\n description=\"DJANGO + FAbric + GUnicorn + NGInx + Supervisor deployment\",\n long_description=open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),\n author='Denis Darii',\n author_email='denis.darii@gmail.com',\n keywords='django fabric gunicorn nginx supervisor',\n packages=find_packages(),\n namespace_packages=['fagungis'],\n include_package_data=True,\n zip_safe=False,\n classifiers=CLASSIFIERS,\n install_requires=[\n 'Fabric>=1.3',\n ],\n)\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CLASSIF", "IER", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Cons", "ole", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "System", " ", "Administra", "tors", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Mac", "OS", " ", "::", " ", "Mac", "OS", " ", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "POSI", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Build", " ", "Tool", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "System", " ", "::", " ", "Clustering", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "System", " ", "::", " ", "Sof", "twa", "re", " ", "Distribut", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "System", " ", "::", " ", "System", "s", " ", "Administrati", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "django", "-", "fa", "gun", "gi", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "fa", "gun", "gi", "s", "'_", ")_", "._", "get", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "bitb", "ucket", ".", "org", "/", "DN", "X", "/", "django", "-", "fa", "gun", "gi", "s", "/", "wiki", "/", "Home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "http", "://", "bitb", "ucket", ".", "org", "/", "DN", "X", "/", "django", "-", "fa", "gun", "gi", "s", "/", "download", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "DJANGO", " ", "+", " ", "FA", "bri", "c", " ", "+", " ", "GU", "nico", "rn", " ", "+", " ", "NG", "In", "x", " ", "+", " ", "Supervis", "or", " ", "deploy", "ment", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "READ", "ME", ".", "rst", "'_", ")_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Den", "is", " ", "Dar", "ii", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "deni", "s", ".", "dar", "ii", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "django", " ", "fab", "ric", " ", "gun", "icor", "n", " ", "ngin", "x", " ", "supervisor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace", "\\u", "packages_", "=_", "[_", "'", "fa", "gun", "gi", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip",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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 ]
First argument to super() is not enclosing class
dtroyer/python-openstackclient/openstackclient/tests/identity/v3/test_mappings.py
[ { "content": " def setUp(self):\n super(TestMapping, self).setUp()\n\n federation_lib = self.app.client_manager.identity.federation\n self.mapping_mock = federation_lib.mappings\n self.mapping_mock.reset_mock()", "metadata": "root.TestMapping.setUp", "header": "['class', 'TestMapping', '(', 'identity_fakes', '.', 'TestFederatedIdentity', ')', ':', '___EOS___']", "index": 26 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Test", "Mapping_", "(_", "identi", "ty", "\\u", "fakes_", "._", "Test", "Federa", "ted", "Identity_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Test", "Mapping_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "federation", "\\u", "lib_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "identity_", "._", "federation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mapping", "\\u", "mock_", "=_", "federation", "\\u", "lib_", "._", "mappings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mapping", "\\u", "mock_", "._", "reset", "\\u", "mock_", "(_", ")_", "\\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 ]
Unused import
tarbell-project/tarbell/tarbell/tests/test.py
[ { "content": "import os\nimport unittest\nfrom tarbell.app import TarbellSite\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TarbellSiteTestCase(unittest.TestCase):\n \"\"\"\n Tests for the TarbellSite class methods.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TarbellSiteTestCase", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def setUp(self):\n \"\"\" Get a fake Tarbell site instance. \"\"\"\n test_dir = os.path.join(\n os.path.dirname(os.path.abspath(__file__)), 'example')\n\n self.site = TarbellSite(test_dir)", "metadata": "root.TarbellSiteTestCase.setUp", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_init(self):\n \"\"\"\n Creating an instance of TarbellSite without a path\n raises a TypeError exception.\n \"\"\"\n self.assertRaises(TypeError, TarbellSite, )", "metadata": "root.TarbellSiteTestCase.test_init", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_filter_files(self):\n name, project, project_path = self.site.projects[0]\n\n filtered = self.site.filter_files(project_path)\n next = filtered.next()\n\n \"\"\"\n Each project tuple has a length of 3\n \"\"\"\n self.assertEqual(len(next), 3)\n\n \"\"\"\n The first item in the project tuple equals the project_path passed\n \"\"\"\n self.assertEqual(project_path, next[0])", "metadata": "root.TarbellSiteTestCase.test_filter_files", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_sort_modules(self):\n \"\"\"\n Our \"base\" project is always the last item in the\n return list of sorted modules\n \"\"\"\n projects = sorted(self.site.projects, cmp=self.site.sort_modules)\n self.assertEqual(projects[-1][0], \"base\")", "metadata": "root.TarbellSiteTestCase.test_sort_modules", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_load_projects(self):\n \"\"\"\n Load projects returns a list with length of 2, since our test app\n has two sub directories: base and project.\n \"\"\"\n self.assertEqual(len(self.site.load_projects()), 2)", "metadata": "root.TarbellSiteTestCase.test_load_projects", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " @unittest.skip('')\n def test_preview(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_preview", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_get_context(self):\n \"\"\"\n Our get_context method should return a dictionary\n \"\"\"\n self.assertTrue(isinstance(self.site.get_context(), dict))", "metadata": "root.TarbellSiteTestCase.test_get_context", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_get_context_from_csv(self):\n \"\"\"\n Our get_context_from_csv should fetch a local file path or an url\n \"\"\"\n self.assertTrue(isinstance(self.site.get_context_from_csv(), dict))\n\n self.site.CONTEXT_SOURCE_FILE = 'https://raw.github.com/newsapps/'\n 'flask-tarbell/0.9/tarbell/tests/example/project/data/project.csv'\n\n self.assertTrue(isinstance(self.site.get_context_from_csv(), dict))", "metadata": "root.TarbellSiteTestCase.test_get_context_from_csv", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " @unittest.skip('')\n def test_get_context_from_gdoc(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_get_context_from_gdoc", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " @unittest.skip('')\n def test__get_context_from_gdoc(self):\n pass", "metadata": "root.TarbellSiteTestCase.test__get_context_from_gdoc", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " @unittest.skip('')\n def test_export_xlsx(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_export_xlsx", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " @unittest.skip('')\n def test_process_xlsx(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_process_xlsx", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 87 }, { "content": " @unittest.skip('')\n def test_copy_global_values(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_copy_global_values", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " @unittest.skip('')\n def test_make_headers(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_make_headers", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " @unittest.skip('')\n def test_make_worksheet_data(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_make_worksheet_data", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 99 }, { "content": " @unittest.skip('')\n def test_generate_static_site(self):\n pass", "metadata": "root.TarbellSiteTestCase.test_generate_static_site", "header": "['class', 'TarbellSiteTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tar", "bell", "_", "._", "app_", "import_", "Tar", "bell", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "Tar", "bell", "Site", " ", "class", " ", "method", "s", ".", "\\", "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_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "a", " ", "fake", " ", "Tar", "bell", " ", "site", " ", "instance", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "example", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "site_", "=_", "Tar", "bell", "Site_", "(_", "test\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "ing", " ", "an", " ", "instance", " ", "of", " ", "Tar", "bell", "Site", " ", "with", "out", " ", "a", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "raise", "s", " ", "a", " ", "Type", "Error", " ", "exception", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "Tar", "bell", "Site_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "filter", "\\u", "files_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "project_", ",_", "project", "\\u", "path_", "=_", "self_", "._", "site_", "._", "projects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filtered_", "=_", "self_", "._", "site_", "._", "filter", "\\u", "files_", "(_", "project", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next_", "=_", "filtered_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "project", " ", "tuple", " ", "has", " ", "a", " ", "length", " ", "of", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "next_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "item", " ", "in", " ", "the", " ", "project", " ", "tuple", " ", "equals", " ", "the", " ", "project", "\\u", "path", " ", "pass", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "project", "\\u", "path_", ",_", "next_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "sort", "\\u", "modules_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ou", "r", " ", "\"", "base", "\"", " ", "project", " ", "is", " ", "alw", "ay", "s", " ", "the", " ", "last", " ", "item", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "list", " ", "of", " ", "sorte", "d", " ", "module", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "projects_", "=_", "sorted_", "(_", "self_", "._", "site_", "._", "projects_", ",_", "cmp_", "=_", "self_", "._", "site_", "._", "sort", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "projects_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", ",_", "\"", "base", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "load", "\\u", "projects_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "project", "s", " ", "return", "s", " ", "a", " ", "list", " ", "with", " ", "length", " ", "of", " ", "2", ",", " ", "sinc", "e", " ", "our", " ", "test", " ", "app", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "two", " ", "sub", " ", "director", "ies", ":", " ", "base", " ", "and", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "self_", "._", "site_", "._", "load", "\\u", "projects_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "preview_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "get", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ou", "r", " ", "get", "\\u", "context", " ", "method", " ", "shou", "ld", " ", "return", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "self_", "._", "site_", "._", "get", "\\u", "context_", "(_", ")_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "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", "get", "\\u", "context", "\\u", "from", "\\u", "csv_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ou", "r", " ", "get", "\\u", "context", "\\u", "from", "\\u", "csv", " ", "shou", "ld", " ", "fetch", " ", "a", " ", "local", " ", "file", " ", "path", " ", "or", " ", "an", " ", "url", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "self_", "._", "site_", "._", "get", "\\u", "context", "\\u", "from", "\\u", "csv_", "(_", ")_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "site_", "._", "CONTE", "XT", "\\u", "SOU", "RC", "E", "\\u", "FILE_", "=_", "'", "https", "://", "raw", ".", "git", "hub", ".", "com", "/", "news", "apps", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'", "fla", "sk", "-", "tar", "bell", "/", "0.", "9", "/", "tar", "bell", "/", "tests", "/", "example", "/", "project", "/", "data", "/", "project", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "self_", "._", "site_", "._", "get", "\\u", "context", "\\u", "from", "\\u", "csv_", "(_", ")_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "context", "\\u", "from", "\\u", "gd", "oc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "context", "\\u", "from", "\\u", "gd", "oc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "export", "\\u", "xls", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "process", "\\u", "xls", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "copy", "\\u", "global", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "make", "\\u", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "make", "\\u", "worksheet", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tar", "bell", "Site", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "''_", ")_", "\\u\\u\\uNE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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Duplicate key in dict literal
catkin/catkin_tools/catkin_tools/context.py
[ { "content": " def summary(self, notes=[]):\n # Add warnings (missing dirs in CMAKE_PREFIX_PATH, etc)\n summary_warnings = self.warnings\n if not self.initialized():\n summary_warnings += [clr(\n \"Workspace `@{yf}{_Context__workspace}@|` is not yet \"\n \"initialized. Use the `catkin init` or run `catkin config \"\n \"--init`.\")]\n if not self.source_space_exists():\n summary_warnings += [clr(\n \"Source space `@{yf}{_Context__source_space_abs}@|` does not yet exist.\")]\n\n summary = [\n [\n clr(\"@{cf}Profile:@| @{yf}{profile}@|\"),\n clr(\"@{cf}Extending:@| {extend_mode} @{yf}{extend}@|\"),\n clr(\"@{cf}Workspace:@| @{yf}{_Context__workspace}@|\"),\n ],\n [\n clr(\"@{cf}Source Space:@| {source_missing} @{yf}{_Context__source_space_abs}@|\"),\n clr(\"@{cf}Log Space:@| {log_missing} @{yf}{_Context__log_space_abs}@|\"),\n clr(\"@{cf}Build Space:@| {build_missing} @{yf}{_Context__build_space_abs}@|\"),\n clr(\"@{cf}Devel Space:@| {devel_missing} @{yf}{_Context__devel_space_abs}@|\"),\n clr(\"@{cf}Install Space:@| {install_missing} @{yf}{_Context__install_space_abs}@|\"),\n clr(\"@{cf}DESTDIR:@| {destdir_missing} @{yf}{_Context__destdir}@|\")\n ],\n [\n clr(\"@{cf}Devel Space Layout:@| @{yf}{_Context__devel_layout}@|\"),\n clr(\"@{cf}Install Space Layout:@| @{yf}{install_layout}@|\"),\n ],\n [\n clr(\"@{cf}Additional CMake Args:@| @{yf}{cmake_args}@|\"),\n clr(\"@{cf}Additional Make Args:@| @{yf}{make_args}@|\"),\n clr(\"@{cf}Additional catkin Make Args:@| @{yf}{catkin_make_args}@|\"),\n clr(\"@{cf}Internal Make Job Server:@| @{yf}{_Context__use_internal_make_jobserver}@|\"),\n clr(\"@{cf}Cache Job Environments:@| @{yf}{_Context__use_env_cache}@|\"),\n ],\n [\n clr(\"@{cf}Whitelisted Packages:@| @{yf}{whitelisted_packages}@|\"),\n clr(\"@{cf}Blacklisted Packages:@| @{yf}{blacklisted_packages}@|\"),\n ]\n ]\n\n # Construct string for extend value\n if self.extend_path:\n extend_value = self.extend_path\n extend_mode = clr('@{gf}[explicit]@|')\n elif self.cached_cmake_prefix_path:\n extend_value = self.cmake_prefix_path\n extend_mode = clr(' @{gf}[cached]@|')\n elif (self.env_cmake_prefix_path and\n self.env_cmake_prefix_path != self.devel_space_abs and\n self.env_cmake_prefix_path != self.install_space_abs):\n extend_value = self.cmake_prefix_path\n extend_mode = clr(' @{gf}[env]@|')\n else:\n extend_value = 'None'\n extend_mode = clr(' ')\n\n def existence_str(path, used=True):\n if used:\n return clr(' @{gf}[exists]@|' if os.path.exists(path) else '@{rf}[missing]@|')\n else:\n return clr(' @{bf}[unused]@|')\n\n install_layout = 'None'\n if self.__install:\n install_layout = 'merged' if not self.__isolate_install else 'isolated'\n\n subs = {\n 'profile': self.profile,\n 'extend_mode': extend_mode,\n 'extend': extend_value,\n 'install_layout': install_layout,\n 'cmake_prefix_path': (self.cmake_prefix_path or ['Empty']),\n 'cmake_args': ' '.join(self.__cmake_args or ['None']),\n 'make_args': ' '.join(self.__make_args + self.__jobs_args or ['None']),\n 'catkin_make_args': ', '.join(self.__catkin_make_args or ['None']),\n 'source_missing': existence_str(self.source_space_abs),\n 'log_missing': existence_str(self.log_space_abs),\n 'build_missing': existence_str(self.build_space_abs),\n 'devel_missing': existence_str(self.devel_space_abs),\n 'install_missing': existence_str(self.install_space_abs, used=self.__install),\n 'destdir_missing': existence_str(self.destdir, used=self.destdir),\n 'whitelisted_packages': ' '.join(self.__whitelist or ['None']),\n 'blacklisted_packages': ' '.join(self.__blacklist or ['None']),\n }\n subs.update(**self.__dict__)\n # Get the width of the shell\n width = terminal_width()\n max_length = 0\n groups = []\n for group in summary:\n for index, line in enumerate(group):\n group[index] = line.format(**subs)\n max_length = min(width, max(max_length, len(remove_ansi_escape(group[index]))))\n groups.append(\"\\n\".join(group))\n divider = clr('@{pf}' + ('-' * max_length) + '@|')\n warning_divider = clr('@{rf}' + ('-' * max_length) + '@|')\n\n # Format warnings\n if len(summary_warnings) == 0:\n notes = [clr(\"@!@{cf}Workspace configuration appears valid.@|\")] + notes\n warnings_joined = ''\n else:\n warnings_formatted = [\n printed_fill(clr('@!@{rf}WARNING:@| ') + sw.format(**subs), max_length)\n for sw in summary_warnings]\n warnings_joined = (\n \"\\n\\n\" + warning_divider + \"\\n\" +\n (\"\\n\" + warning_divider + \"\\n\").join(warnings_formatted) +\n \"\\n\" + warning_divider + \"\\n\")\n\n return (divider + \"\\n\" +\n (\"\\n\" + divider + \"\\n\").join(groups) + \"\\n\" + divider + \"\\n\" +\n (((\"\\n\\n\").join(notes) + \"\\n\" + divider) if notes else '') +\n warnings_joined)", "metadata": "root.Context.summary", "header": "['class', 'Context', '(', 'object', ')', ':', '___EOS___']", "index": 403 } ]
[]
[]
0
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "Context_", "(_", "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_", "summary_", "(_", "self_", ",_", "notes_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "warn", "ings", " ", "(", "missi", "ng", " ", "dirs", " ", "in", " ", "CMA", "KE", "\\u", "PREF", "IX", "\\u", "PATH", ",", " ", "etc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summar", "y", "\\u", "warnings_", "=_", "self_", "._", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "initialized_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summar", "y", "\\u", "warnings_", "+=_", "[_", "clr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Works", "pace", " ", "`", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "works", "pace", "}@", "|", "`", " ", "is", " ", "not", " ", "ye", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "initialize", "d", ".", " ", "Us", "e", " ", "the", " ", "`", "cat", "kin", " ", "init", "`", " ", "or", " ", "run", " ", "`", "cat", "kin", " ", "config", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "init", "`.", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "source", "\\u", "space", "\\u", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summar", "y", "\\u", "warnings_", "+=_", "[_", "clr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sou", "rce", " ", "space", " ", "`", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "source", "\\u", "space", "\\u", "abs", "}@", "|", "`", " ", "doe", "s", " ", "not", " ", "ye", "t", " ", "exist", ".\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "summary_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Profil", "e", ":", "@", "|", " ", " ", " ", "@{", "yf", "}{", "profile", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Extend", "ing", ":", "@", "|", " ", " ", " ", " ", "{", "extend", "\\u", "mode", "}", " ", "@{", "yf", "}{", "extend", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Works", "pace", ":", "@", "|", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "works", "pace", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Sou", "rce", " ", "Spac", "e", ":", "@", "|", " ", " ", "{", "source", "\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "source", "\\u", "space", "\\u", "abs", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Log", " ", "Spac", "e", ":", "@", "|", " ", " ", " ", " ", " ", "{", "log", "\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "log", "\\u", "space", "\\u", "abs", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Build", " ", "Spac", "e", ":", "@", "|", " ", " ", " ", "{", "build", "\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "build", "\\u", "space", "\\u", "abs", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Dev", "el", " ", "Spac", "e", ":", "@", "|", " ", " ", " ", "{", "deve", "l\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "deve", "l\\u", "space", "\\u", "abs", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Install", " ", "Spac", "e", ":", "@", "|", " ", "{", "install", "\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "install", "\\u", "space", "\\u", "abs", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "DEST", "DIR", ":", "@", "|", " ", " ", " ", "{", "dest", "dir\\u", "missi", "ng", "}", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "dest", "dir", "}@", "|\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Dev", "el", " ", "Spac", "e", " ", "Lay", "out", ":", "@", "|", " ", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "deve", "l\\u", "layout", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Install", " ", "Spac", "e", " ", "Lay", "out", ":", "@", "|", " ", " ", " ", " ", "@{", "yf", "}{", "install", "\\u", "layout", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Addition", "al", " ", "CM", "ake", " ", "Arg", "s", ":", "@", "|", " ", " ", " ", "@{", "yf", "}{", "cma", "ke", "\\u", "args", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Addition", "al", " ", "Make", " ", "Arg", "s", ":", "@", "|", " ", " ", " ", " ", "@{", "yf", "}{", "make", "\\u", "args", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Addition", "al", " ", "cat", "kin", " ", "Make", " ", "Arg", "s", ":", "@", "|", " ", "@{", "yf", "}{", "cat", "kin", "\\u", "make", "\\u", "args", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Intern", "al", " ", "Make", " ", "Jo", "b", " ", "Server", ":", "@", "|", " ", " ", " ", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "use", "\\u", "internal", "\\u", "make", "\\u", "jobs", "erver", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Cache", " ", "Jo", "b", " ", "Environ", "ment", "s", ":", "@", "|", " ", " ", "@{", "yf", "}{", "\\u", "Context", "\\u\\u", "use", "\\u", "env", "\\u", "cache", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "White", "liste", "d", " ", "Packa", "ges", ":", "@", "|", " ", " ", " ", " ", "@{", "yf", "}{", "whitelist", "ed", "\\u", "package", "s", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clr_", "(_", "\"@", "{", "cf", "}", "Black", "liste", "d", " ", "Packa", "ges", ":", "@", "|", " ", " ", " ", " ", "@{", "yf", "}{", "blacklisted", "\\u", "package", "s", "}@", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "string", " ", "for", " ", "extend", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "extend", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extend", "\\u", "value_", "=_", "self_", "._", "extend", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extend", "\\u", "mode_", "=_", "clr_", "(_", "'@", "{", "gf", "}[", "explicit", "]", "@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "cache", "d\\u", "cma", "ke", "\\u", "prefix", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extend", "\\u", "value_", "=_", "self_", "._", "cma", "ke", "\\u", "prefix", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extend", "\\u", "mode_", "=_", "clr_", "(_", "'", " ", " ", "@{", "gf", "}[", "cache", "d", "]", "@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "env", "\\u", "cma", "ke", "\\u", "prefix", "\\u", "path_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "env", "\\u", "cma", "ke", "\\u", "prefix", "\\u", "path_", "!=_", "self_", "._", "deve", "l\\u", "space", "\\u", "abs_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "env", "\\u", "cma", "ke", "\\u", "prefix", "\\u", "path_", "!=_", "self_", "._", "install", "\\u", "space", "\\u", "abs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extend", "\\u", "value_", "=_", "self_", "._", "cma", "ke", "\\u", "prefix", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extend", "\\u", "mode_", "=_", "clr_", "(_", "'", " ", "@{", "gf", "}[", "env", "]", "@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extend", "\\u", "value_", "=_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extend", "\\u", "mode_", "=_", "clr_", "(_", "'", " ", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "existence", "\\u", "str_", "(_", "path_", ",_", "used_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "used_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clr_", "(_", "'", " ", "@{", "gf", "}[", "exist", "s", "]", "@", "|'_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", "else_", "'@", "{", "rf", "}[", "missi", "ng", "]", "@", "|'_", ")_", "\\u\\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_", "clr_", "(_", "'", " ", "@{", "bf", "}[", "unu", "sed", "]", "@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "\\u", "layout_", "=_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "install_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "layout_", "=_", "'", "merge", "d", "'_", "if_", "not_", "self_", "._", "\\u\\u", "isolate", "\\u", "install_", "else_", "'", "isolated", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "profile", "'_", ":_", "self_", "._", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extend", "\\u", "mode", "'_", ":_", "extend", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extend", "'_", ":_", "extend", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "\\u", "layout", "'_", ":_", "install", "\\u", "layout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cma", "ke", "\\u", "prefix", "\\u", "path", "'_", ":_", "(_", "self_", "._", "cma", "ke", "\\u", "prefix", "\\u", "path_", "or_", "[_", "'", "Emp", "ty", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cma", "ke", "\\u", "args", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u\\u", "cma", "ke", "\\u", "args_", "or_", "[_", "'", "Non", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "\\u", "args", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u\\u", "make", "\\u", "args_", "+_", "self_", "._", "\\u\\u", "jobs", "\\u", "args_", "or_", "[_", "'", "Non", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cat", "kin", "\\u", "make", "\\u", "args", "'_", ":_", "',", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u\\u", "cat", "kin", "\\u", "make", "\\u", "args_", "or_", "[_", "'", "Non", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "source", "\\u", "space", "\\u", "abs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "log", "\\u", "space", "\\u", "abs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "build", "\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "build", "\\u", "space", "\\u", "abs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deve", "l\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "deve", "l\\u", "space", "\\u", "abs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "install", "\\u", "space", "\\u", "abs_", ",_", "used_", "=_", "self_", "._", "\\u\\u", "install_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "dir\\u", "missi", "ng", "'_", ":_", "existence", "\\u", "str_", "(_", "self_", "._", "destdir_", ",_", "used_", "=_", "self_", "._", "destdir_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "whitelist", "ed", "\\u", "package", "s", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u\\u", "whitelist_", "or_", "[_", "'", "Non", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blacklisted", "\\u", "package", "s", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u\\u", "blacklist_", "or_", "[_", "'", "Non", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "._", "update_", "(_", "**_", "self_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "widt", "h", " ", "of", " ", "the", " ", "shell_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "termina", "l\\u", "width_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "length_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "summary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "index_", ",_", "line_", "in_", "enumerate_", "(_", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "[_", "index_", "]_", "=_", "line_", "._", "format_", "(_", "**_", "subs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "length_", "=_", "min_", "(_", "width_", ",_", "max_", "(_", "max", "\\u", "length_", ",_", "len_", "(_", "remove", "\\u", "ansi", "\\u", "escape_", "(_", "group_", "[_", "index_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "groups_", "._", "append_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "divider", "_", "=_", "clr_", "(_", "'@", "{", "pf", "}'_", "+_", "(_", "'-'_", "*_", "max", "\\u", "length_", ")_", "+_", "'@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ing", "\\u", "divider", "_", "=_", "clr_", "(_", "'@", "{", "rf", "}'_", "+_", "(_", "'-'_", "*_", "max", "\\u", "length_", ")_", "+_", "'@", "|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Format", " ", "warnings_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "summar", "y", "\\u", "warnings_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notes_", "=_", "[_", "clr_", "(_", "\"@", "!@", "{", "cf", "}", "Works", "pace", " ", "configura", "tion", " ", "appear", "s", " ", "valid", ".", "@", "|\"_", ")_", "]_", "+_", "notes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ings", "\\u", "joined_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn", "ings", "\\u", "formatted_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "printed", "\\u", "fill_", "(_", "clr_", "(_", "'@", "!@", "{", "rf", "}", "WARN", "ING", ":", "@", "|", " ", "'_", ")_", "+_", "sw_", "._", "format_", "(_", "**_", "subs_", ")_", ",_", "max", "\\u", "length_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sw_", "in_", "summar", "y", "\\u", "warnings_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ings", "\\u", "joined_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "\\\\", "n", "\"_", "+_", "warn", "ing", "\\u", "divider", "_", "+_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"\\\\", "n", "\"_", "+_", "warn", "ing", "\\u", "divider", "_", "+_", "\"\\\\", "n", "\"_", ")_", "._", "join_", "(_", "warn", "ings", "\\u", "formatted_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "\"_", "+_", "warn", "ing", "\\u", "divider", "_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "divider", "_", "+_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"\\\\", "n", "\"_", "+_", "divider", "_", "+_", "\"\\\\", "n", "\"_", ")_", "._", "join_", "(_", "groups_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "divider", "_", "+_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "(_", "\"\\\\", "n", "\\\\", "n", "\"_", ")_", "._", "join_", "(_", "notes_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "divider", "_", ")_", "if_", "notes_", "else_", "''_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "warn", "ings", "\\u", "joined_", ")_", "\\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, 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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 ]
Unused import
ironcladlou/GoTools/gotools_format.py
[ { "content": "import sublime\nimport sublime_plugin\nimport re\n\nfrom .gotools_util import Buffers\nfrom .gotools_util import GoBuffers\nfrom .gotools_util import Logger\nfrom .gotools_util import ToolRunner\nfrom .gotools_settings import GoToolsSettings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GotoolsFormatOnSave(sublime_plugin.EventListener):", "metadata": "root.GotoolsFormatOnSave", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def on_pre_save(self, view):\n if not GoBuffers.is_go_source(view): return\n if not GoToolsSettings.get().format_on_save: return\n view.run_command('gotools_format')", "metadata": "root.GotoolsFormatOnSave.on_pre_save", "header": "['class', 'GotoolsFormatOnSave', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 11 }, { "content": "class GotoolsFormat(sublime_plugin.TextCommand):\n\n\n\n # Display an output panel containing the syntax errors, and set gutter marks for each error.", "metadata": "root.GotoolsFormat", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def is_enabled(self):\n return GoBuffers.is_go_source(self.view)", "metadata": "root.GotoolsFormat.is_enabled", "header": "['class', 'GotoolsFormat', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 17 }, { "content": " def run(self, edit):\n command = \"\"\n args = []\n if GoToolsSettings.get().format_backend == \"gofmt\":\n command = \"gofmt\"\n args = [\"-e\", \"-s\"]\n elif GoToolsSettings.get().format_backend in [\"goimports\", \"both\"] :\n command = \"goimports\"\n args = [\"-e\"]\n\n stdout, stderr, rc = ToolRunner.run(command, args, stdin=Buffers.buffer_text(self.view))\n\n # Clear previous syntax error marks\n self.view.erase_regions(\"mark\")\n\n if rc == 2:\n # Show syntax errors and bail\n self.show_syntax_errors(stderr)\n return\n\n if rc != 0:\n # Ermmm...\n Logger.log(\"unknown gofmt error (\" + str(rc) + \") stderr:\\n\" + stderr)\n return\n\n if GoToolsSettings.get().format_backend == \"both\":\n command = \"gofmt\"\n args = [\"-e\", \"-s\"]\n stdout, stderr, rc = ToolRunner.run(command, args, stdin=stdout.encode('utf-8'))\n\n # Clear previous syntax error marks\n self.view.erase_regions(\"mark\")\n\n if rc == 2:\n # Show syntax errors and bail\n self.show_syntax_errors(stderr)\n return\n\n if rc != 0:\n # Ermmm...\n Logger.log(\"unknown gofmt error (\" + str(rc) + \") stderr:\\n\" + stderr)\n return\n\n # Everything's good, hide the syntax error panel\n self.view.window().run_command(\"hide_panel\", {\"panel\": \"output.gotools_syntax_errors\"})\n\n # Remember the viewport position. When replacing the buffer, Sublime likes to jitter the\n # viewport around for some reason.\n self.prev_viewport_pos = self.view.viewport_position()\n\n # Replace the buffer with gofmt output.\n self.view.replace(edit, sublime.Region(0, self.view.size()), stdout)\n\n # Restore the viewport on the main GUI thread (which is the only way this works).\n sublime.set_timeout(self.restore_viewport, 0)", "metadata": "root.GotoolsFormat.run", "header": "['class', 'GotoolsFormat', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 20 }, { "content": " def restore_viewport(self):\n self.view.set_viewport_position(self.prev_viewport_pos, False)", "metadata": "root.GotoolsFormat.restore_viewport", "header": "['class', 'GotoolsFormat', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 76 }, { "content": " def show_syntax_errors(self, stderr):\n output_view = self.view.window().create_output_panel('gotools_syntax_errors')\n output_view.set_scratch(True)\n output_view.settings().set(\"result_file_regex\",\"^(.*):(\\d+):(\\d+):(.*)$\")\n output_view.run_command(\"select_all\")\n output_view.run_command(\"right_delete\")\n\n syntax_output = stderr.replace(\"<standard input>\", self.view.file_name())\n output_view.run_command('append', {'characters': syntax_output})\n self.view.window().run_command(\"show_panel\", {\"panel\": \"output.gotools_syntax_errors\"})\n\n marks = []\n for error in stderr.splitlines():\n match = re.match(\"(.*):(\\d+):(\\d+):\", error)\n if not match or not match.group(2):\n Logger.log(\"skipping unrecognizable error:\\n\" + error + \"\\nmatch:\" + str(match))\n continue\n\n row = int(match.group(2))\n pt = self.view.text_point(row-1, 0)\n Logger.log(\"adding mark at row \" + str(row))\n marks.append(sublime.Region(pt))\n\n if len(marks) > 0:\n self.view.add_regions(\"mark\", marks, \"mark\", \"dot\", sublime.DRAW_STIPPLED_UNDERLINE | sublime.PERSISTENT)", "metadata": "root.GotoolsFormat.show_syntax_errors", "header": "['class', 'GotoolsFormat', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 80 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sublim", "e\\u", "plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "got", "ool", "s", "\\u", "util_", "import_", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "got", "ool", "s", "\\u", "util_", "import_", "Go", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "got", "ool", "s", "\\u", "util_", "import_", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "got", "ool", "s", "\\u", "util_", "import_", "Tool", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "got", "ool", "s", "\\u", "settings_", "import_", "Go", "Tool", "s", "Settings_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Got", "ool", "s", "Format", "On", "Save_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "ool", "s", "Format", "On", "Save_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "\\u", "pre", "\\u", "save_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Go", "Buffers", "_", "._", "is", "\\u", "go", "\\u", "source_", "(_", "view_", ")_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "Go", "Tool", "s", "Settings_", "._", "get_", "(_", ")_", "._", "format\\u", "on", "\\u", "save_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "run", "\\u", "command_", "(_", "'", "got", "ool", "s", "\\u", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Got", "ool", "s", "Format_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\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_", "#", " ", "Display", " ", "an", " ", "output", " ", "panel", " ", "contain", "ing", " ", "the", " ", "synta", "x", " ", "error", "s", ",", " ", "and", " ", "set", " ", "gut", "ter", " ", "mark", "s", " ", "for", " ", "each", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Got", "ool", "s", "Format_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "is", "\\u", "enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Go", "Buffers", "_", "._", "is", "\\u", "go", "\\u", "source_", "(_", "self_", "._", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "ool", "s", "Format_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Go", "Tool", "s", "Settings_", "._", "get_", "(_", ")_", "._", "format\\u", "backend_", "==_", "\"", "gof", "mt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"", "gof", "mt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\"-", "e", "\"_", ",_", "\"-", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Go", "Tool", "s", "Settings_", "._", "get_", "(_", ")_", "._", "format\\u", "backend_", "in_", "[_", "\"", "goi", "mpor", "ts", "\"_", ",_", "\"", "bot", "h", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"", "goi", "mpor", "ts", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\"-", "e", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stdout_", ",_", "stderr_", ",_", "rc_", "=_", "Tool", "Runner_", "._", "run_", "(_", "command_", ",_", "args_", ",_", "stdin_", "=_", "Buffers", "_", "._", "buffer", "\\u", "text_", "(_", "self_", "._", "view_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clear", " ", "previ", "ous", " ", "synta", "x", " ", "error", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "erase", "\\u", "regions_", "(_", "\"", "mark", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Show", " ", "synta", "x", " ", "error", "s", " ", "and", " ", "bai", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "synta", "x", "\\u", "errors_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rc_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Er", "mmm", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Logger_", "._", "log_", "(_", "\"", "unknown", " ", "gof", "mt", " ", "error", " ", "(\"_", "+_", "str_", "(_", "rc_", ")_", "+_", "\")", " ", "std", "err", ":\\\\", "n", "\"_", "+_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Go", "Tool", "s", "Settings_", "._", "get_", "(_", ")_", "._", "format\\u", "backend_", "==_", "\"", "bot", "h", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"", "gof", "mt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\"-", "e", "\"_", ",_", "\"-", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", ",_", "stderr_", ",_", "rc_", "=_", "Tool", "Runner_", "._", "run_", "(_", "command_", ",_", "args_", ",_", "stdin_", "=_", "stdout_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clear", " ", "previ", "ous", " ", "synta", "x", " ", "error", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "erase", "\\u", "regions_", "(_", "\"", "mark", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Show", " ", "synta", "x", " ", "error", "s", " ", "and", " ", "bai", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "synta", "x", "\\u", "errors_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rc_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Er", "mmm", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Logger_", "._", "log_", "(_", "\"", "unknown", " ", "gof", "mt", " ", "error", " ", "(\"_", "+_", "str_", "(_", "rc_", ")_", "+_", "\")", " ", "std", "err", ":\\\\", "n", "\"_", "+_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Every", "thing", "'", "s", " ", "good", ",", " ", "hide", " ", "the", " ", "synta", "x", " ", "error", " ", "panel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "window_", "(_", ")_", "._", "run", "\\u", "command_", "(_", "\"", "hide", "\\u", "panel", "\"_", ",_", "{_", "\"", "panel", "\"_", ":_", "\"", "output", ".", "got", "ool", "s", "\\u", "synta", "x", "\\u", "error", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reme", "mber", " ", "the", " ", "viewport", " ", "position", ".", " ", "Whe", "n", " ", "repla", "cing", " ", "the", " ", "buffer", ",", " ", "Sub", "lim", "e", " ", "likes", " ", "to", " ", "jitter", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "viewport", " ", "aro", "und", " ", "for", " ", "some", " ", "reason", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prev", "\\u", "viewport", "\\u", "pos_", "=_", "self_", "._", "view_", "._", "viewport", "\\u", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "the", " ", "buffer", " ", "with", " ", "gof", "mt", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "replace_", "(_", "edit_", ",_", "sublime_", "._", "Region_", "(_", "0_", ",_", "self_", "._", "view_", "._", "size_", "(_", ")_", ")_", ",_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "the", " ", "viewport", " ", "on", " ", "the", " ", "main", " ", "GU", "I", " ", "thread", " ", "(", "whi", "ch", " ", "is", " ", "the", " ", "only", " ", "way", " ", "this", " ", "works", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "sublime_", "._", "set\\u", "timeout_", "(_", "self_", "._", "restore", "\\u", "viewport_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "ool", "s", "Format_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restore", "\\u", "viewport_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "set\\u", "viewport", "\\u", "position_", "(_", "self_", "._", "prev", "\\u", "viewport", "\\u", "pos_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "ool", "s", "Format_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "synta", "x", "\\u", "errors_", "(_", "self_", ",_", "stderr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "view_", "=_", "self_", "._", "view_", "._", "window_", "(_", ")_", "._", "create", "\\u", "output", "\\u", "panel_", "(_", "'", "got", "ool", "s", "\\u", "synta", "x", "\\u", "error", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "set\\u", "scratch", "_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "settings_", "(_", ")_", "._", "set_", "(_", "\"", "result", "\\u", "file", "\\u", "regex", "\"_", ",_", "\"", "^", "(.*)", ":(", "\\\\", "d", "+)", ":(", "\\\\", "d", "+)", ":(", ".*)", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "run", "\\u", "command_", "(_", "\"", "select", "\\u", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "run", "\\u", "command_", "(_", "\"", "right", "\\u", "delete", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "synta", "x", "\\u", "output_", "=_", "stderr_", "._", "replace_", "(_", "\"<", "standard", " ", "input", ">\"_", ",_", "self_", "._", "view_", "._", "file", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "run", "\\u", "command_", "(_", "'", "append", "'_", ",_", "{_", "'", "character", "s", "'_", ":_", "synta", "x", "\\u", "output_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "window_", "(_", ")_", "._", "run", "\\u", "command_", "(_", "\"", "show", "\\u", "panel", "\"_", ",_", "{_", "\"", "panel", "\"_", ":_", "\"", "output", ".", "got", "ool", "s", "\\u", "synta", "x", "\\u", "error", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "marks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "stderr_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "match_", "(_", "\"(.", "*)", ":(", "\\\\", "d", "+)", ":(", "\\\\", "d", "+)", ":\"_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "match_", "or_", "not_", "match_", "._", "group_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Logger_", "._", "log_", "(_", "\"", "skip", "ping", " ", "unre", "cogni", "zab", "le", " ", "error", ":\\\\", "n", "\"_", "+_", "error_", "+_", "\"\\\\", "nma", "tch", ":\"_", "+_", "str_", "(_", "match_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "int_", "(_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "=_", "self_", "._", "view_", "._", "text", "\\u", "point_", "(_", "row_", "-_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Logger_", "._", "log_", "(_", "\"", "addin", "g", " ", "mark", " ", "at", " ", "row", " ", "\"_", "+_", "str_", "(_", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "marks_", "._", "append_", "(_", "sublime_", "._", "Region_", "(_", "pt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "marks_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "add", "\\u", "regions_", "(_", "\"", "mark", "\"_", ",_", "marks_", ",_", "\"", "mark", "\"_", ",_", "\"", "dot", "\"_", ",_", "sublime_", "._", "DRAW", "\\u", "STI", "PP", "LED", "\\u", "UNDER", "LINE_", "|_", "sublime_", "._", "PERS", "ISTE", "NT_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
datastax/python-driver/tests/__init__.py
[ { "content": "# Copyright 2013-2016 DataStax, 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\nimport logging\nimport sys\nimport socket\n\nlog = logging.getLogger()\nlog.setLevel('DEBUG')\n# if nose didn't already attach a log handler, add one here\nif not log.handlers:\n handler = logging.StreamHandler()\n handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s [%(module)s:%(lineno)s]: %(message)s'))\n log.addHandler(handler)\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def is_eventlet_monkey_patched():\n if 'eventlet.patcher' not in sys.modules:\n return False\n import eventlet.patcher\n return eventlet.patcher.is_monkey_patched('socket')", "metadata": "root.is_eventlet_monkey_patched", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def is_gevent_monkey_patched():\n if 'gevent.monkey' not in sys.modules:\n return False\n import gevent.socket\n return socket.socket is gevent.socket.socket", "metadata": "root.is_gevent_monkey_patched", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def is_monkey_patched():\n return is_gevent_monkey_patched() or is_eventlet_monkey_patched()", "metadata": "root.is_monkey_patched", "header": "['module', '___EOS___']", "index": 41 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Data", "Sta", "x", ",", " ", "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_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "set", "Level_", "(_", "'", "DEBU", "G", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "nose", " ", "did", "n", "'", "t", " ", "alr", "ead", "y", " ", "attach", " ", "a", " ", "log", " ", "handler", ",", " ", "add", " ", "one", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "log_", "._", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "logging_", "._", "Stream", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "logging_", "._", "Formatter_", "(_", "'%", "(", "asc", "time", ")", "s", " ", "%", "(", "level", "name", ")", "s", " ", "[", "%", "(", "module", ")", "s", ":", "%", "(", "linen", "o", ")", "s", "]:", " ", "%", "(", "message", ")", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "add", "Handler_", "(_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "eventl", "et", "\\u", "monkey", "\\u", "patched_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "eventl", "et", ".", "patche", "r", "'_", "not_", "in_", "sys_", "._", "modules_", ":_", "\\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_", "import_", "eventlet_", "._", "patcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "eventlet_", "._", "patcher_", "._", "is", "\\u", "monkey", "\\u", "patched_", "(_", "'", "socket", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "gev", "ent", "\\u", "monkey", "\\u", "patched_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "gev", "ent", ".", "monkey", "'_", "not_", "in_", "sys_", "._", "modules_", ":_", "\\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_", "import_", "gevent_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "socket_", "._", "socket_", "is_", "gevent_", "._", "socket_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "monkey", "\\u", "patched_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "is", "\\u", "gev", "ent", "\\u", "monkey", "\\u", "patched_", "(_", ")_", "or_", "is", "\\u", "eventl", "et", "\\u", "monkey", "\\u", "patched_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ibm-security-intelligence/api-samples/servers/02_firewallRules.py
[ { "content": "def main():\n\n # First we have to create our client\n client = client_module.RestApiClient(version='5.0')\n\n # -------------------------------------------------------------------------\n # Basic 'GET'\n # In this example we'll be using the GET endpoint of system/servers without\n # any parameters. This will print all the servers in the deployment\n\n # Send in the request\n SampleUtilities.pretty_print_request(client, 'system/servers', 'GET')\n response = client.call_api('system/servers', 'GET')\n\n # Check if the success code was returned to ensure the call to the API was\n # successful.\n if (response.code != 200):\n print('Failed to retrieve the list of servers')\n SampleUtilities.pretty_print_response(response)\n sys.exit(1)\n\n # loop through the servers\n response_body = json.loads(response.read().decode('utf-8'))\n print('Number of servers retrieved: ' + str(len(response_body)))\n\n for server in response_body:\n server_id = server['server_id']\n print('server_id={0}'.format(server_id))\n\n print('Get the current firewall rules.')\n endpoint = '/system/servers/' + str(server_id) + '/firewall_rules'\n SampleUtilities.pretty_print_request(client, endpoint, 'GET')\n response = client.call_api(endpoint, 'GET')\n\n if (response.code != 200):\n print('Failed to retrieve the firewall rules of the server ' + str(\n server_id))\n SampleUtilities.pretty_print_response(response)\n sys.exit(1)\n\n response_body = json.loads(response.read().decode('utf-8'))\n print(json.dumps(response_body, indent=4))\n\n proceed = input(\n 'Continue running this sample will guide you to add a new ' +\n 'firewall rule to the server. Are your sure to continue (Y/N)? ')\n\n if (proceed != 'Y'):\n sys.exit(1)\n\n # Have the user input the server Id.\n ip = input(\n 'Please enter the ip of the host from where to ' +\n 'access the server.\\n')\n port = input(\n 'Please enter the port on the server you want to access.\\n')\n protocol = input(\n 'Please enter the protocol (TCP, UDP, ANY) used for the access.\\n')\n response_body.append({\n \"is_any_source_ip\": False,\n \"port_range\": None,\n \"port_type\": \"SINGLE\",\n \"protocol\": protocol,\n \"single_port\": port,\n \"source_ip\": ip\n })\n headers = {}\n headers['Content-Type'] = 'application/json'\n endpoint = 'system/servers/' + str(server_id) + '/firewall_rules'\n SampleUtilities.pretty_print_request(\n client,\n endpoint,\n 'PUT',\n headers=headers)\n response = client.call_api(\n endpoint,\n 'PUT',\n headers=headers,\n data=json.dumps(response_body).encode())\n SampleUtilities.pretty_print_response(response)\n if (response.code != 200):\n print('Failed to update the firewall rules of the server ' + str(\n server_id))\n sys.exit(1)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 20 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "we", " ", "have", " ", "to", " ", "create", " ", "our", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "client", "\\u", "module_", "._", "Rest", "Ap", "i", "Client_", "(_", "version_", "=_", "'", "5.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "'", "GET", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "this", " ", "example", " ", "we", "'", "ll", " ", "be", " ", "usi", "ng", " ", "the", " ", "GET", " ", "endpoint", " ", "of", " ", "system", "/", "server", "s", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "parameter", "s", ".", " ", "Thi", "s", " ", "will", " ", "print", " ", "all", " ", "the", " ", "server", "s", " ", "in", " ", "the", " ", "deployment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "in", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "request_", "(_", "client_", ",_", "'", "system", "/", "server", "s", "'_", ",_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "call", "\\u", "api_", "(_", "'", "system", "/", "server", "s", "'_", ",_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "success", " ", "code", " ", "was", " ", "return", "ed", " ", "to", " ", "ensure", " ", "the", " ", "call", " ", "to", " ", "the", " ", "API", " ", "was", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "success", "ful", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "response_", "._", "code_", "!=_", "200_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Fail", "ed", " ", "to", " ", "retrieve", " ", "the", " ", "list", " ", "of", " ", "server", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "the", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Number", " ", "of", " ", "server", "s", " ", "retrieved", ":", " ", "'_", "+_", "str_", "(_", "len_", "(_", "response", "\\u", "body_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "server_", "in_", "response", "\\u", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "id_", "=_", "server_", "[_", "'", "server", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "server", "\\u", "id", "={", "0", "}'_", "._", "format_", "(_", "server", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Get", " ", "the", " ", "current", " ", "firew", "all", " ", "rule", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoint_", "=_", "'/", "system", "/", "server", "s", "/'_", "+_", "str_", "(_", "server", "\\u", "id_", ")_", "+_", "'/", "firew", "all", "\\u", "rule", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "request_", "(_", "client_", ",_", "endpoint_", ",_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "call", "\\u", "api_", "(_", "endpoint_", ",_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "response_", "._", "code_", "!=_", "200_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Fail", "ed", " ", "to", " ", "retrieve", " ", "the", " ", "firew", "all", " ", "rule", "s", " ", "of", " ", "the", " ", "server", " ", "'_", "+_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "response_", "(_", "response_", ")_", "\\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_", "response", "\\u", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "body_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proceed", "_", "=_", "input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Continu", "e", " ", "runn", "ing", " ", "this", " ", "sample", " ", "will", " ", "guide", " ", "you", " ", "to", " ", "add", " ", "a", " ", "new", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "firew", "all", " ", "rule", " ", "to", " ", "the", " ", "server", ".", " ", "Are", " ", "your", " ", "sure", " ", "to", " ", "continue", " ", "(", "Y", "/", "N", ")?", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "proceed", "_", "!=_", "'", "Y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ha", "ve", " ", "the", " ", "user", " ", "input", " ", "the", " ", "server", " ", "Id", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ip_", "=_", "input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "enter", " ", "the", " ", "ip", " ", "of", " ", "the", " ", "host", " ", "from", " ", "where", " ", "to", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "access", " ", "the", " ", "server", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "enter", " ", "the", " ", "port", " ", "on", " ", "the", " ", "server", " ", "you", " ", "want", " ", "to", " ", "access", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "=_", "input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "enter", " ", "the", " ", "protoc", "ol", " ", "(", "TC", "P", ",", " ", "UD", "P", ",", " ", "ANY", ")", " ", "used", " ", "for", " ", "the", " ", "access", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "body_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", "\\u", "any", "\\u", "source", "\\u", "ip", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\\u", "range", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\\u", "type", "\"_", ":_", "\"", "SINGLE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "protoc", "ol", "\"_", ":_", "protocol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "single", "\\u", "port", "\"_", ":_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "source", "\\u", "ip", "\"_", ":_", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoint_", "=_", "'", "system", "/", "server", "s", "/'_", "+_", "str_", "(_", "server", "\\u", "id_", ")_", "+_", "'/", "firew", "all", "\\u", "rule", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "call", "\\u", "api_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "response", "\\u", "body_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sampl", "e", "Utilities_", "._", "pretty", "\\u", "print", "\\u", "response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "response_", "._", "code_", "!=_", "200_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Fail", "ed", " ", "to", " ", "update", " ", "the", " ", "firew", "all", " ", "rule", "s", " ", "of", " ", "the", " ", "server", " ", "'_", "+_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
bmcfee/librosa/tests/test_filters.py
[ { "content": "def test_mel_to_hz():\n\n def __test_to_hz(infile):\n DATA = load(infile)\n z = librosa.mel_to_hz(DATA['f'], DATA['htk'])\n\n assert np.allclose(z, DATA['result'])\n\n for infile in files('data/feature-mel_to_hz-*.mat'):\n yield (__test_to_hz, infile)\n\n pass", "metadata": "root.test_mel_to_hz", "header": "['module', '___EOS___']", "index": 68 } ]
[]
[]
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", "mel", "\\u", "to", "\\u", "hz_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "test\\u", "to", "\\u", "hz_", "(_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DATA_", "=_", "load_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "libro", "sa_", "._", "mel", "\\u", "to", "\\u", "hz_", "(_", "DATA_", "[_", "'", "f", "'_", "]_", ",_", "DATA_", "[_", "'", "ht", "k", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "np_", "._", "allclose_", "(_", "z_", ",_", "DATA_", "[_", "'", "result", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "infile_", "in_", "files_", "(_", "'", "data", "/", "feature", "-", "mel", "\\u", "to", "\\u", "hz", "-*", ".", "mat", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "\\u\\u", "test\\u", "to", "\\u", "hz_", ",_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tomerfiliba/plumbum/plumbum/machines/_windows.py
[ { "content": "import struct\nfrom plumbum.lib import six\n\nLFANEW_OFFSET = 30 * 2\nFILE_HEADER_SIZE = 5 * 4\nSUBSYSTEM_OFFSET = 17 * 4\nIMAGE_SUBSYSTEM_WINDOWS_GUI = 2\nIMAGE_SUBSYSTEM_WINDOWS_CUI = 3\n\n\n# print(get_pe_subsystem(\"c:\\\\windows\\\\notepad.exe\")) == 2\n# print(get_pe_subsystem(\"c:\\\\python32\\\\python.exe\")) == 3\n# print(get_pe_subsystem(\"c:\\\\python32\\\\pythonw.exe\")) == 2\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_pe_subsystem(filename):\n with open(filename, \"rb\") as f:\n if f.read(2) != six.b(\"MZ\"):\n return None\n f.seek(LFANEW_OFFSET)\n lfanew = struct.unpack(\"L\", f.read(4))[0]\n f.seek(lfanew)\n if f.read(4) != six.b(\"PE\\x00\\x00\"):\n return None\n f.seek(FILE_HEADER_SIZE + SUBSYSTEM_OFFSET, 1)\n subsystem = struct.unpack(\"H\", f.read(2))[0]\n return subsystem", "metadata": "root.get_pe_subsystem", "header": "['module', '___EOS___']", "index": 9 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plum", "bu", "m_", "._", "lib_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LF", "AN", "EW", "\\u", "OFFSET_", "=_", "30_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FILE", "\\u", "HEAD", "ER", "\\u", "SIZE_", "=_", "5_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SUBS", "YST", "EM", "\\u", "OFFSET_", "=_", "17_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMA", "GE", "\\u", "SUBS", "YST", "EM", "\\u", "WINDOWS", "\\u", "GUI_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMA", "GE", "\\u", "SUBS", "YST", "EM", "\\u", "WINDOWS", "\\u", "CU", "I_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "get", "\\u", "pe", "\\u", "subsystem", "(\"", "c", ":\\\\", "\\\\", "windows", "\\\\\\\\", "note", "pad", ".", "exe", "\"))", " ", "==", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "get", "\\u", "pe", "\\u", "subsystem", "(\"", "c", ":\\\\", "\\\\", "python", "32", "\\\\\\\\", "python", ".", "exe", "\"))", " ", "==", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "get", "\\u", "pe", "\\u", "subsystem", "(\"", "c", ":\\\\", "\\\\", "python", "32", "\\\\\\\\", "python", "w", ".", "exe", "\"))", " ", "==", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "pe", "\\u", "subsystem", "_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "filename_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "read_", "(_", "2_", ")_", "!=_", "six_", "._", "b_", "(_", "\"", "MZ", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "seek_", "(_", "LF", "AN", "EW", "\\u", "OFFSET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "ane", "w_", "=_", "struct_", "._", "unpack_", "(_", "\"", "L", "\"_", ",_", "f_", "._", "read_", "(_", "4_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "seek_", "(_", "lf", "ane", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "read_", "(_", "4_", ")_", "!=_", "six_", "._", "b_", "(_", "\"", "PE", "\\\\", "x0", "0", "\\\\", "x0", "0", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "seek_", "(_", "FILE", "\\u", "HEAD", "ER", "\\u", "SIZE_", "+_", "SUBS", "YST", "EM", "\\u", "OFFSET_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subsystem", "_", "=_", "struct_", "._", "unpack_", "(_", "\"", "H", "\"_", ",_", "f_", "._", "read_", "(_", "2_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "subsystem", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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\"\"\"\\\n machine host.domain.com login log password pa#ss account acct\n \"\"\", 'pa#ss')", "metadata": "root.NetrcTestCase.test_password_with_internal_hash", "header": "['class', 'NetrcTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Net", "rc", "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", "password", "\\u", "with", "\\u", "internal", "\\u", "hash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "test\\u", "passwords", "_", "(_", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "machine", " ", "host", ".", "domain", ".", "com", " ", "login", " ", "log", " ", "password", " ", "pa", "#", "ss", " ", "account", " ", "acct", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "'", "pa", "#", "ss", "'_", ")_", "\\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 ]
Imprecise assert
autocracy/python-ipy/test/test_fuzz.py
[ { "content": " @iterate(1000)\n def testRandomDisjoint(self):\n prefixes1 = [random_ipv4_prefix() for i in xrange(random.randrange(50))]\n prefixes2 = [random_ipv4_prefix() for i in xrange(random.randrange(50))]\n # test disjointnes the stupid way\n disjoint = True\n for p1, p2 in itertools.product(prefixes1, prefixes2):\n if p1 in p2 or p2 in p1:\n disjoint = False\n break\n ipset1 = IPy.IPSet(prefixes1)\n ipset2 = IPy.IPSet(prefixes2)\n self.assertEqual(ipset1.isdisjoint(ipset2), disjoint,\n \"%s.isdisjoint(%s) != %s\" % (ipset1, ipset2, disjoint))\n self.assertEqual(ipset2.isdisjoint(ipset1), disjoint,\n \"%s.isdisjoint(%s) != %s\" % (ipset2, ipset1, disjoint))", "metadata": "root.TestIPSet.testRandomDisjoint", "header": "['class', 'TestIPSet', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "IPS", "et_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "iterate_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Random", "Dis", "joint_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix", "es", "1_", "=_", "[_", "random", "\\u", "ipv", "4", "\\u", "prefix_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "random_", "._", "randrange_", "(_", "50_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix", "es", "2_", "=_", "[_", "random", "\\u", "ipv", "4", "\\u", "prefix_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "random_", "._", "randrange_", "(_", "50_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "disj", "oint", "nes", " ", "the", " ", "stu", "pid", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "disj", "oint_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p1_", ",_", "p2_", "in_", "itertools_", "._", "product_", "(_", "prefix", "es", "1_", ",_", "prefix", "es", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p1_", "in_", "p2_", "or_", "p2_", "in_", "p1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disj", "oint_", "=_", "False_", "\\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_", "ipse", "t1_", "=_", "IP", "y_", "._", "IPS", "et_", "(_", "prefix", "es", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipse", "t2_", "=_", "IP", "y_", "._", "IPS", "et_", "(_", "prefix", "es", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ipse", "t1_", "._", "isdi", "sj", "oint_", "(_", "ipse", "t2_", ")_", ",_", "disj", "oint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "isdi", "sj", "oint", "(%", "s", ")", " ", "!=", " ", "%", "s", "\"_", "%_", "(_", "ipse", "t1_", ",_", "ipse", "t2_", ",_", "disj", "oint_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ipse", "t2_", "._", "isdi", "sj", "oint_", "(_", "ipse", "t1_", ")_", ",_", "disj", "oint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "isdi", "sj", "oint", "(%", "s", ")", " ", "!=", " ", "%", "s", "\"_", "%_", "(_", "ipse", "t2_", ",_", "ipse", "t1_", ",_", "disj", "oint_", ")_", ")_", "\\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 ]
Redundant comparison
VisTrails/VisTrails/vistrails/gui/module_annotation.py
[ { "content": " def setModelData(self, editor, model, index):\n \"\"\" setModelData(editor: QWidget, model: QAbstractItemModel,\n index: QModelIndex) -> None \n Assign the value of the editor back into the model and emit a\n signal to update vistrail\n \n \"\"\"\n text = str(editor.text())\n row = index.row()\n col = index.column()\n keyItem = self.table.item(row, 0)\n if keyItem:\n key = str(keyItem.text())\n else:\n key = ''\n \n valueItem = self.table.item(row, 1)\n if valueItem:\n value = str(valueItem.text())\n else:\n value = ''\n \n if col==0:\n if text=='' and row<self.table.rowCount()-1:\n self.table.removeRow(row)\n if self.table.controller and self.table.module:\n self.table.lockUpdate()\n self.table.controller.delete_annotation(key,\n self.table.module.id)\n self.table.unlockUpdate()\n return\n if text!='' and text!=key:\n if (self.table.module and\n self.table.module.has_annotation_with_key(text)):\n if text == '__desc__':\n QtGui.QMessageBox.information(None,\n \"VisTrails\",\n 'Please use \"Set Module Label...\" menu option'\n ' to set the label for this module.')\n else:\n QtGui.QMessageBox.information(None,\n \"VisTrails\",\n text + ' already exists in '\n 'the annotations.')\n return\n\n if col==1 and key=='':\n QtGui.QMessageBox.information(None,\n \"VisTrails\",\n \"Must provide a key first.\")\n return\n \n \n if col==0 and key=='' and text!='' and value!='':\n self.table.addRow()\n \n if col==1:\n if text!=value:\n if self.table.controller and self.table.module:\n self.table.lockUpdate()\n self.table.controller.add_annotation((key, text),\n self.table.module.id)\n self.table.unlockUpdate()\n if row == self.table.rowCount()-1:\n self.table.addRow()\n \n elif text!='' and self.table.controller and self.table.module:\n moduleId = self.table.module.id\n self.table.lockUpdate()\n self.table.controller.previousModuleIds = [moduleId]\n if key!=text and key!='':\n self.table.controller.delete_annotation(key, moduleId)\n self.table.controller.add_annotation((text, value),\n moduleId)\n self.table.unlockUpdate()\n \n model.setData(index, text) ", "metadata": "root.QKeyValueDelegate.setModelData", "header": "['class', 'QKeyValueDelegate', '(', 'QtGui', '.', 'QItemDelegate', ')', ':', '___EOS___']", "index": 220 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "QK", "ey", "Value", "Delegate_", "(_", "Qt", "Gui_", "._", "QI", "tem", "Delegate_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Model", "Data_", "(_", "self_", ",_", "editor_", ",_", "model_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "set", "Model", "Data", "(", "editor", ":", " ", "QW", "idge", "t", ",", " ", "model", ":", " ", "QA", "bst", "ract", "Item", "Model", ",", "\\", "10", ";", " ", " ", " ", "index", ":", " ", "QM", "odel", "Index", ")", " ", "->", " ", "Non", "e", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Assign", " ", "the", " ", "value", " ", "of", " ", "the", " ", "editor", " ", "back", " ", "int", "o", " ", "the", " ", "model", " ", "and", " ", "emit", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "signal", " ", "to", " ", "update", " ", "vist", "rail", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "str_", "(_", "editor_", "._", "text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "index_", "._", "row_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "index_", "._", "column_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Item_", "=_", "self_", "._", "table_", "._", "item_", "(_", "row_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key", "Item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "str_", "(_", "key", "Item_", "._", "text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value", "Item_", "=_", "self_", "._", "table_", "._", "item_", "(_", "row_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value", "Item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "str_", "(_", "value", "Item_", "._", "text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "text_", "==_", "''_", "and_", "row_", "<_", "self_", "._", "table_", "._", "row", "Count_", "(_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table_", "._", "remove", "Row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "table_", "._", "controller_", "and_", "self_", "._", "table_", "._", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "table_", "._", "lock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "controller_", "._", "delete", "\\u", "annotation_", "(_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "table_", "._", "module_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "unlock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "text_", "!=_", "''_", "and_", "text_", "!=_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "table_", "._", "module_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "table_", "._", "module_", "._", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "text_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "text_", "==_", "'\\u", "\\u", "desc", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "information_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Vis", "Trail", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "use", " ", "\"", "Set", " ", "Modul", "e", " ", "Label", "...\"", " ", "menu", " ", "option", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "to", " ", "set", " ", "the", " ", "label", " ", "for", " ", "this", " ", "module", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "information_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Vis", "Trail", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "+_", "'", " ", "alr", "ead", "y", " ", "exist", "s", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "the", " ", "annot", "ation", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "1_", "and_", "key_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "information_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Vis", "Trail", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mus", "t", " ", "provide", " ", "a", " ", "key", " ", "first", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "0_", "and_", "key_", "==_", "''_", "and_", "text_", "!=_", "''_", "and_", "value_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table_", "._", "add", "Row_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "text_", "!=_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "table_", "._", "controller_", "and_", "self_", "._", "table_", "._", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "table_", "._", "lock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "controller_", "._", "add", "\\u", "annotation_", "(_", "(_", "key_", ",_", "text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "table_", "._", "module_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "unlock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "==_", "self_", "._", "table_", "._", "row", "Count_", "(_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table_", "._", "add", "Row_", "(_", ")_", "\\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_", "text_", "!=_", "''_", "and_", "self_", "._", "table_", "._", "controller_", "and_", "self_", "._", "table_", "._", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "Id_", "=_", "self_", "._", "table_", "._", "module_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "lock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "controller_", "._", "previ", "ous", "Modul", "e", "Ids_", "=_", "[_", "module", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "!=_", "text_", "and_", "key_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table_", "._", "controller_", "._", "delete", "\\u", "annotation_", "(_", "key_", ",_", "module", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "table_", "._", "controller_", "._", "add", "\\u", "annotation_", "(_", "(_", "text_", ",_", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "unlock", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "._", "set", "Data_", "(_", "index_", ",_", "text_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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": "from datetime import datetime\n\nimport sqlalchemy as sa\nfrom sqlalchemy_utils import TSVectorType\n\nfrom tests import ModelFormTestCase\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestFieldExclusion(ModelFormTestCase):\n\n", "metadata": "root.TestFieldExclusion", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def test_does_not_include_datetime_columns_with_default(self):\n self.init(sa.DateTime, default=datetime.now())\n assert not self.has_field('test_column')", "metadata": "root.TestFieldExclusion.test_does_not_include_datetime_columns_with_default", "header": "['class', 'TestFieldExclusion', '(', 'ModelFormTestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_excludes_surrogate_primary_keys_by_default(self):\n self.init()\n assert not self.has_field('id')", "metadata": "root.TestFieldExclusion.test_excludes_surrogate_primary_keys_by_default", "header": "['class', 'TestFieldExclusion', '(', 'ModelFormTestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_excludes_column_properties(self):\n self.init()\n self.ModelTest.calculated_value = sa.orm.column_property(\n sa.func.lower(self.ModelTest.test_column)\n )\n self.init_form()\n self.form_class()", "metadata": "root.TestFieldExclusion.test_excludes_column_properties", "header": "['class', 'TestFieldExclusion', '(', 'ModelFormTestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": "class TestTSVectorType(ModelFormTestCase):\n", "metadata": "root.TestTSVectorType", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def test_does_not_include_tsvector_typed_columns_with_default(self):\n self.init(TSVectorType)\n assert not self.has_field('test_column')", "metadata": "root.TestTSVectorType.test_does_not_include_tsvector_typed_columns_with_default", "header": "['class', 'TestTSVectorType', '(', 'ModelFormTestCase', ')', ':', '___EOS___']", "index": 28 } ]
[]
[]
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_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqla", "lche", "my", "\\u", "utils_", "import_", "TS", "Vector", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tests_", "import_", "Model", "Form", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "Field", "Exclu", "sion_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Field", "Exclu", "sion_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "doe", "s", "\\u", "not", "\\u", "include", "\\u", "datetime", "\\u", "column", "s", "\\u", "with", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init_", "(_", "sa_", "._", "Date", "Time_", ",_", "default_", "=_", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "has", "\\u", "field_", "(_", "'", "test\\u", "column", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Field", "Exclu", "sion_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "excludes", "\\u", "surrogate", "\\u", "primary", "\\u", "keys", "\\u", "by", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "has", "\\u", "field_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Field", "Exclu", "sion_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "excludes", "\\u", "column", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Model", "Test_", "._", "calculated", "\\u", "value_", "=_", "sa_", "._", "orm_", "._", "column", "\\u", "property_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sa_", "._", "func_", "._", "lower_", "(_", "self_", "._", "Model", "Test_", "._", "test\\u", "column_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "form", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "TS", "Vector", "Type_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "TS", "Vector", "Type_", "(_", "Model", "Form", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "doe", "s", "\\u", "not", "\\u", "include", "\\u", "tsv", "ector", "\\u", "typed", "\\u", "column", "s", "\\u", "with", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init_", "(_", "TS", "Vector", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "has", "\\u", "field_", "(_", "'", "test\\u", "column", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
'import *' may pollute namespace
viewfinderco/viewfinder/backend/www/test/build_archive_test.py
[ { "content": "# Copyright 2013 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Test build_archive service method.\n\"\"\"\nimport re\n\nfrom viewfinder.backend.db.follower import Follower\nfrom viewfinder.backend.db.viewpoint import Viewpoint\nfrom viewfinder.backend.services.email_mgr import TestEmailManager\n\n__authors__ = ['mike@emailscrubbed.com (Mike Purtell)']\n\nfrom viewfinder.backend.www.test import service_base_test\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "build", "\\u", "archive", " ", "service", " ", "method", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "follower", "_", "import_", "Followe", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "view", "point_", "import_", "View", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "services_", "._", "email", "\\u", "mgr_", "import_", "Test", "Ema", "il", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "'", "mike", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Mik", "e", " ", "Pur", "tell", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "www", "_", "._", "test_", "import_", "service", "\\u", "base", "\\u", "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\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fredrik-johansson/mpmath/mpmath/ctx_mp.py
[ { "content": " def fmul(ctx, x, y, **kwargs):\n \"\"\"\n Multiplies the numbers *x* and *y*, giving a floating-point result,\n optionally using a custom precision and rounding mode.\n\n See the documentation of :func:`~mpmath.fadd` for a detailed description\n of how to specify precision and rounding.\n\n **Examples**\n\n The result is an mpmath number::\n\n >>> from mpmath import *\n >>> mp.dps = 15; mp.pretty = False\n >>> fmul(2, 5.0)\n mpf('10.0')\n >>> fmul(0.5j, 0.5)\n mpc(real='0.0', imag='0.25')\n\n Avoiding roundoff::\n\n >>> x, y = 10**10+1, 10**15+1\n >>> print(x*y)\n 10000000001000010000000001\n >>> print(mpf(x) * mpf(y))\n 1.0000000001e+25\n >>> print(int(mpf(x) * mpf(y)))\n 10000000001000011026399232\n >>> print(int(fmul(x, y)))\n 10000000001000011026399232\n >>> print(int(fmul(x, y, dps=25)))\n 10000000001000010000000001\n >>> print(int(fmul(x, y, exact=True)))\n 10000000001000010000000001\n\n Exact multiplication with complex numbers can be inefficient and may\n be impossible to perform with large magnitude differences between\n real and imaginary parts::\n\n >>> x = 1+2j\n >>> y = mpc(2, '1e-100000000000000000000')\n >>> fmul(x, y)\n mpc(real='2.0', imag='4.0')\n >>> fmul(x, y, rounding='u')\n mpc(real='2.0', imag='4.0000000000000009')\n >>> fmul(x, y, exact=True)\n Traceback (most recent call last):\n ...\n OverflowError: the exact result does not fit in memory\n\n \"\"\"\n prec, rounding = ctx._parse_prec(kwargs)\n x = ctx.convert(x)\n y = ctx.convert(y)\n try:\n if hasattr(x, '_mpf_'):\n if hasattr(y, '_mpf_'):\n return ctx.make_mpf(mpf_mul(x._mpf_, y._mpf_, prec, rounding))\n if hasattr(y, '_mpc_'):\n return ctx.make_mpc(mpc_mul_mpf(y._mpc_, x._mpf_, prec, rounding))\n if hasattr(x, '_mpc_'):\n if hasattr(y, '_mpf_'):\n return ctx.make_mpc(mpc_mul_mpf(x._mpc_, y._mpf_, prec, rounding))\n if hasattr(y, '_mpc_'):\n return ctx.make_mpc(mpc_mul(x._mpc_, y._mpc_, prec, rounding))\n except (ValueError, OverflowError):\n raise OverflowError(ctx._exact_overflow_msg)\n raise ValueError(\"Arguments need to be mpf or mpc compatible numbers\")", "metadata": "root.MPContext.fmul", "header": "['class', 'MPContext', '(', 'BaseMPContext', ',', 'StandardBaseContext', ')', ':', '___EOS___']", "index": 977 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "MP", "Context_", "(_", "Base", "MP", "Context_", ",_", "Standard", "Base", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fm", "ul_", "(_", "ctx_", ",_", "x_", ",_", "y_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Multipl", "ies", " ", "the", " ", "numbers", " ", "*", "x", "*", " ", "and", " ", "*", "y", "*", ",", " ", "gi", "ving", " ", "a", " ", "float", "ing", "-", "point", " ", "result", ",", "\\", "10", ";", " ", " ", " ", " ", "option", "ally", " ", "usi", "ng", " ", "a", " ", "custom", " ", "preci", "sion", " ", "and", " ", "rounding", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", "documentation", " ", "of", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "fad", "d", "`", " ", "for", " ", "a", " ", "detailed", " ", "description", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "how", " ", "to", " ", "speci", "fy", " ", "preci", "sion", " ", "and", " ", "rounding", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ples", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", " ", "is", " ", "an", " ", "mpm", "ath", " ", "number", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "*", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mp", ".", "dps", " ", "=", " ", "15", ";", " ", "mp", ".", "pretty", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fm", "ul", "(", "2", ",", " ", "5.0", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "10.", "0", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fm", "ul", "(", "0.", "5", "j", ",", " ", "0.", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "mpc", "(", "real", "='", "0.", "0", "',", " ", "imag", "='", "0.25", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Av", "oid", "ing", " ", "round", "off", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ",", " ", "y", " ", "=", " ", "10", "**", "10", "+", "1", ",", " ", "10", "**", "15", "+", "1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "x", "*", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "1000000000", "10000", "1000000000", "1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "mpf", "(", "x", ")", " ", "*", " ", "mpf", "(", "y", "))\\", "10", ";", " ", " ", " ", " ", "1.000000", "0001", "e", "+", "25", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "int", "(", "mpf", "(", "x", ")", " ", "*", " ", "mpf", "(", "y", ")))", "\\", "10", ";", " ", " ", " ", " ", "1000000000", "10000", "1102", "639", "923", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "int", "(", "fm", "ul", "(", "x", ",", " ", "y", ")))", "\\", "10", ";", " ", " ", " ", " ", "1000000000", "10000", "1102", "639", "923", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "int", "(", "fm", "ul", "(", "x", ",", " ", "y", ",", " ", "dps", "=", "25", ")))", "\\", "10", ";", " ", " ", " ", " ", "1000000000", "10000", "1000000000", "1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "int", "(", "fm", "ul", "(", "x", ",", " ", "y", ",", " ", "exact", "=", "Tru", "e", ")))", "\\", "10", ";", " ", " ", " ", " ", "1000000000", "10000", "1000000000", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ct", " ", "multiplication", " ", "with", " ", "complex", " ", "numbers", " ", "can", " ", "be", " ", "ine", "ffic", "ient", " ", "and", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "impossible", " ", "to", " ", "perform", " ", "with", " ", "large", " ", "magnitude", " ", "difference", "s", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "real", " ", "and", " ", "imagin", "ary", " ", "part", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "1", "+", "2j", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "mpc", "(", "2", ",", " ", "'", "1e-1", "0000000000000", "0000000", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fm", "ul", "(", "x", ",", " ", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "mpc", "(", "real", "='", "2.0", "',", " ", "imag", "='", "4.0", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fm", "ul", "(", "x", ",", " ", "y", ",", " ", "rounding", "='", "u", "')", "\\", "10", ";", " ", " ", " ", " ", "mpc", "(", "real", "='", "2.0", "',", " ", "imag", "='", "4.0", "0000000000000", "09", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fm", "ul", "(", "x", ",", " ", "y", ",", " ", "exact", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Over", "flow", "Error", ":", " ", "the", " ", "exact", " ", "result", " ", "doe", "s", " ", "not", " ", "fit", " ", "in", " ", "memory", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prec_", ",_", "rounding", "_", "=_", "ctx_", "._", "\\u", "parse", "\\u", "prec_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "ctx_", "._", "convert_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "ctx_", "._", "convert_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "x_", ",_", "'\\u", "mpf", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "y_", ",_", "'\\u", "mpf", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "mpf", "\\u", "mul_", "(_", "x_", "._", "\\u", "mpf", "\\u_", ",_", "y_", "._", "\\u", "mpf", "\\u_", ",_", "prec_", ",_", "rounding", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "y_", ",_", "'\\u", "mpc", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "ctx_", "._", "make", "\\u", "mpc", "_", "(_", "mpc", "\\u", "mul", "\\u", "mpf", "_", "(_", "y_", "._", "\\u", "mpc", "\\u_", ",_", "x_", "._", "\\u", "mpf", "\\u_", ",_", "prec_", ",_", "rounding", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "x_", ",_", "'\\u", "mpc", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "y_", ",_", "'\\u", "mpf", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "ctx_", "._", "make", "\\u", "mpc", "_", "(_", "mpc", "\\u", "mul", "\\u", "mpf", "_", "(_", "x_", "._", "\\u", "mpc", "\\u_", ",_", "y_", "._", "\\u", "mpf", "\\u_", ",_", "prec_", ",_", "rounding", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "y_", ",_", "'\\u", "mpc", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "ctx_", "._", "make", "\\u", "mpc", "_", "(_", "mpc", "\\u", "mul_", "(_", "x_", "._", "\\u", "mpc", "\\u_", ",_", "y_", "._", "\\u", "mpc", "\\u_", ",_", "prec_", ",_", "rounding", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Over", "flow", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Over", "flow", "Error_", "(_", "ctx_", "._", "\\u", "exact", "\\u", "overflow", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"", "Arg", "ument", "s", " ", "need", " ", "to", " ", "be", " ", "mpf", " ", "or", " ", "mpc", " ", "compatible", " ", "numbers", "\"_", ")_", "\\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,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/vendor/django/core/management/base.py
[ { "content": "\"\"\"\nBase classes for writing management commands (named commands which can\nbe executed through ``django-admin.py`` or ``manage.py``).\n\n\"\"\"\n\nimport os\nimport sys\nfrom optparse import make_option, OptionParser\n\nimport django\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.management.color import color_style\n\ntry:\n set\nexcept NameError:\n from sets import Set as set # For Python 2.3\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CommandError(Exception):\n \"\"\"\n Exception class indicating a problem while executing a management\n command.\n\n If this exception is raised during the execution of a management\n command, it will be caught and turned into a nicely-printed error\n message to the appropriate output stream (i.e., stderr); as a\n result, raising this exception (with a sensible description of the\n error) is the preferred way to indicate that something has gone\n wrong in the execution of a command.\n \n \"\"\"\n pass", "metadata": "root.CommandError", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def handle_default_options(options):\n \"\"\"\n Include any default options that all commands should accept here\n so that ManagementUtility can handle them before searching for\n user commands.\n \n \"\"\"\n if options.settings:\n os.environ['DJANGO_SETTINGS_MODULE'] = options.settings\n if options.pythonpath:\n sys.path.insert(0, options.pythonpath)", "metadata": "root.handle_default_options", "header": "['module', '___EOS___']", "index": 34 }, { "content": "class BaseCommand(object):\n \"\"\"\n The base class from which all management commands ultimately\n derive.\n\n Use this class if you want access to all of the mechanisms which\n parse the command-line arguments and work out what code to call in\n response; if you don't need to change any of that behavior,\n consider using one of the subclasses defined in this file.\n\n If you are interested in overriding/customizing various aspects of\n the command-parsing and -execution behavior, the normal flow works\n as follows:\n\n 1. ``django-admin.py`` or ``manage.py`` loads the command class\n and calls its ``run_from_argv()`` method.\n\n 2. The ``run_from_argv()`` method calls ``create_parser()`` to get\n an ``OptionParser`` for the arguments, parses them, performs\n any environment changes requested by options like\n ``pythonpath``, and then calls the ``execute()`` method,\n passing the parsed arguments.\n\n 3. The ``execute()`` method attempts to carry out the command by\n calling the ``handle()`` method with the parsed arguments; any\n output produced by ``handle()`` will be printed to standard\n output and, if the command is intended to produce a block of\n SQL statements, will be wrapped in ``BEGIN`` and ``COMMIT``.\n\n 4. If ``handle()`` raised a ``CommandError``, ``execute()`` will\n instead print an error message to ``stderr``.\n\n Thus, the ``handle()`` method is typically the starting point for\n subclasses; many built-in commands and command types either place\n all of their logic in ``handle()``, or perform some additional\n parsing work in ``handle()`` and then delegate from it to more\n specialized methods as needed.\n\n Several attributes affect behavior at various steps along the way:\n \n ``args``\n A string listing the arguments accepted by the command,\n suitable for use in help messages; e.g., a command which takes\n a list of application names might set this to '<appname\n appname ...>'.\n\n ``can_import_settings``\n A boolean indicating whether the command needs to be able to\n import Django settings; if ``True``, ``execute()`` will verify\n that this is possible before proceeding. Default value is\n ``True``.\n\n ``help``\n A short description of the command, which will be printed in\n help messages.\n\n ``option_list``\n This is the list of ``optparse`` options which will be fed\n into the command's ``OptionParser`` for parsing arguments.\n\n ``output_transaction``\n A boolean indicating whether the command outputs SQL\n statements; if ``True``, the output will automatically be\n wrapped with ``BEGIN;`` and ``COMMIT;``. Default value is\n ``False``.\n\n ``requires_model_validation``\n A boolean; if ``True``, validation of installed models will be\n performed prior to executing the command. Default value is\n ``True``. To validate an individual application's models\n rather than all applications' models, call\n ``self.validate(app)`` from ``handle()``, where ``app`` is the\n application's Python module.\n \n \"\"\"\n # Metadata about this command.\n option_list = (\n make_option('-v', '--verbosity', action='store', dest='verbosity', default='1',\n type='choice', choices=['0', '1', '2'],\n help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),\n make_option('--settings',\n help='The Python path to a settings module, e.g. \"myproject.settings.main\". If this isn\\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.'),\n make_option('--pythonpath',\n help='A directory to add to the Python path, e.g. \"/home/djangoprojects/myproject\".'),\n make_option('--traceback', action='store_true',\n help='Print traceback on exception'),\n )\n help = ''\n args = ''\n\n # Configuration shortcuts that alter various logic.\n can_import_settings = True\n requires_model_validation = True\n output_transaction = False # Whether to wrap the output in a \"BEGIN; COMMIT;\"\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseCommand", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def __init__(self):\n self.style = color_style()", "metadata": "root.BaseCommand.__init__", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": " def get_version(self):\n \"\"\"\n Return the Django version, which should be correct for all\n built-in Django commands. User-supplied commands should\n override this method.\n \n \"\"\"\n return django.get_version()", "metadata": "root.BaseCommand.get_version", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def usage(self, subcommand):\n \"\"\"\n Return a brief description of how to use this command, by\n default from the attribute ``self.help``.\n \n \"\"\"\n usage = '%%prog %s [options] %s' % (subcommand, self.args)\n if self.help:\n return '%s\\n\\n%s' % (usage, self.help)\n else:\n return usage", "metadata": "root.BaseCommand.usage", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": " def create_parser(self, prog_name, subcommand):\n \"\"\"\n Create and return the ``OptionParser`` which will be used to\n parse the arguments to this command.\n \n \"\"\"\n return OptionParser(prog=prog_name,\n usage=self.usage(subcommand),\n version=self.get_version(),\n option_list=self.option_list)", "metadata": "root.BaseCommand.create_parser", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " def print_help(self, prog_name, subcommand):\n \"\"\"\n Print the help message for this command, derived from\n ``self.usage()``.\n \n \"\"\"\n parser = self.create_parser(prog_name, subcommand)\n parser.print_help()", "metadata": "root.BaseCommand.print_help", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def run_from_argv(self, argv):\n \"\"\"\n Set up any environment changes requested (e.g., Python path\n and Django settings), then run this command.\n \n \"\"\"\n parser = self.create_parser(argv[0], argv[1])\n options, args = parser.parse_args(argv[2:])\n handle_default_options(options)\n self.execute(*args, **options.__dict__)", "metadata": "root.BaseCommand.run_from_argv", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 185 }, { "content": " def execute(self, *args, **options):\n \"\"\"\n Try to execute this command, performing model validation if\n needed (as controlled by the attribute\n ``self.requires_model_validation``). If the command raises a\n ``CommandError``, intercept it and print it sensibly to\n stderr.\n \n \"\"\"\n # Switch to English, because django-admin.py creates database content\n # like permissions, and those shouldn't contain any translations.\n # But only do this if we can assume we have a working settings file,\n # because django.utils.translation requires settings.\n if self.can_import_settings:\n try:\n from django.utils import translation\n translation.activate('en-us')\n except ImportError, e:\n # If settings should be available, but aren't,\n # raise the error and quit.\n sys.stderr.write(self.style.ERROR(str('Error: %s\\n' % e)))\n sys.exit(1)\n try:\n if self.requires_model_validation:\n self.validate()\n output = self.handle(*args, **options)\n if output:\n if self.output_transaction:\n # This needs to be imported here, because it relies on settings.\n from django.db import connection\n if connection.ops.start_transaction_sql():\n print self.style.SQL_KEYWORD(connection.ops.start_transaction_sql())\n print output\n if self.output_transaction:\n print self.style.SQL_KEYWORD(\"COMMIT;\")\n except CommandError, e:\n sys.stderr.write(self.style.ERROR(str('Error: %s\\n' % e)))\n sys.exit(1)", "metadata": "root.BaseCommand.execute", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 196 }, { "content": " def validate(self, app=None, display_num_errors=False):\n \"\"\"\n Validates the given app, raising CommandError for any errors.\n \n If app is None, then this will validate all installed apps.\n \n \"\"\"\n from django.core.management.validation import get_validation_errors\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO\n s = StringIO()\n num_errors = get_validation_errors(s, app)\n if num_errors:\n s.seek(0)\n error_text = s.read()\n raise CommandError(\"One or more models did not validate:\\n%s\" % error_text)\n if display_num_errors:\n print \"%s error%s found\" % (num_errors, num_errors != 1 and 's' or '')", "metadata": "root.BaseCommand.validate", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 235 }, { "content": " def handle(self, *args, **options):\n \"\"\"\n The actual logic of the command. Subclasses must implement\n this method.\n \n \"\"\"\n raise NotImplementedError()", "metadata": "root.BaseCommand.handle", "header": "['class', 'BaseCommand', '(', 'object', ')', ':', '___EOS___']", "index": 256 }, { "content": "class AppCommand(BaseCommand):\n \"\"\"\n A management command which takes one or more installed application\n names as arguments, and does something with each of them.\n\n Rather than implementing ``handle()``, subclasses must implement\n ``handle_app()``, which will be called once for each application.\n \n \"\"\"\n args = '<appname appname ...>'\n\n", "metadata": "root.AppCommand", "header": "['module', '___EOS___']", "index": 264 }, { "content": " def handle(self, *app_labels, **options):\n from django.db import models\n if not app_labels:\n raise CommandError('Enter at least one appname.')\n try:\n app_list = [models.get_app(app_label) for app_label in app_labels]\n except (ImproperlyConfigured, ImportError), e:\n raise CommandError(\"%s. Are you sure your INSTALLED_APPS setting is correct?\" % e)\n output = []\n for app in app_list:\n app_output = self.handle_app(app, **options)\n if app_output:\n output.append(app_output)\n return '\\n'.join(output)", "metadata": "root.AppCommand.handle", "header": "['class', 'AppCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 275 }, { "content": " def handle_app(self, app, **options):\n \"\"\"\n Perform the command's actions for ``app``, which will be the\n Python module corresponding to an application name given on\n the command line.\n \n \"\"\"\n raise NotImplementedError()", "metadata": "root.AppCommand.handle_app", "header": "['class', 'AppCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 290 }, { "content": "class LabelCommand(BaseCommand):\n \"\"\"\n A management command which takes one or more arbitrary arguments\n (labels) on the command line, and does something with each of\n them.\n\n Rather than implementing ``handle()``, subclasses must implement\n ``handle_label()``, which will be called once for each label.\n\n If the arguments should be names of installed applications, use\n ``AppCommand`` instead.\n \n \"\"\"\n args = '<label label ...>'\n label = 'label'\n\n", "metadata": "root.LabelCommand", "header": "['module', '___EOS___']", "index": 299 }, { "content": " def handle(self, *labels, **options):\n if not labels:\n raise CommandError('Enter at least one %s.' % self.label)\n\n output = []\n for label in labels:\n label_output = self.handle_label(label, **options)\n if label_output:\n output.append(label_output)\n return '\\n'.join(output)", "metadata": "root.LabelCommand.handle", "header": "['class', 'LabelCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 315 }, { "content": " def handle_label(self, label, **options):\n \"\"\"\n Perform the command's actions for ``label``, which will be the\n string as given on the command line.\n \n \"\"\"\n raise NotImplementedError()", "metadata": "root.LabelCommand.handle_label", "header": "['class', 'LabelCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 326 }, { "content": "class NoArgsCommand(BaseCommand):\n \"\"\"\n A command which takes no arguments on the command line.\n\n Rather than implementing ``handle()``, subclasses must implement\n ``handle_noargs()``; ``handle()`` itself is overridden to ensure\n no arguments are passed to the command.\n\n Attempting to pass arguments will raise ``CommandError``.\n \n \"\"\"\n args = ''\n\n", "metadata": "root.NoArgsCommand", "header": "['module', '___EOS___']", "index": 334 }, { "content": " def handle(self, *args, **options):\n if args:\n raise CommandError(\"Command doesn't accept any arguments\")\n return self.handle_noargs(**options)", "metadata": "root.NoArgsCommand.handle", "header": "['class', 'NoArgsCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 347 }, { "content": " def handle_noargs(self, **options):\n \"\"\"\n Perform this command's actions.\n \n \"\"\"\n raise NotImplementedError()", "metadata": "root.NoArgsCommand.handle_noargs", "header": "['class', 'NoArgsCommand', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 352 }, { "content": "def copy_helper(style, app_or_project, name, directory, other_name=''):\n \"\"\"\n Copies either a Django application layout template or a Django project\n layout template into the specified directory.\n\n \"\"\"\n # style -- A color style object (see django.core.management.color).\n # app_or_project -- The string 'app' or 'project'.\n # name -- The name of the application or project.\n # directory -- The directory to which the layout template should be copied.\n # other_name -- When copying an application layout, this should be the name\n # of the project.\n import re\n import shutil\n other = {'project': 'app', 'app': 'project'}[app_or_project]\n if not re.search(r'^[_a-zA-Z]\\w*$', name): # If it's not a valid directory name.\n # Provide a smart error message, depending on the error.\n if not re.search(r'^[_a-zA-Z]', name):\n message = 'make sure the name begins with a letter or underscore'\n else:\n message = 'use only numbers, letters and underscores'\n raise CommandError(\"%r is not a valid %s name. Please %s.\" % (name, app_or_project, message))\n top_dir = os.path.join(directory, name)\n try:\n os.mkdir(top_dir)\n except OSError, e:\n raise CommandError(e)\n\n # Determine where the app or project templates are. Use\n # django.__path__[0] because we don't know into which directory\n # django has been installed.\n template_dir = os.path.join(django.__path__[0], 'conf', '%s_template' % app_or_project)\n\n for d, subdirs, files in os.walk(template_dir):\n relative_dir = d[len(template_dir)+1:].replace('%s_name' % app_or_project, name)\n if relative_dir:\n os.mkdir(os.path.join(top_dir, relative_dir))\n for i, subdir in enumerate(subdirs):\n if subdir.startswith('.'):\n del subdirs[i]\n for f in files:\n if f.endswith('.pyc'):\n continue\n path_old = os.path.join(d, f)\n path_new = os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name))\n fp_old = open(path_old, 'r')\n fp_new = open(path_new, 'w')\n fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name).replace('{{ %s_name }}' % other, other_name))\n fp_old.close()\n fp_new.close()\n try:\n shutil.copymode(path_old, path_new)\n _make_writeable(path_new)\n except OSError:\n sys.stderr.write(style.NOTICE(\"Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\\n\" % path_new))", "metadata": "root.copy_helper", "header": "['module', '___EOS___']", "index": 359 }, { "content": "def _make_writeable(filename):\n \"\"\"\n Make sure that the file is writeable. Useful if our source is\n read-only.\n \n \"\"\"\n import stat\n if sys.platform.startswith('java'):\n # On Jython there is no os.access()\n return\n if not os.access(filename, os.W_OK):\n st = os.stat(filename)\n new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR\n os.chmod(filename, new_permissions)", "metadata": "root._make_writeable", "header": "['module', '___EOS___']", "index": 415 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Base", " ", "classe", "s", " ", "for", " ", "writ", "ing", " ", "manage", "ment", " ", "command", "s", " ", "(", "named", " ", "command", "s", " ", "whi", "ch", " ", "can", "\\", "10", ";", "be", " ", "executed", " ", "through", " ", "``", "django", "-", "admin", ".", "py", "``", " ", "or", " ", "``", "manage", ".", "py", "``)", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "make", "\\u", "option_", ",_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "color_", "import_", "color", "\\u", "style_", "\\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 ", " _", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "#", " ", "For", " ", "Pyth", "on", " ", "2.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Command", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Except", "ion", " ", "class", " ", "indicati", "ng", " ", "a", " ", "problem", " ", "whi", "le", " ", "executi", "ng", " ", "a", " ", "manage", "ment", "\\", "10", ";", " ", " ", " ", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "this", " ", "exception", " ", "is", " ", "raise", "d", " ", "dur", "ing", " ", "the", " ", "executi", "on", " ", "of", " ", "a", " ", "manage", "ment", "\\", "10", ";", " ", " ", " ", " ", "command", ",", " ", "it", " ", "will", " ", "be", " ", "cau", "ght", " ", "and", " ", "turn", "ed", " ", "int", "o", " ", "a", " ", "nice", "ly", "-", "printed", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "to", " ", "the", " ", "appropr", "iate", " ", "output", " ", "stream", " ", "(", "i", ".", "e", ".,", " ", "std", "err", ");", " ", "as", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "result", ",", " ", "rais", "ing", " ", "this", " ", "exception", " ", "(", "with", " ", "a", " ", "sensi", "ble", " ", "description", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "error", ")", " ", "is", " ", "the", " ", "prefer", "red", " ", "way", " ", "to", " ", "indicat", "e", " ", "tha", "t", " ", "somet", "hing", " ", "has", " ", "gone", "\\", "10", ";", " ", " ", " ", " ", "wrong", " ", "in", " ", "the", " ", "executi", "on", " ", "of", " ", "a", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "default", "\\u", "options_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Include", " ", "any", " ", "default", " ", "options", " ", "tha", "t", " ", "all", " ", "command", "s", " ", "shou", "ld", " ", "accept", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "tha", "t", " ", "Manage", "ment", "Utili", "ty", " ", "can", " ", "handle", " ", "them", " ", "bef", "ore", " ", "search", "ing", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "command", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "options_", "._", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "python", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "options_", "._", "python", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "base", " ", "class", " ", "from", " ", "whi", "ch", " ", "all", " ", "manage", "ment", " ", "command", "s", " ", "ultima", "tel", "y", "\\", "10", ";", " ", " ", " ", " ", "derive", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "this", " ", "class", " ", "if", " ", "you", " ", "want", " ", "access", " ", "to", " ", "all", " ", "of", " ", "the", " ", "mechanism", "s", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "parse", " ", "the", " ", "command", "-", "line", " ", "argu", "ment", "s", " ", "and", " ", "work", " ", "out", " ", "what", " ", "code", " ", "to", " ", "call", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "response", ";", " ", "if", " ", "you", " ", "don", "'", "t", " ", "need", " ", "to", " ", "change", " ", "any", " ", "of", " ", "tha", "t", " ", "behavior", ",", "\\", "10", ";", " ", " ", " ", " ", "consider", " ", "usi", "ng", " ", "one", " ", "of", " ", "the", " ", "subclasses", " ", "defin", "ed", " ", "in", " ", "this", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "are", " ", "interest", "ed", " ", "in", " ", "overrid", "ing", "/", "customi", "zin", "g", " ", "vari", "ous", " ", "aspect", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "command", "-", "pars", "ing", " ", "and", " ", "-", "executi", "on", " ", "behavior", ",", " ", "the", " ", "normal", " ", "flow", " ", "works", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "follow", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "``", "django", "-", "admin", ".", "py", "``", " ", "or", " ", "``", "manage", ".", "py", "``", " ", "load", "s", " ", "the", " ", "command", " ", "class", "\\", "10", ";", " ", " ", " ", "and", " ", "calls", " ", "its", " ", "``", "run", "\\u", "from", "\\u", "argv", "()``", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "The", " ", "``", "run", "\\u", "from", "\\u", "argv", "()``", " ", "method", " ", "calls", " ", "``", "create", "\\u", "parser", "()``", " ", "to", " ", "get", "\\", "10", ";", " ", " ", " ", "an", " ", "``", "Optio", "n", "Parser", "``", " ", "for", " ", "the", " ", "argu", "ment", "s", ",", " ", "parse", "s", " ", "them", ",", " ", "perform", "s", "\\", "10", ";", " ", " ", " ", "any", " ", "environ", "ment", " ", "change", "s", " ", "request", "ed", " ", "by", " ", "options", " ", "like", "\\", "10", ";", " ", " ", " ", "``", "python", "path", "``", ",", " ", "and", " ", "then", " ", "calls", " ", "the", " ", "``", "execute", "()``", " ", "method", ",", "\\", "10", ";", " ", " ", " ", "passi", "ng", " ", "the", " ", "parsed", " ", "argu", "ment", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "The", " ", "``", "execute", "()``", " ", "method", " ", "atte", "mpt", "s", " ", "to", " ", "carry", " ", "out", " ", "the", " ", "command", " ", "by", "\\", "10", ";", " ", " ", " ", "calling", " ", "the", " ", "``", "handle", "()``", " ", "method", " ", "with", " ", "the", " ", "parsed", " ", "argu", "ment", "s", ";", " ", "any", "\\", "10", ";", " ", " ", " ", "output", " ", "produce", "d", " ", "by", " ", "``", "handle", "()``", " ", "will", " ", "be", " ", "printed", " ", "to", " ", "standard", "\\", "10", ";", " ", " ", " ", "output", " ", "and", ",", " ", "if", " ", "the", " ", "command", " ", "is", " ", "inten", "ded", " ", "to", " ", "produce", " ", "a", " ", "block", " ", "of", "\\", "10", ";", " ", " ", " ", "SQL", " ", "statem", "ents", ",", " ", "will", " ", "be", " ", "wrapp", "ed", " ", "in", " ", "``", "BEGIN", "``", " ", "and", " ", "``", "COMMIT", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "If", " ", "``", "handle", "()``", " ", "raise", "d", " ", "a", " ", "``", "Command", "Error", "``", ",", " ", "``", "execute", "()``", " ", "will", "\\", "10", ";", " ", " ", " ", "inst", "ead", " ", "print", " ", "an", " ", "error", " ", "message", " ", "to", " ", "``", "std", "err", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thu", "s", ",", " ", "the", " ", "``", "handle", "()``", " ", "method", " ", "is", " ", "typical", "ly", " ", "the", " ", "startin", "g", " ", "point", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "subclasses", ";", " ", "many", " ", "bui", "lt", "-", "in", " ", "command", "s", " ", "and", " ", "command", " ", "types", " ", "eit", "her", " ", "place", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "of", " ", "thei", "r", " ", "logic", " ", "in", " ", "``", "handle", "()``", ",", " ", "or", " ", "perform", " ", "some", " ", "addition", "al", "\\", "10", ";", " ", " ", " ", " ", "pars", "ing", " ", "work", " ", "in", " ", "``", "handle", "()``", " ", "and", " ", "then", " ", "delegate", " ", "from", " ", "it", " ", "to", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "specialize", "d", " ", "method", "s", " ", "as", " ", "need", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Seve", "ral", " ", "attribute", "s", " ", "affect", " ", "behavior", " ", "at", " ", "vari", "ous", " ", "step", "s", " ", "along", " ", "the", " ", "way", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "``", "args", "``", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "listi", "ng", " ", "the", " ", "argu", "ment", "s", " ", "accept", "ed", " ", "by", " ", "the", " ", "command", ",", "\\", "10", ";", " ", " ", " ", " ", "suit", "able", " ", "for", " ", "use", " ", "in", " ", "help", " ", "message", "s", ";", " ", "e", ".", "g", ".,", " ", "a", " ", "command", " ", "whi", "ch", " ", "take", "s", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "list", " ", "of", " ", "applica", "tion", " ", "names", " ", "mig", "ht", " ", "set", " ", "this", " ", "to", " ", "'<", "app", "name", "\\", "10", ";", " ", " ", " ", " ", "app", "name", " ", "...", ">'", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "can", "\\u", "import", "\\u", "settings", "``", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "boolean", " ", "indicati", "ng", " ", "whe", "ther", " ", "the", " ", "command", " ", "need", "s", " ", "to", " ", "be", " ", "able", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "Dj", "ang", "o", " ", "settings", ";", " ", "if", " ", "``", "Tru", "e", "``", ",", " ", "``", "execute", "()``", " ", "will", " ", "verify", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "this", " ", "is", " ", "possib", "le", " ", "bef", "ore", " ", "proceed", "ing", ".", " ", "Default", " ", "value", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "``", "Tru", "e", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "help", "``", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "short", " ", "description", " ", "of", " ", "the", " ", "command", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "printed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "help", " ", "message", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "option", "\\u", "list", "``", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "list", " ", "of", " ", "``", "optparse", "``", " ", "options", " ", "whi", "ch", " ", "will", " ", "be", " ", "fed", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "the", " ", "command", "'", "s", " ", "``", "Optio", "n", "Parser", "``", " ", "for", " ", "pars", "ing", " ", "argu", "ment", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "output", "\\u", "transaction", "``", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "boolean", " ", "indicati", "ng", " ", "whe", "ther", " ", "the", " ", "command", " ", "output", "s", " ", "SQL", "\\", "10", ";", " ", " ", " ", " ", "statem", "ents", ";", " ", "if", " ", "``", "Tru", "e", "``", ",", " ", "the", " ", "output", " ", "will", " ", "automati", "call", "y", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "ed", " ", "with", " ", "``", "BEGIN", ";", "``", " ", "and", " ", "``", "COMMIT", ";", "``.", " ", "Default", " ", "value", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "``", "Fal", "se", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "require", "s", "\\u", "model", "\\u", "validation", "``", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "boolean", ";", " ", "if", " ", "``", "Tru", "e", "``", ",", " ", "validation", " ", "of", " ", "install", "ed", " ", "model", "s", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "perform", "ed", " ", "prior", " ", "to", " ", "executi", "ng", " ", "the", " ", "command", ".", " ", "Default", " ", "value", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "``", "Tru", "e", "``.", " ", "To", " ", "validat", "e", " ", "an", " ", "individual", " ", "applica", "tion", "'", "s", " ", "model", "s", "\\", "10", ";", " ", " ", " ", " ", "rat", "her", " ", "than", " ", "all", " ", "applica", "tion", "s", "'", " ", "model", "s", ",", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "``", "self", ".", "validat", "e", "(", "app", ")`", "`", " ", "from", " ", "``", "handle", "()``", ",", " ", "where", " ", "``", "app", "``", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "applica", "tion", "'", "s", " ", "Pyth", "on", " ", "module", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Meta", "data", " ", "abo", "ut", " ", "this", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "option", "\\u", "list_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "option_", "(_", "'-", "v", "'_", ",_", "'--", "verbo", "sity", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "dest_", "=_", "'", "verbo", "sity", "'_", ",_", "default_", "=_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "choice", "'_", ",_", "choices_", "=_", "[_", "'", "0", "'_", ",_", "'", "1", "'_", ",_", "'", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Verbos", "it", "y", " ", "level", ";", " ", "0", "=", "minima", "l", " ", "output", ",", " ", "1", "=", "normal", " ", "output", ",", " ", "2", "=", "all", " ", "output", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "option_", "(_", "'--", "settings", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "Pyth", "on", " ", "path", " ", "to", " ", "a", " ", "settings", " ", "module", ",", " ", "e", ".", "g", ".", " ", "\"", "mypro", "ject", ".", "settings", ".", "main", "\".", " ", "If", " ", "this", " ", "isn", "\\\\'", "t", " ", "provided", ",", " ", "the", " ", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", " ", "environ", "ment", " ", "variab", "le", " ", "will", " ", "be", " ", "used", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "option_", "(_", "'--", "python", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "A", " ", "director", "y", " ", "to", " ", "add", " ", "to", " ", "the", " ", "Pyth", "on", " ", "path", ",", " ", "e", ".", "g", ".", " ", "\"/", "home", "/", "django", "project", "s", "/", "mypro", "ject", "\".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "option_", "(_", "'--", "traceback", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Print", " ", "traceback", " ", "on", " ", "exception", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configura", "tion", " ", "shortcut", "s", " ", "tha", "t", " ", "alter", " ", "vari", "ous", " ", "logic", "._", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "import", "\\u", "settings_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "s", "\\u", "model", "\\u", "validation_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "transaction_", "=_", "False_", "#", " ", "Whe", "ther", " ", "to", " ", "wrap", " ", "the", " ", "output", " ", "in", " ", "a", " ", "\"", "BEGIN", ";", " ", "COMMIT", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "style_", "=_", "color", "\\u", "style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "Dj", "ang", "o", " ", "version", ",", " ", "whi", "ch", " ", "shou", "ld", " ", "be", " ", "correct", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "bui", "lt", "-", "in", " ", "Dj", "ang", "o", " ", "command", "s", ".", " ", "User", "-", "supplie", "d", " ", "command", "s", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "override", " ", "this", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "django_", "._", "get", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "usage_", "(_", "self_", ",_", "subcommand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "brief", " ", "description", " ", "of", " ", "how", " ", "to", " ", "use", " ", "this", " ", "command", ",", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "default", " ", "from", " ", "the", " ", "attribute", " ", "``", "self", ".", "help", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "=_", "'%%", "prog", " ", "%", "s", " ", "[", "options", "]", " ", "%", "s", "'_", "%_", "(_", "subcommand_", ",_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "help_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", "\\\\", "n", "\\\\", "n", "%", "s", "'_", "%_", "(_", "usage_", ",_", "self_", "._", "help_", ")_", "\\u\\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_", "usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ",_", "subcommand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "and", " ", "return", " ", "the", " ", "``", "Optio", "n", "Parser", "``", " ", "whi", "ch", " ", "will", " ", "be", " ", "used", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "parse", " ", "the", " ", "argu", "ment", "s", " ", "to", " ", "this", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Optio", "n", "Parser_", "(_", "prog_", "=_", "prog", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "self_", "._", "usage_", "(_", "subcommand_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "self_", "._", "get", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "option", "\\u", "list_", "=_", "self_", "._", "option", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "help_", "(_", "self_", ",_", "prog", "\\u", "name_", ",_", "subcommand_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Print", " ", "the", " ", "help", " ", "message", " ", "for", " ", "this", " ", "command", ",", " ", "derive", "d", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "``", "self", ".", "usage", "()``", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "create", "\\u", "parser_", "(_", "prog", "\\u", "name_", ",_", "subcommand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "from", "\\u", "argv_", "(_", "self_", ",_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "up", " ", "any", " ", "environ", "ment", " ", "change", "s", " ", "request", "ed", " ", "(", "e", ".", "g", ".,", " ", "Pyth", "on", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "Dj", "ang", "o", " ", "settings", "),", " ", "then", " ", "run", " ", "this", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "create", "\\u", "parser_", "(_", "argv_", "[_", "0_", "]_", ",_", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "argv_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle", "\\u", "default", "\\u", "options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "*_", "args_", ",_", "**_", "options_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "execute", " ", "this", " ", "command", ",", " ", "perform", "ing", " ", "model", " ", "validation", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "need", "ed", " ", "(", "as", " ", "controlle", "d", " ", "by", " ", "the", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "``", "self", ".", "require", "s", "\\u", "model", "\\u", "validation", "``)", ".", " ", "If", " ", "the", " ", "command", " ", "raise", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "``", "Command", "Error", "``", ",", " ", "intercept", " ", "it", " ", "and", " ", "print", " ", "it", " ", "sensi", "bly", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "std", "err", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Switch", " ", "to", " ", "Eng", "lish", ",", " ", "bec", "aus", "e", " ", "django", "-", "admin", ".", "py", " ", "create", "s", " ", "databa", "se", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "like", " ", "permissi", "ons", ",", " ", "and", " ", "tho", "se", " ", "shou", "ld", "n", "'", "t", " ", "contain", " ", "any", " ", "translatio", "ns", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "t", " ", "only", " ", "do", " ", "this", " ", "if", " ", "we", " ", "can", " ", "assume", " ", "we", " ", "have", " ", "a", " ", "working", " ", "settings", " ", "file", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "django", ".", "util", "s", ".", "translatio", "n", " ", "require", "s", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "can", "\\u", "import", "\\u", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "utils_", "import_", "translation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "translation_", "._", "activate_", "(_", "'", "en", "-", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "settings", " ", "shou", "ld", " ", "be", " ", "avail", "able", ",", " ", "but", " ", "are", "n", "'", "t", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "the", " ", "error", " ", "and", " ", "quit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "self_", "._", "style_", "._", "ERROR_", "(_", "str_", "(_", "'", "Error", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "e_", ")_", ")_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "require", "s", "\\u", "model", "\\u", "validation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "self_", "._", "handle_", "(_", "*_", "args_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "output", "\\u", "transaction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "need", "s", " ", "to", " ", "be", " ", "import", "ed", " ", "here", ",", " ", "bec", "aus", "e", " ", "it", " ", "relie", "s", " ", "on", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "connection_", "._", "ops_", "._", "start", "\\u", "transaction", "\\u", "sql_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "self_", "._", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "connection_", "._", "ops_", "._", "start", "\\u", "transaction", "\\u", "sql_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "output", "\\u", "transaction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "self_", "._", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "\"", "COMMIT", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Command", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "self_", "._", "style_", "._", "ERROR_", "(_", "str_", "(_", "'", "Error", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "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_", "validate_", "(_", "self_", ",_", "app_", "=_", "None_", ",_", "display", "\\u", "num", "\\u", "errors_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "the", " ", "give", "n", " ", "app", ",", " ", "rais", "ing", " ", "Command", "Error", " ", "for", " ", "any", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "app", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "this", " ", "will", " ", "validat", "e", " ", "all", " ", "install", "ed", " ", "apps", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "validation_", "import_", "get", "\\u", "validation", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "errors_", "=_", "get", "\\u", "validation", "\\u", "errors_", "(_", "s_", ",_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "text_", "=_", "s_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Command", "Error_", "(_", "\"", "One", " ", "or", " ", "more", " ", "model", "s", " ", "did", " ", "not", " ", "validat", "e", ":\\\\", "n", "%", "s", "\"_", "%_", "error", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "display", "\\u", "num", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", " ", "error", "%", "s", " ", "found", "\"_", "%_", "(_", "num", "\\u", "errors_", ",_", "num", "\\u", "errors_", "!=_", "1_", "and_", "'", "s", "'_", "or_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Command_", "(_", "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_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "actual", " ", "logic", " ", "of", " ", "the", " ", "command", ".", " ", "Subc", "lasse", "s", " ", "must", " ", "implement", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "App", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "manage", "ment", " ", "command", " ", "whi", "ch", " ", "take", "s", " ", "one", " ", "or", " ", "more", " ", "install", "ed", " ", "applica", "tion", "\\", "10", ";", " ", " ", " ", " ", "names", " ", "as", " ", "argu", "ment", "s", ",", " ", "and", " ", "doe", "s", " ", "somet", "hing", " ", "with", " ", "each", " ", "of", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rat", "her", " ", "than", " ", "implement", "ing", " ", "``", "handle", "()``", ",", " ", "subclasses", " ", "must", " ", "implement", "\\", "10", ";", " ", " ", " ", " ", "``", "handle", "\\u", "app", "()``", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "call", "ed", " ", "onc", "e", " ", "for", " ", "each", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "'<", "app", "name", " ", "app", "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_", "[SEP]_", "class_", "App", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "app", "\\u", "labels_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "'", "Enter", " ", "at", " ", "leas", "t", " ", "one", " ", "app", "name", ".'_", ")_", "\\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 ", " _", "app", "\\u", "list_", "=_", "[_", "models_", "._", "get", "\\u", "app_", "(_", "app", "\\u", "label_", ")_", "for_", "app", "\\u", "label_", "in_", "app", "\\u", "labels_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Impro", "perl", "y", "Configured_", ",_", "Import", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"%", "s", ".", " ", "Are", " ", "you", " ", "sure", " ", "your", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "setti", "ng", " ", "is", " ", "correct", "?\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app_", "in_", "app", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "output_", "=_", "self_", "._", "handle", "\\u", "app_", "(_", "app_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "app", "\\u", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "app_", "(_", "self_", ",_", "app_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "the", " ", "command", "'", "s", " ", "action", "s", " ", "for", " ", "``", "app", "``", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "module", " ", "correspond", "ing", " ", "to", " ", "an", " ", "applica", "tion", " ", "name", " ", "give", "n", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "command", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Label", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "manage", "ment", " ", "command", " ", "whi", "ch", " ", "take", "s", " ", "one", " ", "or", " ", "more", " ", "arbitra", "ry", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "labels", ")", " ", "on", " ", "the", " ", "command", " ", "line", ",", " ", "and", " ", "doe", "s", " ", "somet", "hing", " ", "with", " ", "each", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rat", "her", " ", "than", " ", "implement", "ing", " ", "``", "handle", "()``", ",", " ", "subclasses", " ", "must", " ", "implement", "\\", "10", ";", " ", " ", " ", " ", "``", "handle", "\\u", "label", "()``", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "call", "ed", " ", "onc", "e", " ", "for", " ", "each", " ", "label", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "argu", "ment", "s", " ", "shou", "ld", " ", "be", " ", "names", " ", "of", " ", "install", "ed", " ", "applica", "tion", "s", ",", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "``", "App", "Command", "``", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "'<", "label", " ", "label", " ", "...", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "'", "label", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Label", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "labels_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "'", "Enter", " ", "at", " ", "leas", "t", " ", "one", " ", "%", "s", ".'_", "%_", "self_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "output_", "=_", "self_", "._", "handle", "\\u", "label_", "(_", "label_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "label", "\\u", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Label", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "label_", "(_", "self_", ",_", "label_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "the", " ", "command", "'", "s", " ", "action", "s", " ", "for", " ", "``", "label", "``", ",", " ", "whi", "ch", " ", "will", " ", "be", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "as", " ", "give", "n", " ", "on", " ", "the", " ", "command", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "No", "Arg", "s", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "command", " ", "whi", "ch", " ", "take", "s", " ", "no", " ", "argu", "ment", "s", " ", "on", " ", "the", " ", "command", " ", "line", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rat", "her", " ", "than", " ", "implement", "ing", " ", "``", "handle", "()``", ",", " ", "subclasses", " ", "must", " ", "implement", "\\", "10", ";", " ", " ", " ", " ", "``", "handle", "\\u", "noar", "gs", "()``", ";", " ", "``", "handle", "()``", " ", "its", "elf", " ", "is", " ", "overrid", "den", " ", "to", " ", "ensure", "\\", "10", ";", " ", " ", " ", " ", "no", " ", "argu", "ment", "s", " ", "are", " ", "pass", "ed", " ", "to", " ", "the", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", "ing", " ", "to", " ", "pass", " ", "argu", "ment", "s", " ", "will", " ", "raise", " ", "``", "Command", "Error", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "''_", "\\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_", "No", "Arg", "s", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"", "Command", " ", "doe", "sn", "'", "t", " ", "accept", " ", "any", " ", "argu", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "handle", "\\u", "noar", "gs_", "(_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Arg", "s", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "noar", "gs_", "(_", "self_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "this", " ", "command", "'", "s", " ", "action", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "helper_", "(_", "style_", ",_", "app", "\\u", "or", "\\u", "project_", ",_", "name_", ",_", "directory_", ",_", "other", "\\u", "name_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copie", "s", " ", "eit", "her", " ", "a", " ", "Dj", "ang", "o", " ", "applica", "tion", " ", "layout", " ", "template", " ", "or", " ", "a", " ", "Dj", "ang", "o", " ", "project", "\\", "10", ";", " ", " ", " ", " ", "layout", " ", "template", " ", "int", "o", " ", "the", " ", "specified", " ", "director", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "style", " ", "--", " ", "A", " ", "color", " ", "style", " ", "object", " ", "(", "see", " ", "django", ".", "core", ".", "manage", "ment", ".", "color", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "app", "\\u", "or", "\\u", "project", " ", "--", " ", "The", " ", "string", " ", "'", "app", "'", " ", "or", " ", "'", "project", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", "--", " ", "The", " ", "name", " ", "of", " ", "the", " ", "applica", "tion", " ", "or", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "--", " ", "The", " ", "director", "y", " ", "to", " ", "whi", "ch", " ", "the", " ", "layout", " ", "template", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "\\u", "name", " ", "--", " ", "Whe", "n", " ", "copy", "ing", " ", "an", " ", "applica", "tion", " ", "layout", ",", " ", "this", " ", "shou", "ld", " ", "be", " ", "the", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "of", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "{_", "'", "project", "'_", ":_", "'", "app", "'_", ",_", "'", "app", "'_", ":_", "'", "project", "'_", "}_", "[_", "app", "\\u", "or", "\\u", "project_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "re_", "._", "search_", "(_", "r", "'", "^", "[\\u", "a", "-", "z", "A", "-", "Z", "]\\\\", "w", "*$'_", ",_", "name_", ")_", ":_", "#", " ", "If", " ", "it", "'", "s", " ", "not", " ", "a", " ", "valid", " ", "director", "y", " ", "name", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prov", "ide", " ", "a", " ", "smart", " ", "error", " ", "message", ",", " ", "depend", "ing", " ", "on", " ", "the", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "search_", "(_", "r", "'", "^", "[\\u", "a", "-", "z", "A", "-", "Z", "]'_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", "make", " ", "sure", " ", "the", " ", "name", " ", "begins", " ", "with", " ", "a", " ", "letter", " ", "or", " ", "underscore", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", "use", " ", "only", " ", "numbers", ",", " ", "letter", "s", " ", "and", " ", "underscore", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Command", "Error_", "(_", "\"%", "r", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "%", "s", " ", "name", ".", " ", "Ple", "ase", " ", "%", "s", ".\"_", "%_", "(_", "name_", ",_", "app", "\\u", "or", "\\u", "project_", ",_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "top", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "where", " ", "the", " ", "app", " ", "or", " ", "project", " ", "template", "s", " ", "are", ".", " ", "Use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", ".\\u", "\\u", "path", "\\u\\u", "[", "0", "]", " ", "bec", "aus", "e", " ", "we", " ", "don", "'", "t", " ", "know", " ", "int", "o", " ", "whi", "ch", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", " ", "has", " ", "bee", "n", " ", "install", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "template", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "django_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "'", "conf", "'_", ",_", "'%", "s", "\\u", "template", "'_", "%_", "app", "\\u", "or", "\\u", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", ",_", "subdirs_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "template", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "\\u", "dir_", "=_", "d_", "[_", "len_", "(_", "template", "\\u", "dir_", ")_", "+_", "1_", ":_", "]_", "._", "replace_", "(_", "'%", "s", "\\u", "name", "'_", "%_", "app", "\\u", "or", "\\u", "project_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relative", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "top", "\\u", "dir_", ",_", "relative", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "subdir_", "in_", "enumerate_", "(_", "subdirs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subdir_", "._", "startswith_", "(_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "subdirs_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "endswith_", "(_", "'.", "pyc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path", "\\u", "old_", "=_", "os_", "._", "path_", "._", "join_", "(_", "d_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "new_", "=_", "os_", "._", "path_", "._", "join_", "(_", "top", "\\u", "dir_", ",_", "relative", "\\u", "dir_", ",_", "f_", "._", "replace_", "(_", "'%", "s", "\\u", "name", "'_", "%_", "app", "\\u", "or", "\\u", "project_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "\\u", "old_", "=_", "open_", "(_", "path", "\\u", "old_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "\\u", "new_", "=_", "open_", "(_", "path", "\\u", "new_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "\\u", "new_", "._", "write_", "(_", "fp", "\\u", "old_", "._", "read_", "(_", ")_", "._", "replace_", "(_", "'{{", " ", "%", "s", "\\u", "name", " ", "}}'_", "%_", "app", "\\u", "or", "\\u", "project_", ",_", "name_", ")_", "._", "replace_", "(_", "'{{", " ", "%", "s", "\\u", "name", " ", "}}'_", "%_", "other_", ",_", "other", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "\\u", "old_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "\\u", "new_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy", "mode_", "(_", "path", "\\u", "old_", ",_", "path", "\\u", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "make", "\\u", "writea", "ble_", "(_", "path", "\\u", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "style_", "._", "NOTICE", "_", "(_", "\"", "Noti", "ce", ":", " ", "Cou", "ld", "n", "'", "t", " ", "set", " ", "permissi", "on", " ", "bits", " ", "on", " ", "%", "s", ".", " ", "You", "'", "re", " ", "probab", "ly", " ", "usi", "ng", " ", "an", " ", "uncomm", "on", " ", "filesystem", " ", "setup", ".", " ", "No", " ", "problem", ".\\\\", "n", "\"_", "%_", "path", "\\u", "new_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "writea", "ble_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "sure", " ", "tha", "t", " ", "the", " ", "file", " ", "is", " ", "writea", "ble", ".", " ", "Us", "efu", "l", " ", "if", " ", "our", " ", "source", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "read", "-", "only", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "java", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "Jy", "tho", "n", " ", "there", " ", "is", " ", "no", " ", "os", ".", "access", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "access_", "(_", "filename_", ",_", "os_", "._", "W", "\\u", "OK_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "os_", "._", "stat_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "permissions_", "=_", "stat_", "._", "S", "\\u", "IMO", "DE_", "(_", "st_", "._", "st", "\\u", "mode_", ")_", "|_", "stat_", "._", "S", "\\u", "IW", "USR", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "filename_", ",_", "new", "\\u", "permissions_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
shaunduncan/breezeminder/breezeminder/views/marta.py
[ { "content": "@same_origin\ndef route_upcoming(route_id):\n route = Route.objects.get_or_404(name=route_id)\n schedule = Schedule.objects.for_today()\n\n data = {}\n start = ScheduledStop.arrival_now()\n\n # Filter the next arrivals for 1hour\n # This should limit the results enough so we don't do more work\n qs = ScheduledStop.objects.filter(route_id=route.id,\n schedule_id=schedule.id,\n arrival__gt=start,\n arrival__lt=start + 3600)\n\n # Optionally accept a stop argument\n if 'stop' in request.args:\n try:\n stop = Stop.objects.get(id=request.args['stop'])\n except (Stop.DoesNotExist, Stop.MultipleObjectsReturned, ValueError):\n pass\n else:\n qs = qs.filter(stop_id=stop.id)\n\n # Process ordered by arrival - grouped by stop\n for stop in qs.only('stop_id', 'arrival').order_by('arrival'):\n if stop.stop_id not in data:\n data[stop.stop_id] = {\n 'refresh': stop.arrival - start,\n 'times': []\n }\n\n if len(data[stop.stop_id]['times']) >= 3:\n continue\n\n data[stop.stop_id]['times'].append(\n ScheduledStop.seconds_to_timestring(stop.arrival)\n )\n\n resp = make_response(json.dumps(data))\n resp.cache_control.no_cache = True\n resp.headers['Content-Type'] = 'application/json'\n\n return resp", "metadata": "root.route_upcoming", "header": "['module', '___EOS___']", "index": 67 } ]
[]
[]
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_", "@_", "same", "\\u", "origin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "route", "\\u", "upcom", "ing_", "(_", "route", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "route_", "=_", "Route_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "404_", "(_", "name_", "=_", "route", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "Schedule_", "._", "objects_", "._", "for", "\\u", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "Schedule", "d", "Stop_", "._", "arrival", "\\u", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Filter", " ", "the", " ", "next", " ", "arrival", "s", " ", "for", " ", "1", "hour_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "limit", " ", "the", " ", "results", " ", "eno", "ugh", " ", "so", " ", "we", " ", "don", "'", "t", " ", "do", " ", "more", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "=_", "Schedule", "d", "Stop_", "._", "objects_", "._", "filter_", "(_", "route", "\\u", "id_", "=_", "route_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schedule", "\\u", "id_", "=_", "schedule_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "arrival", "\\u\\u", "gt_", "=_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "arrival", "\\u\\u", "lt_", "=_", "start_", "+_", "3600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", "ly", " ", "accept", " ", "a", " ", "stop", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "stop", "'_", "in_", "request_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop_", "=_", "Stop_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "request_", "._", "args_", "[_", "'", "stop", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Stop_", "._", "Do", "es", "Not", "Exist_", ",_", "Stop_", "._", "Multipl", "e", "Object", "s", "Return", "ed_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "stop", "\\u", "id_", "=_", "stop_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "order", "ed", " ", "by", " ", "arrival", " ", "-", " ", "groupe", "d", " ", "by", " ", "stop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "stop_", "in_", "qs_", "._", "only_", "(_", "'", "stop", "\\u", "id", "'_", ",_", "'", "arrival", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'", "arrival", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "stop_", "._", "stop", "\\u", "id_", "not_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "stop_", "._", "stop", "\\u", "id_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "refre", "sh", "'_", ":_", "stop_", "._", "arrival", "_", "-_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "times", "'_", ":_", "[_", "]_", "\\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_", "len_", "(_", "data_", "[_", "stop_", "._", "stop", "\\u", "id_", "]_", "[_", "'", "times", "'_", "]_", ")_", ">=_", "3_", ":_", "\\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_", "data_", "[_", "stop_", "._", "stop", "\\u", "id_", "]_", "[_", "'", "times", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Schedule", "d", "Stop_", "._", "second", "s", "\\u", "to", "\\u", "timestr", "ing_", "(_", "stop_", "._", "arrival", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "make", "\\u", "response_", "(_", "json_", "._", "dumps_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "cache", "\\u", "control_", "._", "no", "\\u", "cache_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "headers_", "[_", "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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 ]
Unused local variable
aliyun/aliyun-openapi-python-sdk/aliyun-python-sdk-crm/aliyunsdkcrm/request/v20150408/QueryCustomerLabelRequest.py
[ { "content": "\tdef __init__(self):\n\t\tRpcRequest.__init__(self, 'Crm', '2015-04-08', 'QueryCustomerLabel')", "metadata": "root.QueryCustomerLabelRequest.__init__", "header": "['class', 'QueryCustomerLabelRequest', '(', 'RpcRequest', ')', ':', '___EOS___']", "index": 22 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Query", "Custom", "er", "Label", "Request_", "(_", "Rp", "c", "Request_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "Rp", "c", "Request_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "'", "Cr", "m", "'_", ",_", "'", "201", "5", "-0", "4", "-0", "8", "'_", ",_", "'", "Query", "Custom", "er", "Label", "'_", ")_", "\\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 ]
Unused local variable
PyTables/PyTables/tables/node.py
[ { "content": " def _g_update_location(self, newparentpath):\n \"\"\"Update location-dependent attributes.\n\n Updates location data when an ancestor node has changed its\n location in the hierarchy to `newparentpath`. In fact, this\n method is expected to be called by an ancestor of this node.\n\n This also triggers the update of file references to this node.\n If the maximum recommended node depth is exceeded, a\n `PerformanceWarning` is issued. This warning is assured to be\n unique.\n\n \"\"\"\n\n oldpath = self._v_pathname\n newpath = join_path(newparentpath, self._v_name)\n newdepth = newpath.count('/')\n\n self._v_pathname = newpath\n self._v_depth = newdepth\n\n # Check if the node is too deep in the tree.\n if newdepth > self._v_maxtreedepth:\n warnings.warn(\"\"\"\\\nmoved descendent node is exceeding the recommended maximum depth (%d);\\\nbe ready to see PyTables asking for *lots* of memory and possibly slow I/O\"\"\"\n % (self._v_maxtreedepth,), PerformanceWarning)\n\n node_manager = self._v_file._node_manager\n node_manager.rename_node(oldpath, newpath)\n\n # Tell dependent objects about the new location of this node.\n self._g_update_dependent()", "metadata": "root.Node._g_update_location", "header": "['class', 'Node', '(', 'six', '.', 'with_metaclass', '(', 'MetaNode', ',', 'object', ')', ')', ':', '___EOS___']", "index": 394 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Node_", "(_", "six_", "._", "with", "\\u", "metaclass_", "(_", "Meta", "Node_", ",_", "object_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "g", "\\u", "update", "\\u", "location_", "(_", "self_", ",_", "newpa", "rent", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "location", "-", "dependent", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Update", "s", " ", "location", " ", "data", " ", "whe", "n", " ", "an", " ", "ancestor", " ", "node", " ", "has", " ", "change", "d", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "location", " ", "in", " ", "the", " ", "hier", "arch", "y", " ", "to", " ", "`", "newpa", "rent", "path", "`.", " ", " ", "In", " ", "fact", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "call", "ed", " ", "by", " ", "an", " ", "ancestor", " ", "of", " ", "this", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "als", "o", " ", "trigger", "s", " ", "the", " ", "update", " ", "of", " ", "file", " ", "reference", "s", " ", "to", " ", "this", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "maxim", "um", " ", "recommende", "d", " ", "node", " ", "depth", " ", "is", " ", "exceed", "ed", ",", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "`", "Perform", "anc", "e", "Warn", "ing", "`", " ", "is", " ", "issue", "d", ".", " ", " ", "Thi", "s", " ", "warn", "ing", " ", "is", " ", "ass", "ure", "d", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "unique", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "oldp", "ath_", "=_", "self_", "._", "\\u", "v", "\\u", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newpath_", "=_", "join", "\\u", "path_", "(_", "newpa", "rent", "path_", ",_", "self_", "._", "\\u", "v", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newd", "epth", "_", "=_", "newpath_", "._", "count_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "v", "\\u", "pathname_", "=_", "newpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "v", "\\u", "depth_", "=_", "newd", "epth", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "node", " ", "is", " ", "too", " ", "deep", " ", "in", " ", "the", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "newd", "epth", "_", ">_", "self_", "._", "\\u", "v", "\\u", "maxt", "ree", "depth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"\"\"", "\\\\", "\\", "10", ";", "moved", " ", "descend", "ent", " ", "node", " ", "is", " ", "exceed", "ing", " ", "the", " ", "recommende", "d", " ", "maxim", "um", " ", "depth", " ", "(%", "d", ");", "\\\\", "\\", "10", ";", "be", " ", "read", "y", " ", "to", " ", "see", " ", "Py", "Table", "s", " ", "ask", "ing", " ", "for", " ", "*", "lots", "*", " ", "of", " ", "memory", " ", "and", " ", "possib", "ly", " ", "slow", " ", "I", "/", "O", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "self_", "._", "\\u", "v", "\\u", "maxt", "ree", "depth_", ",_", ")_", ",_", "Perform", "anc", "e", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "\\u", "manager_", "=_", "self_", "._", "\\u", "v", "\\u", "file_", "._", "\\u", "node", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "manager_", "._", "rename", "\\u", "node_", "(_", "oldp", "ath_", ",_", "newpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tell", " ", "dependent", " ", "object", "s", " ", "abo", "ut", " ", "the", " ", "new", " ", "location", " ", "of", " ", "this", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "g", "\\u", "update", "\\u", "dependent", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 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'
kvesteri/wtforms-json/tests/test_field_type_coercion.py
[ { "content": "import six # noqa\nfrom pytest import mark\nfrom wtforms import Form, IntegerField, SelectMultipleField, TextField\nfrom wtforms.ext.sqlalchemy.fields import QuerySelectField\nfrom wtforms.validators import IPAddress\n\nsa = None\ntry:\n import sqlalchemy as sa\n from sqlalchemy.ext.declarative import declarative_base\nexcept ImportError:\n pass\n\n\n\n\n\n\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_", "six_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytest_", "import_", "mark_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "import_", "Form_", ",_", "Integer", "Field_", ",_", "Select", "Multipl", "e", "Field_", ",_", "Text", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "._", "ext_", "._", "sqlalchemy_", "._", "fields_", "import_", "Query", "Select", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "._", "validators_", "import_", "IPA", "ddress", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sa_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "ext_", "._", "declarative", "_", "import_", "declarative", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
CGATOxford/cgat/scripts/cgat_get_options.py
[ { "content": "def collectOptionsFromScript(script_name):\n '''collect options used in script *script_name*.'''\n\n # call other script\n prefix, suffix = os.path.splitext(script_name)\n\n dirname = os.path.dirname(script_name)\n basename = os.path.basename(script_name)[:-3]\n\n if os.path.exists(prefix + \".pyc\"):\n os.remove(prefix + \".pyc\")\n\n # check if script contains getopt\n with IOTools.openFile(script_name) as inf:\n if \"getopt\" in inf.read():\n E.warn(\"script %s uses getopt directly\" % script_name)\n return []\n\n try:\n module = imp.load_source(basename, script_name)\n except ImportError, msg:\n E.warn('could not import %s - skipped: %s' % (basename, msg))\n return []\n\n E.Start = LocalStart\n\n try:\n module.main(argv=[\"--help\"])\n except AttributeError:\n E.warn(\"no main method in %s\" % script_name)\n return []\n except SystemExit:\n E.warn(\"script exits - possibly does not use E.Start()\")\n return []\n except DummyError:\n pass\n\n result = []\n for option in PARSER.option_list:\n # ignore options added by optparse\n if option.dest is None:\n continue\n\n optstring = option.get_opt_string()\n if optstring.startswith(\"--\"):\n optstring = optstring[2:]\n result.append(optstring)\n\n return result", "metadata": "root.collectOptionsFromScript", "header": "['module', '___EOS___']", "index": 79 } ]
[]
[]
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_", "collect", "Optio", "ns", "Fro", "m", "Script_", "(_", "script", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "collect", " ", "options", " ", "used", " ", "in", " ", "script", " ", "*", "script", "\\u", "name", "*.", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "other", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", ",_", "suffix_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "script", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dirname_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "script", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "script", "\\u", "name_", ")_", "[_", ":_", "-_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "prefix_", "+_", "\".", "pyc", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "prefix_", "+_", "\".", "pyc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "script", " ", "contain", "s", " ", "getopt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "IO", "Tools_", "._", "open", "File_", "(_", "script", "\\u", "name_", ")_", "as_", "inf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "getop", "t", "\"_", "in_", "inf_", "._", "read_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "\"", "script", " ", "%", "s", " ", "use", "s", " ", "getop", "t", " ", "direct", "ly", "\"_", "%_", "script", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "imp_", "._", "load", "\\u", "source_", "(_", "basename_", ",_", "script", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "'", "coul", "d", " ", "not", " ", "import", " ", "%", "s", " ", "-", " ", "skip", "ped", ":", " ", "%", "s", "'_", "%_", "(_", "basename_", ",_", "msg_", ")_", ")_", "\\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_", "E_", "._", "Start_", "=_", "Local", "Start_", "\\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 ", " _", "module_", "._", "main_", "(_", "argv_", "=_", "[_", "\"--", "help", "\"_", "]_", ")_", "\\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 ", " _", "E_", "._", "warn_", "(_", "\"", "no", " ", "main", " ", "method", " ", "in", " ", "%", "s", "\"_", "%_", "script", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "\"", "script", " ", "exits", " ", "-", " ", "possib", "ly", " ", "doe", "s", " ", "not", " ", "use", " ", "E", ".", "Start", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Du", "mm", "y", "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_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "option_", "in_", "PARSER_", "._", "option", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "options", " ", "adde", "d", " ", "by", " ", "optparse_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "option_", "._", "dest_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opts", "tring_", "=_", "option_", "._", "get", "\\u", "opt", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts", "tring_", "._", "startswith_", "(_", "\"--\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts", "tring_", "=_", "opts", "tring_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "opts", "tring_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
weblabdeusto/weblabdeusto/server/src/test/unit/weblab/experiment/devices/gpib/test_launcher.py
[ { "content": " def test_error_reading_not_background(self):\n launcher = WrappedLauncherPopen(self.mocker.mock(), self.cfg_manager)\n launcher._popen_mock.poll()\n self.mocker.result(0)\n launcher._popen_mock.stdout.read()\n self.mocker.throw(Exception('alehop'))\n\n self.mocker.replay()\n self.assertRaises(\n GpibErrors.ErrorRetrievingOutputFromProgrammingProgramError,\n launcher.execute,\n 'whatever.exe',\n False\n )", "metadata": "root.GpibLauncherTestCase.test_error_reading_not_background", "header": "['class', 'GpibLauncherTestCase', '(', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 98 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Gp", "ib", "Launch", "er", "Test", "Case_", "(_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "error", "\\u", "readi", "ng", "\\u", "not", "\\u", "background_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "launcher_", "=_", "Wrapp", "ed", "Launch", "er", "Popen_", "(_", "self_", "._", "mocker_", "._", "mock_", "(_", ")_", ",_", "self_", "._", "cfg", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launcher_", "._", "\\u", "popen", "\\u", "mock_", "._", "poll_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mocker_", "._", "result_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launcher_", "._", "\\u", "popen", "\\u", "mock_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mocker_", "._", "throw_", "(_", "Exception_", "(_", "'", "ale", "hop", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mocker_", "._", "replay_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Gp", "ib", "Errors_", "._", "Error", "Retriev", "ing", "Output", "Fro", "m", "Programm", "ing", "Program", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launcher_", "._", "execute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "what", "ever", ".", "exe", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", "\\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 ]
Unused import
kuri65536/python-for-android/python-modules/twisted/twisted/internet/default.py
[ { "content": "# -*- test-case-name: twisted.test.test_internet -*-\n# $Id: default.py,v 1.90 2004/01/06 22:35:22 warner Exp $\n#\n# Copyright (c) 2001-2004 Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\n\"\"\"\nDeprecated module that used to contain SelectReactor and PosixReactorBase\n\nMaintainer: Itamar Shtull-Trauring\n\"\"\"\n\nimport warnings\nwarnings.warn(\"twisted.internet.default is deprecated. Use posixbase or selectreactor instead.\", category=DeprecationWarning)\n\n# Backwards compat\nfrom posixbase import PosixReactorBase\nfrom selectreactor import SelectReactor, install\n\n__all__ = [\"install\", \"PosixReactorBase\", \"SelectReactor\"]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "test", "-", "case", "-", "name", ":", " ", "twist", "ed", ".", "test", ".", "test\\u", "interne", "t", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Id", ":", " ", "default", ".", "py", ",", "v", " ", "1.9", "0", " ", "2004", "/", "01", "/", "0", "6", " ", "2", "2", ":", "3", "5", ":", "2", "2", " ", "warn", "er", " ", "Exp", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "1", "-", "2004", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Dep", "reca", "ted", " ", "module", " ", "tha", "t", " ", "used", " ", "to", " ", "contain", " ", "Select", "Reactor", " ", "and", " ", "Posi", "x", "Reactor", "Base", "\\", "10", ";", "\\", "10", ";", "Maint", "aine", "r", ":", " ", "It", "amar", " ", "Sh", "tul", "l", "-", "Tra", "uri", "ng", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "twist", "ed", ".", "interne", "t", ".", "default", " ", "is", " ", "depre", "cated", ".", " ", "Us", "e", " ", "posix", "base", " ", "or", " ", "select", "react", "or", " ", "inst", "ead", ".\"_", ",_", "category_", "=_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Backward", "s", " ", "compat_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "posix", "base_", "import_", "Posi", "x", "Reactor", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "select", "reactor_", "import_", "Select", "Reactor", "_", ",_", "install_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "install", "\"_", ",_", "\"", "Posi", "x", "Reactor", "Base", "\"_", ",_", "\"", "Select", "Reactor", "\"_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/django-1.5/django/views/i18n.py
[ { "content": "def javascript_catalog(request, domain='djangojs', packages=None):\n \"\"\"\n Returns the selected language catalog as a javascript library.\n\n Receives the list of packages to check for translations in the\n packages parameter either from an infodict or as a +-delimited\n string from the request. Default is 'django.conf'.\n\n Additionally you can override the gettext domain for this view,\n but usually you don't want to do that, as JavaScript messages\n go to the djangojs domain. But this might be needed if you\n deliver your JavaScript source from Django templates.\n \"\"\"\n if request.GET:\n if 'language' in request.GET:\n if check_for_language(request.GET['language']):\n activate(request.GET['language'])\n if packages is None:\n packages = ['django.conf']\n if isinstance(packages, six.string_types):\n packages = packages.split('+')\n packages = [p for p in packages if p == 'django.conf' or p in settings.INSTALLED_APPS]\n default_locale = to_locale(settings.LANGUAGE_CODE)\n locale = to_locale(get_language())\n t = {}\n paths = []\n en_selected = locale.startswith('en')\n en_catalog_missing = True\n # paths of requested packages\n for package in packages:\n p = importlib.import_module(package)\n path = os.path.join(os.path.dirname(upath(p.__file__)), 'locale')\n paths.append(path)\n # add the filesystem paths listed in the LOCALE_PATHS setting\n paths.extend(list(reversed(settings.LOCALE_PATHS)))\n # first load all english languages files for defaults\n for path in paths:\n try:\n catalog = gettext_module.translation(domain, path, ['en'])\n t.update(catalog._catalog)\n except IOError:\n pass\n else:\n # 'en' is the selected language and at least one of the packages\n # listed in `packages` has an 'en' catalog\n if en_selected:\n en_catalog_missing = False\n # next load the settings.LANGUAGE_CODE translations if it isn't english\n if default_locale != 'en':\n for path in paths:\n try:\n catalog = gettext_module.translation(domain, path, [default_locale])\n except IOError:\n catalog = None\n if catalog is not None:\n t.update(catalog._catalog)\n # last load the currently selected language, if it isn't identical to the default.\n if locale != default_locale:\n # If the currently selected language is English but it doesn't have a\n # translation catalog (presumably due to being the language translated\n # from) then a wrong language catalog might have been loaded in the\n # previous step. It needs to be discarded.\n if en_selected and en_catalog_missing:\n t = {}\n else:\n locale_t = {}\n for path in paths:\n try:\n catalog = gettext_module.translation(domain, path, [locale])\n except IOError:\n catalog = None\n if catalog is not None:\n locale_t.update(catalog._catalog)\n if locale_t:\n t = locale_t\n src = [LibHead]\n plural = None\n if '' in t:\n for l in t[''].split('\\n'):\n if l.startswith('Plural-Forms:'):\n plural = l.split(':',1)[1].strip()\n if plural is not None:\n # this should actually be a compiled function of a typical plural-form:\n # Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n plural = [el.strip() for el in plural.split(';') if el.strip().startswith('plural=')][0].split('=',1)[1]\n src.append(PluralIdx % plural)\n else:\n src.append(SimplePlural)\n csrc = []\n pdict = {}\n for k, v in t.items():\n if k == '':\n continue\n if isinstance(k, six.string_types):\n csrc.append(\"catalog['%s'] = '%s';\\n\" % (javascript_quote(k), javascript_quote(v)))\n elif isinstance(k, tuple):\n if k[0] not in pdict:\n pdict[k[0]] = k[1]\n else:\n pdict[k[0]] = max(k[1], pdict[k[0]])\n csrc.append(\"catalog['%s'][%d] = '%s';\\n\" % (javascript_quote(k[0]), k[1], javascript_quote(v)))\n else:\n raise TypeError(k)\n csrc.sort()\n for k, v in pdict.items():\n src.append(\"catalog['%s'] = [%s];\\n\" % (javascript_quote(k), ','.join([\"''\"]*(v+1))))\n src.extend(csrc)\n src.append(LibFoot)\n src.append(InterPolate)\n src.append(LibFormatHead)\n src.append(get_formats())\n src.append(LibFormatFoot)\n src = ''.join(src)\n return http.HttpResponse(src, 'text/javascript')", "metadata": "root.javascript_catalog", "header": "['module', '___EOS___']", "index": 170 } ]
[]
[]
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_", "javascript", "\\u", "catalog_", "(_", "request_", ",_", "domain_", "=_", "'", "django", "js", "'_", ",_", "packages_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "selecte", "d", " ", "language", " ", "catal", "og", " ", "as", " ", "a", " ", "javascript", " ", "librar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Receive", "s", " ", "the", " ", "list", " ", "of", " ", "package", "s", " ", "to", " ", "check", " ", "for", " ", "translatio", "ns", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "package", "s", " ", "parameter", " ", "eit", "her", " ", "from", " ", "an", " ", "info", "dict", " ", "or", " ", "as", " ", "a", " ", "+-", "delim", "ited", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "from", " ", "the", " ", "request", ".", " ", "Default", " ", "is", " ", "'", "django", ".", "conf", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Addition", "ally", " ", "you", " ", "can", " ", "override", " ", "the", " ", "gettext", " ", "domain", " ", "for", " ", "this", " ", "view", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "usual", "ly", " ", "you", " ", "don", "'", "t", " ", "want", " ", "to", " ", "do", " ", "tha", "t", ",", " ", "as", " ", "Ja", "va", "Script", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "go", " ", "to", " ", "the", " ", "django", "js", " ", "domain", ".", " ", "Bu", "t", " ", "this", " ", "mig", "ht", " ", "be", " ", "need", "ed", " ", "if", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "deliver", " ", "your", " ", "Ja", "va", "Script", " ", "source", " ", "from", " ", "Dj", "ang", "o", " ", "template", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "language", "'_", "in_", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "check", "\\u", "for", "\\u", "language_", "(_", "request_", "._", "GET_", "[_", "'", "language", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "activate_", "(_", "request_", "._", "GET_", "[_", "'", "language", "'_", "]_", ")_", "\\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_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packages_", "=_", "[_", "'", "django", ".", "conf", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "packages_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packages_", "=_", "packages_", "._", "split_", "(_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "packages_", "=_", "[_", "p_", "for_", "p_", "in_", "packages_", "if_", "p_", "==_", "'", "django", ".", "conf", "'_", "or_", "p_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "locale_", "=_", "to", "\\u", "locale_", "(_", "settings_", "._", "LANGUAGE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locale_", "=_", "to", "\\u", "locale_", "(_", "get", "\\u", "language_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paths_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "\\u", "selected_", "=_", "locale_", "._", "startswith_", "(_", "'", "en", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "\\u", "catal", "og", "\\u", "missing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "path", "s", " ", "of", " ", "request", "ed", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "package_", "in_", "packages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "importlib_", "._", "import", "\\u", "module_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "upa", "th_", "(_", "p_", "._", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "locale", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paths_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "filesystem", " ", "path", "s", " ", "liste", "d", " ", "in", " ", "the", " ", "LOCALE", "\\u", "PATH", "S", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "paths_", "._", "extend_", "(_", "list_", "(_", "reversed_", "(_", "settings_", "._", "LOCALE", "\\u", "PATHS_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "load", " ", "all", " ", "english", " ", "language", "s", " ", "files", " ", "for", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "path_", "in_", "paths_", ":_", "\\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 ", " _", "catalog_", "=_", "gettext", "\\u", "module_", "._", "translation_", "(_", "domain_", ",_", "path_", ",_", "[_", "'", "en", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "update_", "(_", "catalog_", "._", "\\u", "catalog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "'", "en", "'", " ", "is", " ", "the", " ", "selecte", "d", " ", "language", " ", "and", " ", "at", " ", "leas", "t", " ", "one", " ", "of", " ", "the", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "liste", "d", " ", "in", " ", "`", "package", "s", "`", " ", "has", " ", "an", " ", "'", "en", "'", " ", "catalog_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "en", "\\u", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "en", "\\u", "catal", "og", "\\u", "missing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "next", " ", "load", " ", "the", " ", "settings", ".", "LANGUAGE", "\\u", "CODE", " ", "translatio", "ns", " ", "if", " ", "it", " ", "isn", "'", "t", " ", "english", "_", "\\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_", "default", "\\u", "locale_", "!=_", "'", "en", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "paths_", ":_", "\\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 ", " _", "catalog_", "=_", "gettext", "\\u", "module_", "._", "translation_", "(_", "domain_", ",_", "path_", ",_", "[_", "default", "\\u", "locale_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "catalog_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "update_", "(_", "catalog_", "._", "\\u", "catalog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "last", " ", "load", " ", "the", " ", "currentl", "y", " ", "selecte", "d", " ", "language", ",", " ", "if", " ", "it", " ", "isn", "'", "t", " ", "identi", "cal", " ", "to", " ", "the", " ", "default", "._", "\\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_", "locale_", "!=_", "default", "\\u", "locale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "currentl", "y", " ", "selecte", "d", " ", "language", " ", "is", " ", "Eng", "lish", " ", "but", " ", "it", " ", "doe", "sn", "'", "t", " ", "have", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translatio", "n", " ", "catal", "og", " ", "(", "presu", "mab", "ly", " ", "due", " ", "to", " ", "bei", "ng", " ", "the", " ", "language", " ", "translated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", ")", " ", "then", " ", "a", " ", "wrong", " ", "language", " ", "catal", "og", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "load", "ed", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "previ", "ous", " ", "step", ".", " ", "It", " ", "need", "s", " ", "to", " ", "be", " ", "discard", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "en", "\\u", "selected_", "and_", "en", "\\u", "catal", "og", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "locale", "\\u", "t_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "paths_", ":_", "\\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 ", " ", "_", "catalog_", "=_", "gettext", "\\u", "module_", "._", "translation_", "(_", "domain_", ",_", "path_", ",_", "[_", "locale_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "catalog_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "catalog_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "locale", "\\u", "t_", "._", "update_", "(_", "catalog_", "._", "\\u", "catalog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "locale", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "locale", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "[_", "Lib", "Head_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plural_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "''_", "in_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "l_", "in_", "t_", "[_", "''_", "]_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "startswith_", "(_", "'", "Plur", "al", "-", "Form", "s", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plural_", "=_", "l_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "[_", "1_", "]_", "._", "strip_", "(_", ")_", "\\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_", "plural_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "actual", "ly", " ", "be", " ", "a", " ", "compile", "d", " ", "function", " ", "of", " ", "a", " ", "typical", " ", "plural", "-", "form", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "3", ";", " ", "plural", "=", "n", "%", "10", "==", "1", " ", "&&", " ", "n", "%", "100", "!=", "11", " ", "?", " ", "0", " ", ":", " ", "n", "%", "10", ">=", "2", " ", "&&", " ", "n", "%", "10", "<=", "4", " ", "&&", " ", "(", "n", "%", "100", "<", "10", " ", "||", " ", "n", "%", "100", ">=", "20", ")", " ", "?", " ", "1", " ", ":", " ", "2", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plural_", "=_", "[_", "el_", "._", "strip_", "(_", ")_", "for_", "el_", "in_", "plural_", "._", "split_", "(_", "';'_", ")_", "if_", "el_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'", "plural", "='_", ")_", "]_", "[_", "0_", "]_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "Plur", "al", "Idx_", "%_", "plural_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "._", "append_", "(_", "Simple", "Plur", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csr", "c_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdict", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "t_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "k_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csr", "c_", "._", "append_", "(_", "\"", "catal", "og", "['", "%", "s", "']", " ", "=", " ", "'%", "s", "';", "\\\\", "n", "\"_", "%_", "(_", "javascript", "\\u", "quote_", "(_", "k_", ")_", ",_", "javascript", "\\u", "quote_", "(_", "v_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "k_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "[_", "0_", "]_", "not_", "in_", "pdict", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdict", "_", "[_", "k_", "[_", "0_", "]_", "]_", "=_", "k_", "[_", "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 ", " _", "pdict", "_", "[_", "k_", "[_", "0_", "]_", "]_", "=_", "max_", "(_", "k_", "[_", "1_", "]_", ",_", "pdict", "_", "[_", "k_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csr", "c_", "._", "append_", "(_", "\"", "catal", "og", "['", "%", "s", "']", "[", "%", "d", "]", " ", "=", " ", "'%", "s", "';", "\\\\", "n", "\"_", "%_", "(_", "javascript", "\\u", "quote_", "(_", "k_", "[_", "0_", "]_", ")_", ",_", "k_", "[_", "1_", "]_", ",_", "javascript", "\\u", "quote_", "(_", "v_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csr", "c_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "pdict", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "._", "append_", "(_", "\"", "catal", "og", "['", "%", "s", "']", " ", "=", " ", "[", "%", "s", "];", "\\\\", "n", "\"_", "%_", "(_", "javascript", "\\u", "quote_", "(_", "k_", ")_", ",_", "','_", "._", "join_", "(_", "[_", "\"''\"_", "]_", "*_", "(_", "v_", "+_", "1_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "._", "extend_", "(_", "csr", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "Lib", "Foot", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "Inter", "Pola", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "Lib", "Format", "Head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "get", "\\u", "formats_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "Lib", "Format", "Foot", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "''_", "._", "join_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "http_", "._", "Http", "Response_", "(_", "src_", ",_", "'", "text", "/", "javascript", "'_", ")_" ]
[ 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, 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 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gkno/gkno_launcher/src/networkx/algorithms/link_analysis/pagerank_alg.py
[ { "content": "def pagerank(G,alpha=0.85,personalization=None,\n max_iter=100,tol=1.0e-8,nstart=None,weight='weight'):\n \"\"\"Return the PageRank of the nodes in the graph.\n\n PageRank computes a ranking of the nodes in the graph G based on\n the structure of the incoming links. It was originally designed as\n an algorithm to rank web pages.\n\n Parameters\n -----------\n G : graph\n A NetworkX graph\n\n alpha : float, optional\n Damping parameter for PageRank, default=0.85\n\n personalization: dict, optional\n The \"personalization vector\" consisting of a dictionary with a\n key for every graph node and nonzero personalization value for each node.\n\n max_iter : integer, optional\n Maximum number of iterations in power method eigenvalue solver.\n\n tol : float, optional\n Error tolerance used to check convergence in power method solver.\n\n nstart : dictionary, optional\n Starting value of PageRank iteration for each node.\n\n weight : key, optional\n Edge data key to use as weight. If None weights are set to 1.\n\n Returns\n -------\n pagerank : dictionary\n Dictionary of nodes with PageRank as value\n\n Examples\n --------\n >>> G=nx.DiGraph(nx.path_graph(4))\n >>> pr=nx.pagerank(G,alpha=0.9)\n\n Notes\n -----\n The eigenvector calculation is done by the power iteration method\n and has no guarantee of convergence. The iteration will stop\n after max_iter iterations or an error tolerance of\n number_of_nodes(G)*tol has been reached.\n\n The PageRank algorithm was designed for directed graphs but this\n algorithm does not check if the input graph is directed and will\n execute on undirected graphs by converting each oriented edge in the\n directed graph to two edges.\n\n See Also\n --------\n pagerank_numpy, pagerank_scipy, google_matrix\n\n References\n ----------\n .. [1] A. Langville and C. Meyer,\n \"A survey of eigenvector methods of web information retrieval.\"\n http://citeseer.ist.psu.edu/713792.html\n .. [2] Page, Lawrence; Brin, Sergey; Motwani, Rajeev and Winograd, Terry,\n The PageRank citation ranking: Bringing order to the Web. 1999\n http://dbpubs.stanford.edu:8090/pub/showDoc.Fulltext?lang=en&doc=1999-66&format=pdf\n \"\"\"\n if type(G) == nx.MultiGraph or type(G) == nx.MultiDiGraph:\n raise Exception(\"pagerank() not defined for graphs with multiedges.\")\n\n if len(G) == 0:\n return {}\n\n if not G.is_directed():\n D=G.to_directed()\n else:\n D=G\n\n # create a copy in (right) stochastic form\n W=nx.stochastic_graph(D, weight=weight)\n scale=1.0/W.number_of_nodes()\n\n # choose fixed starting vector if not given\n if nstart is None:\n x=dict.fromkeys(W,scale)\n else:\n x=nstart\n # normalize starting vector to 1\n s=1.0/sum(x.values())\n for k in x: x[k]*=s\n\n # assign uniform personalization/teleportation vector if not given\n if personalization is None:\n p=dict.fromkeys(W,scale)\n else:\n p=personalization\n # normalize starting vector to 1\n s=1.0/sum(p.values())\n for k in p:\n p[k]*=s\n if set(p)!=set(G):\n raise NetworkXError('Personalization vector '\n 'must have a value for every node')\n\n\n # \"dangling\" nodes, no links out from them\n out_degree=W.out_degree()\n dangle=[n for n in W if out_degree[n]==0.0]\n i=0\n while True: # power iteration: make up to max_iter iterations\n xlast=x\n x=dict.fromkeys(xlast.keys(),0)\n danglesum=alpha*scale*sum(xlast[n] for n in dangle)\n for n in x:\n # this matrix multiply looks odd because it is\n # doing a left multiply x^T=xlast^T*W\n for nbr in W[n]:\n x[nbr]+=alpha*xlast[n]*W[n][nbr][weight]\n x[n]+=danglesum+(1.0-alpha)*p[n]\n # normalize vector\n s=1.0/sum(x.values())\n for n in x:\n x[n]*=s\n # check convergence, l1 norm\n err=sum([abs(x[n]-xlast[n]) for n in x])\n if err < tol:\n break\n if i>max_iter:\n raise NetworkXError('pagerank: power iteration failed to converge '\n 'in %d iterations.'%(i-1))\n i+=1\n return x", "metadata": "root.pagerank", "header": "['module', '___EOS___']", "index": 13 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pager", "ank", "_", "(_", "G_", ",_", "alpha_", "=_", "0.85_", ",_", "personali", "zation_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "iter_", "=_", "100_", ",_", "tol_", "=_", "1.0e-", "8_", ",_", "nsta", "rt_", "=_", "None_", ",_", "weight_", "=_", "'", "weight", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "Page", "Rank", " ", "of", " ", "the", " ", "nodes", " ", "in", " ", "the", " ", "graph", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Page", "Rank", " ", "compute", "s", " ", "a", " ", "ranking", " ", "of", " ", "the", " ", "nodes", " ", "in", " ", "the", " ", "graph", " ", "G", " ", "based", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "structure", " ", "of", " ", "the", " ", "inco", "ming", " ", "link", "s", ".", " ", "It", " ", "was", " ", "original", "ly", " ", "design", "ed", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "algo", "rit", "hm", " ", "to", " ", "rank", " ", "web", " ", "page", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "-----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "graph", "\\", "10", ";", " ", " ", "A", " ", "Network", "X", " ", "graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "alpha", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", "Dam", "ping", " ", "parameter", " ", "for", " ", "Page", "Rank", ",", " ", "default", "=", "0.85", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "personali", "zatio", "n", ":", " ", "dict", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", "The", " ", "\"", "personali", "zatio", "n", " ", "vector", "\"", " ", "consi", "stin", "g", " ", "of", " ", "a", " ", "dictionar", "y", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", "key", " ", "for", " ", "every", " ", "graph", " ", "node", " ", "and", " ", "nonzero", " ", "personali", "zatio", "n", " ", "value", " ", "for", " ", "each", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "iter", " ", ":", " ", "integ", "er", ",", " ", "option", "al", "\\", "10", ";", " ", " ", "Maxim", "um", " ", "number", " ", "of", " ", "iterati", "ons", " ", "in", " ", "power", " ", "method", " ", "eigen", "value", " ", "solve", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tol", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", "Error", " ", "tolera", "nce", " ", "used", " ", "to", " ", "check", " ", "convergence", " ", "in", " ", "power", " ", "method", " ", "solve", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nsta", "rt", " ", ":", " ", "dictionar", "y", ",", " ", "option", "al", "\\", "10", ";", " ", " ", "Start", "ing", " ", "value", " ", "of", " ", "Page", "Rank", " ", "iterati", "on", " ", "for", " ", "each", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "weight", " ", ":", " ", "key", ",", " ", "option", "al", "\\", "10", ";", " ", " ", "Ed", "ge", " ", "data", " ", "key", " ", "to", " ", "use", " ", "as", " ", "weight", ".", " ", " ", "If", " ", "Non", "e", " ", "weight", "s", " ", "are", " ", "set", " ", "to", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "pager", "ank", " ", ":", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", "Dict", "ionar", "y", " ", "of", " ", "nodes", " ", "with", " ", "Page", "Rank", " ", "as", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", "=", "nx", ".", "Di", "Graph", "(", "nx", ".", "path", "\\u", "graph", "(", "4", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pr", "=", "nx", ".", "pager", "ank", "(", "G", ",", "alpha", "=", "0.", "9", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "eigenvector", " ", "calculati", "on", " ", "is", " ", "don", "e", " ", "by", " ", "the", " ", "power", " ", "iterati", "on", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "has", " ", "no", " ", "guaran", "tee", " ", "of", " ", "convergence", ".", " ", " ", "The", " ", "iterati", "on", " ", "will", " ", "stop", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "max", "\\u", "iter", " ", "iterati", "ons", " ", "or", " ", "an", " ", "error", " ", "tolera", "nce", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "number", "\\u", "of", "\\u", "nodes", "(", "G", ")*", "tol", " ", "has", " ", "bee", "n", " ", "reache", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Page", "Rank", " ", "algo", "rit", "hm", " ", "was", " ", "design", "ed", " ", "for", " ", "direct", "ed", " ", "graph", "s", " ", "but", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "algo", "rit", "hm", " ", "doe", "s", " ", "not", " ", "check", " ", "if", " ", "the", " ", "input", " ", "graph", " ", "is", " ", "direct", "ed", " ", "and", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "execute", " ", "on", " ", "undi", "rect", "ed", " ", "graph", "s", " ", "by", " ", "convert", "ing", " ", "each", " ", "orient", "ed", " ", "edge", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "direct", "ed", " ", "graph", " ", "to", " ", "two", " ", "edge", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "pager", "ank", "\\u", "nump", "y", ",", " ", "pager", "ank", "\\u", "sci", "py", ",", " ", "google", "\\u", "matrix", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "A", ".", " ", "Lang", "vil", "le", " ", "and", " ", "C", ".", " ", "Me", "yer", ",", "\\", "10", ";", " ", " ", " ", "\"", "A", " ", "survey", " ", "of", " ", "eigenvector", " ", "method", "s", " ", "of", " ", "web", " ", "informati", "on", " ", "retrie", "val", ".\"", "\\", "10", ";", " ", " ", " ", "http", "://", "cite", "see", "r", ".", "ist", ".", "psu", ".", "edu", "/", "713", "792", ".", "html", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "2", "]", " ", "Page", ",", " ", "Law", "ren", "ce", ";", " ", "Bri", "n", ",", " ", "Ser", "ge", "y", ";", " ", "Mot", "wan", "i", ",", " ", "Ra", "je", "ev", " ", "and", " ", "Win", "ogr", "ad", ",", " ", "Ter", "ry", ",", "\\", "10", ";", " ", " ", " ", "The", " ", "Page", "Rank", " ", "cit", "ation", " ", "ranking", ":", " ", "Bri", "ngin", "g", " ", "order", " ", "to", " ", "the", " ", "Web", ".", " ", "1999", "\\", "10", ";", " ", " ", " ", "http", "://", "dbp", "ubs", ".", "stan", "for", "d", ".", "edu", ":", "809", "0", "/", "pub", "/", "show", "Doc", ".", "Full", "text", "?", "lang", "=", "en", "&", "doc", "=", "1999", "-", "6", "6", "&", "format", "=", "pdf", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "G_", ")_", "==_", "nx_", "._", "Multi", "Graph_", "or_", "type_", "(_", "G_", ")_", "==_", "nx_", "._", "Multi", "Di", "Graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "pager", "ank", "()", " ", "not", " ", "defin", "ed", " ", "for", " ", "graph", "s", " ", "with", " ", "multi", "edge", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "G_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "G_", "._", "is", "\\u", "directed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "G_", "._", "to", "\\u", "directed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "copy", " ", "in", " ", "(", "right", ")", " ", "stochastic", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "W_", "=_", "nx_", "._", "stochastic", "\\u", "graph_", "(_", "D_", ",_", "weight_", "=_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "1.0_", "/_", "W_", "._", "number", "\\u", "of", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "choose", " ", "fixed", " ", "startin", "g", " ", "vector", " ", "if", " ", "not", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nsta", "rt_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "dict_", "._", "fromkeys_", "(_", "W_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "nsta", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normali", "ze", " ", "startin", "g", " ", "vector", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "1.0_", "/_", "sum_", "(_", "x_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "x_", ":_", "x_", "[_", "k_", "]_", "*=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "uniform", " ", "personali", "zatio", "n", "/", "telep", "orta", "tion", " ", "vector", " ", "if", " ", "not", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "personali", "zation_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "dict_", "._", "fromkeys_", "(_", "W_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "personali", "zation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normali", "ze", " ", "startin", "g", " ", "vector", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "1.0_", "/_", "sum_", "(_", "p_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "k_", "]_", "*=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "set_", "(_", "p_", ")_", "!=_", "set_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Network", "XE", "rror_", "(_", "'", "Persona", "liza", "tion", " ", "vector", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "must", " ", "have", " ", "a", " ", "value", " ", "for", " ", "every", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "dan", "glin", "g", "\"", " ", "nodes", ",", " ", "no", " ", "link", "s", " ", "out", " ", "from", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "degree_", "=_", "W_", "._", "out", "\\u", "degree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dan", "gle_", "=_", "[_", "n_", "for_", "n_", "in_", "W_", "if_", "out", "\\u", "degree_", "[_", "n_", "]_", "==_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "power", " ", "iterati", "on", ":", " ", "make", " ", "up", " ", "to", " ", "max", "\\u", "iter", " ", "iterations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xla", "st_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "dict_", "._", "fromkeys_", "(_", "xla", "st_", "._", "keys_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dan", "gle", "sum_", "=_", "alpha_", "*_", "scale_", "*_", "sum_", "(_", "xla", "st_", "[_", "n_", "]_", "for_", "n_", "in_", "dan", "gle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "matrix", " ", "multipl", "y", " ", "look", "s", " ", "odd", " ", "bec", "aus", "e", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doi", "ng", " ", "a", " ", "left", " ", "multipl", "y", " ", "x", "^", "T", "=", "xla", "st", "^", "T", "*", "W_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "nbr_", "in_", "W_", "[_", "n_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "[_", "nbr_", "]_", "+=_", "alpha_", "*_", "xla", "st_", "[_", "n_", "]_", "*_", "W_", "[_", "n_", "]_", "[_", "nbr_", "]_", "[_", "weight_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "[_", "n_", "]_", "+=_", "dan", "gle", "sum_", "+_", "(_", "1.0_", "-_", "alpha_", ")_", "*_", "p_", "[_", "n_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normali", "ze", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "1.0_", "/_", "sum_", "(_", "x_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "[_", "n_", "]_", "*=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "convergence", ",", " ", "l1", " ", "norm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err_", "=_", "sum_", "(_", "[_", "abs_", "(_", "x_", "[_", "n_", "]_", "-_", "xla", "st_", "[_", "n_", "]_", ")_", "for_", "n_", "in_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "<_", "tol_", ":_", "\\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_", "i_", ">_", "max", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Network", "XE", "rror_", "(_", "'", "pager", "ank", ":", " ", "power", " ", "iterati", "on", " ", "fail", "ed", " ", "to", " ", "converg", "e", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", " ", "%", "d", " ", "iterati", "ons", ".'_", "%_", "(_", "i_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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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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 ]
Unused import
zomux/deepy/experiments/tutorials/tutorial2.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport logging, os\nlogging.basicConfig(level=logging.INFO)\nimport theano.tensor as T\n\nfrom deepy.dataset import MnistDataset, MiniBatches\nfrom deepy.networks import ComputationalGraph\nfrom deepy.layers import Dense, Softmax, NeuralLayer, Chain\nfrom deepy.trainers import MomentumTrainer, LearningRateAnnealer\nfrom deepy.utils import AutoEncoderCost, CrossEntropyCost, ErrorRateCost\n\n\nmodel_path = os.path.join(os.path.dirname(__file__), \"models\", \"tutorial2.gz\")\n\n\n\nif __name__ == '__main__':\n model = ComputationalGraph(input_dim=28 * 28)\n\n mnist = MiniBatches(MnistDataset(), batch_size=20)\n\n trainer = MomentumTrainer(model, {'weight_l2': 0.0001})\n\n trainer.run(mnist, controllers=[LearningRateAnnealer(trainer)])\n\n model.save_params(model_path)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MyJointTrainingModel(NeuralLayer):\n \"\"\"\n A customized model that trains an auto-encoder and MLP classifier simultaneously.\n \"\"\"\n\n\n", "metadata": "root.MyJointTrainingModel", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, internal_layer_size=100):\n super(MyJointTrainingModel, self).__init__(\"my joint-training model\")\n self.internal_layer_size = internal_layer_size", "metadata": "root.MyJointTrainingModel.__init__", "header": "['class', 'MyJointTrainingModel', '(', 'NeuralLayer', ')', ':', '___EOS___']", "index": 22 }, { "content": " def prepare(self):\n \"\"\"\n All codes that create parameters should be put into 'setup' function.\n \"\"\"\n self.output_dim = 10\n self.encoder = Chain(self.input_dim).stack(Dense(self.internal_layer_size, 'tanh'))\n self.decoder = Chain(self.internal_layer_size).stack(Dense(self.input_dim))\n self.classifier = Chain(self.internal_layer_size).stack(Dense(50, 'tanh'),\n Dense(self.output_dim),\n Softmax())\n\n self.register_inner_layers(self.encoder, self.decoder, self.classifier)\n\n self.target_input = T.ivector('target')\n self.register_external_inputs(self.target_input)", "metadata": "root.MyJointTrainingModel.prepare", "header": "['class', 'MyJointTrainingModel', '(', 'NeuralLayer', ')', ':', '___EOS___']", "index": 26 }, { "content": " def compute_tensor(self, x):\n \"\"\"\n Build the computation graph here.\n \"\"\"\n internal_variable = self.encoder.compute_tensor(x)\n\n decoding_output = self.decoder.compute_tensor(internal_variable)\n\n classification_output = self.classifier.compute_tensor(internal_variable)\n\n auto_encoder_cost = AutoEncoderCost(decoding_output, x).get()\n\n classification_cost = CrossEntropyCost(classification_output, self.target_input).get()\n\n final_cost = 0.01 * auto_encoder_cost + classification_cost\n\n error_rate = ErrorRateCost(classification_output, self.target_input).get()\n\n self.register_monitors((\"err\", error_rate),\n (\"encoder_cost\", auto_encoder_cost),\n (\"classify_cost\", classification_cost))\n\n return final_cost", "metadata": "root.MyJointTrainingModel.compute_tensor", "header": "['class', 'MyJointTrainingModel', '(', 'NeuralLayer', ')', ':', '___EOS___']", "index": 42 } ]
[]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "deep", "y_", "._", "dataset_", "import_", "Mn", "ist", "Dataset_", ",_", "Mini", "Bat", "ches", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "deep", "y_", "._", "networks_", "import_", "Computation", "al", "Graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "deep", "y_", "._", "layers_", "import_", "Dense_", ",_", "Softmax", "_", ",_", "Neu", "ral", "Layer_", ",_", "Chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "deep", "y_", "._", "trainer", "s_", "import_", "Moment", "um", "Trainer", "_", ",_", "Learn", "ing", "Rat", "e", "Ann", "eal", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "deep", "y_", "._", "utils_", "import_", "Auto", "Encode", "r", "Cost_", ",_", "Cross", "Entr", "opy", "Cost_", ",_", "Error", "Rat", "e", "Cost_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "model", "s", "\"_", ",_", "\"", "tutorial", "2", ".", "gz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Computation", "al", "Graph_", "(_", "input", "\\u", "dim_", "=_", "28_", "*_", "28_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mnist_", "=_", "Mini", "Bat", "ches", "_", "(_", "Mn", "ist", "Dataset_", "(_", ")_", ",_", "batch", "\\u", "size_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trainer_", "=_", "Moment", "um", "Trainer", "_", "(_", "model_", ",_", "{_", "'", "weight", "\\u", "l2", "'_", ":_", "0.0001_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trainer_", "._", "run_", "(_", "mnist_", ",_", "controllers_", "=_", "[_", "Learn", "ing", "Rat", "e", "Ann", "eal", "er_", "(_", "trainer_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "save", "\\u", "params_", "(_", "model", "\\u", "path_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "Joint", "Train", "ing", "Model_", "(_", "Neu", "ral", "Layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "customize", "d", " ", "model", " ", "tha", "t", " ", "trains", " ", "an", " ", "auto", "-", "encode", "r", " ", "and", " ", "MLP", " ", "classif", "ier", " ", "simultaneous", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "My", "Joint", "Train", "ing", "Model_", "(_", "Neu", "ral", "Layer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "internal", "\\u", "layer", "\\u", "size_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "My", "Joint", "Train", "ing", "Model_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\"", "my", " ", "joint", "-", "train", "ing", " ", "model", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "internal", "\\u", "layer", "\\u", "size_", "=_", "internal", "\\u", "layer", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Joint", "Train", "ing", "Model_", "(_", "Neu", "ral", "Layer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepare_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "codes", " ", "tha", "t", " ", "create", " ", "parameter", "s", " ", "shou", "ld", " ", "be", " ", "put", " ", "int", "o", " ", "'", "setup", "'", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "dim_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encoder_", "=_", "Chain_", "(_", "self_", "._", "input", "\\u", "dim_", ")_", "._", "stack_", "(_", "Dense_", "(_", "self_", "._", "internal", "\\u", "layer", "\\u", "size_", ",_", "'", "tan", "h", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "decoder_", "=_", "Chain_", "(_", "self_", "._", "internal", "\\u", "layer", "\\u", "size_", ")_", "._", "stack_", "(_", "Dense_", "(_", "self_", "._", "input", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classifier_", "=_", "Chain_", "(_", "self_", "._", "internal", "\\u", "layer", "\\u", "size_", ")_", "._", "stack_", "(_", "Dense_", "(_", "50_", ",_", "'", "tan", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dense_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Softmax", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "register", "\\u", "inner", "\\u", "layers_", "(_", "self_", "._", "encoder_", ",_", "self_", "._", "decoder_", ",_", "self_", "._", "classifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "input_", "=_", "T_", "._", "ive", "ctor_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "register", "\\u", "external", "\\u", "inputs_", "(_", "self_", "._", "target", "\\u", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Joint", "Train", "ing", "Model_", "(_", "Neu", "ral", "Layer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "tensor_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", " ", "the", " ", "computation", " ", "graph", " ", "here", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "internal", "\\u", "variable_", "=_", "self_", "._", "encoder_", "._", "compute", "\\u", "tensor_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deco", "ding", "\\u", "output_", "=_", "self_", "._", "decoder_", "._", "compute", "\\u", "tensor_", "(_", "internal", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classificati", "on", "\\u", "output_", "=_", "self_", "._", "classifier_", "._", "compute", "\\u", "tensor_", "(_", "internal", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "encode", "r", "\\u", "cost_", "=_", "Auto", "Encode", "r", "Cost_", "(_", "deco", "ding", "\\u", "output_", ",_", "x_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classificati", "on", "\\u", "cost_", "=_", "Cross", "Entr", "opy", "Cost_", "(_", "classificati", "on", "\\u", "output_", ",_", "self_", "._", "target", "\\u", "input_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "\\u", "cost_", "=_", "0.01_", "*_", "auto", "\\u", "encode", "r", "\\u", "cost_", "+_", "classificati", "on", "\\u", "cost_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "rate_", "=_", "Error", "Rat", "e", "Cost_", "(_", "classificati", "on", "\\u", "output_", ",_", "self_", "._", "target", "\\u", "input_", ")_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "register", "\\u", "monitors_", "(_", "(_", "\"", "err", "\"_", ",_", "error", "\\u", "rate_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "encode", "r", "\\u", "cost", "\"_", ",_", "auto", "\\u", "encode", "r", "\\u", "cost_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "classify", "\\u", "cost", "\"_", ",_", "classificati", "on", "\\u", "cost_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "final", "\\u", "cost_", "\\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,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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 ]
Imprecise assert
mozilla/moztrap/tests/view/users/test_views.py
[ { "content": " def test_set_username(self):\n \"\"\"A new browserID user is prompted to set their username, and can.\"\"\"\n form = self.new_browserid().follow().follow().forms[\"setusernameform\"]\n form[\"username\"] = \"tester\"\n res = form.submit(status=302)\n\n self.assertRedirects(res, \"/\")\n user = self.model.User.objects.get()\n self.assertEqual(user.username, \"tester\")", "metadata": "root.BrowserIDTest.test_set_username", "header": "['class', 'BrowserIDTest', '(', 'case', '.', 'view', '.', 'ViewTestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test_reset_password(self):\n \"\"\"Get a confirmation message and reset email.\"\"\"\n self.F.UserFactory.create(\n email=\"user@example.com\",\n password=\"somethingusable\"\n )\n\n r = self.get()\n form = r.forms[\"resetpasswordform\"]\n form[\"email\"] = \"user@example.com\"\n\n res = form.submit(status=302).follow().follow()\n\n res.mustcontain(\"Password reset email sent\")\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].to, [\"user@example.com\"])", "metadata": "root.PasswordResetTest.test_reset_password", "header": "['class', 'PasswordResetTest', '(', 'case', '.', 'view', '.', 'ViewTestCase', ')', ':', '___EOS___']", "index": 386 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Brows", "er", "ID", "Test_", "(_", "case_", "._", "view_", "._", "View", "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", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "new", " ", "browse", "r", "ID", " ", "user", " ", "is", " ", "prompt", "ed", " ", "to", " ", "set", " ", "thei", "r", " ", "user", "name", ",", " ", "and", " ", "can", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "self_", "._", "new", "\\u", "browse", "rid_", "(_", ")_", "._", "follow_", "(_", ")_", "._", "follow_", "(_", ")_", "._", "forms_", "[_", "\"", "set", "user", "name", "form", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "\"", "user", "name", "\"_", "]_", "=_", "\"", "teste", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "form_", "._", "submit_", "(_", "status_", "=_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "res_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "model_", "._", "User_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user_", "._", "username_", ",_", "\"", "teste", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Passw", "ord", "Reset", "Test_", "(_", "case_", "._", "view_", "._", "View", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "reset", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "confirmation", " ", "message", " ", "and", " ", "reset", " ", "email", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "\"", "user", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "\"", "somet", "hing", "usable", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "self_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "r_", "._", "forms_", "[_", "\"", "reset", "password", "form", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "\"", "email", "\"_", "]_", "=_", "\"", "user", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "form_", "._", "submit_", "(_", "status_", "=_", "302_", ")_", "._", "follow_", "(_", ")_", "._", "follow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "must", "contain", "_", "(_", "\"", "Passw", "ord", " ", "reset", " ", "email", " ", "sent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "to_", ",_", "[_", "\"", "user", "@", "example", ".", "com", "\"_", "]_", ")_", "\\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 ]
Unreachable code
buildingenergy/buildingenergy-platform/seed/tests/test_api.py
[ { "content": "\"\"\"\n:copyright: (c) 2014 Building Energy Inc\n:license: see LICENSE for more details.\n\"\"\"\nimport json\nfrom django.core.urlresolvers import reverse_lazy, reverse\nfrom django.test import TestCase\n\nfrom superperms.orgs.models import Organization, OrganizationUser\n\nfrom landing.models import SEEDUser as User\nfrom seed.factory import SEEDFactory\nfrom seed.models import CanonicalBuilding\nfrom seed.utils.api import get_api_endpoints\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2014", " ", "Building", " ", "Energ", "y", " ", "Inc", "\\", "10", ";", ":", "license", ":", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse", "\\u", "lazy_", ",_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "super", "perms_", "._", "orgs", "_", "._", "models_", "import_", "Organization_", ",_", "Organiz", "ation", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "landing", "_", "._", "models_", "import_", "SEED", "User_", "as_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "seed_", "._", "factory_", "import_", "SEED", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "seed_", "._", "models_", "import_", "Canonical", "Building", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "seed_", "._", "utils_", "._", "api_", "import_", "get", "\\u", "api", "\\u", "endpoints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/tests/unit/utils/test_general.py
[ { "content": "# Copyright (c) 2013 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\nimport mock\n\nfrom sahara.tests.unit import base\nfrom sahara.utils import general\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UtilsGeneralTest(base.SaharaWithDbTestCase):\n\n\n\n", "metadata": "root.UtilsGeneralTest", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def setUp(self):\n super(UtilsGeneralTest, self).setUp()", "metadata": "root.UtilsGeneralTest.setUp", "header": "['class', 'UtilsGeneralTest', '(', 'base', '.', 'SaharaWithDbTestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_find_dict(self):\n iterable = [\n {\n \"a\": 1\n },\n {\n \"a\": 1,\n \"b\": 2,\n \"c\": 3\n },\n {\n \"a\": 2\n },\n {\n \"c\": 3\n }\n ]\n\n self.assertEqual({\"a\": 1, \"b\": 2, \"c\": 3},\n general.find_dict(iterable, a=1, b=2))\n self.assertIsNone(general.find_dict(iterable, z=4))", "metadata": "root.UtilsGeneralTest.test_find_dict", "header": "['class', 'UtilsGeneralTest', '(', 'base', '.', 'SaharaWithDbTestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_find(self):\n lst = [mock.Mock(a=5), mock.Mock(b=5), mock.Mock(a=7, b=7)]\n self.assertEqual(lst[0], general.find(lst, a=5))\n self.assertEqual(lst[1], general.find(lst, b=5))\n self.assertIsNone(general.find(lst, a=8))\n self.assertEqual(lst[2], general.find(lst, a=7))\n self.assertEqual(lst[2], general.find(lst, a=7, b=7))", "metadata": "root.UtilsGeneralTest.test_find", "header": "['class', 'UtilsGeneralTest', '(', 'base', '.', 'SaharaWithDbTestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_generate_instance_name(self):\n inst_name = \"cluster-worker-001\"\n self.assertEqual(\n inst_name, general.generate_instance_name(\"cluster\", \"worker\", 1))\n self.assertEqual(\n inst_name, general.generate_instance_name(\"CLUSTER\", \"WORKER\", 1))", "metadata": "root.UtilsGeneralTest.test_generate_instance_name", "header": "['class', 'UtilsGeneralTest', '(', 'base', '.', 'SaharaWithDbTestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_get_by_id(self):\n lst = [mock.Mock(id=5), mock.Mock(id=7)]\n self.assertIsNone(general.get_by_id(lst, 9))\n self.assertEqual(lst[0], general.get_by_id(lst, 5))\n self.assertEqual(lst[1], general.get_by_id(lst, 7))", "metadata": "root.UtilsGeneralTest.test_get_by_id", "header": "['class', 'UtilsGeneralTest', '(', 'base', '.', 'SaharaWithDbTestCase', ')', ':', '___EOS___']", "index": 62 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "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_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sahara", "_", "._", "tests_", "._", "unit_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "utils_", "import_", "general_", "\\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_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ut", "il", "s", "General", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterable_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", "\"_", ":_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ":_", "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_", "self_", "._", "assert", "Equal_", "(_", "{_", "\"", "a", "\"_", ":_", "1_", ",_", "\"", "b", "\"_", ":_", "2_", ",_", "\"", "c", "\"_", ":_", "3_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "general_", "._", "find", "\\u", "dict_", "(_", "iterable_", ",_", "a_", "=_", "1_", ",_", "b_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "general_", "._", "find", "\\u", "dict_", "(_", "iterable_", ",_", "z_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lst_", "=_", "[_", "mock_", "._", "Mock_", "(_", "a_", "=_", "5_", ")_", ",_", "mock_", "._", "Mock_", "(_", "b_", "=_", "5_", ")_", ",_", "mock_", "._", "Mock_", "(_", "a_", "=_", "7_", ",_", "b_", "=_", "7_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "0_", "]_", ",_", "general_", "._", "find_", "(_", "lst_", ",_", "a_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "1_", "]_", ",_", "general_", "._", "find_", "(_", "lst_", ",_", "b_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "general_", "._", "find_", "(_", "lst_", ",_", "a_", "=_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "2_", "]_", ",_", "general_", "._", "find_", "(_", "lst_", ",_", "a_", "=_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "2_", "]_", ",_", "general_", "._", "find_", "(_", "lst_", ",_", "a_", "=_", "7_", ",_", "b_", "=_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "e\\u", "instance", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst", "\\u", "name_", "=_", "\"", "cluster", "-", "worker", "-0", "01", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "name_", ",_", "general_", "._", "generat", "e\\u", "instance", "\\u", "name_", "(_", "\"", "cluster", "\"_", ",_", "\"", "worker", "\"_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "name_", ",_", "general_", "._", "generat", "e\\u", "instance", "\\u", "name_", "(_", "\"", "CLUSTER", "\"_", ",_", "\"", "WORKER", "\"_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ut", "il", "s", "General", "Test_", "(_", "base_", "._", "Sa", "hara", "With", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "by", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lst_", "=_", "[_", "mock_", "._", "Mock_", "(_", "id_", "=_", "5_", ")_", ",_", "mock_", "._", "Mock_", "(_", "id_", "=_", "7_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "general_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "lst_", ",_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "0_", "]_", ",_", "general_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "lst_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lst_", "[_", "1_", "]_", ",_", "general_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "lst_", ",_", "7_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cloudera/hue/desktop/core/ext-py/Babel-0.9.6/babel/messages/tests/frontend.py
[ { "content": " def test_keeps_catalog_non_fuzzy(self):\n self.cmd.input_file = 'project/i18n/messages_non_fuzzy.pot'\n self.cmd.locale = 'en_US'\n self.cmd.output_dir = 'project/i18n'\n\n self.cmd.finalize_options()\n self.cmd.run()\n\n po_file = os.path.join(self.datadir, 'project', 'i18n', 'en_US',\n 'LC_MESSAGES', 'messages.po')\n assert os.path.isfile(po_file)\n\n self.assertEqual(\nr\"\"\"# English (United States) 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: en_US <LL@li.org>\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1)\\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 coment,\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\"\"\" % {'version': VERSION,\n 'date': format_datetime(datetime.now(LOCALTZ), 'yyyy-MM-dd HH:mmZ',\n tzinfo=LOCALTZ, locale='en')},\n open(po_file, 'U').read())", "metadata": "root.InitCatalogTestCase.test_keeps_catalog_non_fuzzy", "header": "['class', 'InitCatalogTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 350 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Ini", "t", "Catalog", "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", "keep", "s", "\\u", "catal", "og", "\\u", "non", "\\u", "fuzzy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "._", "input", "\\u", "file_", "=_", "'", "project", "/", "i18n", "/", "message", "s", "\\u", "non", "\\u", "fuzz", "y", ".", "pot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "._", "locale_", "=_", "'", "en", "\\u", "US", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "._", "output", "\\u", "dir_", "=_", "'", "project", "/", "i18n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cmd_", "._", "finalize", "\\u", "options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "po", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "datadir_", ",_", "'", "project", "'_", ",_", "'", "i18n", "'_", ",_", "'", "en", "\\u", "US", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LC", "\\u", "MESSAGE", "S", "'_", ",_", "'", "message", "s", ".", "po", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "po", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\"\"#", " ", "Eng", "lish", " ", "(", "Unit", "ed", " ", "State", "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", ":", " ", "en", "\\u", "US", " ", "<", "LL", "@", "li", ".", "org", ">\\\\", "n", "\"", "\\", "10", ";", "\"", "Plur", "al", "-", "Form", "s", ":", " ", "npl", "ural", "s", "=", "2", ";", " ", "plural", "=(", "n", " ", "!=", " ", "1", ")\\\\", "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", " ", "come", "nt", ",", "\\", "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", ";\"\"\"_", "%_", "{_", "'", "version", "'_", ":_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "format\\u", "datetime_", "(_", "datetime_", "._", "now_", "(_", "LOCAL", "TZ_", ")_", ",_", "'", "yyyy", "-", "MM", "-", "dd", " ", "HH", ":", "mm", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tzinfo_", "=_", "LOCAL", "TZ_", ",_", "locale_", "=_", "'", "en", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "po", "\\u", "file_", ",_", "'", "U", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
francelabs/datafari/windows/python/Lib/site-packages/pip/_vendor/pkg_resources/tests/test_resources.py
[ { "content": "import os\nimport sys\nimport tempfile\nimport shutil\nimport string\n\nimport pytest\n\nimport pkg_resources\nfrom pkg_resources import (parse_requirements, VersionConflict, parse_version,\n Distribution, EntryPoint, Requirement, safe_version, safe_name,\n WorkingSet)\n\npackaging = pkg_resources.packaging\n\n\n\n\n\n\ndist_from_fn = pkg_resources.Distribution.from_filename\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def safe_repr(obj, short=False):\n \"\"\" copied from Python2.7\"\"\"\n try:\n result = repr(obj)\n except Exception:\n result = object.__repr__(obj)\n if not short or len(result) < pkg_resources._MAX_LENGTH:\n return result\n return result[:pkg_resources._MAX_LENGTH] + ' [truncated]...'", "metadata": "root.safe_repr", "header": "['module', '___EOS___']", "index": 16 }, { "content": "class Metadata(pkg_resources.EmptyProvider):\n \"\"\"Mock object to return metadata as if from an on-disk distribution\"\"\"\n\n\n\n", "metadata": "root.Metadata", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, *pairs):\n self.metadata = dict(pairs)", "metadata": "root.Metadata.__init__", "header": "['class', 'Metadata', '(', 'pkg_resources', '.', 'EmptyProvider', ')', ':', '___EOS___']", "index": 30 }, { "content": " def has_metadata(self, name):\n return name in self.metadata", "metadata": "root.Metadata.has_metadata", "header": "['class', 'Metadata', '(', 'pkg_resources', '.', 'EmptyProvider', ')', ':', '___EOS___']", "index": 33 }, { "content": " def get_metadata(self, name):\n return self.metadata[name]", "metadata": "root.Metadata.get_metadata", "header": "['class', 'Metadata', '(', 'pkg_resources', '.', 'EmptyProvider', ')', ':', '___EOS___']", "index": 36 }, { "content": " def get_metadata_lines(self, name):\n return pkg_resources.yield_lines(self.get_metadata(name))", "metadata": "root.Metadata.get_metadata_lines", "header": "['class', 'Metadata', '(', 'pkg_resources', '.', 'EmptyProvider', ')', ':', '___EOS___']", "index": 39 }, { "content": "class TestDistro:\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestDistro", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def testCollection(self):\n # empty path should produce no distributions\n ad = pkg_resources.Environment([], platform=None, python=None)\n assert list(ad) == []\n assert ad['FooPkg'] == []\n ad.add(dist_from_fn(\"FooPkg-1.3_1.egg\"))\n ad.add(dist_from_fn(\"FooPkg-1.4-py2.4-win32.egg\"))\n ad.add(dist_from_fn(\"FooPkg-1.2-py2.4.egg\"))\n\n # Name is in there now\n assert ad['FooPkg']\n # But only 1 package\n assert list(ad) == ['foopkg']\n\n # Distributions sort by version\n assert [dist.version for dist in ad['FooPkg']] == ['1.4','1.3-1','1.2']\n\n # Removing a distribution leaves sequence alone\n ad.remove(ad['FooPkg'][1])\n assert [dist.version for dist in ad['FooPkg']] == ['1.4','1.2']\n\n # And inserting adds them in order\n ad.add(dist_from_fn(\"FooPkg-1.9.egg\"))\n assert [dist.version for dist in ad['FooPkg']] == ['1.9','1.4','1.2']\n\n ws = WorkingSet([])\n foo12 = dist_from_fn(\"FooPkg-1.2-py2.4.egg\")\n foo14 = dist_from_fn(\"FooPkg-1.4-py2.4-win32.egg\")\n req, = parse_requirements(\"FooPkg>=1.3\")\n\n # Nominal case: no distros on path, should yield all applicable\n assert ad.best_match(req, ws).version == '1.9'\n # If a matching distro is already installed, should return only that\n ws.add(foo14)\n assert ad.best_match(req, ws).version == '1.4'\n\n # If the first matching distro is unsuitable, it's a version conflict\n ws = WorkingSet([])\n ws.add(foo12)\n ws.add(foo14)\n with pytest.raises(VersionConflict):\n ad.best_match(req, ws)\n\n # If more than one match on the path, the first one takes precedence\n ws = WorkingSet([])\n ws.add(foo14)\n ws.add(foo12)\n ws.add(foo14)\n assert ad.best_match(req, ws).version == '1.4'", "metadata": "root.TestDistro.testCollection", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 47 }, { "content": " def checkFooPkg(self,d):\n assert d.project_name == \"FooPkg\"\n assert d.key == \"foopkg\"\n assert d.version == \"1.3.post1\"\n assert d.py_version == \"2.4\"\n assert d.platform == \"win32\"\n assert d.parsed_version == parse_version(\"1.3-1\")", "metadata": "root.TestDistro.checkFooPkg", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 97 }, { "content": " def testDistroBasics(self):\n d = Distribution(\n \"/some/path\",\n project_name=\"FooPkg\",version=\"1.3-1\",py_version=\"2.4\",platform=\"win32\"\n )\n self.checkFooPkg(d)\n\n d = Distribution(\"/some/path\")\n assert d.py_version == sys.version[:3]\n assert d.platform == None", "metadata": "root.TestDistro.testDistroBasics", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 105 }, { "content": " def testDistroParse(self):\n d = dist_from_fn(\"FooPkg-1.3.post1-py2.4-win32.egg\")\n self.checkFooPkg(d)\n d = dist_from_fn(\"FooPkg-1.3.post1-py2.4-win32.egg-info\")\n self.checkFooPkg(d)", "metadata": "root.TestDistro.testDistroParse", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 116 }, { "content": " def testDistroMetadata(self):\n d = Distribution(\n \"/some/path\", project_name=\"FooPkg\", py_version=\"2.4\", platform=\"win32\",\n metadata = Metadata(\n ('PKG-INFO',\"Metadata-Version: 1.0\\nVersion: 1.3-1\\n\")\n )\n )\n self.checkFooPkg(d)", "metadata": "root.TestDistro.testDistroMetadata", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 122 }, { "content": " def distRequires(self, txt):\n return Distribution(\"/foo\", metadata=Metadata(('depends.txt', txt)))", "metadata": "root.TestDistro.distRequires", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 131 }, { "content": " def checkRequires(self, dist, txt, extras=()):\n assert list(dist.requires(extras)) == list(parse_requirements(txt))", "metadata": "root.TestDistro.checkRequires", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 134 }, { "content": " def testDistroDependsSimple(self):\n for v in \"Twisted>=1.5\", \"Twisted>=1.5\\nZConfig>=2.0\":\n self.checkRequires(self.distRequires(v), v)", "metadata": "root.TestDistro.testDistroDependsSimple", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 137 }, { "content": " def testResolve(self):\n ad = pkg_resources.Environment([])\n ws = WorkingSet([])\n # Resolving no requirements -> nothing to install\n assert list(ws.resolve([], ad)) == []\n # Request something not in the collection -> DistributionNotFound\n with pytest.raises(pkg_resources.DistributionNotFound):\n ws.resolve(parse_requirements(\"Foo\"), ad)\n\n Foo = Distribution.from_filename(\n \"/foo_dir/Foo-1.2.egg\",\n metadata=Metadata(('depends.txt', \"[bar]\\nBaz>=2.0\"))\n )\n ad.add(Foo)\n ad.add(Distribution.from_filename(\"Foo-0.9.egg\"))\n\n # Request thing(s) that are available -> list to activate\n for i in range(3):\n targets = list(ws.resolve(parse_requirements(\"Foo\"), ad))\n assert targets == [Foo]\n list(map(ws.add,targets))\n with pytest.raises(VersionConflict):\n ws.resolve(parse_requirements(\"Foo==0.9\"), ad)\n ws = WorkingSet([]) # reset\n\n # Request an extra that causes an unresolved dependency for \"Baz\"\n with pytest.raises(pkg_resources.DistributionNotFound):\n ws.resolve(parse_requirements(\"Foo[bar]\"), ad)\n Baz = Distribution.from_filename(\n \"/foo_dir/Baz-2.1.egg\", metadata=Metadata(('depends.txt', \"Foo\"))\n )\n ad.add(Baz)\n\n # Activation list now includes resolved dependency\n assert list(ws.resolve(parse_requirements(\"Foo[bar]\"), ad)) ==[Foo,Baz]\n # Requests for conflicting versions produce VersionConflict\n with pytest.raises(VersionConflict) as vc:\n ws.resolve(parse_requirements(\"Foo==1.2\\nFoo!=1.2\"), ad)\n\n msg = 'Foo 0.9 is installed but Foo==1.2 is required'\n assert vc.value.report() == msg", "metadata": "root.TestDistro.testResolve", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 141 }, { "content": " def testDistroDependsOptions(self):\n d = self.distRequires(\"\"\"\n Twisted>=1.5\n [docgen]\n ZConfig>=2.0\n docutils>=0.3\n [fastcgi]\n fcgiapp>=0.1\"\"\")\n self.checkRequires(d,\"Twisted>=1.5\")\n self.checkRequires(\n d,\"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3\".split(), [\"docgen\"]\n )\n self.checkRequires(\n d,\"Twisted>=1.5 fcgiapp>=0.1\".split(), [\"fastcgi\"]\n )\n self.checkRequires(\n d,\"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1\".split(),\n [\"docgen\",\"fastcgi\"]\n )\n self.checkRequires(\n d,\"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3\".split(),\n [\"fastcgi\", \"docgen\"]\n )\n with pytest.raises(pkg_resources.UnknownExtra):\n d.requires([\"foo\"])", "metadata": "root.TestDistro.testDistroDependsOptions", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 183 }, { "content": "class TestWorkingSet:\n", "metadata": "root.TestWorkingSet", "header": "['module', '___EOS___']", "index": 210 }, { "content": " def test_find_conflicting(self):\n ws = WorkingSet([])\n Foo = Distribution.from_filename(\"/foo_dir/Foo-1.2.egg\")\n ws.add(Foo)\n\n # create a requirement that conflicts with Foo 1.2\n req = next(parse_requirements(\"Foo<1.2\"))\n\n with pytest.raises(VersionConflict) as vc:\n ws.find(req)\n\n msg = 'Foo 1.2 is installed but Foo<1.2 is required'\n assert vc.value.report() == msg", "metadata": "root.TestWorkingSet.test_find_conflicting", "header": "['class', 'TestWorkingSet', ':', '___EOS___']", "index": 211 }, { "content": " def test_resolve_conflicts_with_prior(self):\n \"\"\"\n A ContextualVersionConflict should be raised when a requirement\n conflicts with a prior requirement for a different package.\n \"\"\"\n # Create installation where Foo depends on Baz 1.0 and Bar depends on\n # Baz 2.0.\n ws = WorkingSet([])\n md = Metadata(('depends.txt', \"Baz==1.0\"))\n Foo = Distribution.from_filename(\"/foo_dir/Foo-1.0.egg\", metadata=md)\n ws.add(Foo)\n md = Metadata(('depends.txt', \"Baz==2.0\"))\n Bar = Distribution.from_filename(\"/foo_dir/Bar-1.0.egg\", metadata=md)\n ws.add(Bar)\n Baz = Distribution.from_filename(\"/foo_dir/Baz-1.0.egg\")\n ws.add(Baz)\n Baz = Distribution.from_filename(\"/foo_dir/Baz-2.0.egg\")\n ws.add(Baz)\n\n with pytest.raises(VersionConflict) as vc:\n ws.resolve(parse_requirements(\"Foo\\nBar\\n\"))\n\n msg = \"Baz 1.0 is installed but Baz==2.0 is required by {'Bar'}\"\n if pkg_resources.PY2:\n msg = msg.replace(\"{'Bar'}\", \"set(['Bar'])\")\n assert vc.value.report() == msg", "metadata": "root.TestWorkingSet.test_resolve_conflicts_with_prior", "header": "['class', 'TestWorkingSet', ':', '___EOS___']", "index": 225 }, { "content": "class TestEntryPoints:\n\n\n\n\n\n reject_specs = \"foo\", \"x=a:b:c\", \"q=x/na\", \"fez=pish:tush-z\", \"x=f[a]>2\"\n\n\n\n submap_expect = dict(\n feature1=EntryPoint('feature1', 'somemodule', ['somefunction']),\n feature2=EntryPoint('feature2', 'another.module', ['SomeClass'], ['extra1','extra2']),\n feature3=EntryPoint('feature3', 'this.module', extras=['something'])\n )\n submap_str = \"\"\"\n # define features for blah blah\n feature1 = somemodule:somefunction\n feature2 = another.module:SomeClass [extra1,extra2]\n feature3 = this.module [something]\n \"\"\"\n\n", "metadata": "root.TestEntryPoints", "header": "['module', '___EOS___']", "index": 253 }, { "content": " def assertfields(self, ep):\n assert ep.name == \"foo\"\n assert ep.module_name == \"pkg_resources.tests.test_resources\"\n assert ep.attrs == (\"TestEntryPoints\",)\n assert ep.extras == (\"x\",)\n assert ep.load() is TestEntryPoints\n expect = \"foo = pkg_resources.tests.test_resources:TestEntryPoints [x]\"\n assert str(ep) == expect", "metadata": "root.TestEntryPoints.assertfields", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 255 }, { "content": " def setup_method(self, method):\n self.dist = Distribution.from_filename(\n \"FooPkg-1.2-py2.4.egg\", metadata=Metadata(('requires.txt','[x]')))", "metadata": "root.TestEntryPoints.setup_method", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 264 }, { "content": " def testBasics(self):\n ep = EntryPoint(\n \"foo\", \"pkg_resources.tests.test_resources\", [\"TestEntryPoints\"],\n [\"x\"], self.dist\n )\n self.assertfields(ep)", "metadata": "root.TestEntryPoints.testBasics", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 268 }, { "content": " def testParse(self):\n s = \"foo = pkg_resources.tests.test_resources:TestEntryPoints [x]\"\n ep = EntryPoint.parse(s, self.dist)\n self.assertfields(ep)\n\n ep = EntryPoint.parse(\"bar baz= spammity[PING]\")\n assert ep.name == \"bar baz\"\n assert ep.module_name == \"spammity\"\n assert ep.attrs == ()\n assert ep.extras == (\"ping\",)\n\n ep = EntryPoint.parse(\" fizzly = wocka:foo\")\n assert ep.name == \"fizzly\"\n assert ep.module_name == \"wocka\"\n assert ep.attrs == (\"foo\",)\n assert ep.extras == ()\n\n # plus in the name\n spec = \"html+mako = mako.ext.pygmentplugin:MakoHtmlLexer\"\n ep = EntryPoint.parse(spec)\n assert ep.name == 'html+mako'", "metadata": "root.TestEntryPoints.testParse", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 275 }, { "content": " @pytest.mark.parametrize(\"reject_spec\", reject_specs)\n def test_reject_spec(self, reject_spec):\n with pytest.raises(ValueError):\n EntryPoint.parse(reject_spec)", "metadata": "root.TestEntryPoints.test_reject_spec", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 298 }, { "content": " def test_printable_name(self):\n \"\"\"\n Allow any printable character in the name.\n \"\"\"\n # Create a name with all printable characters; strip the whitespace.\n name = string.printable.strip()\n spec = \"{name} = module:attr\".format(**locals())\n ep = EntryPoint.parse(spec)\n assert ep.name == name", "metadata": "root.TestEntryPoints.test_printable_name", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 303 }, { "content": " def checkSubMap(self, m):\n assert len(m) == len(self.submap_expect)\n for key, ep in pkg_resources.iteritems(self.submap_expect):\n assert repr(m.get(key)) == repr(ep)", "metadata": "root.TestEntryPoints.checkSubMap", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 313 }, { "content": " def testParseList(self):\n self.checkSubMap(EntryPoint.parse_group(\"xyz\", self.submap_str))\n with pytest.raises(ValueError):\n EntryPoint.parse_group(\"x a\", \"foo=bar\")\n with pytest.raises(ValueError):\n EntryPoint.parse_group(\"x\", [\"foo=baz\", \"foo=bar\"])", "metadata": "root.TestEntryPoints.testParseList", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 330 }, { "content": " def testParseMap(self):\n m = EntryPoint.parse_map({'xyz':self.submap_str})\n self.checkSubMap(m['xyz'])\n assert list(m.keys()) == ['xyz']\n m = EntryPoint.parse_map(\"[xyz]\\n\"+self.submap_str)\n self.checkSubMap(m['xyz'])\n assert list(m.keys()) == ['xyz']\n with pytest.raises(ValueError):\n EntryPoint.parse_map([\"[xyz]\", \"[xyz]\"])\n with pytest.raises(ValueError):\n EntryPoint.parse_map(self.submap_str)", "metadata": "root.TestEntryPoints.testParseMap", "header": "['class', 'TestEntryPoints', ':', '___EOS___']", "index": 337 }, { "content": "class TestRequirements:\n\n\n\n\n\n", "metadata": "root.TestRequirements", "header": "['module', '___EOS___']", "index": 349 }, { "content": " def testBasics(self):\n r = Requirement.parse(\"Twisted>=1.2\")\n assert str(r) == \"Twisted>=1.2\"\n assert repr(r) == \"Requirement.parse('Twisted>=1.2')\"\n assert r == Requirement(\"Twisted\", [('>=','1.2')], ())\n assert r == Requirement(\"twisTed\", [('>=','1.2')], ())\n assert r != Requirement(\"Twisted\", [('>=','2.0')], ())\n assert r != Requirement(\"Zope\", [('>=','1.2')], ())\n assert r != Requirement(\"Zope\", [('>=','3.0')], ())\n assert r != Requirement.parse(\"Twisted[extras]>=1.2\")", "metadata": "root.TestRequirements.testBasics", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 351 }, { "content": " def testOrdering(self):\n r1 = Requirement(\"Twisted\", [('==','1.2c1'),('>=','1.2')], ())\n r2 = Requirement(\"Twisted\", [('>=','1.2'),('==','1.2c1')], ())\n assert r1 == r2\n assert str(r1) == str(r2)\n assert str(r2) == \"Twisted==1.2c1,>=1.2\"", "metadata": "root.TestRequirements.testOrdering", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 362 }, { "content": " def testBasicContains(self):\n r = Requirement(\"Twisted\", [('>=','1.2')], ())\n foo_dist = Distribution.from_filename(\"FooPkg-1.3_1.egg\")\n twist11 = Distribution.from_filename(\"Twisted-1.1.egg\")\n twist12 = Distribution.from_filename(\"Twisted-1.2.egg\")\n assert parse_version('1.2') in r\n assert parse_version('1.1') not in r\n assert '1.2' in r\n assert '1.1' not in r\n assert foo_dist not in r\n assert twist11 not in r\n assert twist12 in r", "metadata": "root.TestRequirements.testBasicContains", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 369 }, { "content": " def testOptionsAndHashing(self):\n r1 = Requirement.parse(\"Twisted[foo,bar]>=1.2\")\n r2 = Requirement.parse(\"Twisted[bar,FOO]>=1.2\")\n assert r1 == r2\n assert r1.extras == (\"foo\",\"bar\")\n assert r2.extras == (\"bar\",\"foo\") # extras are normalized\n assert hash(r1) == hash(r2)\n assert (\n hash(r1)\n ==\n hash((\n \"twisted\",\n packaging.specifiers.SpecifierSet(\">=1.2\"),\n frozenset([\"foo\",\"bar\"]),\n ))\n )", "metadata": "root.TestRequirements.testOptionsAndHashing", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 382 }, { "content": " def testVersionEquality(self):\n r1 = Requirement.parse(\"foo==0.3a2\")\n r2 = Requirement.parse(\"foo!=0.3a4\")\n d = Distribution.from_filename\n\n assert d(\"foo-0.3a4.egg\") not in r1\n assert d(\"foo-0.3a1.egg\") not in r1\n assert d(\"foo-0.3a4.egg\") not in r2\n\n assert d(\"foo-0.3a2.egg\") in r1\n assert d(\"foo-0.3a2.egg\") in r2\n assert d(\"foo-0.3a3.egg\") in r2\n assert d(\"foo-0.3a5.egg\") in r2", "metadata": "root.TestRequirements.testVersionEquality", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 399 }, { "content": " def testSetuptoolsProjectName(self):\n \"\"\"\n The setuptools project should implement the setuptools package.\n \"\"\"\n\n assert (\n Requirement.parse('setuptools').project_name == 'setuptools')\n # setuptools 0.7 and higher means setuptools.\n assert (\n Requirement.parse('setuptools == 0.7').project_name == 'setuptools')\n assert (\n Requirement.parse('setuptools == 0.7a1').project_name == 'setuptools')\n assert (\n Requirement.parse('setuptools >= 0.7').project_name == 'setuptools')", "metadata": "root.TestRequirements.testSetuptoolsProjectName", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 413 }, { "content": "class TestParsing:\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestParsing", "header": "['module', '___EOS___']", "index": 429 }, { "content": " def testEmptyParse(self):\n assert list(parse_requirements('')) == []", "metadata": "root.TestParsing.testEmptyParse", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 431 }, { "content": " def testYielding(self):\n for inp,out in [\n ([], []), ('x',['x']), ([[]],[]), (' x\\n y', ['x','y']),\n (['x\\n\\n','y'], ['x','y']),\n ]:\n assert list(pkg_resources.yield_lines(inp)) == out", "metadata": "root.TestParsing.testYielding", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 434 }, { "content": " def testSplitting(self):\n sample = \"\"\"\n x\n [Y]\n z\n\n a\n [b ]\n # foo\n c\n [ d]\n [q]\n v\n \"\"\"\n assert (\n list(pkg_resources.split_sections(sample))\n ==\n [\n (None, [\"x\"]),\n (\"Y\", [\"z\", \"a\"]),\n (\"b\", [\"c\"]),\n (\"d\", []),\n (\"q\", [\"v\"]),\n ]\n )\n with pytest.raises(ValueError):\n list(pkg_resources.split_sections(\"[foo\"))", "metadata": "root.TestParsing.testSplitting", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 441 }, { "content": " def testSafeName(self):\n assert safe_name(\"adns-python\") == \"adns-python\"\n assert safe_name(\"WSGI Utils\") == \"WSGI-Utils\"\n assert safe_name(\"WSGI Utils\") == \"WSGI-Utils\"\n assert safe_name(\"Money$$$Maker\") == \"Money-Maker\"\n assert safe_name(\"peak.web\") != \"peak-web\"", "metadata": "root.TestParsing.testSafeName", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 469 }, { "content": " def testSafeVersion(self):\n assert safe_version(\"1.2-1\") == \"1.2.post1\"\n assert safe_version(\"1.2 alpha\") == \"1.2.alpha\"\n assert safe_version(\"2.3.4 20050521\") == \"2.3.4.20050521\"\n assert safe_version(\"Money$$$Maker\") == \"Money-Maker\"\n assert safe_version(\"peak.web\") == \"peak.web\"", "metadata": "root.TestParsing.testSafeVersion", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 476 }, { "content": " def testSimpleRequirements(self):\n assert (\n list(parse_requirements('Twis-Ted>=1.2-1'))\n ==\n [Requirement('Twis-Ted',[('>=','1.2-1')], ())]\n )\n assert (\n list(parse_requirements('Twisted >=1.2, \\ # more\\n<2.0'))\n ==\n [Requirement('Twisted',[('>=','1.2'),('<','2.0')], ())]\n )\n assert (\n Requirement.parse(\"FooBar==1.99a3\")\n ==\n Requirement(\"FooBar\", [('==','1.99a3')], ())\n )\n with pytest.raises(ValueError):\n Requirement.parse(\">=2.3\")\n with pytest.raises(ValueError):\n Requirement.parse(\"x\\\\\")\n with pytest.raises(ValueError):\n Requirement.parse(\"x==2 q\")\n with pytest.raises(ValueError):\n Requirement.parse(\"X==1\\nY==2\")\n with pytest.raises(ValueError):\n Requirement.parse(\"#\")", "metadata": "root.TestParsing.testSimpleRequirements", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 483 }, { "content": " def testVersionEquality(self):\n def c(s1,s2):\n p1, p2 = parse_version(s1),parse_version(s2)\n assert p1 == p2, (s1,s2,p1,p2)\n\n c('1.2-rc1', '1.2rc1')\n c('0.4', '0.4.0')\n c('0.4.0.0', '0.4.0')\n c('0.4.0-0', '0.4-0')\n c('0post1', '0.0post1')\n c('0pre1', '0.0c1')\n c('0.0.0preview1', '0c1')\n c('0.0c1', '0-rc1')\n c('1.2a1', '1.2.a.1')\n c('1.2.a', '1.2a')", "metadata": "root.TestParsing.testVersionEquality", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 510 }, { "content": " def testVersionOrdering(self):\n def c(s1,s2):\n p1, p2 = parse_version(s1),parse_version(s2)\n assert p1<p2, (s1,s2,p1,p2)\n\n c('2.1','2.1.1')\n c('2a1','2b0')\n c('2a1','2.1')\n c('2.3a1', '2.3')\n c('2.1-1', '2.1-2')\n c('2.1-1', '2.1.1')\n c('2.1', '2.1post4')\n c('2.1a0-20040501', '2.1')\n c('1.1', '02.1')\n c('3.2', '3.2.post0')\n c('3.2post1', '3.2post2')\n c('0.4', '4.0')\n c('0.0.4', '0.4.0')\n c('0post1', '0.4post1')\n c('2.1.0-rc1','2.1.0')\n c('2.1dev','2.1a0')\n\n torture =\"\"\"\n 0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1\n 0.79.9999+0.80.0pre2-3 0.79.9999+0.80.0pre2-2\n 0.77.2-1 0.77.1-1 0.77.0-1\n \"\"\".split()\n\n for p,v1 in enumerate(torture):\n for v2 in torture[p+1:]:\n c(v2,v1)", "metadata": "root.TestParsing.testVersionOrdering", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 526 }, { "content": " def testVersionBuildout(self):\n \"\"\"\n Buildout has a function in it's bootstrap.py that inspected the return\n value of parse_version. The new parse_version returns a Version class\n which needs to support this behavior, at least for now.\n \"\"\"\n def buildout(parsed_version):\n _final_parts = '*final-', '*final'\n\n def _final_version(parsed_version):\n for part in parsed_version:\n if (part[:1] == '*') and (part not in _final_parts):\n return False\n return True\n return _final_version(parsed_version)\n\n assert buildout(parse_version(\"1.0\"))\n assert not buildout(parse_version(\"1.0a1\"))", "metadata": "root.TestParsing.testVersionBuildout", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 558 }, { "content": " def testVersionIndexable(self):\n \"\"\"\n Some projects were doing things like parse_version(\"v\")[0], so we'll\n support indexing the same as we support iterating.\n \"\"\"\n assert parse_version(\"1.0\")[0] == \"00000001\"", "metadata": "root.TestParsing.testVersionIndexable", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 577 }, { "content": " def testVersionTupleSort(self):\n \"\"\"\n Some projects expected to be able to sort tuples against the return\n value of parse_version. So again we'll add a warning enabled shim to\n make this possible.\n \"\"\"\n assert parse_version(\"1.0\") < tuple(parse_version(\"2.0\"))\n assert parse_version(\"1.0\") <= tuple(parse_version(\"2.0\"))\n assert parse_version(\"1.0\") == tuple(parse_version(\"1.0\"))\n assert parse_version(\"3.0\") > tuple(parse_version(\"2.0\"))\n assert parse_version(\"3.0\") >= tuple(parse_version(\"2.0\"))\n assert parse_version(\"3.0\") != tuple(parse_version(\"2.0\"))\n assert not (parse_version(\"3.0\") != tuple(parse_version(\"3.0\")))", "metadata": "root.TestParsing.testVersionTupleSort", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 584 }, { "content": " def testVersionHashable(self):\n \"\"\"\n Ensure that our versions stay hashable even though we've subclassed\n them and added some shim code to them.\n \"\"\"\n assert (\n hash(parse_version(\"1.0\"))\n ==\n hash(parse_version(\"1.0\"))\n )", "metadata": "root.TestParsing.testVersionHashable", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 598 }, { "content": "class TestNamespaces:\n\n\n", "metadata": "root.TestNamespaces", "header": "['module', '___EOS___']", "index": 610 }, { "content": " def setup_method(self, method):\n self._ns_pkgs = pkg_resources._namespace_packages.copy()\n self._tmpdir = tempfile.mkdtemp(prefix=\"tests-setuptools-\")\n os.makedirs(os.path.join(self._tmpdir, \"site-pkgs\"))\n self._prev_sys_path = sys.path[:]\n sys.path.append(os.path.join(self._tmpdir, \"site-pkgs\"))", "metadata": "root.TestNamespaces.setup_method", "header": "['class', 'TestNamespaces', ':', '___EOS___']", "index": 612 }, { "content": " def teardown_method(self, method):\n shutil.rmtree(self._tmpdir)\n pkg_resources._namespace_packages = self._ns_pkgs.copy()\n sys.path = self._prev_sys_path[:]", "metadata": "root.TestNamespaces.teardown_method", "header": "['class', 'TestNamespaces', ':', '___EOS___']", "index": 619 }, { "content": " @pytest.mark.skipif(os.path.islink(tempfile.gettempdir()),\n reason=\"Test fails when /tmp is a symlink. See #231\")\n def test_two_levels_deep(self):\n \"\"\"\n Test nested namespace packages\n Create namespace packages in the following tree :\n site-packages-1/pkg1/pkg2\n site-packages-2/pkg1/pkg2\n Check both are in the _namespace_packages dict and that their __path__\n is correct\n \"\"\"\n sys.path.append(os.path.join(self._tmpdir, \"site-pkgs2\"))\n os.makedirs(os.path.join(self._tmpdir, \"site-pkgs\", \"pkg1\", \"pkg2\"))\n os.makedirs(os.path.join(self._tmpdir, \"site-pkgs2\", \"pkg1\", \"pkg2\"))\n ns_str = \"__import__('pkg_resources').declare_namespace(__name__)\\n\"\n for site in [\"site-pkgs\", \"site-pkgs2\"]:\n pkg1_init = open(os.path.join(self._tmpdir, site,\n \"pkg1\", \"__init__.py\"), \"w\")\n pkg1_init.write(ns_str)\n pkg1_init.close()\n pkg2_init = open(os.path.join(self._tmpdir, site,\n \"pkg1\", \"pkg2\", \"__init__.py\"), \"w\")\n pkg2_init.write(ns_str)\n pkg2_init.close()\n import pkg1\n assert \"pkg1\" in pkg_resources._namespace_packages\n # attempt to import pkg2 from site-pkgs2\n import pkg1.pkg2\n # check the _namespace_packages dict\n assert \"pkg1.pkg2\" in pkg_resources._namespace_packages\n assert pkg_resources._namespace_packages[\"pkg1\"] == [\"pkg1.pkg2\"]\n # check the __path__ attribute contains both paths\n expected = [\n os.path.join(self._tmpdir, \"site-pkgs\", \"pkg1\", \"pkg2\"),\n os.path.join(self._tmpdir, \"site-pkgs2\", \"pkg1\", \"pkg2\"),\n ]\n assert pkg1.pkg2.__path__ == expected", "metadata": "root.TestNamespaces.test_two_levels_deep", "header": "['class', 'TestNamespaces', ':', '___EOS___']", "index": 624 } ]
[]
[]
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_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pkg", "\\u", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pkg", "\\u", "resources_", "import_", "(_", "parse", "\\u", "requirements_", ",_", "Version", "Conflict_", ",_", "parse", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Distribution_", ",_", "Entr", "y", "Point_", ",_", "Requirement", "_", ",_", "safe", "\\u", "version_", ",_", "safe", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Work", "ing", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "packaging", "_", "=_", "pkg", "\\u", "resources_", "._", "packaging", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "dist", "\\u", "from", "\\u", "fn_", "=_", "pkg", "\\u", "resources_", "._", "Distribution_", "._", "from", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "safe", "\\u", "repr_", "(_", "obj_", ",_", "short_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "copie", "d", " ", "from", " ", "Pyth", "on2", ".7", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "repr_", "(_", "obj_", ")_", "\\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 ", " _", "result_", "=_", "object_", "._", "\\u\\u", "repr\\u\\u_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "short_", "or_", "len_", "(_", "result_", ")_", "<_", "pkg", "\\u", "resources_", "._", "\\u", "MAX", "\\u", "LENGTH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", ":_", "pkg", "\\u", "resources_", "._", "\\u", "MAX", "\\u", "LENGTH_", "]_", "+_", "'", " ", "[", "truncat", "ed", "].", "..'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Metadata_", "(_", "pkg", "\\u", "resources_", "._", "Emp", "ty", "Provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Moc", "k", " ", "object", " ", "to", " ", "return", " ", "metadata", " ", "as", " ", "if", " ", "from", " ", "an", " ", "on", "-", "disk", " ", "distribu", "tion", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Metadata_", "(_", "pkg", "\\u", "resources_", "._", "Emp", "ty", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "pairs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metadata_", "=_", "dict_", "(_", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Metadata_", "(_", "pkg", "\\u", "resources_", "._", "Emp", "ty", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "metadata_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "in_", "self_", "._", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Metadata_", "(_", "pkg", "\\u", "resources_", "._", "Emp", "ty", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "metadata_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "metadata_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Metadata_", "(_", "pkg", "\\u", "resources_", "._", "Emp", "ty", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "metadata", "\\u", "lines_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pkg", "\\u", "resources_", "._", "yield", "\\u", "lines_", "(_", "self_", "._", "get", "\\u", "metadata_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Collection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "empty", " ", "path", " ", "shou", "ld", " ", "produce", " ", "no", " ", "distributions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ad_", "=_", "pkg", "\\u", "resources_", "._", "Environment_", "(_", "[_", "]_", ",_", "platform_", "=_", "None_", ",_", "python_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "ad_", ")_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".3", "\\u", "1.e", "gg", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".4", "-", "py2", ".4", "-", "win32", ".", "egg", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".2", "-", "py2", ".4", ".", "egg", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", " ", "is", " ", "in", " ", "there", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bu", "t", " ", "only", " ", "1", " ", "package_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "list_", "(_", "ad_", ")_", "==_", "[_", "'", "foo", "pkg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ion", "s", " ", "sort", " ", "by", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "[_", "dist_", "._", "version_", "for_", "dist_", "in_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "]_", "==_", "[_", "'", "1.4", "'_", ",_", "'", "1.3", "-1", "'_", ",_", "'", "1.2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "a", " ", "distribu", "tion", " ", "lea", "ves", " ", "sequence", " ", "alo", "ne_", "\\u\\u\\uNL\\u\\u\\u_", "ad_", "._", "remove_", "(_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "[_", "dist_", "._", "version_", "for_", "dist_", "in_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "]_", "==_", "[_", "'", "1.4", "'_", ",_", "'", "1.2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "insert", "ing", " ", "adds", " ", "them", " ", "in", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "ad_", "._", "add_", "(_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".9", ".", "egg", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "[_", "dist_", "._", "version_", "for_", "dist_", "in_", "ad_", "[_", "'", "Foo", "Pk", "g", "'_", "]_", "]_", "==_", "[_", "'", "1.9", "'_", ",_", "'", "1.4", "'_", ",_", "'", "1.2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "12_", "=_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".2", "-", "py2", ".4", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "14_", "=_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".4", "-", "py2", ".4", "-", "win32", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", ",_", "=_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "Pk", "g", ">=", "1.3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nomi", "nal", " ", "case", ":", " ", "no", " ", "distr", "os", " ", "on", " ", "path", ",", " ", "shou", "ld", " ", "yield", " ", "all", " ", "applica", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ad_", "._", "best", "\\u", "match_", "(_", "req_", ",_", "ws_", ")_", "._", "version_", "==_", "'", "1.9", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "matchi", "ng", " ", "distr", "o", " ", "is", " ", "alr", "ead", "y", " ", "install", "ed", ",", " ", "shou", "ld", " ", "return", " ", "only", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ad_", "._", "best", "\\u", "match_", "(_", "req_", ",_", "ws_", ")_", "._", "version_", "==_", "'", "1.4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "first", " ", "matchi", "ng", " ", "distr", "o", " ", "is", " ", "uns", "uit", "able", ",", " ", "it", "'", "s", " ", "a", " ", "version", " ", "conflict_", "\\u\\u\\uNL\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Version", "Conflict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ad_", "._", "best", "\\u", "match_", "(_", "req_", ",_", "ws_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "more", " ", "than", " ", "one", " ", "match", " ", "on", " ", "the", " ", "path", ",", " ", "the", " ", "first", " ", "one", " ", "take", "s", " ", "preceden", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "foo", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ad_", "._", "best", "\\u", "match_", "(_", "req_", ",_", "ws_", ")_", "._", "version_", "==_", "'", "1.4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Foo", "Pk", "g_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "d_", "._", "project", "\\u", "name_", "==_", "\"", "Foo", "Pk", "g", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "key_", "==_", "\"", "foo", "pkg", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "version_", "==_", "\"", "1.3", ".", "post", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "py", "\\u", "version_", "==_", "\"", "2.4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "platform_", "==_", "\"", "win32", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "parsed", "\\u", "version_", "==_", "parse", "\\u", "version_", "(_", "\"", "1.3", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Basic", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Distribution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "some", "/", "path", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "name_", "=_", "\"", "Foo", "Pk", "g", "\"_", ",_", "version_", "=_", "\"", "1.3", "-1", "\"_", ",_", "py", "\\u", "version_", "=_", "\"", "2.4", "\"_", ",_", "platform_", "=_", "\"", "win32", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Foo", "Pk", "g_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Distribution_", "(_", "\"/", "some", "/", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "py", "\\u", "version_", "==_", "sys_", "._", "version_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "platform_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".3", ".", "post", "1", "-", "py2", ".4", "-", "win32", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Foo", "Pk", "g_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "dist", "\\u", "from", "\\u", "fn_", "(_", "\"", "Foo", "Pk", "g", "-1", ".3", ".", "post", "1", "-", "py2", ".4", "-", "win32", ".", "egg", "-", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Foo", "Pk", "g_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Distribution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "some", "/", "path", "\"_", ",_", "project", "\\u", "name_", "=_", "\"", "Foo", "Pk", "g", "\"_", ",_", "py", "\\u", "version_", "=_", "\"", "2.4", "\"_", ",_", "platform_", "=_", "\"", "win32", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "Metadata_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "PKG", "-", "INFO", "'_", ",_", "\"", "Meta", "data", "-", "Version", ":", " ", "1.0", "\\\\", "n", "Version", ":", " ", "1.3", "-1", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Foo", "Pk", "g_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dist", "Requ", "ires", "_", "(_", "self_", ",_", "txt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Distribution_", "(_", "\"/", "foo", "\"_", ",_", "metadata_", "=_", "Metadata_", "(_", "(_", "'", "depend", "s", ".", "txt", "'_", ",_", "txt_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Requ", "ires", "_", "(_", "self_", ",_", "dist_", ",_", "txt_", ",_", "extras_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "list_", "(_", "dist_", "._", "requires_", "(_", "extras_", ")_", ")_", "==_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "txt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Depend", "s", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v_", "in_", "\"", "Twi", "sted", ">=", "1.5", "\"_", ",_", "\"", "Twi", "sted", ">=", "1.5", "\\\\", "n", "ZC", "onfi", "g", ">=", "2.0", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "Requ", "ires", "_", "(_", "self_", "._", "dist", "Requ", "ires", "_", "(_", "v_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\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", "Resolv", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ad_", "=_", "pkg", "\\u", "resources_", "._", "Environment_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Resolv", "ing", " ", "no", " ", "require", "ment", "s", " ", "->", " ", "not", "hing", " ", "to", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "list_", "(_", "ws_", "._", "resolve_", "(_", "[_", "]_", ",_", "ad_", ")_", ")_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Request", " ", "somet", "hing", " ", "not", " ", "in", " ", "the", " ", "collection", " ", "->", " ", "Distribut", "ion", "Not", "Found_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "pkg", "\\u", "resources_", "._", "Distribut", "ion", "Not", "Found_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "\"_", ")_", ",_", "ad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Foo_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "foo", "\\u", "dir", "/", "Foo", "-1", ".2", ".", "egg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "Metadata_", "(_", "(_", "'", "depend", "s", ".", "txt", "'_", ",_", "\"[", "bar", "]\\\\", "n", "Baz", ">=", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "Foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Foo", "-0", ".9", ".", "egg", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "thing", "(", "s", ")", " ", "tha", "t", " ", "are", " ", "avail", "able", " ", "->", " ", "list", " ", "to", " ", "activate_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "targets_", "=_", "list_", "(_", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "\"_", ")_", ",_", "ad_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "targets_", "==_", "[_", "Foo_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "(_", "map_", "(_", "ws_", "._", "add_", ",_", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Version", "Conflict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "==", "0.", "9", "\"_", ")_", ",_", "ad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "#", " ", "reset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "an", " ", "extra", " ", "tha", "t", " ", "caus", "es", " ", "an", " ", "unresolv", "ed", " ", "dependen", "cy", " ", "for", " ", "\"", "Baz", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "pkg", "\\u", "resources_", "._", "Distribut", "ion", "Not", "Found_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "[", "bar", "]\"_", ")_", ",_", "ad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Baz", "_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "foo", "\\u", "dir", "/", "Baz", "-", "2.1", ".", "egg", "\"_", ",_", "metadata_", "=_", "Metadata_", "(_", "(_", "'", "depend", "s", ".", "txt", "'_", ",_", "\"", "Foo", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ad_", "._", "add_", "(_", "Baz", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Activat", "ion", " ", "list", " ", "now", " ", "include", "s", " ", "resolve", "d", " ", "dependency_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "list_", "(_", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "[", "bar", "]\"_", ")_", ",_", "ad_", ")_", ")_", "==_", "[_", "Foo_", ",_", "Baz", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Request", "s", " ", "for", " ", "conflicting", " ", "version", "s", " ", "produce", " ", "Version", "Conflict_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Version", "Conflict_", ")_", "as_", "vc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "==", "1.2", "\\\\", "n", "Foo", "!=", "1.2", "\"_", ")_", ",_", "ad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "'", "Foo", " ", "0.", "9", " ", "is", " ", "install", "ed", " ", "but", " ", "Foo", "==", "1.2", " ", "is", " ", "require", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "vc_", "._", "value_", "._", "report_", "(_", ")_", "==_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Depend", "s", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "dist", "Requ", "ires", "_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Twi", "sted", ">=", "1.5", "\\", "10", ";", " ", " ", " ", " ", "[", "doc", "gen", "]", "\\", "10", ";", " ", " ", " ", " ", "ZC", "onfi", "g", ">=", "2.0", "\\", "10", ";", " ", " ", " ", " ", "docu", "til", "s", ">=", "0.", "3", "\\", "10", ";", " ", " ", " ", " ", "[", "fast", "cgi", "]", "\\", "10", ";", " ", " ", " ", " ", "fc", "gia", "pp", ">=", "0.", "1", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Requ", "ires", "_", "(_", "d_", ",_", "\"", "Twi", "sted", ">=", "1.5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Requ", "ires", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "d_", ",_", "\"", "Twi", "sted", ">=", "1.5", " ", "ZC", "onfi", "g", ">=", "2.0", " ", "docu", "til", "s", ">=", "0.", "3", "\"_", "._", "split_", "(_", ")_", ",_", "[_", "\"", "doc", "gen", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Requ", "ires", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "d_", ",_", "\"", "Twi", "sted", ">=", "1.5", " ", "fc", "gia", "pp", ">=", "0.", "1", "\"_", "._", "split_", "(_", ")_", ",_", "[_", "\"", "fast", "cgi", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Requ", "ires", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "d_", ",_", "\"", "Twi", "sted", ">=", "1.5", " ", "ZC", "onfi", "g", ">=", "2.0", " ", "docu", "til", "s", ">=", "0.", "3", " ", "fc", "gia", "pp", ">=", "0.", "1", "\"_", "._", "split_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "doc", "gen", "\"_", ",_", "\"", "fast", "cgi", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Requ", "ires", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "d_", ",_", "\"", "Twi", "sted", ">=", "1.5", " ", "fc", "gia", "pp", ">=", "0.", "1", " ", "ZC", "onfi", "g", ">=", "2.0", " ", "docu", "til", "s", ">=", "0.", "3", "\"_", "._", "split_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "fast", "cgi", "\"_", ",_", "\"", "doc", "gen", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "pkg", "\\u", "resources_", "._", "Un", "know", "n", "Extra", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "requires_", "(_", "[_", "\"", "foo", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Test", "Work", "ing", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Work", "ing", "Set_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "find", "\\u", "conflicting", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Foo_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"/", "foo", "\\u", "dir", "/", "Foo", "-1", ".2", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "Foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "require", "ment", " ", "tha", "t", " ", "confl", "icts", " ", "with", " ", "Foo", " ", "1.2_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "next_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "<", "1.2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Version", "Conflict_", ")_", "as_", "vc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "find_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "'", "Foo", " ", "1.2", " ", "is", " ", "install", "ed", " ", "but", " ", "Foo", "<", "1.2", " ", "is", " ", "require", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "vc_", "._", "value_", "._", "report_", "(_", ")_", "==_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Work", "ing", "Set_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "resolve", "\\u", "confl", "icts", "\\u", "with", "\\u", "prior_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Context", "ual", "Version", "Confl", "ict", " ", "shou", "ld", " ", "be", " ", "raise", "d", " ", "whe", "n", " ", "a", " ", "require", "ment", "\\", "10", ";", " ", " ", " ", " ", "confl", "icts", " ", "with", " ", "a", " ", "prior", " ", "require", "ment", " ", "for", " ", "a", " ", "different", " ", "package", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "installation", " ", "where", " ", "Foo", " ", "depend", "s", " ", "on", " ", "Baz", " ", "1.0", " ", "and", " ", "Bar", " ", "depend", "s", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Baz", " ", "2.0", "._", "\\u\\u\\uNL\\u\\u\\u_", "ws_", "=_", "Work", "ing", "Set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "Metadata_", "(_", "(_", "'", "depend", "s", ".", "txt", "'_", ",_", "\"", "Baz", "==", "1.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Foo_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"/", "foo", "\\u", "dir", "/", "Foo", "-1", ".0", ".", "egg", "\"_", ",_", "metadata_", "=_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "Foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "Metadata_", "(_", "(_", "'", "depend", "s", ".", "txt", "'_", ",_", "\"", "Baz", "==", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Bar_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"/", "foo", "\\u", "dir", "/", "Bar", "-1", ".0", ".", "egg", "\"_", ",_", "metadata_", "=_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "Bar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Baz", "_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"/", "foo", "\\u", "dir", "/", "Baz", "-1", ".0", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "Baz", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Baz", "_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"/", "foo", "\\u", "dir", "/", "Baz", "-", "2.0", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "add_", "(_", "Baz", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Version", "Conflict_", ")_", "as_", "vc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "resolve_", "(_", "parse", "\\u", "requirements_", "(_", "\"", "Foo", "\\\\", "n", "Bar", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "\"", "Baz", " ", "1.0", " ", "is", " ", "install", "ed", " ", "but", " ", "Baz", "==", "2.0", " ", "is", " ", "require", "d", " ", "by", " ", "{", "'", "Bar", "'}", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pkg", "\\u", "resources_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "msg_", "._", "replace_", "(_", "\"{", "'", "Bar", "'}", "\"_", ",_", "\"", "set", "([", "'", "Bar", "'])", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "vc_", "._", "value_", "._", "report_", "(_", ")_", "==_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "reject", "\\u", "specs_", "=_", "\"", "foo", "\"_", ",_", "\"", "x", "=", "a", ":", "b", ":", "c", "\"_", ",_", "\"", "q", "=", "x", "/", "na", "\"_", ",_", "\"", "fe", "z", "=", "pis", "h", ":", "tus", "h", "-", "z", "\"_", ",_", "\"", "x", "=", "f", "[", "a", "]>", "2", "\"_", "\\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_", "subma", "p", "\\u", "expect_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "1_", "=_", "Entr", "y", "Point_", "(_", "'", "feature", "1", "'_", ",_", "'", "some", "module", "'_", ",_", "[_", "'", "some", "function", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "2_", "=_", "Entr", "y", "Point_", "(_", "'", "feature", "2", "'_", ",_", "'", "anot", "her", ".", "module", "'_", ",_", "[_", "'", "Some", "Class", "'_", "]_", ",_", "[_", "'", "extra", "1", "'_", ",_", "'", "extra", "2", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "3_", "=_", "Entr", "y", "Point_", "(_", "'", "feature", "3", "'_", ",_", "'", "this", ".", "module", "'_", ",_", "extras_", "=_", "[_", "'", "somet", "hing", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subma", "p", "\\u", "str_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "defin", "e", " ", "features", " ", "for", " ", "bla", "h", " ", "bla", "h", "\\", "10", ";", " ", " ", " ", " ", "feature", "1", " ", "=", " ", "some", "module", ":", "some", "function", "\\", "10", ";", " ", " ", " ", " ", "feature", "2", " ", "=", " ", "anot", "her", ".", "module", ":", "Some", "Class", " ", "[", "extra", "1", ",", "extra", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "feature", "3", " ", "=", " ", "this", ".", "module", " ", "[", "somet", "hing", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "fields_", "(_", "self_", ",_", "ep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ep_", "._", "name_", "==_", "\"", "foo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "module", "\\u", "name_", "==_", "\"", "pkg", "\\u", "resource", "s", ".", "tests", ".", "test\\u", "resource", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "attrs_", "==_", "(_", "\"", "Test", "Entr", "y", "Point", "s", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "extras_", "==_", "(_", "\"", "x", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "load_", "(_", ")_", "is_", "Test", "Entr", "y", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "\"", "foo", " ", "=", " ", "pkg", "\\u", "resource", "s", ".", "tests", ".", "test\\u", "resource", "s", ":", "Test", "Entr", "y", "Point", "s", " ", "[", "x", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "ep_", ")_", "==_", "expect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dist_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Pk", "g", "-1", ".2", "-", "py2", ".4", ".", "egg", "\"_", ",_", "metadata_", "=_", "Metadata_", "(_", "(_", "'", "require", "s", ".", "txt", "'_", ",_", "'[", "x", "]'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Basic", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ep_", "=_", "Entr", "y", "Point_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "\"_", ",_", "\"", "pkg", "\\u", "resource", "s", ".", "tests", ".", "test\\u", "resource", "s", "\"_", ",_", "[_", "\"", "Test", "Entr", "y", "Point", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "x", "\"_", "]_", ",_", "self_", "._", "dist_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "fields_", "(_", "ep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"", "foo", " ", "=", " ", "pkg", "\\u", "resource", "s", ".", "tests", ".", "test\\u", "resource", "s", ":", "Test", "Entr", "y", "Point", "s", " ", "[", "x", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "Entr", "y", "Point_", "._", "parse_", "(_", "s_", ",_", "self_", "._", "dist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "fields_", "(_", "ep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ep_", "=_", "Entr", "y", "Point_", "._", "parse_", "(_", "\"", "bar", " ", "ba", "z", "=", " ", " ", "spam", "mit", "y", "[", "PING", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "name_", "==_", "\"", "bar", " ", "ba", "z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "module", "\\u", "name_", "==_", "\"", "spam", "mit", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "attrs_", "==_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "extras_", "==_", "(_", "\"", "ping", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ep_", "=_", "Entr", "y", "Point_", "._", "parse_", "(_", "\"", " ", "fi", "zz", "ly", " ", "=", " ", " ", "wo", "ck", "a", ":", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "name_", "==_", "\"", "fi", "zz", "ly", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "module", "\\u", "name_", "==_", "\"", "wo", "ck", "a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "attrs_", "==_", "(_", "\"", "foo", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "extras_", "==_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plus", " ", "in", " ", "the", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "\"", "html", "+", "mak", "o", " ", "=", " ", "mak", "o", ".", "ext", ".", "pyg", "ment", "plugin", ":", "Ma", "ko", "Ht", "ml", "Lex", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "Entr", "y", "Point_", "._", "parse_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "name_", "==_", "'", "html", "+", "mak", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "\"", "reject", "\\u", "spec", "\"_", ",_", "reject", "\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "reject", "\\u", "spec_", "(_", "self_", ",_", "reject", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "Point_", "._", "parse_", "(_", "reject", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\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", "printable", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", " ", "any", " ", "printable", " ", "character", " ", "in", " ", "the", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "name", " ", "with", " ", "all", " ", "printable", " ", "character", "s", ";", " ", "strip", " ", "the", " ", "whitespace", "._", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "string_", "._", "printable", "_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "\"{", "name", "}", " ", "=", " ", "module", ":", "attr", "\"_", "._", "format_", "(_", "**_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "Entr", "y", "Point_", "._", "parse_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ep_", "._", "name_", "==_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Sub", "Map_", "(_", "self_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "m_", ")_", "==_", "len_", "(_", "self_", "._", "subma", "p", "\\u", "expect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "ep_", "in_", "pkg", "\\u", "resources_", "._", "iteritems_", "(_", "self_", "._", "subma", "p", "\\u", "expect_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "repr_", "(_", "m_", "._", "get_", "(_", "key_", ")_", ")_", "==_", "repr_", "(_", "ep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Pars", "e", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "Sub", "Map_", "(_", "Entr", "y", "Point_", "._", "parse", "\\u", "group_", "(_", "\"", "xyz", "\"_", ",_", "self_", "._", "subma", "p", "\\u", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "Point_", "._", "parse", "\\u", "group_", "(_", "\"", "x", " ", "a", "\"_", ",_", "\"", "foo", "=", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "Point_", "._", "parse", "\\u", "group_", "(_", "\"", "x", "\"_", ",_", "[_", "\"", "foo", "=", "ba", "z", "\"_", ",_", "\"", "foo", "=", "bar", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Entr", "y", "Points_", ":_", "\\u\\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", "Pars", "e", "Map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Entr", "y", "Point_", "._", "parse", "\\u", "map_", "(_", "{_", "'", "xyz", "'_", ":_", "self_", "._", "subma", "p", "\\u", "str_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Sub", "Map_", "(_", "m_", "[_", "'", "xyz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "m_", "._", "keys_", "(_", ")_", ")_", "==_", "[_", "'", "xyz", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Entr", "y", "Point_", "._", "parse", "\\u", "map_", "(_", "\"[", "xyz", "]\\\\", "n", "\"_", "+_", "self_", "._", "subma", "p", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Sub", "Map_", "(_", "m_", "[_", "'", "xyz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "m_", "._", "keys_", "(_", ")_", ")_", "==_", "[_", "'", "xyz", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "Point_", "._", "parse", "\\u", "map_", "(_", "[_", "\"[", "xyz", "]\"_", ",_", "\"[", "xyz", "]\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "Point_", "._", "parse", "\\u", "map_", "(_", "self_", "._", "subma", "p", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Basic", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "Requirement", "_", "._", "parse_", "(_", "\"", "Twi", "sted", ">=", "1.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "r_", ")_", "==_", "\"", "Twi", "sted", ">=", "1.2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "repr_", "(_", "r_", ")_", "==_", "\"", "Requirement", ".", "parse", "('", "Twi", "sted", ">=", "1.2", "')\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "==_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "==_", "Requirement", "_", "(_", "\"", "twi", "s", "Te", "d", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "!=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "2.0", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "!=_", "Requirement", "_", "(_", "\"", "Zo", "pe", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "!=_", "Requirement", "_", "(_", "\"", "Zo", "pe", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "3.0", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r_", "!=_", "Requirement", "_", "._", "parse_", "(_", "\"", "Twi", "sted", "[", "extra", "s", "]>", "=", "1.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Order", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r1_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'=='_", ",_", "'", "1.2", "c1", "'_", ")_", ",_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", ",_", "(_", "'=='_", ",_", "'", "1.2", "c1", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "==_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "r1_", ")_", "==_", "str_", "(_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "r2_", ")_", "==_", "\"", "Twi", "sted", "==", "1.2", "c1", ",", ">=", "1.2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Basic", "Contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "dist_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Foo", "Pk", "g", "-1", ".3", "\\u", "1.e", "gg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twist", "11_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Twi", "sted", "-1", ".1", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twist", "12_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Twi", "sted", "-1", ".2", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "'", "1.2", "'_", ")_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "'", "1.1", "'_", ")_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "1.2", "'_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "1.1", "'_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "foo", "\\u", "dist_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "twist", "11_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "twist", "12_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Optio", "ns", "And", "Hash", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r1_", "=_", "Requirement", "_", "._", "parse_", "(_", "\"", "Twi", "sted", "[", "foo", ",", "bar", "]>", "=", "1.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "Requirement", "_", "._", "parse_", "(_", "\"", "Twi", "sted", "[", "bar", ",", "FOO", "]>", "=", "1.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "==_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "._", "extras_", "==_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r2_", "._", "extras_", "==_", "(_", "\"", "bar", "\"_", ",_", "\"", "foo", "\"_", ")_", "#", " ", "extra", "s", " ", "are", " ", "normalized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "hash_", "(_", "r1_", ")_", "==_", "hash_", "(_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hash_", "(_", "r1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "hash_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twist", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packaging", "_", "._", "specifier", "s_", "._", "Specifie", "r", "Set_", "(_", "\">", "=", "1.2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frozenset_", "(_", "[_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Equali", "ty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r1_", "=_", "Requirement", "_", "._", "parse_", "(_", "\"", "foo", "==", "0.", "3a", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "Requirement", "_", "._", "parse_", "(_", "\"", "foo", "!=", "0.", "3a", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a4", ".", "egg", "\"_", ")_", "not_", "in_", "r1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a1", ".", "egg", "\"_", ")_", "not_", "in_", "r1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a4", ".", "egg", "\"_", ")_", "not_", "in_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a2", ".", "egg", "\"_", ")_", "in_", "r1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a2", ".", "egg", "\"_", ")_", "in_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a3", ".", "egg", "\"_", ")_", "in_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "(_", "\"", "foo", "-0", ".3", "a5", ".", "egg", "\"_", ")_", "in_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Set", "upto", "ols", "Project", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "setup", "tool", "s", " ", "project", " ", "shou", "ld", " ", "implement", " ", "the", " ", "setup", "tool", "s", " ", "package", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "'", "setup", "tool", "s", "'_", ")_", "._", "project", "\\u", "name_", "==_", "'", "setup", "tool", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "setup", "tool", "s", " ", "0.", "7", " ", "and", " ", "higher", " ", "means", " ", "setup", "tool", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "'", "setup", "tool", "s", " ", "==", " ", "0.", "7", "'_", ")_", "._", "project", "\\u", "name_", "==_", "'", "setup", "tool", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "'", "setup", "tool", "s", " ", "==", " ", "0.", "7a", "1", "'_", ")_", "._", "project", "\\u", "name_", "==_", "'", "setup", "tool", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "'", "setup", "tool", "s", " ", ">=", " ", "0.", "7", "'_", ")_", "._", "project", "\\u", "name_", "==_", "'", "setup", "tool", "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_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Emp", "ty", "Parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "''_", ")_", ")_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Yi", "eld", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inp_", ",_", "out_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "]_", ",_", "[_", "]_", ")_", ",_", "(_", "'", "x", "'_", ",_", "[_", "'", "x", "'_", "]_", ")_", ",_", "(_", "[_", "[_", "]_", "]_", ",_", "[_", "]_", ")_", ",_", "(_", "'", " ", "x", "\\\\", "n", " ", "y", "'_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "x", "\\\\", "n", "\\\\", "n", "'_", ",_", "'", "y", "'_", "]_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "list_", "(_", "pkg", "\\u", "resources_", "._", "yield", "\\u", "lines_", "(_", "inp_", ")_", ")_", "==_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\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", "Split", "ting_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", "x", "\\", "10", ";", " ", " ", "[", "Y", "]", "\\", "10", ";", " ", " ", "z", "\\", "10", ";", "\\", "10", ";", " ", " ", "a", "\\", "10", ";", " ", " ", "[", "b", " ", "]", "\\", "10", ";", " ", " ", "#", " ", "foo", "\\", "10", ";", " ", " ", "c", "\\", "10", ";", " ", " ", "[", " ", "d", "]", "\\", "10", ";", " ", " ", "[", "q", "]", "\\", "10", ";", " ", " ", "v", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "pkg", "\\u", "resources_", "._", "split", "\\u", "sections_", "(_", "sample_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "[_", "\"", "x", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Y", "\"_", ",_", "[_", "\"", "z", "\"_", ",_", "\"", "a", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "b", "\"_", ",_", "[_", "\"", "c", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "d", "\"_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "q", "\"_", ",_", "[_", "\"", "v", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "(_", "pkg", "\\u", "resources_", "._", "split", "\\u", "sections_", "(_", "\"[", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\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", "Safe", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "safe", "\\u", "name_", "(_", "\"", "ad", "ns", "-", "python", "\"_", ")_", "==_", "\"", "ad", "ns", "-", "python", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "name_", "(_", "\"", "WS", "GI", " ", "Ut", "il", "s", "\"_", ")_", "==_", "\"", "WS", "GI", "-", "Ut", "il", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "name_", "(_", "\"", "WS", "GI", " ", " ", "Ut", "il", "s", "\"_", ")_", "==_", "\"", "WS", "GI", "-", "Ut", "il", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "name_", "(_", "\"", "Mone", "y", "$$", "$", "Make", "r", "\"_", ")_", "==_", "\"", "Mone", "y", "-", "Make", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "name_", "(_", "\"", "peak", ".", "web", "\"_", ")_", "!=_", "\"", "peak", "-", "web", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Safe", "Version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "safe", "\\u", "version_", "(_", "\"", "1.2", "-1", "\"_", ")_", "==_", "\"", "1.2", ".", "post", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "version_", "(_", "\"", "1.2", " ", "alpha", "\"_", ")_", "==_", "\"", "1.2", ".", "alpha", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "version_", "(_", "\"", "2.3", ".4", " ", "2005", "052", "1", "\"_", ")_", "==_", "\"", "2.3", ".4", ".2", "0050", "521", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "version_", "(_", "\"", "Mone", "y", "$$", "$", "Make", "r", "\"_", ")_", "==_", "\"", "Mone", "y", "-", "Make", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "safe", "\\u", "version_", "(_", "\"", "peak", ".", "web", "\"_", ")_", "==_", "\"", "peak", ".", "web", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Simple", "Requirements", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "'", "Twi", "s", "-", "Te", "d", ">=", "1.2", "-1", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Requirement", "_", "(_", "'", "Twi", "s", "-", "Te", "d", "'_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "-1", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "'", "Twi", "sted", " ", ">=", "1.2", ",", " ", "\\\\", " ", "#", " ", "more", "\\\\", "n", "<", "2.0", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Requirement", "_", "(_", "'", "Twi", "sted", "'_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", ",_", "(_", "'<'_", ",_", "'", "2.0", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "\"", "Foo", "Bar", "==", "1.9", "9", "a3", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "(_", "\"", "Foo", "Bar", "\"_", ",_", "[_", "(_", "'=='_", ",_", "'", "1.9", "9", "a3", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\">", "=", "2.3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "x", "\\\\\\\\\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "x", "==", "2", " ", "q", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "X", "==", "1", "\\\\", "n", "Y", "==", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"#\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\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", "Version", "Equali", "ty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "c_", "(_", "s1_", ",_", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", ",_", "p2_", "=_", "parse", "\\u", "version_", "(_", "s1_", ")_", ",_", "parse", "\\u", "version_", "(_", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p1_", "==_", "p2_", ",_", "(_", "s1_", ",_", "s2_", ",_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "(_", "'", "1.2", "-", "rc", "1", "'_", ",_", "'", "1.2", "rc", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "4", "'_", ",_", "'", "0.", "4.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "4.0", ".0", "'_", ",_", "'", "0.", "4.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "4.0", "-0", "'_", ",_", "'", "0.", "4", "-0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0", "post", "1", "'_", ",_", "'", "0.", "0", "post", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0", "pre", "1", "'_", ",_", "'", "0.", "0c", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "0.", "0", "previe", "w", "1", "'_", ",_", "'", "0c", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "0c", "1", "'_", ",_", "'", "0", "-", "rc", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "1.2", "a1", "'_", ",_", "'", "1.2", ".", "a", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "1.2", ".", "a", "'_", ",_", "'", "1.2", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Order", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "c_", "(_", "s1_", ",_", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", ",_", "p2_", "=_", "parse", "\\u", "version_", "(_", "s1_", ")_", ",_", "parse", "\\u", "version_", "(_", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p1_", "<_", "p2_", ",_", "(_", "s1_", ",_", "s2_", ",_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "(_", "'", "2.1", "'_", ",_", "'", "2.1", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2a", "1", "'_", ",_", "'", "2b", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2a", "1", "'_", ",_", "'", "2.1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.3", "a1", "'_", ",_", "'", "2.3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", "-1", "'_", ",_", "'", "2.1", "-", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", "-1", "'_", ",_", "'", "2.1", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", "'_", ",_", "'", "2.1", "post", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", "a0", "-", "2004", "050", "1", "'_", ",_", "'", "2.1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "1.1", "'_", ",_", "'", "02", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "3.2", "'_", ",_", "'", "3.2", ".", "post", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "3.2", "post", "1", "'_", ",_", "'", "3.2", "post", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "4", "'_", ",_", "'", "4.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0.", "0.", "4", "'_", ",_", "'", "0.", "4.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "0", "post", "1", "'_", ",_", "'", "0.", "4", "post", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", ".0", "-", "rc", "1", "'_", ",_", "'", "2.1", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "(_", "'", "2.1", "dev", "'_", ",_", "'", "2.1", "a0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tortur", "e_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "0.80", ".1", "-", "3", " ", "0.80", ".1", "-", "2", " ", "0.80", ".1", "-1", " ", "0.79", ".99", "9", "9", "+0", ".8", "0.", "0", "pre", "4", "-1", "\\", "10", ";", " ", " ", " ", " ", "0.79", ".99", "9", "9", "+0", ".8", "0.", "0", "pre", "2", "-", "3", " ", "0.79", ".99", "9", "9", "+0", ".8", "0.", "0", "pre", "2", "-", "2", "\\", "10", ";", " ", " ", " ", " ", "0.77", ".2", "-1", " ", "0.77", ".1", "-1", " ", "0.77", ".0", "-1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", ",_", "v1_", "in_", "enumerate_", "(_", "tortur", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v2_", "in_", "tortur", "e_", "[_", "p_", "+_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "(_", "v2_", ",_", "v1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Build", "out_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "out", " ", "has", " ", "a", " ", "function", " ", "in", " ", "it", "'", "s", " ", "boots", "trap", ".", "py", " ", "tha", "t", " ", "inspect", "ed", " ", "the", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "parse", "\\u", "version", ".", " ", "The", " ", "new", " ", "parse", "\\u", "version", " ", "return", "s", " ", "a", " ", "Version", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "need", "s", " ", "to", " ", "support", " ", "this", " ", "behavior", ",", " ", "at", " ", "leas", "t", " ", "for", " ", "now", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "buildo", "ut_", "(_", "parsed", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "final", "\\u", "parts_", "=_", "'*", "final", "-'_", ",_", "'*", "final", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "final", "\\u", "version_", "(_", "parsed", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "part_", "in_", "parsed", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "part_", "[_", ":_", "1_", "]_", "==_", "'*'_", ")_", "and_", "(_", "part_", "not_", "in_", "\\u", "final", "\\u", "parts_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "final", "\\u", "version_", "(_", "parsed", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "buildo", "ut_", "(_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "buildo", "ut_", "(_", "parse", "\\u", "version_", "(_", "\"", "1.0", "a1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Index", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "project", "s", " ", "wer", "e", " ", "doi", "ng", " ", "thing", "s", " ", "like", " ", "parse", "\\u", "version", "(\"", "v", "\")", "[", "0", "],", " ", "so", " ", "we", "'", "ll", "\\", "10", ";", " ", " ", " ", " ", "support", " ", "indexing", " ", "the", " ", "same", " ", "as", " ", "we", " ", "support", " ", "iterati", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", "[_", "0_", "]_", "==_", "\"", "00000001", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Tup", "le", "Sort_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "project", "s", " ", "expected", " ", "to", " ", "be", " ", "able", " ", "to", " ", "sort", " ", "tuple", "s", " ", "against", " ", "the", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "parse", "\\u", "version", ".", " ", "So", " ", "again", " ", "we", "'", "ll", " ", "add", " ", "a", " ", "warn", "ing", " ", "enable", "d", " ", "shi", "m", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "this", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", "<_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", "<=_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", "==_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "3.0", "\"_", ")_", ">_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "3.0", "\"_", ")_", ">=_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "\"", "3.0", "\"_", ")_", "!=_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "2.0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "(_", "parse", "\\u", "version_", "(_", "\"", "3.0", "\"_", ")_", "!=_", "tuple_", "(_", "parse", "\\u", "version_", "(_", "\"", "3.0", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Version", "Hash", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "tha", "t", " ", "our", " ", "version", "s", " ", "stay", " ", "hashable", " ", "even", " ", "tho", "ugh", " ", "we", "'", "ve", " ", "subclass", "ed", "\\", "10", ";", " ", " ", " ", " ", "them", " ", "and", " ", "adde", "d", " ", "some", " ", "shi", "m", " ", "code", " ", "to", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hash_", "(_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "hash_", "(_", "parse", "\\u", "version_", "(_", "\"", "1.0", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Names", "paces", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Names", "paces", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ns", "\\u", "pkgs_", "=_", "pkg", "\\u", "resources_", "._", "\\u", "namespace", "\\u", "packages_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", "=_", "\"", "tests", "-", "setup", "tool", "s", "-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "prev", "\\u", "sys", "\\u", "path_", "=_", "sys_", "._", "path_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Names", "paces", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "\\u", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "resources_", "._", "\\u", "namespace", "\\u", "packages_", "=_", "self_", "._", "\\u", "ns", "\\u", "pkgs_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "=_", "self_", "._", "\\u", "prev", "\\u", "sys", "\\u", "path_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Names", "paces", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "skipif_", "(_", "os_", "._", "path_", "._", "islink_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "\"", "Test", " ", "fail", "s", " ", "whe", "n", " ", "/", "tmp", " ", "is", " ", "a", " ", "symlink", ".", " ", "See", " ", "#", "231", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "level", "s", "\\u", "deep_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "nest", "ed", " ", "namespace", " ", "package", "s", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "namespace", " ", "package", "s", " ", "in", " ", "the", " ", "follow", "ing", " ", "tree", " ", ":", "\\", "10", ";", " ", " ", " ", " ", "site", "-", "package", "s", "-1", "/", "pkg", "1", "/", "pkg", "2", "\\", "10", ";", " ", " ", " ", " ", "site", "-", "package", "s", "-", "2", "/", "pkg", "1", "/", "pkg", "2", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "bot", "h", " ", "are", " ", "in", " ", "the", " ", "\\u", "namespace", "\\u", "package", "s", " ", "dict", " ", "and", " ", "tha", "t", " ", "thei", "r", " ", "\\u\\u", "path", "\\u\\u", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "\"_", ",_", "\"", "pkg", "1", "\"_", ",_", "\"", "pkg", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "2", "\"_", ",_", "\"", "pkg", "1", "\"_", ",_", "\"", "pkg", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "str_", "=_", "\"\\u\\u", "import", "\\u\\u", "('", "pkg", "\\u", "resource", "s", "')", ".", "declar", "e\\u", "namespace", "(\\u", "\\u", "name", "\\u\\u)", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "[_", "\"", "site", "-", "pkgs", "\"_", ",_", "\"", "site", "-", "pkgs", "2", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "1", "\\u", "init_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pkg", "1", "\"_", ",_", "\"\\u\\u", "init", "\\u\\u", ".", "py", "\"_", ")_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "1", "\\u", "init_", "._", "write_", "(_", "ns", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "1", "\\u", "init_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "2", "\\u", "init_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pkg", "1", "\"_", ",_", "\"", "pkg", "2", "\"_", ",_", "\"\\u\\u", "init", "\\u\\u", ".", "py", "\"_", ")_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "2", "\\u", "init_", "._", "write_", "(_", "ns", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "2", "\\u", "init_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pkg", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "pkg", "1", "\"_", "in_", "pkg", "\\u", "resources_", "._", "\\u", "namespace", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "import", " ", "pkg", "2", " ", "from", " ", "site", "-", "pkgs", "2_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pkg", "1_", "._", "pkg", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "\\u", "namespace", "\\u", "package", "s", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "pkg", "1", ".", "pkg", "2", "\"_", "in_", "pkg", "\\u", "resources_", "._", "\\u", "namespace", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "resources_", "._", "\\u", "namespace", "\\u", "packages_", "[_", "\"", "pkg", "1", "\"_", "]_", "==_", "[_", "\"", "pkg", "1", ".", "pkg", "2", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "\\u\\u", "path", "\\u\\u", " ", "attribute", " ", "contain", "s", " ", "bot", "h", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "\"_", ",_", "\"", "pkg", "1", "\"_", ",_", "\"", "pkg", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "tmpdir_", ",_", "\"", "site", "-", "pkgs", "2", "\"_", ",_", "\"", "pkg", "1", "\"_", ",_", "\"", "pk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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 ]
Unused local variable
fabiocorneti/django-easytree/easytree_example/admin.py
[ { "content": "class SingleRootExampleNodeAdmin(EasyTreeAdmin):\n list_display = ('display_as_node', 'lft', 'rgt', 'tree_id', 'title')\n list_editable = ('title',)\n list_filter = ('tree_id',)", "metadata": "root.SingleRootExampleNodeAdmin", "header": "['module', '___EOS___']", "index": 14 } ]
[]
[]
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_", "class_", "Sing", "le", "Roo", "t", "Exam", "ple", "Node", "Admin_", "(_", "Eas", "y", "Tree", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "'", "display", "\\u", "as", "\\u", "node", "'_", ",_", "'", "lft", "'_", ",_", "'", "rg", "t", "'_", ",_", "'", "tree", "\\u", "id", "'_", ",_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "editable_", "=_", "(_", "'", "title", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", "'", "tree", "\\u", "id", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Wrong number of arguments in a call
lbryio/lbry/tests/functional_tests.py
[ { "content": " def __init__(self):\n self.private_key = RSA.generate(1024)\n self.encoded_public_key = self.private_key.publickey().exportKey()", "metadata": "root.FakeWallet.__init__", "header": "['class', 'FakeWallet', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def __init__(self, start_port, peer_manager, num_peers):\n self.start_port = start_port\n self.peer_manager = peer_manager\n self.num_peers = num_peers\n self.count = 0", "metadata": "root.FakePeerFinder.__init__", "header": "['class', 'FakePeerFinder', '(', 'object', ')', ':', '___EOS___']", "index": 94 }, { "content": " def __init__(self, *args):\n pass", "metadata": "root.FakeAnnouncer.__init__", "header": "['class', 'FakeAnnouncer', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def test_lbry_transfer(self):\n\n sd_hash_queue = Queue()\n kill_event = Event()\n dead_event = Event()\n uploader = Process(target=start_lbry_uploader, args=(sd_hash_queue, kill_event, dead_event, 5209343))\n uploader.start()\n self.server_processes.append(uploader)\n\n logging.debug(\"Testing transfer\")\n\n wallet = FakeWallet()\n peer_manager = PeerManager()\n peer_finder = FakePeerFinder(5553, peer_manager, 1)\n hash_announcer = FakeAnnouncer()\n rate_limiter = DummyRateLimiter()\n sd_identifier = StreamDescriptorIdentifier()\n\n db_dir = \"client\"\n blob_dir = os.path.join(db_dir, \"blobfiles\")\n os.mkdir(db_dir)\n os.mkdir(blob_dir)\n\n self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid=\"abcd\",\n peer_finder=peer_finder, hash_announcer=hash_announcer,\n blob_dir=blob_dir, peer_port=5553,\n use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)\n\n self.stream_info_manager = TempLBRYFileMetadataManager()\n\n self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)\n\n def make_downloader(metadata, prm):\n info_validator = metadata.validator\n options = metadata.options\n factories = metadata.factories\n chosen_options = [o.default_value for o in options.get_downloader_options(info_validator, prm)]\n return factories[0].make_downloader(metadata, chosen_options, prm)\n\n def download_file(sd_hash):\n prm = PaymentRateManager(self.session.base_payment_rate_manager)\n d = download_sd_blob(self.session, sd_hash, prm)\n d.addCallback(sd_identifier.get_metadata_for_sd_blob)\n d.addCallback(make_downloader, prm)\n d.addCallback(lambda downloader: downloader.start())\n return d\n\n def check_md5_sum():\n f = open('test_file')\n hashsum = MD5.new()\n hashsum.update(f.read())\n self.assertEqual(hashsum.hexdigest(), \"4ca2aafb4101c1e42235aad24fbb83be\")\n\n def start_transfer(sd_hash):\n\n logging.debug(\"Starting the transfer\")\n\n d = self.session.setup()\n d.addCallback(lambda _: add_lbry_file_to_sd_identifier(sd_identifier))\n d.addCallback(lambda _: self.lbry_file_manager.setup())\n d.addCallback(lambda _: download_file(sd_hash))\n d.addCallback(lambda _: check_md5_sum())\n\n return d\n\n def stop(arg):\n if isinstance(arg, Failure):\n logging.debug(\"Client is stopping due to an error. Error: %s\", arg.getTraceback())\n else:\n logging.debug(\"Client is stopping normally.\")\n kill_event.set()\n logging.debug(\"Set the kill event\")\n d = self.wait_for_event(dead_event, 15)\n\n def print_shutting_down():\n logging.info(\"Client is shutting down\")\n\n d.addCallback(lambda _: print_shutting_down())\n d.addCallback(lambda _: arg)\n return d\n\n d = self.wait_for_hash_from_queue(sd_hash_queue)\n d.addCallback(start_transfer)\n d.addBoth(stop)\n\n return d", "metadata": "root.TestTransfer.test_lbry_transfer", "header": "['class', 'TestTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 754 } ]
[]
[]
0
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "class_", "Fake", "Wallet_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "private", "\\u", "key_", "=_", "RSA", "_", "._", "generate_", "(_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encode", "d\\u", "public", "\\u", "key_", "=_", "self_", "._", "private", "\\u", "key_", "._", "public", "key_", "(_", ")_", "._", "export", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Peer", "Finder_", "(_", "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_", ",_", "start", "\\u", "port_", ",_", "peer", "\\u", "manager_", ",_", "num", "\\u", "peers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "port_", "=_", "start", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "\\u", "manager_", "=_", "peer", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "\\u", "peers_", "=_", "num", "\\u", "peers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Announce", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lbr", "y", "\\u", "transfer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sd", "\\u", "hash", "\\u", "queue_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kill", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dead", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uploader_", "=_", "Process_", "(_", "target_", "=_", "start", "\\u", "lbr", "y", "\\u", "uploader_", ",_", "args_", "=_", "(_", "sd", "\\u", "hash", "\\u", "queue_", ",_", "kill", "\\u", "event_", ",_", "dead", "\\u", "event_", ",_", "520", "934", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uploader_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "processes_", "._", "append_", "(_", "uploader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Test", "ing", " ", "transfer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wallet_", "=_", "Fake", "Wallet_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer", "\\u", "manager_", "=_", "Peer", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer", "\\u", "finder_", "=_", "Fake", "Peer", "Finder_", "(_", "555", "3_", ",_", "peer", "\\u", "manager_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "announce", "r_", "=_", "Fake", "Announce", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate", "\\u", "limiter", "_", "=_", "Du", "mm", "y", "Rat", "e", "Limit", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sd", "\\u", "identifier_", "=_", "Stream", "Descrip", "tor", "Identifier_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "dir_", "=_", "\"", "client", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "db", "\\u", "dir_", ",_", "\"", "blob", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "db", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "blob", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "=_", "LB", "RY", "Session_", "(_", "MIN", "\\u", "BLOB", "\\u", "DATA", "\\u", "PAY", "MENT", "\\u", "RATE_", ",_", "db", "\\u", "dir_", "=_", "db", "\\u", "dir_", ",_", "lbr", "yi", "d_", "=_", "\"", "abc", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "peer", "\\u", "finder_", "=_", "peer", "\\u", "finder_", ",_", "hash", "\\u", "announce", "r_", "=_", "hash", "\\u", "announce", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blob", "\\u", "dir_", "=_", "blob", "\\u", "dir_", ",_", "peer", "\\u", "port_", "=_", "555", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "upnp", "_", "=_", "False_", ",_", "rate", "\\u", "limiter", "_", "=_", "rate", "\\u", "limiter", "_", ",_", "wallet_", "=_", "wallet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stream", "\\u", "info", "\\u", "manager_", "=_", "Temp", "LB", "RY", "File", "Meta", "data", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lbr", "y", "\\u", "file", "\\u", "manager_", "=_", "LB", "RY", "File", "Manager_", "(_", "self_", "._", "session_", ",_", "self_", "._", "stream", "\\u", "info", "\\u", "manager_", ",_", "sd", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "downloader_", "(_", "metadata_", ",_", "prm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "validator_", "=_", "metadata_", "._", "validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "metadata_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factories_", "=_", "metadata_", "._", "factories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "\\u", "options_", "=_", "[_", "o_", "._", "default", "\\u", "value_", "for_", "o_", "in_", "options_", "._", "get", "\\u", "downloader", "\\u", "options_", "(_", "info", "\\u", "validator_", ",_", "prm_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "factories_", "[_", "0_", "]_", "._", "make", "\\u", "downloader_", "(_", "metadata_", ",_", "chosen", "\\u", "options_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "file_", "(_", "sd", "\\u", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prm_", "=_", "Payment", "Rat", "e", "Manager_", "(_", "self_", "._", "session_", "._", "base", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "download", "\\u", "sd", "\\u", "blob_", "(_", "self_", "._", "session_", ",_", "sd", "\\u", "hash_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "sd", "\\u", "identifier_", "._", "get", "\\u", "metadata", "\\u", "for", "\\u", "sd", "\\u", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "make", "\\u", "downloader_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "downloader_", ":_", "downloader_", "._", "start_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "md5", "\\u", "sum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test\\u", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "sum_", "=_", "MD", "5_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "sum_", "._", "update_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hash", "sum_", "._", "hexdigest_", "(_", ")_", ",_", "\"", "4c", "a2", "aa", "fb", "410", "1c", "1e", "422", "3", "5a", "ad", "24", "fb", "b8", "3b", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "transfer_", "(_", "sd", "\\u", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "the", " ", "transfer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "self_", "._", "session_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "add", "\\u", "lbr", "y", "\\u", "file", "\\u", "to", "\\u", "sd", "\\u", "identifier_", "(_", "sd", "\\u", "identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "self_", "._", "lbr", "y", "\\u", "file", "\\u", "manager_", "._", "setup_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "download", "\\u", "file_", "(_", "sd", "\\u", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "check", "\\u", "md5", "\\u", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "arg_", ",_", "Failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Client", " ", "is", " ", "stopping", " ", "due", " ", "to", " ", "an", " ", "error", ".", " ", "Error", ":", " ", "%", "s", "\"_", ",_", "arg_", "._", "get", "Trace", "back_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Client", " ", "is", " ", "stopping", " ", "normal", "ly", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kill", "\\u", "event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Set", " ", "the", " ", "kill", " ", "event", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "wait", "\\u", "for", "\\u", "event_", "(_", "dead", "\\u", "event_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "\\u", "shutt", "ing", "\\u", "down_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Client", " ", "is", " ", "shutt", "ing", " ", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "print", "\\u", "shutt", "ing", "\\u", "down_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "self_", "._", "wait", "\\u", "for", "\\u", "hash", "\\u", "from", "\\u", "queue_", "(_", "sd", "\\u", "hash", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "start", "\\u", "transfer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Bot", "h_", "(_", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/nova/nova/crypto.py
[ { "content": "# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Wrappers around standard crypto data elements.\n\nIncludes root and intermediate CAs, SSH key_pairs and x509 certificates.\n\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport base64\nimport binascii\nimport os\n\nfrom Crypto.PublicKey import RSA\nfrom cryptography import exceptions\nfrom cryptography.hazmat import backends\nfrom cryptography.hazmat.primitives.asymmetric import padding\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives import serialization\nfrom cryptography import x509\nfrom oslo_concurrency import processutils\nfrom oslo_log import log as logging\nfrom oslo_utils import excutils\nfrom oslo_utils import fileutils\nimport paramiko\nimport six\n\nimport nova.conf\nfrom nova import context\nfrom nova import db\nfrom nova import exception\nfrom nova.i18n import _, _LE\nfrom nova import utils\n\n\nLOG = logging.getLogger(__name__)\n\nCONF = nova.conf.CONF\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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 ca_folder(project_id=None):\n if CONF.crypto.use_project_ca and project_id:\n return os.path.join(CONF.crypto.ca_path, 'projects', project_id)\n return CONF.crypto.ca_path", "metadata": "root.ca_folder", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def ca_path(project_id=None):\n return os.path.join(ca_folder(project_id), CONF.crypto.ca_file)", "metadata": "root.ca_path", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def key_path(project_id=None):\n return os.path.join(ca_folder(project_id), CONF.crypto.key_file)", "metadata": "root.key_path", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def crl_path(project_id=None):\n return os.path.join(ca_folder(project_id), CONF.crypto.crl_file)", "metadata": "root.crl_path", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def fetch_ca(project_id=None):\n if not CONF.crypto.use_project_ca:\n project_id = None\n ca_file_path = ca_path(project_id)\n if not os.path.exists(ca_file_path):\n raise exception.CryptoCAFileNotFound(project=project_id)\n with open(ca_file_path, 'r') as cafile:\n return cafile.read()", "metadata": "root.fetch_ca", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def ensure_ca_filesystem():\n \"\"\"Ensure the CA filesystem exists.\"\"\"\n ca_dir = ca_folder()\n if not os.path.exists(ca_path()):\n genrootca_sh_path = os.path.abspath(\n os.path.join(os.path.dirname(__file__), 'CA', 'genrootca.sh'))\n\n fileutils.ensure_tree(ca_dir)\n utils.execute(\"sh\", genrootca_sh_path, cwd=ca_dir)", "metadata": "root.ensure_ca_filesystem", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def generate_fingerprint(public_key):\n try:\n pub_bytes = public_key.encode('utf-8')\n # Test that the given public_key string is a proper ssh key. The\n # returned object is unused since pyca/cryptography does not have a\n # fingerprint method.\n serialization.load_ssh_public_key(\n pub_bytes, backends.default_backend())\n pub_data = base64.b64decode(public_key.split(' ')[1])\n digest = hashes.Hash(hashes.MD5(), backends.default_backend())\n digest.update(pub_data)\n md5hash = digest.finalize()\n raw_fp = binascii.hexlify(md5hash)\n if six.PY3:\n raw_fp = raw_fp.decode('ascii')\n return ':'.join(a + b for a, b in zip(raw_fp[::2], raw_fp[1::2]))\n except Exception:\n raise exception.InvalidKeypair(\n reason=_('failed to generate fingerprint'))", "metadata": "root.generate_fingerprint", "header": "['module', '___EOS___']", "index": 94 }, { "content": "def generate_x509_fingerprint(pem_key):\n try:\n if isinstance(pem_key, six.text_type):\n pem_key = pem_key.encode('utf-8')\n cert = x509.load_pem_x509_certificate(\n pem_key, backends.default_backend())\n raw_fp = binascii.hexlify(cert.fingerprint(hashes.SHA1()))\n if six.PY3:\n raw_fp = raw_fp.decode('ascii')\n return ':'.join(a + b for a, b in zip(raw_fp[::2], raw_fp[1::2]))\n except (ValueError, TypeError, binascii.Error) as ex:\n raise exception.InvalidKeypair(\n reason=_('failed to generate X509 fingerprint. '\n 'Error message: %s') % ex)", "metadata": "root.generate_x509_fingerprint", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def generate_key(bits):\n \"\"\"Generate a paramiko RSAKey\"\"\"\n # NOTE(dims): pycryptodome has changed the signature of the RSA.generate\n # call. specifically progress_func has been dropped. paramiko still uses\n # pycrypto. However some projects like latest pysaml2 have switched from\n # pycrypto to pycryptodome as pycrypto seems to have been abandoned.\n # paramiko project has started transition to pycryptodome as well but\n # there is no release yet with that support. So at the moment depending on\n # which version of pysaml2 is installed, Nova is likely to break. So we\n # call \"RSA.generate(bits)\" which works on both pycrypto and pycryptodome\n # and then wrap it into a paramiko.RSAKey\n rsa = RSA.generate(bits)\n key = paramiko.RSAKey(vals=(rsa.e, rsa.n))\n key.d = rsa.d\n key.p = rsa.p\n key.q = rsa.q\n return key", "metadata": "root.generate_key", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def generate_key_pair(bits=2048):\n key = generate_key(bits)\n keyout = six.StringIO()\n key.write_private_key(keyout)\n private_key = keyout.getvalue()\n public_key = '%s %s Generated-by-Nova' % (key.get_name(), key.get_base64())\n fingerprint = generate_fingerprint(public_key)\n return (private_key, public_key, fingerprint)", "metadata": "root.generate_key_pair", "header": "['module', '___EOS___']", "index": 150 }, { "content": "def fetch_crl(project_id):\n \"\"\"Get crl file for project.\"\"\"\n if not CONF.crypto.use_project_ca:\n project_id = None\n crl_file_path = crl_path(project_id)\n if not os.path.exists(crl_file_path):\n raise exception.CryptoCRLFileNotFound(project=project_id)\n with open(crl_file_path, 'r') as crlfile:\n return crlfile.read()", "metadata": "root.fetch_crl", "header": "['module', '___EOS___']", "index": 160 }, { "content": "def decrypt_text(project_id, text):\n private_key_file = key_path(project_id)\n if not os.path.exists(private_key_file):\n raise exception.ProjectNotFound(project_id=project_id)\n with open(private_key_file, 'rb') as f:\n data = f.read()\n try:\n priv_key = serialization.load_pem_private_key(\n data, None, backends.default_backend())\n return priv_key.decrypt(text, padding.PKCS1v15())\n except (ValueError, TypeError, exceptions.UnsupportedAlgorithm) as exc:\n raise exception.DecryptionFailure(reason=six.text_type(exc))", "metadata": "root.decrypt_text", "header": "['module', '___EOS___']", "index": 171 }, { "content": "def ssh_encrypt_text(ssh_public_key, text):\n \"\"\"Encrypt text with an ssh public key.\n\n If text is a Unicode string, encode it to UTF-8.\n \"\"\"\n if isinstance(text, six.text_type):\n text = text.encode('utf-8')\n try:\n pub_bytes = ssh_public_key.encode('utf-8')\n pub_key = serialization.load_ssh_public_key(\n pub_bytes, backends.default_backend())\n return pub_key.encrypt(text, padding.PKCS1v15())\n except Exception as exc:\n raise exception.EncryptionFailure(reason=six.text_type(exc))", "metadata": "root.ssh_encrypt_text", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def revoke_cert(project_id, file_name):\n \"\"\"Revoke a cert by file name.\"\"\"\n try:\n # NOTE(vish): potential race condition here\n utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke',\n file_name, cwd=ca_folder(project_id))\n utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf',\n '-out', CONF.crypto.crl_file, cwd=ca_folder(project_id))\n except OSError:\n raise exception.ProjectNotFound(project_id=project_id)\n except processutils.ProcessExecutionError:\n raise exception.RevokeCertFailure(project_id=project_id)", "metadata": "root.revoke_cert", "header": "['module', '___EOS___']", "index": 201 }, { "content": "def revoke_certs_by_user(user_id):\n \"\"\"Revoke all user certs.\"\"\"\n admin = context.get_admin_context()\n for cert in db.certificate_get_all_by_user(admin, user_id):\n revoke_cert(cert['project_id'], cert['file_name'])", "metadata": "root.revoke_certs_by_user", "header": "['module', '___EOS___']", "index": 215 }, { "content": "def revoke_certs_by_project(project_id):\n \"\"\"Revoke all project certs.\"\"\"\n # NOTE(vish): This is somewhat useless because we can just shut down\n # the vpn.\n admin = context.get_admin_context()\n for cert in db.certificate_get_all_by_project(admin, project_id):\n revoke_cert(cert['project_id'], cert['file_name'])", "metadata": "root.revoke_certs_by_project", "header": "['module', '___EOS___']", "index": 222 }, { "content": "def revoke_certs_by_user_and_project(user_id, project_id):\n \"\"\"Revoke certs for user in project.\"\"\"\n admin = context.get_admin_context()\n for cert in db.certificate_get_all_by_user_and_project(admin,\n user_id, project_id):\n revoke_cert(cert['project_id'], cert['file_name'])", "metadata": "root.revoke_certs_by_user_and_project", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def _project_cert_subject(project_id):\n \"\"\"Helper to generate user cert subject.\"\"\"\n return CONF.crypto.project_cert_subject % (project_id, utils.isotime())", "metadata": "root._project_cert_subject", "header": "['module', '___EOS___']", "index": 239 }, { "content": "def _user_cert_subject(user_id, project_id):\n \"\"\"Helper to generate user cert subject.\"\"\"\n return CONF.crypto.user_cert_subject % (project_id, user_id,\n utils.isotime())", "metadata": "root._user_cert_subject", "header": "['module', '___EOS___']", "index": 244 }, { "content": "def generate_x509_cert(user_id, project_id, bits=2048):\n \"\"\"Generate and sign a cert for user in project.\"\"\"\n subject = _user_cert_subject(user_id, project_id)\n\n with utils.tempdir() as tmpdir:\n keyfile = os.path.abspath(os.path.join(tmpdir, 'temp.key'))\n csrfile = os.path.abspath(os.path.join(tmpdir, 'temp.csr'))\n utils.execute('openssl', 'genrsa', '-out', keyfile, str(bits))\n utils.execute('openssl', 'req', '-new', '-key', keyfile, '-out',\n csrfile, '-batch', '-subj', subject)\n with open(keyfile) as f:\n private_key = f.read()\n with open(csrfile) as f:\n csr = f.read()\n\n (serial, signed_csr) = sign_csr(csr, project_id)\n fname = os.path.join(ca_folder(project_id), 'newcerts/%s.pem' % serial)\n cert = {'user_id': user_id,\n 'project_id': project_id,\n 'file_name': fname}\n db.certificate_create(context.get_admin_context(), cert)\n return (private_key, signed_csr)", "metadata": "root.generate_x509_cert", "header": "['module', '___EOS___']", "index": 250 }, { "content": "def generate_winrm_x509_cert(user_id, bits=2048):\n \"\"\"Generate a cert for passwordless auth for user in project.\"\"\"\n subject = '/CN=%s' % user_id\n upn = '%s@localhost' % user_id\n\n with utils.tempdir() as tmpdir:\n keyfile = os.path.abspath(os.path.join(tmpdir, 'temp.key'))\n conffile = os.path.abspath(os.path.join(tmpdir, 'temp.conf'))\n\n _create_x509_openssl_config(conffile, upn)\n\n (certificate, _err) = utils.execute(\n 'openssl', 'req', '-x509', '-nodes', '-days', '3650',\n '-config', conffile, '-newkey', 'rsa:%s' % bits,\n '-outform', 'PEM', '-keyout', keyfile, '-subj', subject,\n '-extensions', 'v3_req_client',\n binary=True)\n\n (out, _err) = utils.execute('openssl', 'pkcs12', '-export',\n '-inkey', keyfile, '-password', 'pass:',\n process_input=certificate,\n binary=True)\n\n private_key = base64.b64encode(out)\n fingerprint = generate_x509_fingerprint(certificate)\n if six.PY3:\n private_key = private_key.decode('ascii')\n certificate = certificate.decode('utf-8')\n\n return (private_key, certificate, fingerprint)", "metadata": "root.generate_winrm_x509_cert", "header": "['module', '___EOS___']", "index": 274 }, { "content": "def _create_x509_openssl_config(conffile, upn):\n content = (\"distinguished_name = req_distinguished_name\\n\"\n \"[req_distinguished_name]\\n\"\n \"[v3_req_client]\\n\"\n \"extendedKeyUsage = clientAuth\\n\"\n \"subjectAltName = otherName:\"\"1.3.6.1.4.1.311.20.2.3;UTF8:%s\\n\")\n\n with open(conffile, 'w') as file:\n file.write(content % upn)", "metadata": "root._create_x509_openssl_config", "header": "['module', '___EOS___']", "index": 306 }, { "content": "def _ensure_project_folder(project_id):\n if not os.path.exists(ca_path(project_id)):\n geninter_sh_path = os.path.abspath(\n os.path.join(os.path.dirname(__file__), 'CA', 'geninter.sh'))\n utils.execute('sh', geninter_sh_path, project_id,\n _project_cert_subject(project_id), cwd=ca_folder())", "metadata": "root._ensure_project_folder", "header": "['module', '___EOS___']", "index": 317 }, { "content": "def generate_vpn_files(project_id):\n project_folder = ca_folder(project_id)\n key_fn = os.path.join(project_folder, 'server.key')\n crt_fn = os.path.join(project_folder, 'server.crt')\n\n if os.path.exists(crt_fn):\n return\n # NOTE(vish): The 2048 is to maintain compatibility with the old script.\n # We are using \"project-vpn\" as the user_id for the cert\n # even though that user may not really exist. Ultimately\n # this will be changed to be launched by a real user. At\n # that point we will can delete this helper method.\n key, csr = generate_x509_cert('project-vpn', project_id, 2048)\n with open(key_fn, 'w') as keyfile:\n keyfile.write(key)\n with open(crt_fn, 'w') as crtfile:\n crtfile.write(csr)", "metadata": "root.generate_vpn_files", "header": "['module', '___EOS___']", "index": 325 }, { "content": "def sign_csr(csr_text, project_id=None):\n if not CONF.crypto.use_project_ca:\n project_id = None\n if not project_id:\n return _sign_csr(csr_text, ca_folder())\n _ensure_project_folder(project_id)\n return _sign_csr(csr_text, ca_folder(project_id))", "metadata": "root.sign_csr", "header": "['module', '___EOS___']", "index": 344 }, { "content": "def _sign_csr(csr_text, ca_folder):\n with utils.tempdir() as tmpdir:\n inbound = os.path.join(tmpdir, 'inbound.csr')\n outbound = os.path.join(tmpdir, 'outbound.csr')\n\n try:\n with open(inbound, 'w') as csrfile:\n csrfile.write(csr_text)\n except IOError:\n with excutils.save_and_reraise_exception():\n LOG.exception(_LE('Failed to write inbound.csr'))\n\n LOG.debug('Flags path: %s', ca_folder)\n\n # Change working dir to CA\n fileutils.ensure_tree(ca_folder)\n utils.execute('openssl', 'ca', '-batch', '-out', outbound, '-config',\n './openssl.cnf', '-infiles', inbound, cwd=ca_folder)\n out, _err = utils.execute('openssl', 'x509', '-in', outbound,\n '-serial', '-noout', cwd=ca_folder)\n serial = out.rpartition('=')[2].strip()\n\n with open(outbound, 'r') as crtfile:\n return (serial, crtfile.read())", "metadata": "root._sign_csr", "header": "['module', '___EOS___']", "index": 353 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Unit", "ed", " ", "State", "s", " ", "Gov", "ern", "ment", " ", "as", " ", "represent", "ed", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Administra", "tor", " ", "of", " ", "the", " ", "Nat", "ional", " ", "Aer", "ona", "uti", "cs", " ", "and", " ", "Spac", "e", " ", "Administrati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Wrapper", "s", " ", "aro", "und", " ", "standard", " ", "crypto", " ", "data", " ", "element", "s", ".", "\\", "10", ";", "\\", "10", ";", "Includes", " ", "root", " ", "and", " ", "intermediate", " ", "CA", "s", ",", " ", "SSH", " ", "key", "\\u", "pair", "s", " ", "and", " ", "x5", "09", " ", "certificates", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\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_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "binascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Crypto_", "._", "Public", "Key_", "import_", "RSA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "._", "haz", "mat_", "import_", "backends_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "._", "haz", "mat_", "._", "primitives_", "._", "asymmetr", "ic_", "import_", "padding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "._", "haz", "mat_", "._", "primitives_", "import_", "hashes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "._", "haz", "mat_", "._", "primitives_", "import_", "serialization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cryptography", "_", "import_", "x509_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "concurrency", "_", "import_", "process", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "log_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "excu", "tils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "fileu", "tils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "paramiko_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "nova_", "._", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "i18n_", "import_", "\\u_", ",_", "\\u", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "nova_", "._", "conf_", "._", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "CONF_", "._", "crypto_", "._", "use", "\\u", "project", "\\u", "ca_", "and_", "project", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "CONF_", "._", "crypto_", "._", "ca", "\\u", "path_", ",_", "'", "project", "s", "'_", ",_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "CONF_", "._", "crypto_", "._", "ca", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ca", "\\u", "path_", "(_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ",_", "CONF_", "._", "crypto_", "._", "ca", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key", "\\u", "path_", "(_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ",_", "CONF_", "._", "crypto_", "._", "key", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "crl", "\\u", "path_", "(_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ",_", "CONF_", "._", "crypto_", "._", "crl", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fetch", "\\u", "ca_", "(_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "CONF_", "._", "crypto_", "._", "use", "\\u", "project", "\\u", "ca_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ca", "\\u", "file", "\\u", "path_", "=_", "ca", "\\u", "path_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "ca", "\\u", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Crypto", "CA", "File", "Not", "Found_", "(_", "project_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "ca", "\\u", "file", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "caf", "ile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "caf", "ile_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ensure", "\\u", "ca", "\\u", "filesystem_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "the", " ", "CA", " ", "filesystem", " ", "exist", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ca", "\\u", "dir_", "=_", "ca", "\\u", "folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "ca", "\\u", "path_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genr", "oot", "ca", "\\u", "sh", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "CA", "'_", ",_", "'", "genr", "oot", "ca", ".", "sh", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fileu", "tils_", "._", "ensure", "\\u", "tree_", "(_", "ca", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "\"", "sh", "\"_", ",_", "genr", "oot", "ca", "\\u", "sh", "\\u", "path_", ",_", "cwd_", "=_", "ca", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "fingerprint_", "(_", "public", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pub", "\\u", "bytes_", "=_", "public", "\\u", "key_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "the", " ", "give", "n", " ", "public", "\\u", "key", " ", "string", " ", "is", " ", "a", " ", "proper", " ", "ssh", " ", "key", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ed", " ", "object", " ", "is", " ", "unu", "sed", " ", "sinc", "e", " ", "pyca", "/", "cryptography", " ", "doe", "s", " ", "not", " ", "have", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fingerprint", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "serialization_", "._", "load", "\\u", "ssh", "\\u", "public", "\\u", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "bytes_", ",_", "backends_", "._", "default", "\\u", "backend_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "\\u", "data_", "=_", "base64_", "._", "b64decode_", "(_", "public", "\\u", "key_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest_", "=_", "hashes_", "._", "Hash_", "(_", "hashes_", "._", "MD", "5_", "(_", ")_", ",_", "backends_", "._", "default", "\\u", "backend_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digest_", "._", "update_", "(_", "pub", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "hash_", "=_", "digest_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "fp_", "=_", "binascii_", "._", "hexlify_", "(_", "md5", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "fp_", "=_", "raw", "\\u", "fp_", "._", "decode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "':'_", "._", "join_", "(_", "a_", "+_", "b_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "raw", "\\u", "fp_", "[_", ":_", ":_", "2_", "]_", ",_", "raw", "\\u", "fp_", "[_", "1_", ":_", ":_", "2_", "]_", ")_", ")_", "\\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 ", " _", "raise_", "exception_", "._", "Inva", "lid", "Keyp", "air_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "\\u_", "(_", "'", "fail", "ed", " ", "to", " ", "generat", "e", " ", "fingerprint", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "x5", "09", "\\u", "fingerprint_", "(_", "pe", "m", "\\u", "key_", ")_", ":_", "\\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_", "isinstance_", "(_", "pe", "m", "\\u", "key_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pe", "m", "\\u", "key_", "=_", "pe", "m", "\\u", "key_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cert_", "=_", "x509_", "._", "load", "\\u", "pe", "m", "\\u", "x5", "09", "\\u", "certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pe", "m", "\\u", "key_", ",_", "backends_", "._", "default", "\\u", "backend_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "fp_", "=_", "binascii_", "._", "hexlify_", "(_", "cert_", "._", "fingerprint_", "(_", "hashes_", "._", "SHA", "1_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "fp_", "=_", "raw", "\\u", "fp_", "._", "decode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "':'_", "._", "join_", "(_", "a_", "+_", "b_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "raw", "\\u", "fp_", "[_", ":_", ":_", "2_", "]_", ",_", "raw", "\\u", "fp_", "[_", "1_", ":_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "binascii_", "._", "Error_", ")_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Inva", "lid", "Keyp", "air_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "\\u_", "(_", "'", "fail", "ed", " ", "to", " ", "generat", "e", " ", "X509", " ", "fingerprint", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Error", " ", "message", ":", " ", "%", "s", "'_", ")_", "%_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "key_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "param", "iko", " ", "RSA", "Key", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "dims", "):", " ", "pyc", "rypt", "odom", "e", " ", "has", " ", "change", "d", " ", "the", " ", "signa", "ture", " ", "of", " ", "the", " ", "RSA", ".", "generate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", ".", " ", "specifica", "ll", "y", " ", "progress", "\\u", "func", " ", "has", " ", "bee", "n", " ", "dropped", ".", " ", "param", "iko", " ", "still", " ", "uses_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyc", "rypt", "o", ".", " ", "Ho", "we", "ver", " ", "some", " ", "project", "s", " ", "like", " ", "late", "st", " ", "pysam", "l2", " ", "have", " ", "switche", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyc", "rypt", "o", " ", "to", " ", "pyc", "rypt", "odom", "e", " ", "as", " ", "pyc", "rypt", "o", " ", "see", "ms", " ", "to", " ", "have", " ", "bee", "n", " ", "aband", "oned", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "param", "iko", " ", "project", " ", "has", " ", "start", "ed", " ", "transiti", "on", " ", "to", " ", "pyc", "rypt", "odom", "e", " ", "as", " ", "well", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "no", " ", "release", " ", "ye", "t", " ", "with", " ", "tha", "t", " ", "support", ".", " ", "So", " ", "at", " ", "the", " ", "moment", " ", "depend", "ing", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "version", " ", "of", " ", "pysam", "l2", " ", "is", " ", "install", "ed", ",", " ", "Nov", "a", " ", "is", " ", "like", "ly", " ", "to", " ", "break", ".", " ", "So", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "\"", "RSA", ".", "generat", "e", "(", "bits", ")\"", " ", "whi", "ch", " ", "works", " ", "on", " ", "bot", "h", " ", "pyc", "rypt", "o", " ", "and", " ", "pyc", "rypt", "odom", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "then", " ", "wrap", " ", "it", " ", "int", "o", " ", "a", " ", "param", "iko", ".", "RSA", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "rsa", "_", "=_", "RSA", "_", "._", "generate_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "paramiko_", "._", "RSA", "Key_", "(_", "vals_", "=_", "(_", "rsa", "_", "._", "e_", ",_", "rsa", "_", "._", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "d_", "=_", "rsa", "_", "._", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "p_", "=_", "rsa", "_", "._", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "q_", "=_", "rsa", "_", "._", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "key", "\\u", "pair_", "(_", "bits_", "=_", "2048_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "generat", "e\\u", "key_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "out_", "=_", "six_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "write", "\\u", "private", "\\u", "key_", "(_", "key", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "private", "\\u", "key_", "=_", "key", "out_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "public", "\\u", "key_", "=_", "'%", "s", " ", "%", "s", " ", "Generate", "d", "-", "by", "-", "Nov", "a", "'_", "%_", "(_", "key_", "._", "get", "\\u", "name_", "(_", ")_", ",_", "key_", "._", "get", "\\u", "base64_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fingerprint_", "=_", "generat", "e\\u", "fingerprint_", "(_", "public", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "private", "\\u", "key_", ",_", "public", "\\u", "key_", ",_", "fingerprint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fetch", "\\u", "crl", "_", "(_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "crl", " ", "file", " ", "for", " ", "project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "CONF_", "._", "crypto_", "._", "use", "\\u", "project", "\\u", "ca_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "crl", "\\u", "file", "\\u", "path_", "=_", "crl", "\\u", "path_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "crl", "\\u", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Crypto", "CRL", "File", "Not", "Found_", "(_", "project_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "crl", "\\u", "file", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "crl", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crl", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decrypt", "\\u", "text_", "(_", "project", "\\u", "id_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "private", "\\u", "key", "\\u", "file_", "=_", "key", "\\u", "path_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "private", "\\u", "key", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Project", "Not", "Found_", "(_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "private", "\\u", "key", "\\u", "file_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\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 ", " _", "priv", "\\u", "key_", "=_", "serialization_", "._", "load", "\\u", "pe", "m", "\\u", "private", "\\u", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ",_", "None_", ",_", "backends_", "._", "default", "\\u", "backend_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "priv", "\\u", "key_", "._", "decrypt_", "(_", "text_", ",_", "padding_", "._", "PKC", "S1", "v1", "5_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "exceptions_", "._", "Unsu", "ppo", "rted", "Algorithm_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Decrypt", "ion", "Failure_", "(_", "reason_", "=_", "six_", "._", "text", "\\u", "type_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssh", "\\u", "encrypt", "\\u", "text_", "(_", "ssh", "\\u", "public", "\\u", "key_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Encrypt", " ", "text", " ", "with", " ", "an", " ", "ssh", " ", "public", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "text", " ", "is", " ", "a", " ", "Unic", "ode", " ", "string", ",", " ", "encode", " ", "it", " ", "to", " ", "UT", "F", "-", "8", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "text_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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 ", " _", "pub", "\\u", "bytes_", "=_", "ssh", "\\u", "public", "\\u", "key_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "\\u", "key_", "=_", "serialization_", "._", "load", "\\u", "ssh", "\\u", "public", "\\u", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "bytes_", ",_", "backends_", "._", "default", "\\u", "backend_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pub", "\\u", "key_", "._", "encrypt_", "(_", "text_", ",_", "padding_", "._", "PKC", "S1", "v1", "5_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Encrypt", "ion", "Failure_", "(_", "reason_", "=_", "six_", "._", "text", "\\u", "type_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revoke", "\\u", "cert_", "(_", "project", "\\u", "id_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revo", "ke", " ", "a", " ", "cert", " ", "by", " ", "file", " ", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "vis", "h", "):", " ", "potenti", "al", " ", "race", " ", "condition", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "ca", "'_", ",_", "'-", "config", "'_", ",_", "'./", "openss", "l", ".", "cnf", "'_", ",_", "'-", "revoke", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "name_", ",_", "cwd_", "=_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "ca", "'_", ",_", "'-", "genc", "rl", "'_", ",_", "'-", "config", "'_", ",_", "'./", "openss", "l", ".", "cnf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "out", "'_", ",_", "CONF_", "._", "crypto_", "._", "crl", "\\u", "file_", ",_", "cwd_", "=_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Project", "Not", "Found_", "(_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "process", "utils_", "._", "Process", "Execut", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Revo", "ke", "Cert", "Failure_", "(_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revoke", "\\u", "cert", "s", "\\u", "by", "\\u", "user_", "(_", "user", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revo", "ke", " ", "all", " ", "user", " ", "cert", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cert_", "in_", "db_", "._", "certifica", "te", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "user_", "(_", "admin_", ",_", "user", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "revoke", "\\u", "cert_", "(_", "cert_", "[_", "'", "project", "\\u", "id", "'_", "]_", ",_", "cert_", "[_", "'", "file", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revoke", "\\u", "cert", "s", "\\u", "by", "\\u", "project_", "(_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revo", "ke", " ", "all", " ", "project", " ", "cert", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "vis", "h", "):", " ", "Thi", "s", " ", "is", " ", "some", "what", " ", "usel", "ess", " ", "bec", "aus", "e", " ", "we", " ", "can", " ", "just", " ", "shut", " ", "down_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "the", " ", "vpn", "._", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cert_", "in_", "db_", "._", "certifica", "te", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "project_", "(_", "admin_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "revoke", "\\u", "cert_", "(_", "cert_", "[_", "'", "project", "\\u", "id", "'_", "]_", ",_", "cert_", "[_", "'", "file", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revoke", "\\u", "cert", "s", "\\u", "by", "\\u", "user", "\\u", "and", "\\u", "project_", "(_", "user", "\\u", "id_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revo", "ke", " ", "cert", "s", " ", "for", " ", "user", " ", "in", " ", "project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cert_", "in_", "db_", "._", "certifica", "te", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "user", "\\u", "and", "\\u", "project_", "(_", "admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "revoke", "\\u", "cert_", "(_", "cert_", "[_", "'", "project", "\\u", "id", "'_", "]_", ",_", "cert_", "[_", "'", "file", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "project", "\\u", "cert", "\\u", "subject_", "(_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "generat", "e", " ", "user", " ", "cert", " ", "subject", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "CONF_", "._", "crypto_", "._", "project", "\\u", "cert", "\\u", "subject_", "%_", "(_", "project", "\\u", "id_", ",_", "utils_", "._", "isot", "ime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\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", "user", "\\u", "cert", "\\u", "subject_", "(_", "user", "\\u", "id_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "generat", "e", " ", "user", " ", "cert", " ", "subject", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "CONF_", "._", "crypto_", "._", "user", "\\u", "cert", "\\u", "subject_", "%_", "(_", "project", "\\u", "id_", ",_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "isot", "ime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "x5", "09", "\\u", "cert_", "(_", "user", "\\u", "id_", ",_", "project", "\\u", "id_", ",_", "bits_", "=_", "2048_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "and", " ", "sign", " ", "a", " ", "cert", " ", "for", " ", "user", " ", "in", " ", "project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "\\u", "user", "\\u", "cert", "\\u", "subject_", "(_", "user", "\\u", "id_", ",_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "utils_", "._", "tempdir_", "(_", ")_", "as_", "tmpdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyfile_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "temp", ".", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csr", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "temp", ".", "csr", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "genr", "sa", "'_", ",_", "'-", "out", "'_", ",_", "keyfile_", ",_", "str_", "(_", "bits_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "req", "'_", ",_", "'-", "new", "'_", ",_", "'-", "key", "'_", ",_", "keyfile_", ",_", "'-", "out", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "csr", "file_", ",_", "'-", "batch", "'_", ",_", "'-", "subj", "'_", ",_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "keyfile_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "private", "\\u", "key_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "csr", "file_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csr_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "serial_", ",_", "sign", "ed", "\\u", "csr_", ")_", "=_", "sign", "\\u", "csr_", "(_", "csr_", ",_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ",_", "'", "newc", "ert", "s", "/", "%", "s", ".", "pe", "m", "'_", "%_", "serial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "id", "'_", ":_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "name", "'_", ":_", "fname_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "certifica", "te", "\\u", "create_", "(_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", ",_", "cert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "private", "\\u", "key_", ",_", "sign", "ed", "\\u", "csr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "winr", "m", "\\u", "x5", "09", "\\u", "cert_", "(_", "user", "\\u", "id_", ",_", "bits_", "=_", "2048_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "cert", " ", "for", " ", "password", "less", " ", "auth", " ", "for", " ", "user", " ", "in", " ", "project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "'/", "CN", "=", "%", "s", "'_", "%_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up", "n_", "=_", "'%", "s", "@", "local", "host", "'_", "%_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "utils_", "._", "tempdir_", "(_", ")_", "as_", "tmpdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyfile_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "temp", ".", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "temp", ".", "conf", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "create", "\\u", "x5", "09", "\\u", "openss", "l\\u", "config_", "(_", "conf", "file_", ",_", "up", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "certificate_", ",_", "\\u", "err_", ")_", "=_", "utils_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openss", "l", "'_", ",_", "'", "req", "'_", ",_", "'-", "x5", "09", "'_", ",_", "'-", "nodes", "'_", ",_", "'-", "day", "s", "'_", ",_", "'", "365", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "config", "'_", ",_", "conf", "file_", ",_", "'-", "new", "key", "'_", ",_", "'", "rsa", ":", "%", "s", "'_", "%_", "bits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "outf", "orm", "'_", ",_", "'", "PEM", "'_", ",_", "'-", "key", "out", "'_", ",_", "keyfile_", ",_", "'-", "subj", "'_", ",_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "extensi", "ons", "'_", ",_", "'", "v", "3", "\\u", "req", "\\u", "client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "binary_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "out_", ",_", "\\u", "err_", ")_", "=_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "pkcs", "1", "2", "'_", ",_", "'-", "export", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "inke", "y", "'_", ",_", "keyfile_", ",_", "'-", "password", "'_", ",_", "'", "pass", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "process", "\\u", "input_", "=_", "certificate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "binary_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "private", "\\u", "key_", "=_", "base64_", "._", "b64encode_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fingerprint_", "=_", "generat", "e\\u", "x5", "09", "\\u", "fingerprint_", "(_", "certificate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "private", "\\u", "key_", "=_", "private", "\\u", "key_", "._", "decode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "certificate_", "=_", "certificate_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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_", "(_", "private", "\\u", "key_", ",_", "certificate_", ",_", "fingerprint_", ")_", "\\u\\u\\uNEWLINE\\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", "create", "\\u", "x5", "09", "\\u", "openss", "l\\u", "config_", "(_", "conf", "file_", ",_", "up", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "(_", "\"", "distinguish", "ed", "\\u", "name", " ", " ", "=", " ", "req", "\\u", "distinguish", "ed", "\\u", "name", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "req", "\\u", "distinguish", "ed", "\\u", "name", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "v", "3", "\\u", "req", "\\u", "client", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "extend", "ed", "Key", "Us", "age", " ", "=", " ", "client", "Auth", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "subject", "Alt", "Name", " ", "=", " ", "other", "Name", ":\"_", "\"", "1.3", ".6", ".1", ".4", ".1", ".3", "11.", "20.", "2.3", ";", "UT", "F8", ":", "%", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "conf", "file_", ",_", "'", "w", "'_", ")_", "as_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "._", "write_", "(_", "content_", "%_", "up", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ensure", "\\u", "project", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "ca", "\\u", "path_", "(_", "project", "\\u", "id_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geni", "nter", "\\u", "sh", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "CA", "'_", ",_", "'", "geni", "nter", ".", "sh", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "'", "sh", "'_", ",_", "geni", "nter", "\\u", "sh", "\\u", "path_", ",_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "project", "\\u", "cert", "\\u", "subject_", "(_", "project", "\\u", "id_", ")_", ",_", "cwd_", "=_", "ca", "\\u", "folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "vpn", "\\u", "files_", "(_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "folder_", "=_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "project", "\\u", "folder_", ",_", "'", "server", ".", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crt", "\\u", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "project", "\\u", "folder_", ",_", "'", "server", ".", "crt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "crt", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "vis", "h", "):", " ", "The", " ", "204", "8", " ", "is", " ", "to", " ", "maintain", " ", "compatibility", " ", "with", " ", "the", " ", "old", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "We", " ", "are", " ", "usi", "ng", " ", "\"", "project", "-", "vpn", "\"", " ", "as", " ", "the", " ", "user", "\\u", "id", " ", "for", " ", "the", " ", "cert_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "even", " ", "tho", "ugh", " ", "tha", "t", " ", "user", " ", "may", " ", "not", " ", "reall", "y", " ", "exist", ".", " ", "Ult", "imat", "el", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "this", " ", "will", " ", "be", " ", "change", "d", " ", "to", " ", "be", " ", "launched", " ", "by", " ", "a", " ", "real", " ", "user", ".", " ", " ", "At_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "tha", "t", " ", "point", " ", "we", " ", "will", " ", "can", " ", "delete", " ", "this", " ", "help", "er", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", ",_", "csr_", "=_", "generat", "e\\u", "x5", "09", "\\u", "cert_", "(_", "'", "project", "-", "vpn", "'_", ",_", "project", "\\u", "id_", ",_", "2048_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "key", "\\u", "fn_", ",_", "'", "w", "'_", ")_", "as_", "keyfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyfile_", "._", "write_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "crt", "\\u", "fn_", ",_", "'", "w", "'_", ")_", "as_", "crt", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crt", "file_", "._", "write_", "(_", "csr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "\\u", "csr_", "(_", "csr", "\\u", "text_", ",_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "CONF_", "._", "crypto_", "._", "use", "\\u", "project", "\\u", "ca_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "project", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "sign", "\\u", "csr_", "(_", "csr", "\\u", "text_", ",_", "ca", "\\u", "folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "ensure", "\\u", "project", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "sign", "\\u", "csr_", "(_", "csr", "\\u", "text_", ",_", "ca", "\\u", "folder_", "(_", "project", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "sign", "\\u", "csr_", "(_", "csr", "\\u", "text_", ",_", "ca", "\\u", "folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "utils_", "._", "tempdir_", "(_", ")_", "as_", "tmpdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inbound", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "inbound", ".", "csr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outb", "ound_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "outb", "ound", ".", "csr", "'_", ")_", "\\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_", "open_", "(_", "inbound", "_", ",_", "'", "w", "'_", ")_", "as_", "csr", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csr", "file_", "._", "write_", "(_", "csr", "\\u", "text_", ")_", "\\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 ", " _", "with_", "excu", "tils_", "._", "save", "\\u", "and", "\\u", "reraise", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "\\u", "LE_", "(_", "'", "Fail", "ed", " ", "to", " ", "write", " ", "inbound", ".", "csr", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "'", "Fla", "gs", " ", "path", ":", " ", "%", "s", "'_", ",_", "ca", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "working", " ", "dir", " ", "to", " ", "CA_", "\\u\\u\\uNL\\u\\u\\u_", "fileu", "tils_", "._", "ensure", "\\u", "tree_", "(_", "ca", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "ca", "'_", ",_", "'-", "batch", "'_", ",_", "'-", "out", "'_", ",_", "outb", "ound_", ",_", "'-", "config", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'./", "openss", "l", ".", "cnf", "'_", ",_", "'-", "infiles", "'_", ",_", "inbound", "_", ",_", "cwd_", "=_", "ca", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "\\u", "err_", "=_", "utils_", "._", "execute_", "(_", "'", "openss", "l", "'_", ",_", "'", "x5", "09", "'_", ",_", "'-", "in", "'_", ",_", "outb", "ound_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "serial", "'_", ",_", "'-", "noo", "ut", "'_", ",_", "cwd_", "=_", "ca", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serial_", "=_", "out_", "._", "rpartition_", "(_", "'='_", ")_", "[_", "2_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "outb", "ound_", ",_", "'", "r", "'_", ")_", "as_", "crt", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "serial_", ",_", "crt", "file_", "._", "read_", "(_", ")_", ")_" ]
[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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 ]
Except block handles 'BaseException'
jumoconnect/openjumo/jumodjango/mailer/messager_tasks.py
[ { "content": "def send_user_message(message_id):\n \"\"\" Make this call appear synchronous. Usage:\n\n send_user_message(1)\n\n Actually an asynchronous task\n \"\"\"\n\n try:\n _send_user_message.delay(message_id)\n except socket.timeout:\n logging.error(\"Couldn't send message due to socket timeout. Rabbit may be down\")", "metadata": "root.send_user_message", "header": "['module', '___EOS___']", "index": 17 } ]
[]
[]
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_", "send", "\\u", "user", "\\u", "message_", "(_", "message", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Make", " ", "this", " ", "call", " ", "appear", " ", "synchron", "ous", ".", " ", "Us", "age", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "send", "\\u", "user", "\\u", "message", "(", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Actual", "ly", " ", "an", " ", "async", "hronous", " ", "task", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "send", "\\u", "user", "\\u", "message_", "._", "delay_", "(_", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "send", " ", "message", " ", "due", " ", "to", " ", "socket", " ", "timeo", "ut", ".", " ", "Ra", "bbi", "t", " ", "may", " ", "be", " ", "down", "\"_", ")_" ]
[ 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 ]
Redundant comparison
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/objects/fixed_ip.py
[ { "content": " def obj_make_compatible(self, primitive, target_version):\n super(FixedIP, self).obj_make_compatible(primitive, target_version)\n target_version = versionutils.convert_version_to_tuple(target_version)\n if target_version < (1, 4) and 'default_route' in primitive:\n del primitive['default_route']", "metadata": "root.FixedIP.obj_make_compatible", "header": "['class', 'FixedIP', '(', 'obj_base', '.', 'NovaPersistentObject', ',', 'obj_base', '.', 'NovaObject', ',', '___NL___', 'obj_base', '.', 'NovaObjectDictCompat', ')', ':', '___NEWLINE___', '# Version 1.0: Initial version', '___NL___', '# Version 1.1: Added virtual_interface field', '___NL___', '# Version 1.2: Instance version 1.14', '___NL___', '# Version 1.3: Instance 1.15', '___NL___', '# Version 1.4: Added default_route field', '___NL___', '# Version 1.5: Added floating_ips field', '___NL___', '# Version 1.6: Instance 1.16', '___NL___', '# Version 1.7: Instance 1.17', '___NL___', '# Version 1.8: Instance 1.18', '___NL___', '# Version 1.9: Instance 1.19', '___NL___', '# Version 1.10: Instance 1.20', '___NL___', '# Version 1.11: Instance 1.21', '___NL___', '# Version 1.12: Instance 1.22, FloatingIPList 1.9', '___NL___', '# Version 1.13: Instance 1.23, FloatingIPList 1.10', '___NL___', '# Version 1.14: Added vif_id kwarg to associate(_pool), FloatingIPList 1.11', '___NL___', '___EOS___']", "index": 71 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "Fix", "ed", "IP_", "(_", "obj", "\\u", "base_", "._", "Nov", "a", "Persisten", "t", "Object_", ",_", "obj", "\\u", "base_", "._", "Nov", "a", "Object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "base_", "._", "Nov", "a", "Object", "Dict", "Compat", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Version", " ", "1.0", ":", " ", "Initial", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", ":", " ", "Added", " ", "virtual", "\\u", "interface", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.2", ":", " ", "Insta", "nce", " ", "version", " ", "1.1", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.3", ":", " ", "Insta", "nce", " ", "1.1", "5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.4", ":", " ", "Added", " ", "default", "\\u", "route", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.5", ":", " ", "Added", " ", "float", "ing", "\\u", "ips", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.6", ":", " ", "Insta", "nce", " ", "1.1", "6_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.7", ":", " ", "Insta", "nce", " ", "1.1", "7_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.8", ":", " ", "Insta", "nce", " ", "1.1", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.9", ":", " ", "Insta", "nce", " ", "1.1", "9_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", "0", ":", " ", "Insta", "nce", " ", "1.2", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", "1", ":", " ", "Insta", "nce", " ", "1.2", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", "2", ":", " ", "Insta", "nce", " ", "1.2", "2", ",", " ", "Float", "ing", "IP", "List", " ", "1.9", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", "3", ":", " ", "Insta", "nce", " ", "1.23", ",", " ", "Float", "ing", "IP", "List", " ", "1.1", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.1", "4", ":", " ", "Added", " ", "vi", "f", "\\u", "id", " ", "kwarg", " ", "to", " ", "associate", "(\\u", "pool", "),", " ", "Float", "ing", "IP", "List", " ", "1.1", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "obj", "\\u", "make", "\\u", "compatible_", "(_", "self_", ",_", "primitive_", ",_", "target", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Fix", "ed", "IP_", ",_", "self_", ")_", "._", "obj", "\\u", "make", "\\u", "compatible_", "(_", "primitive_", ",_", "target", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "version_", "=_", "version", "utils_", "._", "convert", "\\u", "version", "\\u", "to", "\\u", "tuple_", "(_", "target", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "version_", "<_", "(_", "1_", ",_", "4_", ")_", "and_", "'", "default", "\\u", "route", "'_", "in_", "primitive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "primitive_", "[_", "'", "default", "\\u", "route", "'_", "]_", "\\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 ]
Unused import
amorphic/braubuddy/braubuddy/thermometer/temper_usb.py
[ { "content": "import temperusb\nfrom braubuddy.thermometer import DeviceError\nfrom braubuddy.thermometer import ReadError\nfrom braubuddy.thermometer import IThermometer\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TEMPerThermometer(IThermometer):\n \"\"\"\n TEMPer USB Thermometer manufactured by `RDing\n <http://www.rding-china.com/>`_.\n\n :raises: :class:`braubuddy.thermometer.DeviceError` if no TEMPer USB\n thermometer devices discovered.\n \"\"\"\n\n\n", "metadata": "root.TEMPerThermometer", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def __init__(self):\n temper_devices = self._get_temper_devices()\n if len(temper_devices) == 0:\n msg = 'No TEMPer devices discovered'\n raise DeviceError(msg)\n # Use first device if multiple devices discovered\n self._temper_device = temper_devices[0]", "metadata": "root.TEMPerThermometer.__init__", "header": "['class', 'TEMPerThermometer', '(', 'IThermometer', ')', ':', '___EOS___']", "index": 15 }, { "content": " def _get_temper_devices(self):\n \"\"\"\n Internal method.\n\n Get attached TEMPer devices\n\n :returns: list of attached TEMPer devices\n :rtype: :class:`list` of :class:`temperusb.TemperDevice`\n \"\"\"\n th = temperusb.TemperHandler()\n temper_devices = th.get_devices()\n return temper_devices", "metadata": "root.TEMPerThermometer._get_temper_devices", "header": "['class', 'TEMPerThermometer', '(', 'IThermometer', ')', ':', '___EOS___']", "index": 23 }, { "content": " def get_temperature(self, units='celsius'):\n try:\n return self._temper_device.get_temperature(format=units)\n except Exception as err:\n raise ReadError(\n 'Error reading device temperature: {0}'.format(err))", "metadata": "root.TEMPerThermometer.get_temperature", "header": "['class', 'TEMPerThermometer', '(', 'IThermometer', ')', ':', '___EOS___']", "index": 36 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "tempe", "rus", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bra", "ubu", "dd", "y_", "._", "thermo", "meter_", "import_", "Dev", "ice", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bra", "ubu", "dd", "y_", "._", "thermo", "meter_", "import_", "Read", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bra", "ubu", "dd", "y_", "._", "thermo", "meter_", "import_", "IT", "herm", "ometer", "_", "\\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_", "TEMP", "er", "Thermo", "meter_", "(_", "IT", "herm", "ometer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "TEMP", "er", " ", "USB", " ", "Thermo", "mete", "r", " ", "manufactur", "ed", " ", "by", " ", "`", "RD", "ing", "\\", "10", ";", " ", " ", " ", " ", "<", "http", "://", "www", ".", "rdin", "g", "-", "chin", "a", ".", "com", "/>", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "class", ":`", "bra", "ubu", "dd", "y", ".", "thermo", "mete", "r", ".", "Dev", "ice", "Error", "`", " ", "if", " ", "no", " ", "TEMP", "er", " ", "USB", "\\", "10", ";", " ", " ", " ", " ", "thermo", "mete", "r", " ", "device", "s", " ", "discovere", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TEMP", "er", "Thermo", "meter_", "(_", "IT", "herm", "ometer", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tempe", "r", "\\u", "devices_", "=_", "self_", "._", "\\u", "get", "\\u", "tempe", "r", "\\u", "devices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tempe", "r", "\\u", "devices_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "No", " ", "TEMP", "er", " ", "device", "s", " ", "discovere", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Dev", "ice", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "first", " ", "device", " ", "if", " ", "multiple", " ", "device", "s", " ", "discovere", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "tempe", "r", "\\u", "device_", "=_", "tempe", "r", "\\u", "devices_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TEMP", "er", "Thermo", "meter_", "(_", "IT", "herm", "ometer", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "tempe", "r", "\\u", "devices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Intern", "al", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "attache", "d", " ", "TEMP", "er", " ", "device", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "list", " ", "of", " ", "attache", "d", " ", "TEMP", "er", " ", "device", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "list", "`", " ", "of", " ", ":", "class", ":`", "tempe", "rus", "b", ".", "Tempe", "r", "Dev", "ice", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th_", "=_", "tempe", "rus", "b_", "._", "Tempe", "r", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempe", "r", "\\u", "devices_", "=_", "th_", "._", "get", "\\u", "devices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tempe", "r", "\\u", "devices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TEMP", "er", "Thermo", "meter_", "(_", "IT", "herm", "ometer", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "temperature_", "(_", "self_", ",_", "units_", "=_", "'", "cel", "sius", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "tempe", "r", "\\u", "device_", "._", "get", "\\u", "temperature_", "(_", "format_", "=_", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Read", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Error", " ", "readi", "ng", " ", "device", " ", "tempe", "ratur", "e", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "err_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
gatoatigrado/vimap/vimap/ext/sugar.py
[ { "content": "def imap_unordered(fcn, iterable, **kwargs):\n \"\"\"Maps a function over an iterable. Essentially equivalent to\n multiprocessing.Pool().imap_unordered(fcn, iterable). Since vimap\n fixes bugs in multiprocessing, this function can be a nice alternative.\n\n Keyword arguments:\n num_workers (from fork_identical) -- number of workers\n extra keyword arguments: passed to the function on each iteration\n \"\"\"\n @vimap.worker_process.worker\n def worker(inputs, **kwargs2):\n for in_ in inputs:\n yield fcn(in_, **kwargs2)\n pool = vimap.pool.fork_identical(worker, **kwargs)\n for _, output in pool.imap(iterable).zip_in_out():\n yield output", "metadata": "root.imap_unordered", "header": "['module', '___EOS___']", "index": 10 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "imap", "\\u", "unordered", "_", "(_", "fcn", "_", ",_", "iterable_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Map", "s", " ", "a", " ", "function", " ", "over", " ", "an", " ", "iterable", ".", " ", "Ess", "ential", "ly", " ", "equivalent", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "multipro", "cess", "ing", ".", "Poo", "l", "()", ".", "imap", "\\u", "unordered", "(", "fcn", ",", " ", "iterable", ").", " ", "Sin", "ce", " ", "vim", "ap", "\\", "10", ";", " ", " ", " ", " ", "fixes", " ", "bug", "s", " ", "in", " ", "multipro", "cess", "ing", ",", " ", "this", " ", "function", " ", "can", " ", "be", " ", "a", " ", "nice", " ", "alternative", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Key", "word", " ", "argu", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "worker", "s", " ", "(", "from", " ", "fork", "\\u", "identi", "cal", ")", " ", "--", " ", "number", " ", "of", " ", "worker", "s", "\\", "10", ";", " ", " ", " ", " ", "extra", " ", "keyw", "ord", " ", "argu", "ment", "s", ":", " ", "pass", "ed", " ", "to", " ", "the", " ", "function", " ", "on", " ", "each", " ", "iterati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "vim", "ap_", "._", "worker", "\\u", "process_", "._", "worker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "worker_", "(_", "inputs_", ",_", "**_", "kwarg", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "in\\u_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "fcn", "_", "(_", "in\\u_", ",_", "**_", "kwarg", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pool_", "=_", "vim", "ap_", "._", "pool_", "._", "fork", "\\u", "identical_", "(_", "worker_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_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 2, 2 ]
Unused import
remyzane/flask-http-api/http_api/element.py
[ { "content": "import os\nimport logging\nimport docutils\nfrom docutils.core import publish_doctree\n\nfrom .parameter import Param, List\nfrom .utility import rst_to_html\n\nlog = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Element(object):\n \"\"\"\n element: {\n title: 'xxxxx',\n description: 'xxxxxx',\n response: response,\n plugins: (class_A, class_B),\n plugin_keys: ('plugin_a', 'plugin_b'),\n param_not_null: ('xx', 'yy'),\n param_allow_null: ('zz',),\n param_index: ('xx', 'yy', 'zz'),\n param_list: (\n {\n name: xxx,\n type: class_A,\n requisite: True/False,\n description: 'xxxxx'\n },\n ...\n ),\n param_dict: {\n xxx: {\n name: xxx,\n type: class_A,\n requisite: True/False,\n description: 'xxxxx'\n },\n ...\n },\n param_default: {\n 'xx': None,\n 'yy': None,\n 'zz': None\n }\n code_index: ('xx', 'yy', 'zz'),\n code_list: (\n ('xx', 'xxxxxxx', 'common'),\n ('yy', 'yyyyyyy', 'plugin'),\n ('zz', 'zzzzzzz', 'type'),\n ('aa', 'aaaaaaa', 'biz')\n )\n code_dict: {\n 'xx': 'xxxxxxx',\n 'yy': 'yyyyyyy',\n 'zz': 'zzzzzzz'\n }\n \"\"\"\n title = None\n\n description = None\n\n response = None\n\n plugin = None\n\n param_list = None\n\n param_dict = None\n\n param_index = None\n\n param_default = None\n\n param_not_null = None\n\n param_allow_null = None\n\n param_types = None\n\n code_index = None\n\n code_dict = None\n\n\n\n\n", "metadata": "root.Element", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, app, view, method):\n self.title = ''\n self.plugins = []\n self.plugin_keys = []\n self.param_list = []\n self.param_dict = {}\n self.param_index = []\n self.param_default = {}\n self.param_not_null = []\n self.param_allow_null = []\n self.param_types = {}\n self.code_index = []\n self.code_list = []\n self.code_dict = {}\n self.__element_code_set('success', 'Success', 'common')\n self.__element_code_set('exception', 'Unknown exception', 'common')\n self.__element_code_set('param_unknown', 'Unknown parameter', 'common')\n if not method.__doc__:\n raise Exception('%s.%s doc not undefined' % (view.__name__, method.__name__))\n try:\n doc_field = publish_doctree(method.__doc__)\n self.__parse_doc_tree(app, view, method, doc_field)\n self.__clear_up(app)\n except Exception:\n log.exception('element defined error')", "metadata": "root.Element.__init__", "header": "['class', 'Element', '(', 'object', ')', ':', '___EOS___']", "index": 84 }, { "content": " def __clear_up(self, app):\n if self.param_not_null:\n self.code_index.insert(2, 'param_missing')\n self.code_list.insert(2, ('param_missing', 'Missing parameter', 'common'))\n self.code_dict['param_missing'] = 'Missing parameter'\n self.plugins = tuple(self.plugins)\n self.plugin_keys = tuple(self.plugin_keys)\n self.param_list = tuple(self.param_list)\n self.param_not_null = tuple(self.param_not_null)\n self.param_allow_null = tuple(self.param_allow_null)\n self.param_index = self.param_not_null + self.param_allow_null\n self.code_index = tuple(self.code_index)\n self.code_list = tuple(self.code_list)\n self.response = self.response or app.config['responses']['default']\n self.description = self.description or ''", "metadata": "root.Element.__clear_up", "header": "['class', 'Element', '(', 'object', ')', ':', '___EOS___']", "index": 110 }, { "content": " def __element_code_set(self, error_code, error_message, category='biz'):\n if error_code not in self.code_index:\n self.code_index.append(error_code)\n self.code_list.append((error_code, error_message, category))\n self.code_dict[error_code] = error_message", "metadata": "root.Element.__element_code_set", "header": "['class', 'Element', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " def __parse_doc_field(self, app, view, method, doc_field):\n name = doc_field.children[0].astext()\n content = rst_to_html(doc_field.children[1].rawsource)\n if name == 'response':\n self.response = app.config['responses'][content]\n elif name == 'plugin':\n for item in content.split():\n plugin = app.config['plugins'].get(item)\n if not plugin:\n raise Exception('%s.%s use undefined plugin %s' % (view.__name__, method.__name__, item))\n self.plugins.append(plugin)\n self.plugin_keys.append(item)\n for error_code, error_message in plugin.error_codes.items():\n self.__element_code_set(error_code, error_message, 'plugin ' + item)\n elif name.startswith('raise '):\n self.__element_code_set(name[6:], content)\n elif name.startswith('param '):\n items = name[6:].split()\n param_type = items[0]\n if param_type.endswith(']'):\n sub_type = app.config['parameter_types'].get(param_type.split('[')[1][:-1])\n param_type = app.config['parameter_types'].get(param_type.split('[')[0])\n param_type = param_type(sub_type)\n else:\n param_type = app.config['parameter_types'].get(param_type)\n if not param_type:\n raise Exception('%s.%s use undefined parameter type %s' % (self.__name__, method.__name__, items[0]))\n if method.__name__.upper() not in param_type.support:\n raise Exception('%s.%s use parameter %s type that not support %s method.' %\n (self.__name__, method.__name__, param_type.__name__, method.__name__.upper()))\n param = {'name': items[-1], 'type': param_type, 'requisite': False, 'description': content}\n if len(items) > 2 and items[1] == '*':\n param['requisite'] = True\n self.param_not_null.append(items[-1])\n else:\n self.param_allow_null.append(items[-1])\n self.param_list.append(param)\n self.param_dict[items[-1]] = param\n self.param_default[items[-1]] = None\n self.param_types[items[-1]] = param_type\n if isinstance(param['type'], List):\n self.__element_code_set(param_type.type.error_code, param_type.type.description, 'type')\n self.__element_code_set(param_type.error_code, param_type.description % param_type.type.__name__, 'type')\n elif param['type'] != Param:\n self.__element_code_set(param_type.error_code, param_type.description, 'type')\n else:\n setattr(self, name, content)", "metadata": "root.Element.__parse_doc_field", "header": "['class', 'Element', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": " def __parse_doc_tree(self, app, view, method, doc_tree):\n if type(doc_tree) == docutils.nodes.term:\n self.title = rst_to_html(doc_tree.rawsource)\n return\n\n if type(doc_tree) == docutils.nodes.paragraph:\n if self.description is None:\n self.title = self.title + rst_to_html(doc_tree.rawsource)\n self.description = ''\n elif self.description == '':\n self.description = rst_to_html(doc_tree.rawsource)\n else:\n self.description = self.description + os.linesep * 2 + rst_to_html(doc_tree.rawsource)\n return\n\n if type(doc_tree) == docutils.nodes.field:\n self.__parse_doc_field(app, view, method, doc_tree)\n return\n\n for item in doc_tree.children:\n self.__parse_doc_tree(app, view, method, item)", "metadata": "root.Element.__parse_doc_tree", "header": "['class', 'Element', '(', 'object', ')', ':', '___EOS___']", "index": 180 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "docutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "core_", "import_", "publi", "sh", "\\u", "doct", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "parameter_", "import_", "Param_", ",_", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utility_", "import_", "rst", "\\u", "to", "\\u", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "element", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "title", ":", " ", "'", "xxx", "xx", "',", "\\", "10", ";", " ", " ", " ", " ", "description", ":", " ", "'", "xxxxxx", "',", "\\", "10", ";", " ", " ", " ", " ", "response", ":", " ", "response", ",", "\\", "10", ";", " ", " ", " ", " ", "plugin", "s", ":", " ", "(", "class", "\\u", "A", ",", " ", "class", "\\u", "B", "),", "\\", "10", ";", " ", " ", " ", " ", "plugin", "\\u", "keys", ":", " ", "('", "plugin", "\\u", "a", "',", " ", "'", "plugin", "\\u", "b", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "not", "\\u", "null", ":", " ", "('", "xx", "',", " ", "'", "yy", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "allow", "\\u", "null", ":", " ", "('", "zz", "',", "),", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "index", ":", " ", "('", "xx", "',", " ", "'", "yy", "',", " ", "'", "zz", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "list", ":", " ", "(", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "xxx", ",", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "class", "\\u", "A", ",", "\\", "10", ";", " ", " ", " ", " ", "requisit", "e", ":", " ", "Tru", "e", "/", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "description", ":", " ", "'", "xxx", "xx", "'", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "),", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "dict", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "xxx", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "xxx", ",", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "class", "\\u", "A", ",", "\\", "10", ";", " ", " ", " ", " ", "requisit", "e", ":", " ", "Tru", "e", "/", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "description", ":", " ", "'", "xxx", "xx", "'", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "default", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "'", "xx", "':", " ", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "yy", "':", " ", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "zz", "':", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "code", "\\u", "index", ":", " ", "('", "xx", "',", " ", "'", "yy", "',", " ", "'", "zz", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "code", "\\u", "list", ":", " ", "(", "\\", "10", ";", " ", " ", " ", " ", "('", "xx", "',", " ", "'", "xxxxxx", "x", "',", " ", "'", "common", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "('", "yy", "',", " ", "'", "yyyy", "yyy", "',", " ", "'", "plugin", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "('", "zz", "',", " ", "'", "zzz", "zzz", "z", "',", " ", "'", "type", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "('", "aa", "',", " ", "'", "aaaaa", "aa", "',", " ", "'", "biz", "')", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "code", "\\u", "dict", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "'", "xx", "':", " ", "'", "xxxxxx", "x", "',", "\\", "10", ";", " ", " ", " ", " ", "'", "yy", "':", " ", "'", "yyyy", "yyy", "',", "\\", "10", ";", " ", " ", " ", " ", "'", "zz", "':", " ", "'", "zzz", "zzz", "z", "'", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plugin_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "list_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "index_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "default_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "not", "\\u", "null_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "allow", "\\u", "null_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "types_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "index_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app_", ",_", "view_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "title_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plugins_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plugin", "\\u", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "index_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "default_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "not", "\\u", "null_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "allow", "\\u", "null_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "types_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "index_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "'", "success", "'_", ",_", "'", "Success", "'_", ",_", "'", "common", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "'", "exception", "'_", ",_", "'", "Un", "know", "n", " ", "exception", "'_", ",_", "'", "common", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "'", "param", "\\u", "unknown", "'_", ",_", "'", "Un", "know", "n", " ", "parameter", "'_", ",_", "'", "common", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "method_", "._", "\\u\\u", "doc\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'%", "s", ".", "%", "s", " ", "doc", " ", "not", " ", "undefined", "'_", "%_", "(_", "view_", "._", "\\u\\u", "name\\u\\u_", ",_", "method_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc", "\\u", "field_", "=_", "publi", "sh", "\\u", "doct", "ree_", "(_", "method_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "parse", "\\u", "doc", "\\u", "tree_", "(_", "app_", ",_", "view_", ",_", "method_", ",_", "doc", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "clear", "\\u", "up_", "(_", "app_", ")_", "\\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 ", " _", "log_", "._", "exception_", "(_", "'", "element", " ", "defin", "ed", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "clear", "\\u", "up_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "param", "\\u", "not", "\\u", "null_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "code", "\\u", "index_", "._", "insert_", "(_", "2_", ",_", "'", "param", "\\u", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "list_", "._", "insert_", "(_", "2_", ",_", "(_", "'", "param", "\\u", "missi", "ng", "'_", ",_", "'", "Missing", " ", "parameter", "'_", ",_", "'", "common", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "dict_", "[_", "'", "param", "\\u", "missi", "ng", "'_", "]_", "=_", "'", "Missing", " ", "parameter", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "plugins_", "=_", "tuple_", "(_", "self_", "._", "plugins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plugin", "\\u", "keys_", "=_", "tuple_", "(_", "self_", "._", "plugin", "\\u", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "list_", "=_", "tuple_", "(_", "self_", "._", "param", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "not", "\\u", "null_", "=_", "tuple_", "(_", "self_", "._", "param", "\\u", "not", "\\u", "null_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "allow", "\\u", "null_", "=_", "tuple_", "(_", "self_", "._", "param", "\\u", "allow", "\\u", "null_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "index_", "=_", "self_", "._", "param", "\\u", "not", "\\u", "null_", "+_", "self_", "._", "param", "\\u", "allow", "\\u", "null_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "index_", "=_", "tuple_", "(_", "self_", "._", "code", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "list_", "=_", "tuple_", "(_", "self_", "._", "code", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "self_", "._", "response_", "or_", "app_", "._", "config_", "[_", "'", "response", "s", "'_", "]_", "[_", "'", "default", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "self_", "._", "description_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "self_", ",_", "error", "\\u", "code_", ",_", "error", "\\u", "message_", ",_", "category_", "=_", "'", "biz", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "error", "\\u", "code_", "not_", "in_", "self_", "._", "code", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "code", "\\u", "index_", "._", "append_", "(_", "error", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "list_", "._", "append_", "(_", "(_", "error", "\\u", "code_", ",_", "error", "\\u", "message_", ",_", "category_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code", "\\u", "dict_", "[_", "error", "\\u", "code_", "]_", "=_", "error", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "parse", "\\u", "doc", "\\u", "field_", "(_", "self_", ",_", "app_", ",_", "view_", ",_", "method_", ",_", "doc", "\\u", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "doc", "\\u", "field_", "._", "children_", "[_", "0_", "]_", "._", "ast", "ext_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "rst", "\\u", "to", "\\u", "html_", "(_", "doc", "\\u", "field_", "._", "children_", "[_", "1_", "]_", "._", "raws", "ource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "response", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "=_", "app_", "._", "config_", "[_", "'", "response", "s", "'_", "]_", "[_", "content_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'", "plugin", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "content_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin_", "=_", "app_", "._", "config_", "[_", "'", "plugin", "s", "'_", "]_", "._", "get_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "'%", "s", ".", "%", "s", " ", "use", " ", "undefined", " ", "plugin", " ", "%", "s", "'_", "%_", "(_", "view_", "._", "\\u\\u", "name\\u\\u_", ",_", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "plugins_", "._", "append_", "(_", "plugin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plugin", "\\u", "keys_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error", "\\u", "code_", ",_", "error", "\\u", "message_", "in_", "plugin_", "._", "error", "\\u", "codes_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "error", "\\u", "code_", ",_", "error", "\\u", "message_", ",_", "'", "plugin", " ", "'_", "+_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "startswith_", "(_", "'", "raise", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "name_", "[_", "6_", ":_", "]_", ",_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "startswith_", "(_", "'", "param", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "name_", "[_", "6_", ":_", "]_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "type_", "=_", "items_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "param", "\\u", "type_", "._", "endswith_", "(_", "']'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "type_", "=_", "app_", "._", "config_", "[_", "'", "parameter", "\\u", "types", "'_", "]_", "._", "get_", "(_", "param", "\\u", "type_", "._", "split_", "(_", "'['_", ")_", "[_", "1_", "]_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "type_", "=_", "app_", "._", "config_", "[_", "'", "parameter", "\\u", "types", "'_", "]_", "._", "get_", "(_", "param", "\\u", "type_", "._", "split_", "(_", "'['_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "type_", "=_", "param", "\\u", "type_", "(_", "sub\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "type_", "=_", "app_", "._", "config_", "[_", "'", "parameter", "\\u", "types", "'_", "]_", "._", "get_", "(_", "param", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "param", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'%", "s", ".", "%", "s", " ", "use", " ", "undefined", " ", "parameter", " ", "type", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "\\u\\u", "name\\u\\u_", ",_", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "items_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "method_", "._", "\\u\\u", "name\\u\\u_", "._", "upper_", "(_", ")_", "not_", "in_", "param", "\\u", "type_", "._", "support_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'%", "s", ".", "%", "s", " ", "use", " ", "parameter", " ", "%", "s", " ", "type", " ", "tha", "t", " ", "not", " ", "support", " ", "%", "s", " ", "method", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "\\u\\u", "name\\u\\u_", ",_", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "param", "\\u", "type_", "._", "\\u\\u", "name\\u\\u_", ",_", "method_", "._", "\\u\\u", "name\\u\\u_", "._", "upper_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "param_", "=_", "{_", "'", "name", "'_", ":_", "items_", "[_", "-_", "1_", "]_", ",_", "'", "type", "'_", ":_", "param", "\\u", "type_", ",_", "'", "requisit", "e", "'_", ":_", "False_", ",_", "'", "description", "'_", ":_", "content_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "items_", ")_", ">_", "2_", "and_", "items_", "[_", "1_", "]_", "==_", "'*'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "[_", "'", "requisit", "e", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "not", "\\u", "null_", "._", "append_", "(_", "items_", "[_", "-_", "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 ", " _", "self_", "._", "param", "\\u", "allow", "\\u", "null_", "._", "append_", "(_", "items_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "param", "\\u", "list_", "._", "append_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "dict_", "[_", "items_", "[_", "-_", "1_", "]_", "]_", "=_", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "default_", "[_", "items_", "[_", "-_", "1_", "]_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "types_", "[_", "items_", "[_", "-_", "1_", "]_", "]_", "=_", "param", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "param_", "[_", "'", "type", "'_", "]_", ",_", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "param", "\\u", "type_", "._", "type_", "._", "error", "\\u", "code_", ",_", "param", "\\u", "type_", "._", "type_", "._", "description_", ",_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "param", "\\u", "type_", "._", "error", "\\u", "code_", ",_", "param", "\\u", "type_", "._", "description_", "%_", "param", "\\u", "type_", "._", "type_", "._", "\\u\\u", "name\\u\\u_", ",_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "param_", "[_", "'", "type", "'_", "]_", "!=_", "Param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "element", "\\u", "code", "\\u", "set_", "(_", "param", "\\u", "type_", "._", "error", "\\u", "code_", ",_", "param", "\\u", "type_", "._", "description_", ",_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "name_", ",_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "parse", "\\u", "doc", "\\u", "tree_", "(_", "self_", ",_", "app_", ",_", "view_", ",_", "method_", ",_", "doc", "\\u", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "doc", "\\u", "tree_", ")_", "==_", "docutils_", "._", "nodes_", "._", "term_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "title_", "=_", "rst", "\\u", "to", "\\u", "html_", "(_", "doc", "\\u", "tree_", "._", "raws", "ource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "doc", "\\u", "tree_", ")_", "==_", "docutils_", "._", "nodes_", "._", "paragraph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "description_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "title_", "=_", "self_", "._", "title_", "+_", "rst", "\\u", "to", "\\u", "html_", "(_", "doc", "\\u", "tree_", "._", "raws", "ource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "description_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "description_", "=_", "rst", "\\u", "to", "\\u", "html_", "(_", "doc", "\\u", "tree_", "._", "raws", "ource_", ")_", "\\u\\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_", "._", "description_", "=_", "self_", "._", "description_", "+_", "os_", "._", "linesep_", "*_", "2_", "+_", "rst", "\\u", "to", "\\u", "html_", "(_", "doc", "\\u", "tree_", "._", "raws", "ource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "doc", "\\u", "tree_", ")_", "==_", "docutils_", "._", "nodes_", "._", "field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "parse", "\\u", "doc", "\\u", "field_", "(_", "app_", ",_", "view_", ",_", "method_", ",_", "doc", "\\u", "tree_", ")_", "\\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_", "for_", "item_", "in_", "doc", "\\u", "tree_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "parse", "\\u", "doc", "\\u", "tree_", "(_", "app_", ",_", "view_", ",_", "method_", ",_", "item_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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xdog-studios/pyddp/ddp/messages/server/moved_before_message_serializer.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright 2014 Foxdog Studios\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\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom .constants import MSG_MOVED_BEFORE\nfrom .server_message_serializer import ServerMessageSerializer\n\n__all__ = ['MovedBeforeMessageSerializer']\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MovedBeforeMessageSerializer(ServerMessageSerializer):\n MESSAGE_TYPE = MSG_MOVED_BEFORE\n", "metadata": "root.MovedBeforeMessageSerializer", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def serialize_fields(self, message):\n return {\n 'collection': message.collection,\n 'id': message.id,\n 'before': message.before,\n }", "metadata": "root.MovedBeforeMessageSerializer.serialize_fields", "header": "['class', 'MovedBeforeMessageSerializer', '(', 'ServerMessageSerializer', ')', ':', '___EOS___']", "index": 29 } ]
[]
[]
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", " ", "2014", " ", "Fo", "xd", "og", " ", "Stud", "ios_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\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_", "from_", "._", "constants_", "import_", "MS", "G", "\\u", "MOVE", "D", "\\u", "BEFORE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "server", "\\u", "message", "\\u", "serializer_", "import_", "Server", "Messag", "e", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Move", "d", "Be", "fore", "Messag", "e", "Seriali", "zer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Move", "d", "Be", "fore", "Messag", "e", "Serializer_", "(_", "Server", "Messag", "e", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MESSAGE", "\\u", "TYPE_", "=_", "MS", "G", "\\u", "MOVE", "D", "\\u", "BEFORE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Move", "d", "Be", "fore", "Messag", "e", "Serializer_", "(_", "Server", "Messag", "e", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "serialize", "\\u", "fields_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "message_", "._", "collection_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "message_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bef", "ore", "'_", ":_", "message_", "._", "before_", ",_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
ashcrow/flask-track-usage/test/test_storage_sqlalchemy.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Mar 24 21:31:41 2014\n\n@author: Goutham\n\"\"\"\n\ntry:\n import sqlalchemy as sql\n HAS_SQLALCHEMY = True\nexcept ImportError:\n HAS_SQLALCHEMY = False\n\ntry:\n import psycopg2\n HAS_POSTGRES = True\nexcept ImportError:\n HAS_POSTGRES = False\n\ntry:\n import _mysql\n HAS_MYSQL = True\nexcept ImportError:\n HAS_MYSQL = False\n\nimport datetime\nimport unittest\nfrom flask import Blueprint\nfrom test import FlaskTrackUsageTestCase\nfrom flask_track_usage import TrackUsage\nfrom flask_track_usage.storage.sql import SQLStorage\n\n\n\n\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_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Mon", " ", "Mar", " ", "24", " ", "21", ":", "3", "1", ":", "4", "1", " ", "2014", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Go", "uth", "am", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sqlalchemy_", "as_", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "SQL", "ALC", "HEM", "Y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HAS", "\\u", "SQL", "ALC", "HEM", "Y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "psycopg2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "POST", "GRES", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HAS", "\\u", "POST", "GRES", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u", "mysql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "MYSQL", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HAS", "\\u", "MYSQL", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "Blueprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "import_", "Fla", "sk", "Track", "Us", "age", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "track", "\\u", "usage_", "import_", "Track", "Usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "track", "\\u", "usage_", "._", "storage_", "._", "sql_", "import_", "SQL", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
SpriteLink/NIPAP/nipap-www/nipapwww/tests/functional/test_auth.py
[ { "content": "class TestAuthController(TestController):\n", "metadata": "root.TestAuthController", "header": "['module', '___EOS___']", "index": 2 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Auth", "Controller_", "(_", "Test", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/choices/tests.py
[ { "content": " def test_display(self):\n a = Person.objects.create(name='Adrian', gender='M')\n s = Person.objects.create(name='Sara', gender='F')\n self.assertEqual(a.gender, 'M')\n self.assertEqual(s.gender, 'F')\n\n self.assertEqual(a.get_gender_display(), 'Male')\n self.assertEqual(s.get_gender_display(), 'Female')\n\n # If the value for the field doesn't correspond to a valid choice,\n # the value itself is provided as a display value.\n a.gender = ''\n self.assertEqual(a.get_gender_display(), '')\n\n a.gender = 'U'\n self.assertEqual(a.get_gender_display(), 'U')", "metadata": "root.ChoicesTests.test_display", "header": "['class', 'ChoicesTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 8 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Choi", "ces", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "display_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "Person_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Adr", "ian", "'_", ",_", "gender_", "=_", "'", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Person_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Sar", "a", "'_", ",_", "gender_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "gender_", ",_", "'", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "gender_", ",_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "get", "\\u", "gender", "\\u", "display_", "(_", ")_", ",_", "'", "Mal", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "get", "\\u", "gender", "\\u", "display_", "(_", ")_", ",_", "'", "Fe", "male", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "value", " ", "for", " ", "the", " ", "field", " ", "doe", "sn", "'", "t", " ", "correspond", " ", "to", " ", "a", " ", "valid", " ", "choice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "value", " ", "its", "elf", " ", "is", " ", "provided", " ", "as", " ", "a", " ", "display", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "gender_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "get", "\\u", "gender", "\\u", "display_", "(_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "gender_", "=_", "'", "U", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "get", "\\u", "gender", "\\u", "display_", "(_", ")_", ",_", "'", "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 ]
Unused local variable
mayan-edms/mayan-edms/mayan/apps/smart_settings/tests/test_view_permissions.py
[ { "content": " def test_view_access_permitted(self):\n self.role.permissions.add(permission_settings_view.stored_permission)\n\n response = self.client.get(reverse('settings:namespace_list'))\n self.assertEqual(response.status_code, 200)\n\n response = self.client.get(\n reverse('settings:namespace_detail', args=('common',),)\n )\n self.assertEqual(response.status_code, 200)", "metadata": "root.SmartSettingViewPermissionsTestCase.test_view_access_permitted", "header": "['class', 'SmartSettingViewPermissionsTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sma", "rt", "Sett", "ing", "View", "Permi", "ssion", "s", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "view", "\\u", "access", "\\u", "permit", "ted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "role_", "._", "permissions_", "._", "add_", "(_", "permissi", "on", "\\u", "settings", "\\u", "view_", "._", "store", "d\\u", "permission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "settings", ":", "namespace", "\\u", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "settings", ":", "namespace", "\\u", "deta", "il", "'_", ",_", "args_", "=_", "(_", "'", "common", "'_", ",_", ")_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_" ]
[ 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 ]
Except block handles 'BaseException'
getsentry/raven-python/raven/contrib/django/views.py
[ { "content": "@csrf_exempt\n@require_http_methods(['GET', 'POST', 'OPTIONS'])\n@never_cache\n@with_origin\ndef report(request, project_id=None):\n if request.method == 'OPTIONS':\n return HttpResponse()\n\n if request.method == 'POST':\n if hasattr(request, 'body'):\n data = request.body\n else:\n data = request.raw_post_data\n else:\n data = request.GET.get('sentry_data')\n\n if not data:\n return HttpResponseBadRequest()\n\n try:\n decoded = json.loads(data.decode('utf8'))\n except json.JSONDecodeError:\n return HttpResponseBadRequest()\n\n client.send(auth_header=extract_auth_vars(request), **decoded)\n\n return HttpResponse()", "metadata": "root.report", "header": "['module', '___EOS___']", "index": 81 } ]
[]
[]
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_", "@_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "http", "\\u", "methods_", "(_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "neve", "r", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "with", "\\u", "origin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "report_", "(_", "request_", ",_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "OPTION", "S", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "request_", ",_", "'", "body", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "request_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "request_", "._", "raw", "\\u", "post", "\\u", "data_", "\\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 ", " _", "data_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "sentry", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", ")_", "\\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 ", " _", "decoded_", "=_", "json_", "._", "loads_", "(_", "data_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "json_", "._", "JSO", "ND", "ecode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "send_", "(_", "auth", "\\u", "header_", "=_", "extract", "\\u", "auth", "\\u", "vars_", "(_", "request_", ")_", ",_", "**_", "decoded_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", ")_" ]
[ 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 ]
Unused import
CollabQ/CollabQ/vendor/gdata/photos/__init__.py
[ { "content": "# -*-*- encoding: utf-8 -*-*-\n#\n# This is the base file for the PicasaWeb python client.\n# It is used for lower level operations.\n#\n# $Id: __init__.py 148 2007-10-28 15:09:19Z havard.gulldahl $\n#\n# Copyright 2007 Håvard Gulldahl \n# Portions (C) 2006 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"This module provides a pythonic, gdata-centric interface to Google Photos\n(a.k.a. Picasa Web Services.\n\nIt is modelled after the gdata/* interfaces from the gdata-python-client\nproject[1] by Google. \n\nYou'll find the user-friendly api in photos.service. Please see the\ndocumentation or live help() system for available methods.\n\n[1]: http://gdata-python-client.googlecode.com/\n\n \"\"\"\n\n__author__ = u'havard@gulldahl.no'# (Håvard Gulldahl)' #BUG: pydoc chokes on non-ascii chars in __author__\n__license__ = 'Apache License v2'\n__version__ = '$Revision: 164 $'[11:-2]\n\nimport re\ntry:\n from xml.etree import cElementTree as ElementTree\nexcept ImportError:\n try:\n import cElementTree as ElementTree\n except ImportError:\n try:\n from xml.etree import ElementTree\n except ImportError:\n from elementtree import ElementTree\nimport atom\nimport gdata\n\n# importing google photo submodules\nimport gdata.media as Media, gdata.exif as Exif, gdata.geo as Geo\n\n# XML namespaces which are often used in Google Photo elements\nPHOTOS_NAMESPACE = 'http://schemas.google.com/photos/2007'\nMEDIA_NAMESPACE = 'http://search.yahoo.com/mrss/'\nEXIF_NAMESPACE = 'http://schemas.google.com/photos/exif/2007'\nOPENSEARCH_NAMESPACE = 'http://a9.com/-/spec/opensearchrss/1.0/'\nGEO_NAMESPACE = 'http://www.w3.org/2003/01/geo/wgs84_pos#'\nGML_NAMESPACE = 'http://www.opengis.net/gml'\nGEORSS_NAMESPACE = 'http://www.georss.org/georss'\nPHEED_NAMESPACE = 'http://www.pheed.com/pheed/'\nBATCH_NAMESPACE = 'http://schemas.google.com/gdata/batch'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n########################## ################################\n\n\n\n \n \n\n\n\n\n\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 PhotosBaseElement(atom.AtomBase):\n \"\"\"Base class for elements in the PHOTO_NAMESPACE. To add new elements,\n you only need to add the element tag name to self._tag\n \"\"\"\n \n _tag = ''\n _namespace = PHOTOS_NAMESPACE\n _children = atom.AtomBase._children.copy()\n _attributes = atom.AtomBase._attributes.copy()\n\n #def __str__(self):\n #return str(self.text)\n #def __unicode__(self):\n #return unicode(self.text)", "metadata": "root.PhotosBaseElement", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def __init__(self, name=None, extension_elements=None,\n extension_attributes=None, text=None):\n self.name = name\n self.text = text\n self.extension_elements = extension_elements or []\n self.extension_attributes = extension_attributes or {}", "metadata": "root.PhotosBaseElement.__init__", "header": "['class', 'PhotosBaseElement', '(', 'atom', '.', 'AtomBase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def __int__(self):\n return int(self.text)", "metadata": "root.PhotosBaseElement.__int__", "header": "['class', 'PhotosBaseElement', '(', 'atom', '.', 'AtomBase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def bool(self):\n return self.text == 'true'", "metadata": "root.PhotosBaseElement.bool", "header": "['class', 'PhotosBaseElement', '(', 'atom', '.', 'AtomBase', ')', ':', '___EOS___']", "index": 90 }, { "content": "class GPhotosBaseFeed(gdata.GDataFeed, gdata.LinkFinder):\n \"Base class for all Feeds in gdata.photos\"\n _tag = 'feed'\n _namespace = atom.ATOM_NAMESPACE\n _attributes = gdata.GDataFeed._attributes.copy()\n _children = gdata.GDataFeed._children.copy()\n # We deal with Entry elements ourselves\n del _children['{%s}entry' % atom.ATOM_NAMESPACE]\n \n\n \n ", "metadata": "root.GPhotosBaseFeed", "header": "['module', '___EOS___']", "index": 93 }, { "content": " def __init__(self, author=None, category=None, contributor=None,\n generator=None, icon=None, atom_id=None, link=None, logo=None,\n rights=None, subtitle=None, title=None, updated=None,\n entry=None, total_results=None, start_index=None,\n items_per_page=None, extension_elements=None,\n extension_attributes=None, text=None):\n gdata.GDataFeed.__init__(self, author=author, category=category,\n contributor=contributor, generator=generator,\n icon=icon, atom_id=atom_id, link=link,\n logo=logo, rights=rights, subtitle=subtitle,\n title=title, updated=updated, entry=entry,\n total_results=total_results,\n start_index=start_index,\n items_per_page=items_per_page,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes,\n text=text)", "metadata": "root.GPhotosBaseFeed.__init__", "header": "['class', 'GPhotosBaseFeed', '(', 'gdata', '.', 'GDataFeed', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 102 }, { "content": " def kind(self):\n \"(string) Returns the kind\"\n try:\n return self.category[0].term.split('#')[1]\n except IndexError:\n return None", "metadata": "root.GPhotosBaseFeed.kind", "header": "['class', 'GPhotosBaseFeed', '(', 'gdata', '.', 'GDataFeed', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 120 }, { "content": " def _feedUri(self, kind):\n \"Convenience method to return a uri to a feed of a special kind\"\n assert(kind in ('album', 'tag', 'photo', 'comment', 'user'))\n here_href = self.GetSelfLink().href\n if 'kind=%s' % kind in here_href:\n return here_href\n if not 'kind=' in here_href:\n sep = '?'\n if '?' in here_href: sep = '&'\n return here_href + \"%skind=%s\" % (sep, kind)\n rx = re.match('.*(kind=)(album|tag|photo|comment)', here_href)\n return here_href[:rx.end(1)] + kind + here_href[rx.end(2):]", "metadata": "root.GPhotosBaseFeed._feedUri", "header": "['class', 'GPhotosBaseFeed', '(', 'gdata', '.', 'GDataFeed', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 127 }, { "content": " def _ConvertElementTreeToMember(self, child_tree):\n \"\"\"Re-implementing the method from AtomBase, since we deal with\n Entry elements specially\"\"\"\n category = child_tree.find('{%s}category' % atom.ATOM_NAMESPACE)\n if category is None:\n return atom.AtomBase._ConvertElementTreeToMember(self, child_tree)\n namespace, kind = category.get('term').split('#')\n if namespace != PHOTOS_NAMESPACE:\n return atom.AtomBase._ConvertElementTreeToMember(self, child_tree)\n ## TODO: is it safe to use getattr on gdata.photos?\n entry_class = getattr(gdata.photos, '%sEntry' % kind.title())\n if not hasattr(self, 'entry') or self.entry is None:\n self.entry = []\n self.entry.append(atom._CreateClassFromElementTree(\n entry_class, child_tree))", "metadata": "root.GPhotosBaseFeed._ConvertElementTreeToMember", "header": "['class', 'GPhotosBaseFeed', '(', 'gdata', '.', 'GDataFeed', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 140 }, { "content": "class GPhotosBaseEntry(gdata.GDataEntry, gdata.LinkFinder):\n \"Base class for all Entry elements in gdata.photos\"\n _tag = 'entry'\n _kind = ''\n _namespace = atom.ATOM_NAMESPACE\n _children = gdata.GDataEntry._children.copy()\n _attributes = gdata.GDataEntry._attributes.copy()\n \n\n ", "metadata": "root.GPhotosBaseEntry", "header": "['module', '___EOS___']", "index": 156 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None,\n title=None, updated=None,\n extended_property=None,\n extension_elements=None, extension_attributes=None, text=None):\n gdata.GDataEntry.__init__(self, author=author, category=category,\n content=content, atom_id=atom_id, link=link,\n published=published, title=title,\n updated=updated, text=text,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes)\n self.category.append(\n atom.Category(scheme='http://schemas.google.com/g/2005#kind', \n term = 'http://schemas.google.com/photos/2007#%s' % self._kind))", "metadata": "root.GPhotosBaseEntry.__init__", "header": "['class', 'GPhotosBaseEntry', '(', 'gdata', '.', 'GDataEntry', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 164 }, { "content": " def kind(self):\n \"(string) Returns the kind\"\n try:\n return self.category[0].term.split('#')[1]\n except IndexError:\n return None", "metadata": "root.GPhotosBaseEntry.kind", "header": "['class', 'GPhotosBaseEntry', '(', 'gdata', '.', 'GDataEntry', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 179 }, { "content": " def _feedUri(self, kind):\n \"Convenience method to get the uri to this entry's feed of the some kind\"\n try:\n href = self.GetFeedLink().href\n except AttributeError:\n return None\n sep = '?'\n if '?' in href: sep = '&'\n return '%s%skind=%s' % (href, sep, kind)", "metadata": "root.GPhotosBaseEntry._feedUri", "header": "['class', 'GPhotosBaseEntry', '(', 'gdata', '.', 'GDataEntry', ',', 'gdata', '.', 'LinkFinder', ')', ':', '___EOS___']", "index": 186 }, { "content": "class PhotosBaseEntry(GPhotosBaseEntry):\n pass", "metadata": "root.PhotosBaseEntry", "header": "['module', '___EOS___']", "index": 197 }, { "content": "class PhotosBaseFeed(GPhotosBaseFeed):\n pass", "metadata": "root.PhotosBaseFeed", "header": "['module', '___EOS___']", "index": 200 }, { "content": "class GPhotosBaseData(object):\n pass", "metadata": "root.GPhotosBaseData", "header": "['module', '___EOS___']", "index": 203 }, { "content": "class Access(PhotosBaseElement):\n \"\"\"The Google Photo `Access' element.\n\n The album's access level. Valid values are `public' or `private'.\n In documentation, access level is also referred to as `visibility.'\"\"\"\n \n _tag = 'access'", "metadata": "root.Access", "header": "['module', '___EOS___']", "index": 206 }, { "content": "def AccessFromString(xml_string):\n return atom.CreateClassFromXMLString(Access, xml_string)", "metadata": "root.AccessFromString", "header": "['module', '___EOS___']", "index": 213 }, { "content": "class Albumid(PhotosBaseElement):\n \"The Google Photo `Albumid' element\"\n \n _tag = 'albumid'", "metadata": "root.Albumid", "header": "['module', '___EOS___']", "index": 216 }, { "content": "def AlbumidFromString(xml_string):\n return atom.CreateClassFromXMLString(Albumid, xml_string)", "metadata": "root.AlbumidFromString", "header": "['module', '___EOS___']", "index": 220 }, { "content": "class BytesUsed(PhotosBaseElement):\n \"The Google Photo `BytesUsed' element\"\n \n _tag = 'bytesUsed'", "metadata": "root.BytesUsed", "header": "['module', '___EOS___']", "index": 223 }, { "content": "def BytesUsedFromString(xml_string):\n return atom.CreateClassFromXMLString(BytesUsed, xml_string)", "metadata": "root.BytesUsedFromString", "header": "['module', '___EOS___']", "index": 227 }, { "content": "class Client(PhotosBaseElement):\n \"The Google Photo `Client' element\"\n \n _tag = 'client'", "metadata": "root.Client", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def ClientFromString(xml_string):\n return atom.CreateClassFromXMLString(Client, xml_string)", "metadata": "root.ClientFromString", "header": "['module', '___EOS___']", "index": 234 }, { "content": "class Checksum(PhotosBaseElement):\n \"The Google Photo `Checksum' element\"\n \n _tag = 'checksum'", "metadata": "root.Checksum", "header": "['module', '___EOS___']", "index": 237 }, { "content": "def ChecksumFromString(xml_string):\n return atom.CreateClassFromXMLString(Checksum, xml_string)", "metadata": "root.ChecksumFromString", "header": "['module', '___EOS___']", "index": 241 }, { "content": "class CommentCount(PhotosBaseElement):\n \"The Google Photo `CommentCount' element\"\n \n _tag = 'commentCount'", "metadata": "root.CommentCount", "header": "['module', '___EOS___']", "index": 244 }, { "content": "def CommentCountFromString(xml_string):\n return atom.CreateClassFromXMLString(CommentCount, xml_string)", "metadata": "root.CommentCountFromString", "header": "['module', '___EOS___']", "index": 248 }, { "content": "class CommentingEnabled(PhotosBaseElement):\n \"The Google Photo `CommentingEnabled' element\"\n \n _tag = 'commentingEnabled'", "metadata": "root.CommentingEnabled", "header": "['module', '___EOS___']", "index": 251 }, { "content": "def CommentingEnabledFromString(xml_string):\n return atom.CreateClassFromXMLString(CommentingEnabled, xml_string)", "metadata": "root.CommentingEnabledFromString", "header": "['module', '___EOS___']", "index": 255 }, { "content": "class Height(PhotosBaseElement):\n \"The Google Photo `Height' element\"\n \n _tag = 'height'", "metadata": "root.Height", "header": "['module', '___EOS___']", "index": 258 }, { "content": "def HeightFromString(xml_string):\n return atom.CreateClassFromXMLString(Height, xml_string)", "metadata": "root.HeightFromString", "header": "['module', '___EOS___']", "index": 262 }, { "content": "class Id(PhotosBaseElement):\n \"The Google Photo `Id' element\"\n \n _tag = 'id'", "metadata": "root.Id", "header": "['module', '___EOS___']", "index": 265 }, { "content": "def IdFromString(xml_string):\n return atom.CreateClassFromXMLString(Id, xml_string)", "metadata": "root.IdFromString", "header": "['module', '___EOS___']", "index": 269 }, { "content": "class Location(PhotosBaseElement):\n \"The Google Photo `Location' element\"\n \n _tag = 'location'", "metadata": "root.Location", "header": "['module', '___EOS___']", "index": 272 }, { "content": "def LocationFromString(xml_string):\n return atom.CreateClassFromXMLString(Location, xml_string)", "metadata": "root.LocationFromString", "header": "['module', '___EOS___']", "index": 276 }, { "content": "class MaxPhotosPerAlbum(PhotosBaseElement):\n \"The Google Photo `MaxPhotosPerAlbum' element\"\n \n _tag = 'maxPhotosPerAlbum'", "metadata": "root.MaxPhotosPerAlbum", "header": "['module', '___EOS___']", "index": 279 }, { "content": "def MaxPhotosPerAlbumFromString(xml_string):\n return atom.CreateClassFromXMLString(MaxPhotosPerAlbum, xml_string)", "metadata": "root.MaxPhotosPerAlbumFromString", "header": "['module', '___EOS___']", "index": 283 }, { "content": "class Name(PhotosBaseElement):\n \"The Google Photo `Name' element\"\n \n _tag = 'name'", "metadata": "root.Name", "header": "['module', '___EOS___']", "index": 286 }, { "content": "def NameFromString(xml_string):\n return atom.CreateClassFromXMLString(Name, xml_string)", "metadata": "root.NameFromString", "header": "['module', '___EOS___']", "index": 290 }, { "content": "class Nickname(PhotosBaseElement):\n \"The Google Photo `Nickname' element\"\n \n _tag = 'nickname'", "metadata": "root.Nickname", "header": "['module', '___EOS___']", "index": 293 }, { "content": "def NicknameFromString(xml_string):\n return atom.CreateClassFromXMLString(Nickname, xml_string)", "metadata": "root.NicknameFromString", "header": "['module', '___EOS___']", "index": 297 }, { "content": "class Numphotos(PhotosBaseElement):\n \"The Google Photo `Numphotos' element\"\n \n _tag = 'numphotos'", "metadata": "root.Numphotos", "header": "['module', '___EOS___']", "index": 300 }, { "content": "def NumphotosFromString(xml_string):\n return atom.CreateClassFromXMLString(Numphotos, xml_string)", "metadata": "root.NumphotosFromString", "header": "['module', '___EOS___']", "index": 304 }, { "content": "class Numphotosremaining(PhotosBaseElement):\n \"The Google Photo `Numphotosremaining' element\"\n \n _tag = 'numphotosremaining'", "metadata": "root.Numphotosremaining", "header": "['module', '___EOS___']", "index": 307 }, { "content": "def NumphotosremainingFromString(xml_string):\n return atom.CreateClassFromXMLString(Numphotosremaining, xml_string)", "metadata": "root.NumphotosremainingFromString", "header": "['module', '___EOS___']", "index": 311 }, { "content": "class Position(PhotosBaseElement):\n \"The Google Photo `Position' element\"\n \n _tag = 'position'", "metadata": "root.Position", "header": "['module', '___EOS___']", "index": 314 }, { "content": "def PositionFromString(xml_string):\n return atom.CreateClassFromXMLString(Position, xml_string)", "metadata": "root.PositionFromString", "header": "['module', '___EOS___']", "index": 318 }, { "content": "class Photoid(PhotosBaseElement):\n \"The Google Photo `Photoid' element\"\n \n _tag = 'photoid'", "metadata": "root.Photoid", "header": "['module', '___EOS___']", "index": 321 }, { "content": "def PhotoidFromString(xml_string):\n return atom.CreateClassFromXMLString(Photoid, xml_string)", "metadata": "root.PhotoidFromString", "header": "['module', '___EOS___']", "index": 325 }, { "content": "class Quotacurrent(PhotosBaseElement):\n \"The Google Photo `Quotacurrent' element\"\n \n _tag = 'quotacurrent'", "metadata": "root.Quotacurrent", "header": "['module', '___EOS___']", "index": 328 }, { "content": "def QuotacurrentFromString(xml_string):\n return atom.CreateClassFromXMLString(Quotacurrent, xml_string)", "metadata": "root.QuotacurrentFromString", "header": "['module', '___EOS___']", "index": 332 }, { "content": "class Quotalimit(PhotosBaseElement):\n \"The Google Photo `Quotalimit' element\"\n \n _tag = 'quotalimit'", "metadata": "root.Quotalimit", "header": "['module', '___EOS___']", "index": 335 }, { "content": "def QuotalimitFromString(xml_string):\n return atom.CreateClassFromXMLString(Quotalimit, xml_string)", "metadata": "root.QuotalimitFromString", "header": "['module', '___EOS___']", "index": 339 }, { "content": "class Rotation(PhotosBaseElement):\n \"The Google Photo `Rotation' element\"\n \n _tag = 'rotation'", "metadata": "root.Rotation", "header": "['module', '___EOS___']", "index": 342 }, { "content": "def RotationFromString(xml_string):\n return atom.CreateClassFromXMLString(Rotation, xml_string)", "metadata": "root.RotationFromString", "header": "['module', '___EOS___']", "index": 346 }, { "content": "class Size(PhotosBaseElement):\n \"The Google Photo `Size' element\"\n \n _tag = 'size'", "metadata": "root.Size", "header": "['module', '___EOS___']", "index": 349 }, { "content": "def SizeFromString(xml_string):\n return atom.CreateClassFromXMLString(Size, xml_string)", "metadata": "root.SizeFromString", "header": "['module', '___EOS___']", "index": 353 }, { "content": "class Snippet(PhotosBaseElement):\n \"\"\"The Google Photo `snippet' element.\n\n When searching, the snippet element will contain a \n string with the word you're looking for, highlighted in html markup\n E.g. when your query is `hafjell', this element may contain:\n `... here at <b>Hafjell</b>.'\n\n You'll find this element in searches -- that is, feeds that combine the \n `kind=photo' and `q=yoursearch' parameters in the request.\n\n See also gphoto:truncated and gphoto:snippettype.\n \n \"\"\"\n \n _tag = 'snippet'", "metadata": "root.Snippet", "header": "['module', '___EOS___']", "index": 356 }, { "content": "def SnippetFromString(xml_string):\n return atom.CreateClassFromXMLString(Snippet, xml_string)", "metadata": "root.SnippetFromString", "header": "['module', '___EOS___']", "index": 372 }, { "content": "class Snippettype(PhotosBaseElement):\n \"\"\"The Google Photo `Snippettype' element\n\n When searching, this element will tell you the type of element that matches.\n\n You'll find this element in searches -- that is, feeds that combine the \n `kind=photo' and `q=yoursearch' parameters in the request.\n\n See also gphoto:snippet and gphoto:truncated.\n \n Possible values and their interpretation: \n o ALBUM_TITLE - The album title matches \n o PHOTO_TAGS - The match is a tag/keyword\n o PHOTO_DESCRIPTION - The match is in the photo's description\n\n If you discover a value not listed here, please submit a patch to update this docstring.\n \n \"\"\"\n \n _tag = 'snippettype'", "metadata": "root.Snippettype", "header": "['module', '___EOS___']", "index": 375 }, { "content": "def SnippettypeFromString(xml_string):\n return atom.CreateClassFromXMLString(Snippettype, xml_string)", "metadata": "root.SnippettypeFromString", "header": "['module', '___EOS___']", "index": 395 }, { "content": "class Thumbnail(PhotosBaseElement):\n \"\"\"The Google Photo `Thumbnail' element\n\n Used to display user's photo thumbnail (hackergotchi).\n \n (Not to be confused with the <media:thumbnail> element, which gives you\n small versions of the photo object.)\"\"\"\n \n _tag = 'thumbnail'", "metadata": "root.Thumbnail", "header": "['module', '___EOS___']", "index": 398 }, { "content": "def ThumbnailFromString(xml_string):\n return atom.CreateClassFromXMLString(Thumbnail, xml_string)", "metadata": "root.ThumbnailFromString", "header": "['module', '___EOS___']", "index": 407 }, { "content": "class Timestamp(PhotosBaseElement):\n \"\"\"The Google Photo `Timestamp' element\n Represented as the number of milliseconds since January 1st, 1970.\n \n \n Take a look at the convenience methods .isoformat() and .datetime():\n\n photo_epoch = Time.text # 1180294337000\n photo_isostring = Time.isoformat() # '2007-05-27T19:32:17.000Z'\n\n Alternatively: \n photo_datetime = Time.datetime() # (requires python >= 2.3)\n \"\"\"\n \n _tag = 'timestamp'\n ", "metadata": "root.Timestamp", "header": "['module', '___EOS___']", "index": 410 }, { "content": " def isoformat(self):\n \"\"\"(string) Return the timestamp as a ISO 8601 formatted string,\n e.g. '2007-05-27T19:32:17.000Z'\n \"\"\"\n import time\n epoch = float(self.text)/1000\n return time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime(epoch))", "metadata": "root.Timestamp.isoformat", "header": "['class', 'Timestamp', '(', 'PhotosBaseElement', ')', ':', '___EOS___']", "index": 425 }, { "content": " def datetime(self):\n \"\"\"(datetime.datetime) Return the timestamp as a datetime.datetime object\n\n Requires python 2.3\n \"\"\"\n import datetime\n epoch = float(self.text)/1000\n return datetime.datetime.fromtimestamp(epoch)", "metadata": "root.Timestamp.datetime", "header": "['class', 'Timestamp', '(', 'PhotosBaseElement', ')', ':', '___EOS___']", "index": 433 }, { "content": "def TimestampFromString(xml_string):\n return atom.CreateClassFromXMLString(Timestamp, xml_string)", "metadata": "root.TimestampFromString", "header": "['module', '___EOS___']", "index": 441 }, { "content": "class Truncated(PhotosBaseElement):\n \"\"\"The Google Photo `Truncated' element\n\n You'll find this element in searches -- that is, feeds that combine the \n `kind=photo' and `q=yoursearch' parameters in the request.\n\n See also gphoto:snippet and gphoto:snippettype.\n \n Possible values and their interpretation:\n 0 -- unknown \n \"\"\"\n \n _tag = 'Truncated'", "metadata": "root.Truncated", "header": "['module', '___EOS___']", "index": 444 }, { "content": "def TruncatedFromString(xml_string):\n return atom.CreateClassFromXMLString(Truncated, xml_string)", "metadata": "root.TruncatedFromString", "header": "['module', '___EOS___']", "index": 457 }, { "content": "class User(PhotosBaseElement):\n \"The Google Photo `User' element\"\n \n _tag = 'user'", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 460 }, { "content": "def UserFromString(xml_string):\n return atom.CreateClassFromXMLString(User, xml_string)", "metadata": "root.UserFromString", "header": "['module', '___EOS___']", "index": 464 }, { "content": "class Version(PhotosBaseElement):\n \"The Google Photo `Version' element\"\n \n _tag = 'version'", "metadata": "root.Version", "header": "['module', '___EOS___']", "index": 467 }, { "content": "def VersionFromString(xml_string):\n return atom.CreateClassFromXMLString(Version, xml_string)", "metadata": "root.VersionFromString", "header": "['module', '___EOS___']", "index": 471 }, { "content": "class Width(PhotosBaseElement):\n \"The Google Photo `Width' element\"\n \n _tag = 'width'", "metadata": "root.Width", "header": "['module', '___EOS___']", "index": 474 }, { "content": "def WidthFromString(xml_string):\n return atom.CreateClassFromXMLString(Width, xml_string)", "metadata": "root.WidthFromString", "header": "['module', '___EOS___']", "index": 478 }, { "content": "class Weight(PhotosBaseElement):\n \"\"\"The Google Photo `Weight' element.\n\n The weight of the tag is the number of times the tag\n appears in the collection of tags currently being viewed.\n The default weight is 1, in which case this tags is omitted.\"\"\"\n _tag = 'weight'", "metadata": "root.Weight", "header": "['module', '___EOS___']", "index": 481 }, { "content": "def WeightFromString(xml_string):\n return atom.CreateClassFromXMLString(Weight, xml_string)", "metadata": "root.WeightFromString", "header": "['module', '___EOS___']", "index": 488 }, { "content": "class CommentAuthor(atom.Author):\n \"\"\"The Atom `Author' element in CommentEntry entries is augmented to\n contain elements from the PHOTOS_NAMESPACE\n\n http://groups.google.com/group/Google-Picasa-Data-API/msg/819b0025b5ff5e38\n \"\"\"\n _children = atom.Author._children.copy()\n _children['{%s}user' % PHOTOS_NAMESPACE] = ('user', User)\n _children['{%s}nickname' % PHOTOS_NAMESPACE] = ('nickname', Nickname)\n _children['{%s}thumbnail' % PHOTOS_NAMESPACE] = ('thumbnail', Thumbnail)", "metadata": "root.CommentAuthor", "header": "['module', '___EOS___']", "index": 491 }, { "content": "def CommentAuthorFromString(xml_string):\n return atom.CreateClassFromXMLString(CommentAuthor, xml_string)", "metadata": "root.CommentAuthorFromString", "header": "['module', '___EOS___']", "index": 501 }, { "content": "class AlbumData(object):\n _children = {}\n _children['{%s}id' % PHOTOS_NAMESPACE] = ('gphoto_id', Id) \n _children['{%s}name' % PHOTOS_NAMESPACE] = ('name', Name)\n _children['{%s}location' % PHOTOS_NAMESPACE] = ('location', Location)\n _children['{%s}access' % PHOTOS_NAMESPACE] = ('access', Access)\n _children['{%s}bytesUsed' % PHOTOS_NAMESPACE] = ('bytesUsed', BytesUsed)\n _children['{%s}timestamp' % PHOTOS_NAMESPACE] = ('timestamp', Timestamp)\n _children['{%s}numphotos' % PHOTOS_NAMESPACE] = ('numphotos', Numphotos)\n _children['{%s}numphotosremaining' % PHOTOS_NAMESPACE] = \\\n ('numphotosremaining', Numphotosremaining)\n _children['{%s}user' % PHOTOS_NAMESPACE] = ('user', User)\n _children['{%s}nickname' % PHOTOS_NAMESPACE] = ('nickname', Nickname)\n _children['{%s}commentingEnabled' % PHOTOS_NAMESPACE] = \\\n ('commentingEnabled', CommentingEnabled)\n _children['{%s}commentCount' % PHOTOS_NAMESPACE] = \\\n ('commentCount', CommentCount)\n ## NOTE: storing media:group as self.media, to create a self-explaining api\n gphoto_id = None\n name = None\n location = None\n access = None\n bytesUsed = None\n timestamp = None\n numphotos = None\n numphotosremaining = None\n user = None\n nickname = None\n commentingEnabled = None\n commentCount = None", "metadata": "root.AlbumData", "header": "['module', '___EOS___']", "index": 506 }, { "content": "class AlbumEntry(GPhotosBaseEntry, AlbumData):\n \"\"\"All metadata for a Google Photos Album\n\n Take a look at AlbumData for metadata accessible as attributes to this object.\n\n Notes:\n To avoid name clashes, and to create a more sensible api, some\n objects have names that differ from the original elements:\n \n o media:group -> self.media,\n o geo:where -> self.geo,\n o photo:id -> self.gphoto_id\n \"\"\"\n \n _kind = 'album'\n _children = GPhotosBaseEntry._children.copy()\n _children.update(AlbumData._children.copy())\n # child tags only for Album entries, not feeds\n _children['{%s}where' % GEORSS_NAMESPACE] = ('geo', Geo.Where)\n _children['{%s}group' % MEDIA_NAMESPACE] = ('media', Media.Group)\n media = Media.Group()\n geo = Geo.Where()\n \n\n \n \n ", "metadata": "root.AlbumEntry", "header": "['module', '___EOS___']", "index": 537 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None,\n title=None, updated=None,\n #GPHOTO NAMESPACE:\n gphoto_id=None, name=None, location=None, access=None, \n timestamp=None, numphotos=None, user=None, nickname=None,\n commentingEnabled=None, commentCount=None, thumbnail=None,\n # MEDIA NAMESPACE:\n media=None,\n # GEORSS NAMESPACE:\n geo=None,\n extended_property=None,\n extension_elements=None, extension_attributes=None, text=None):\n GPhotosBaseEntry.__init__(self, author=author, category=category,\n content=content, atom_id=atom_id, link=link,\n published=published, title=title,\n updated=updated, text=text,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes)\n\n ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id\n self.gphoto_id = gphoto_id \n self.name = name\n self.location = location\n self.access = access\n self.timestamp = timestamp\n self.numphotos = numphotos\n self.user = user\n self.nickname = nickname\n self.commentingEnabled = commentingEnabled\n self.commentCount = commentCount\n self.thumbnail = thumbnail\n self.extended_property = extended_property or []\n self.text = text\n ## NOTE: storing media:group as self.media, and geo:where as geo,\n ## to create a self-explaining api\n self.media = media or Media.Group()\n self.geo = geo or Geo.Where()", "metadata": "root.AlbumEntry.__init__", "header": "['class', 'AlbumEntry', '(', 'GPhotosBaseEntry', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 560 }, { "content": " def GetAlbumId(self):\n \"Return the id of this album\"\n \n return self.GetFeedLink().href.split('/')[-1]", "metadata": "root.AlbumEntry.GetAlbumId", "header": "['class', 'AlbumEntry', '(', 'GPhotosBaseEntry', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 599 }, { "content": " def GetPhotosUri(self):\n \"(string) Return the uri to this albums feed of the PhotoEntry kind\"\n return self._feedUri('photo')", "metadata": "root.AlbumEntry.GetPhotosUri", "header": "['class', 'AlbumEntry', '(', 'GPhotosBaseEntry', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 604 }, { "content": " def GetCommentsUri(self):\n \"(string) Return the uri to this albums feed of the CommentEntry kind\"\n return self._feedUri('comment')", "metadata": "root.AlbumEntry.GetCommentsUri", "header": "['class', 'AlbumEntry', '(', 'GPhotosBaseEntry', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 608 }, { "content": " def GetTagsUri(self):\n \"(string) Return the uri to this albums feed of the TagEntry kind\"\n return self._feedUri('tag')", "metadata": "root.AlbumEntry.GetTagsUri", "header": "['class', 'AlbumEntry', '(', 'GPhotosBaseEntry', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 612 }, { "content": "def AlbumEntryFromString(xml_string):\n return atom.CreateClassFromXMLString(AlbumEntry, xml_string)", "metadata": "root.AlbumEntryFromString", "header": "['module', '___EOS___']", "index": 616 }, { "content": "class AlbumFeed(GPhotosBaseFeed, AlbumData):\n \"\"\"All metadata for a Google Photos Album, including its sub-elements\n \n This feed represents an album as the container for other objects.\n\n A Album feed contains entries of\n PhotoEntry, CommentEntry or TagEntry,\n depending on the `kind' parameter in the original query.\n\n Take a look at AlbumData for accessible attributes.\n \n \"\"\"\n \n _children = GPhotosBaseFeed._children.copy()\n _children.update(AlbumData._children.copy())\n\n \n ", "metadata": "root.AlbumFeed", "header": "['module', '___EOS___']", "index": 619 }, { "content": " def GetPhotosUri(self):\n \"(string) Return the uri to the same feed, but of the PhotoEntry kind\"\n \n return self._feedUri('photo')", "metadata": "root.AlbumFeed.GetPhotosUri", "header": "['class', 'AlbumFeed', '(', 'GPhotosBaseFeed', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 635 }, { "content": " def GetTagsUri(self):\n \"(string) Return the uri to the same feed, but of the TagEntry kind\"\n\n return self._feedUri('tag')", "metadata": "root.AlbumFeed.GetTagsUri", "header": "['class', 'AlbumFeed', '(', 'GPhotosBaseFeed', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 640 }, { "content": " def GetCommentsUri(self):\n \"(string) Return the uri to the same feed, but of the CommentEntry kind\"\n\n return self._feedUri('comment')", "metadata": "root.AlbumFeed.GetCommentsUri", "header": "['class', 'AlbumFeed', '(', 'GPhotosBaseFeed', ',', 'AlbumData', ')', ':', '___EOS___']", "index": 645 }, { "content": "def AlbumFeedFromString(xml_string):\n return atom.CreateClassFromXMLString(AlbumFeed, xml_string)", "metadata": "root.AlbumFeedFromString", "header": "['module', '___EOS___']", "index": 650 }, { "content": "class PhotoData(object):\n _children = {}\n ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id\n _children['{%s}id' % PHOTOS_NAMESPACE] = ('gphoto_id', Id) \n _children['{%s}albumid' % PHOTOS_NAMESPACE] = ('albumid', Albumid)\n _children['{%s}checksum' % PHOTOS_NAMESPACE] = ('checksum', Checksum)\n _children['{%s}client' % PHOTOS_NAMESPACE] = ('client', Client)\n _children['{%s}height' % PHOTOS_NAMESPACE] = ('height', Height)\n _children['{%s}position' % PHOTOS_NAMESPACE] = ('position', Position)\n _children['{%s}rotation' % PHOTOS_NAMESPACE] = ('rotation', Rotation)\n _children['{%s}size' % PHOTOS_NAMESPACE] = ('size', Size)\n _children['{%s}timestamp' % PHOTOS_NAMESPACE] = ('timestamp', Timestamp)\n _children['{%s}version' % PHOTOS_NAMESPACE] = ('version', Version)\n _children['{%s}width' % PHOTOS_NAMESPACE] = ('width', Width)\n _children['{%s}commentingEnabled' % PHOTOS_NAMESPACE] = \\\n ('commentingEnabled', CommentingEnabled)\n _children['{%s}commentCount' % PHOTOS_NAMESPACE] = \\\n ('commentCount', CommentCount)\n ## NOTE: storing media:group as self.media, exif:tags as self.exif, and\n ## geo:where as self.geo, to create a self-explaining api\n _children['{%s}tags' % EXIF_NAMESPACE] = ('exif', Exif.Tags)\n _children['{%s}where' % GEORSS_NAMESPACE] = ('geo', Geo.Where)\n _children['{%s}group' % MEDIA_NAMESPACE] = ('media', Media.Group)\n # These elements show up in search feeds \n _children['{%s}snippet' % PHOTOS_NAMESPACE] = ('snippet', Snippet)\n _children['{%s}snippettype' % PHOTOS_NAMESPACE] = ('snippettype', Snippettype)\n _children['{%s}truncated' % PHOTOS_NAMESPACE] = ('truncated', Truncated)\n gphoto_id = None\n albumid = None\n checksum = None\n client = None\n height = None\n position = None\n rotation = None\n size = None\n timestamp = None\n version = None\n width = None\n commentingEnabled = None\n commentCount = None\n snippet=None\n snippettype=None\n truncated=None\n media = Media.Group()\n geo = Geo.Where()\n tags = Exif.Tags()", "metadata": "root.PhotoData", "header": "['module', '___EOS___']", "index": 654 }, { "content": "class PhotoEntry(GPhotosBaseEntry, PhotoData):\n \"\"\"All metadata for a Google Photos Photo\n\n Take a look at PhotoData for metadata accessible as attributes to this object.\n\n Notes:\n To avoid name clashes, and to create a more sensible api, some\n objects have names that differ from the original elements:\n \n o media:group -> self.media,\n o exif:tags -> self.exif,\n o geo:where -> self.geo,\n o photo:id -> self.gphoto_id\n \"\"\"\n\n _kind = 'photo'\n _children = GPhotosBaseEntry._children.copy()\n _children.update(PhotoData._children.copy())\n \n\n\n\n", "metadata": "root.PhotoEntry", "header": "['module', '___EOS___']", "index": 701 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None, \n title=None, updated=None, text=None,\n # GPHOTO NAMESPACE:\n gphoto_id=None, albumid=None, checksum=None, client=None, height=None,\n position=None, rotation=None, size=None, timestamp=None, version=None,\n width=None, commentCount=None, commentingEnabled=None,\n # MEDIARSS NAMESPACE:\n media=None,\n # EXIF_NAMESPACE:\n exif=None,\n # GEORSS NAMESPACE:\n geo=None,\n extension_elements=None, extension_attributes=None):\n GPhotosBaseEntry.__init__(self, author=author, category=category,\n content=content,\n atom_id=atom_id, link=link, published=published,\n title=title, updated=updated, text=text,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes)\n \n\n ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id\n self.gphoto_id = gphoto_id\n self.albumid = albumid\n self.checksum = checksum\n self.client = client\n self.height = height\n self.position = position\n self.rotation = rotation\n self.size = size\n self.timestamp = timestamp\n self.version = version\n self.width = width\n self.commentingEnabled = commentingEnabled\n self.commentCount = commentCount\n ## NOTE: storing media:group as self.media, to create a self-explaining api\n self.media = media or Media.Group()\n self.exif = exif or Exif.Tags()\n self.geo = geo or Geo.Where()", "metadata": "root.PhotoEntry.__init__", "header": "['class', 'PhotoEntry', '(', 'GPhotosBaseEntry', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 720 }, { "content": " def GetPostLink(self):\n \"Return the uri to this photo's `POST' link (use it for updates of the object)\"\n\n return self.GetFeedLink()", "metadata": "root.PhotoEntry.GetPostLink", "header": "['class', 'PhotoEntry', '(', 'GPhotosBaseEntry', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 761 }, { "content": " def GetCommentsUri(self):\n \"Return the uri to this photo's feed of CommentEntry comments\"\n return self._feedUri('comment') ", "metadata": "root.PhotoEntry.GetCommentsUri", "header": "['class', 'PhotoEntry', '(', 'GPhotosBaseEntry', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 766 }, { "content": " def GetTagsUri(self):\n \"Return the uri to this photo's feed of TagEntry tags\"\n return self._feedUri('tag') ", "metadata": "root.PhotoEntry.GetTagsUri", "header": "['class', 'PhotoEntry', '(', 'GPhotosBaseEntry', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 770 }, { "content": " def GetAlbumUri(self):\n \"\"\"Return the uri to the AlbumEntry containing this photo\"\"\"\n\n href = self.GetSelfLink().href\n return href[:href.find('/photoid')]", "metadata": "root.PhotoEntry.GetAlbumUri", "header": "['class', 'PhotoEntry', '(', 'GPhotosBaseEntry', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 774 }, { "content": "def PhotoEntryFromString(xml_string):\n return atom.CreateClassFromXMLString(PhotoEntry, xml_string)", "metadata": "root.PhotoEntryFromString", "header": "['module', '___EOS___']", "index": 780 }, { "content": "class PhotoFeed(GPhotosBaseFeed, PhotoData):\n \"\"\"All metadata for a Google Photos Photo, including its sub-elements\n \n This feed represents a photo as the container for other objects.\n\n A Photo feed contains entries of\n CommentEntry or TagEntry,\n depending on the `kind' parameter in the original query.\n\n Take a look at PhotoData for metadata accessible as attributes to this object.\n \n \"\"\"\n _children = GPhotosBaseFeed._children.copy()\n _children.update(PhotoData._children.copy())\n\n ", "metadata": "root.PhotoFeed", "header": "['module', '___EOS___']", "index": 783 }, { "content": " def GetTagsUri(self):\n \"(string) Return the uri to the same feed, but of the TagEntry kind\"\n \n return self._feedUri('tag')", "metadata": "root.PhotoFeed.GetTagsUri", "header": "['class', 'PhotoFeed', '(', 'GPhotosBaseFeed', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 798 }, { "content": " def GetCommentsUri(self):\n \"(string) Return the uri to the same feed, but of the CommentEntry kind\"\n \n return self._feedUri('comment')", "metadata": "root.PhotoFeed.GetCommentsUri", "header": "['class', 'PhotoFeed', '(', 'GPhotosBaseFeed', ',', 'PhotoData', ')', ':', '___EOS___']", "index": 803 }, { "content": "def PhotoFeedFromString(xml_string):\n return atom.CreateClassFromXMLString(PhotoFeed, xml_string)", "metadata": "root.PhotoFeedFromString", "header": "['module', '___EOS___']", "index": 808 }, { "content": "class TagData(GPhotosBaseData):\n _children = {}\n _children['{%s}weight' % PHOTOS_NAMESPACE] = ('weight', Weight)\n weight=None", "metadata": "root.TagData", "header": "['module', '___EOS___']", "index": 811 }, { "content": "class TagEntry(GPhotosBaseEntry, TagData):\n \"\"\"All metadata for a Google Photos Tag\n\n The actual tag is stored in the .title.text attribute\n\n \"\"\"\n\n _kind = 'tag'\n _children = GPhotosBaseEntry._children.copy()\n _children.update(TagData._children.copy())\n\n\n", "metadata": "root.TagEntry", "header": "['module', '___EOS___']", "index": 816 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None,\n title=None, updated=None,\n # GPHOTO NAMESPACE:\n weight=None,\n extended_property=None,\n extension_elements=None, extension_attributes=None, text=None):\n GPhotosBaseEntry.__init__(self, author=author, category=category,\n content=content,\n atom_id=atom_id, link=link, published=published,\n title=title, updated=updated, text=text,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes)\n \n self.weight = weight", "metadata": "root.TagEntry.__init__", "header": "['class', 'TagEntry', '(', 'GPhotosBaseEntry', ',', 'TagData', ')', ':', '___EOS___']", "index": 827 }, { "content": " def GetAlbumUri(self):\n \"\"\"Return the uri to the AlbumEntry containing this tag\"\"\"\n\n href = self.GetSelfLink().href\n pos = href.find('/photoid')\n if pos == -1:\n return None\n return href[:pos]", "metadata": "root.TagEntry.GetAlbumUri", "header": "['class', 'TagEntry', '(', 'GPhotosBaseEntry', ',', 'TagData', ')', ':', '___EOS___']", "index": 843 }, { "content": " def GetPhotoUri(self):\n \"\"\"Return the uri to the PhotoEntry containing this tag\"\"\"\n\n href = self.GetSelfLink().href\n pos = href.find('/tag')\n if pos == -1:\n return None\n return href[:pos]", "metadata": "root.TagEntry.GetPhotoUri", "header": "['class', 'TagEntry', '(', 'GPhotosBaseEntry', ',', 'TagData', ')', ':', '___EOS___']", "index": 852 }, { "content": "def TagEntryFromString(xml_string):\n return atom.CreateClassFromXMLString(TagEntry, xml_string)", "metadata": "root.TagEntryFromString", "header": "['module', '___EOS___']", "index": 861 }, { "content": "class TagFeed(GPhotosBaseFeed, TagData):\n \"\"\"All metadata for a Google Photos Tag, including its sub-elements\"\"\"\n \n _children = GPhotosBaseFeed._children.copy()\n _children.update(TagData._children.copy())", "metadata": "root.TagFeed", "header": "['module', '___EOS___']", "index": 865 }, { "content": "def TagFeedFromString(xml_string):\n return atom.CreateClassFromXMLString(TagFeed, xml_string)", "metadata": "root.TagFeedFromString", "header": "['module', '___EOS___']", "index": 871 }, { "content": "class CommentData(GPhotosBaseData):\n _children = {}\n ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id\n _children['{%s}id' % PHOTOS_NAMESPACE] = ('gphoto_id', Id)\n _children['{%s}albumid' % PHOTOS_NAMESPACE] = ('albumid', Albumid)\n _children['{%s}photoid' % PHOTOS_NAMESPACE] = ('photoid', Photoid)\n _children['{%s}author' % atom.ATOM_NAMESPACE] = ('author', [CommentAuthor,])\n gphoto_id=None\n albumid=None\n photoid=None\n author=None", "metadata": "root.CommentData", "header": "['module', '___EOS___']", "index": 874 }, { "content": "class CommentEntry(GPhotosBaseEntry, CommentData):\n \"\"\"All metadata for a Google Photos Comment\n \n The comment is stored in the .content.text attribute,\n with a content type in .content.type.\n\n\n \"\"\"\n \n _kind = 'comment'\n _children = GPhotosBaseEntry._children.copy()\n _children.update(CommentData._children.copy())\n\n\n", "metadata": "root.CommentEntry", "header": "['module', '___EOS___']", "index": 886 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None,\n title=None, updated=None,\n # GPHOTO NAMESPACE:\n gphoto_id=None, albumid=None, photoid=None,\n extended_property=None,\n extension_elements=None, extension_attributes=None, text=None):\n \n GPhotosBaseEntry.__init__(self, author=author, category=category,\n content=content,\n atom_id=atom_id, link=link, published=published,\n title=title, updated=updated,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes,\n text=text)\n \n self.gphoto_id = gphoto_id\n self.albumid = albumid\n self.photoid = photoid", "metadata": "root.CommentEntry.__init__", "header": "['class', 'CommentEntry', '(', 'GPhotosBaseEntry', ',', 'CommentData', ')', ':', '___EOS___']", "index": 898 }, { "content": " def GetCommentId(self):\n \"\"\"Return the globally unique id of this comment\"\"\"\n return self.GetSelfLink().href.split('/')[-1]", "metadata": "root.CommentEntry.GetCommentId", "header": "['class', 'CommentEntry', '(', 'GPhotosBaseEntry', ',', 'CommentData', ')', ':', '___EOS___']", "index": 918 }, { "content": " def GetAlbumUri(self):\n \"\"\"Return the uri to the AlbumEntry containing this comment\"\"\"\n\n href = self.GetSelfLink().href\n return href[:href.find('/photoid')]", "metadata": "root.CommentEntry.GetAlbumUri", "header": "['class', 'CommentEntry', '(', 'GPhotosBaseEntry', ',', 'CommentData', ')', ':', '___EOS___']", "index": 922 }, { "content": " def GetPhotoUri(self):\n \"\"\"Return the uri to the PhotoEntry containing this comment\"\"\"\n\n href = self.GetSelfLink().href\n return href[:href.find('/commentid')]", "metadata": "root.CommentEntry.GetPhotoUri", "header": "['class', 'CommentEntry', '(', 'GPhotosBaseEntry', ',', 'CommentData', ')', ':', '___EOS___']", "index": 928 }, { "content": "def CommentEntryFromString(xml_string):\n return atom.CreateClassFromXMLString(CommentEntry, xml_string)", "metadata": "root.CommentEntryFromString", "header": "['module', '___EOS___']", "index": 934 }, { "content": "class CommentFeed(GPhotosBaseFeed, CommentData):\n \"\"\"All metadata for a Google Photos Comment, including its sub-elements\"\"\"\n \n _children = GPhotosBaseFeed._children.copy()\n _children.update(CommentData._children.copy())", "metadata": "root.CommentFeed", "header": "['module', '___EOS___']", "index": 937 }, { "content": "def CommentFeedFromString(xml_string):\n return atom.CreateClassFromXMLString(CommentFeed, xml_string)", "metadata": "root.CommentFeedFromString", "header": "['module', '___EOS___']", "index": 943 }, { "content": "class UserData(GPhotosBaseData):\n _children = {}\n _children['{%s}maxPhotosPerAlbum' % PHOTOS_NAMESPACE] = ('maxPhotosPerAlbum', MaxPhotosPerAlbum)\n _children['{%s}nickname' % PHOTOS_NAMESPACE] = ('nickname', Nickname)\n _children['{%s}quotalimit' % PHOTOS_NAMESPACE] = ('quotalimit', Quotalimit)\n _children['{%s}quotacurrent' % PHOTOS_NAMESPACE] = ('quotacurrent', Quotacurrent)\n _children['{%s}thumbnail' % PHOTOS_NAMESPACE] = ('thumbnail', Thumbnail)\n _children['{%s}user' % PHOTOS_NAMESPACE] = ('user', User)\n _children['{%s}id' % PHOTOS_NAMESPACE] = ('gphoto_id', Id) \n\n maxPhotosPerAlbum=None\n nickname=None\n quotalimit=None\n quotacurrent=None\n thumbnail=None\n user=None\n gphoto_id=None", "metadata": "root.UserData", "header": "['module', '___EOS___']", "index": 946 }, { "content": "class UserEntry(GPhotosBaseEntry, UserData):\n \"\"\"All metadata for a Google Photos User\n\n This entry represents an album owner and all appropriate metadata.\n\n Take a look at at the attributes of the UserData for metadata available.\n \"\"\"\n _children = GPhotosBaseEntry._children.copy()\n _children.update(UserData._children.copy())\n _kind = 'user'\n \n\n \n \n ", "metadata": "root.UserEntry", "header": "['module', '___EOS___']", "index": 965 }, { "content": " def __init__(self, author=None, category=None, content=None,\n atom_id=None, link=None, published=None,\n title=None, updated=None,\n # GPHOTO NAMESPACE:\n gphoto_id=None, maxPhotosPerAlbum=None, nickname=None, quotalimit=None,\n quotacurrent=None, thumbnail=None, user=None,\n extended_property=None,\n extension_elements=None, extension_attributes=None, text=None):\n \n GPhotosBaseEntry.__init__(self, author=author, category=category,\n content=content,\n atom_id=atom_id, link=link, published=published,\n title=title, updated=updated,\n extension_elements=extension_elements,\n extension_attributes=extension_attributes,\n text=text)\n \n \n self.gphoto_id=gphoto_id\n self.maxPhotosPerAlbum=maxPhotosPerAlbum\n self.nickname=nickname\n self.quotalimit=quotalimit\n self.quotacurrent=quotacurrent\n self.thumbnail=thumbnail\n self.user=user", "metadata": "root.UserEntry.__init__", "header": "['class', 'UserEntry', '(', 'GPhotosBaseEntry', ',', 'UserData', ')', ':', '___EOS___']", "index": 976 }, { "content": " def GetAlbumsUri(self):\n \"(string) Return the uri to this user's feed of the AlbumEntry kind\"\n return self._feedUri('album')", "metadata": "root.UserEntry.GetAlbumsUri", "header": "['class', 'UserEntry', '(', 'GPhotosBaseEntry', ',', 'UserData', ')', ':', '___EOS___']", "index": 1002 }, { "content": " def GetPhotosUri(self):\n \"(string) Return the uri to this user's feed of the PhotoEntry kind\"\n return self._feedUri('photo')", "metadata": "root.UserEntry.GetPhotosUri", "header": "['class', 'UserEntry', '(', 'GPhotosBaseEntry', ',', 'UserData', ')', ':', '___EOS___']", "index": 1006 }, { "content": " def GetCommentsUri(self):\n \"(string) Return the uri to this user's feed of the CommentEntry kind\"\n return self._feedUri('comment')", "metadata": "root.UserEntry.GetCommentsUri", "header": "['class', 'UserEntry', '(', 'GPhotosBaseEntry', ',', 'UserData', ')', ':', '___EOS___']", "index": 1010 }, { "content": " def GetTagsUri(self):\n \"(string) Return the uri to this user's feed of the TagEntry kind\"\n return self._feedUri('tag')", "metadata": "root.UserEntry.GetTagsUri", "header": "['class', 'UserEntry', '(', 'GPhotosBaseEntry', ',', 'UserData', ')', ':', '___EOS___']", "index": 1014 }, { "content": "def UserEntryFromString(xml_string):\n return atom.CreateClassFromXMLString(UserEntry, xml_string)", "metadata": "root.UserEntryFromString", "header": "['module', '___EOS___']", "index": 1018 }, { "content": "class UserFeed(GPhotosBaseFeed, UserData):\n \"\"\"Feed for a User in the google photos api.\n\n This feed represents a user as the container for other objects.\n\n A User feed contains entries of\n AlbumEntry, PhotoEntry, CommentEntry, UserEntry or TagEntry,\n depending on the `kind' parameter in the original query.\n\n The user feed itself also contains all of the metadata available\n as part of a UserData object.\"\"\"\n _children = GPhotosBaseFeed._children.copy()\n _children.update(UserData._children.copy())\n\n\n\n", "metadata": "root.UserFeed", "header": "['module', '___EOS___']", "index": 1021 }, { "content": " def GetAlbumsUri(self):\n \"\"\"Get the uri to this feed, but with entries of the AlbumEntry kind.\"\"\"\n return self._feedUri('album')", "metadata": "root.UserFeed.GetAlbumsUri", "header": "['class', 'UserFeed', '(', 'GPhotosBaseFeed', ',', 'UserData', ')', ':', '___EOS___']", "index": 1035 }, { "content": " def GetTagsUri(self):\n \"\"\"Get the uri to this feed, but with entries of the TagEntry kind.\"\"\"\n return self._feedUri('tag')", "metadata": "root.UserFeed.GetTagsUri", "header": "['class', 'UserFeed', '(', 'GPhotosBaseFeed', ',', 'UserData', ')', ':', '___EOS___']", "index": 1039 }, { "content": " def GetPhotosUri(self):\n \"\"\"Get the uri to this feed, but with entries of the PhotosEntry kind.\"\"\"\n return self._feedUri('photo')", "metadata": "root.UserFeed.GetPhotosUri", "header": "['class', 'UserFeed', '(', 'GPhotosBaseFeed', ',', 'UserData', ')', ':', '___EOS___']", "index": 1043 }, { "content": " def GetCommentsUri(self):\n \"\"\"Get the uri to this feed, but with entries of the CommentsEntry kind.\"\"\"\n return self._feedUri('comment')", "metadata": "root.UserFeed.GetCommentsUri", "header": "['class', 'UserFeed', '(', 'GPhotosBaseFeed', ',', 'UserData', ')', ':', '___EOS___']", "index": 1047 }, { "content": "def UserFeedFromString(xml_string):\n return atom.CreateClassFromXMLString(UserFeed, xml_string)", "metadata": "root.UserFeedFromString", "header": "['module', '___EOS___']", "index": 1051 }, { "content": "def AnyFeedFromString(xml_string):\n \"\"\"Creates an instance of the appropriate feed class from the\n xml string contents.\n\n Args:\n xml_string: str A string which contains valid XML. The root element\n of the XML string should match the tag and namespace of the desired\n class.\n\n Returns:\n An instance of the target class with members assigned according to the\n contents of the XML - or a basic gdata.GDataFeed instance if it is\n impossible to determine the appropriate class (look for extra elements\n in GDataFeed's .FindExtensions() and extension_elements[] ).\n \"\"\"\n tree = ElementTree.fromstring(xml_string)\n category = tree.find('{%s}category' % atom.ATOM_NAMESPACE)\n if category is None:\n # TODO: is this the best way to handle this?\n return atom._CreateClassFromElementTree(GPhotosBaseFeed, tree)\n namespace, kind = category.get('term').split('#')\n if namespace != PHOTOS_NAMESPACE:\n # TODO: is this the best way to handle this?\n return atom._CreateClassFromElementTree(GPhotosBaseFeed, tree)\n ## TODO: is getattr safe this way?\n feed_class = getattr(gdata.photos, '%sFeed' % kind.title())\n return atom._CreateClassFromElementTree(feed_class, tree)", "metadata": "root.AnyFeedFromString", "header": "['module', '___EOS___']", "index": 1056 }, { "content": "def AnyEntryFromString(xml_string):\n \"\"\"Creates an instance of the appropriate entry class from the\n xml string contents.\n\n Args:\n xml_string: str A string which contains valid XML. The root element\n of the XML string should match the tag and namespace of the desired\n class.\n\n Returns:\n An instance of the target class with members assigned according to the\n contents of the XML - or a basic gdata.GDataEndry instance if it is\n impossible to determine the appropriate class (look for extra elements\n in GDataEntry's .FindExtensions() and extension_elements[] ).\n \"\"\"\n tree = ElementTree.fromstring(xml_string)\n category = tree.find('{%s}category' % atom.ATOM_NAMESPACE)\n if category is None:\n # TODO: is this the best way to handle this?\n return atom._CreateClassFromElementTree(GPhotosBaseEntry, tree)\n namespace, kind = category.get('term').split('#')\n if namespace != PHOTOS_NAMESPACE:\n # TODO: is this the best way to handle this?\n return atom._CreateClassFromElementTree(GPhotosBaseEntry, tree)\n ## TODO: is getattr safe this way?\n feed_class = getattr(gdata.photos, '%sEntry' % kind.title())\n return atom._CreateClassFromElementTree(feed_class, tree)", "metadata": "root.AnyEntryFromString", "header": "['module', '___EOS___']", "index": 1084 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", "*-", " ", "encoding", ":", " ", "utf", "-", "8", " ", "-*-", "*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "base", " ", "file", " ", "for", " ", "the", " ", "Pic", "asa", "Web", " ", "python", " ", "client", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "used", " ", "for", " ", "lower", " ", "level", " ", "operati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Id", ":", " ", "\\u\\u", "init", "\\u\\u", ".", "py", " ", "148", " ", "2007", "-1", "0", "-", "2", "8", " ", "15", ":", "09", ":", "1", "9", "Z", " ", "hav", "ard", ".", "gul", "lda", "hl", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "H", "\\", "229", ";", "vard", " ", "Gu", "ll", "da", "hl", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Port", "ion", "s", " ", "(", "C", ")", " ", "2006", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "module", " ", "provide", "s", " ", "a", " ", "python", "ic", ",", " ", "gdat", "a", "-", "centr", "ic", " ", "interface", " ", "to", " ", "Goo", "gle", " ", "Photos", "\\", "10", ";", "(", "a", ".", "k", ".", "a", ".", " ", "Pic", "asa", " ", "Web", " ", "Service", "s", ".", "\\", "10", ";", "\\", "10", ";", "It", " ", "is", " ", "modell", "ed", " ", "after", " ", "the", " ", "gdat", "a", "/*", " ", "interface", "s", " ", "from", " ", "the", " ", "gdat", "a", "-", "python", "-", "client", "\\", "10", ";", "project", "[", "1", "]", " ", "by", " ", "Goo", "gle", ".", " ", "\\", "10", ";", "\\", "10", ";", "You", "'", "ll", " ", "find", " ", "the", " ", "user", "-", "frie", "ndl", "y", " ", "api", " ", "in", " ", "photo", "s", ".", "service", ".", " ", "Ple", "ase", " ", "see", " ", "the", "\\", "10", ";", "documentation", " ", "or", " ", "live", " ", "help", "()", " ", "system", " ", "for", " ", "avail", "able", " ", "method", "s", ".", "\\", "10", ";", "\\", "10", ";", "[", "1", "]:", " ", "http", "://", "gdat", "a", "-", "python", "-", "client", ".", "googlec", "ode", ".", "com", "/", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "u", "'", "hav", "ard", "@", "gul", "lda", "hl", ".", "no", "'_", "#", " ", "(", "H", "\\", "229", ";", "vard", " ", "Gu", "ll", "da", "hl", ")'", " ", "#", "BUG", ":", " ", "pydo", "c", " ", "cho", "kes", " ", "on", " ", "non", "-", "ascii", " ", "char", "s", " ", "in", " ", "\\u\\u", "author\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "'", "Ap", "ache", " ", "License", " ", "v2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Revi", "sion", ":", " ", "164", " ", "$'_", "[_", "11_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "xml_", "._", "etree_", "import_", "c", "Element", "Tree_", "as_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Element", "Tree_", "as_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "xml_", "._", "etree_", "import_", "Element", "Tree_", "\\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_", "element", "tree_", "import_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "atom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gdata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", "ing", " ", "google", " ", "photo", " ", "submodules", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gdata_", "._", "media_", "as_", "Media_", ",_", "gdata_", "._", "exif", "_", "as_", "Exi", "f_", ",_", "gdata_", "._", "geo_", "as_", "Geo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XML", " ", "namespace", "s", " ", "whi", "ch", " ", "are", " ", "oft", "en", " ", "used", " ", "in", " ", "Goo", "gle", " ", "Photo", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "PHOTO", "S", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "photo", "s", "/", "2007", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MEDIA", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "search", ".", "ya", "hoo", ".", "com", "/", "mrs", "s", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EX", "IF", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "photo", "s", "/", "exif", "/", "2007", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPENS", "EAR", "CH", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "a9", ".", "com", "/-", "/", "spec", "/", "opens", "ear", "chr", "ss", "/", "1.0", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GEO", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "www", ".", "w3", ".", "org", "/", "2003", "/", "01", "/", "geo", "/", "wg", "s", "84", "\\u", "pos", "#'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GM", "L", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "gm", "l", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GEO", "RSS", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "www", ".", "geor", "ss", ".", "org", "/", "geor", "ss", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PH", "EE", "D", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "www", ".", "phe", "ed", ".", "com", "/", "phe", "ed", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BATCH", "\\u", "NAMESPACE_", "=_", "'", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "gdat", "a", "/", "batch", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNEW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INE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###", "#", " ", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u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WLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Photos", "Base", "Element_", "(_", "atom_", "._", "Atom", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "element", "s", " ", "in", " ", "the", " ", "PHOTO", "\\u", "NAMESPACE", ".", " ", "To", " ", "add", " ", "new", " ", "element", "s", ",", "\\", "10", ";", " ", " ", "you", " ", "only", " ", "need", " ", "to", " ", "add", " ", "the", " ", "element", " ", "tag", " ", "name", " ", "to", " ", "self", ".\\u", "tag", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "namespace_", "=_", "PHOTO", "S", "\\u", "NAMESPACE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "atom_", "._", "Atom", "Base_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "attributes_", "=_", "atom_", "._", "Atom", "Base_", "._", "\\u", "attributes_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "def", " ", "\\u\\u", "str", "\\u\\u", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "str", "(", "self", ".", "text", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "\\u\\u", "unicode", "\\u\\u", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "unicode", "(", "self", ".", "text", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Photos", "Base", "Element_", "(_", "atom_", "._", "Atom", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "Base", "Element_", "(_", "atom_", "._", "Atom", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "int\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "Base", "Element_", "(_", "atom_", "._", "Atom", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "text_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "GP", "hot", "os", "Base", "Feed_", "(_", "gdata_", "._", "GD", "ata", "Feed_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Base", " ", "class", " ", "for", " ", "all", " ", "Feed", "s", " ", "in", " ", "gdat", "a", ".", "photo", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "tag_", "=_", "'", "feed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "namespace_", "=_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "attributes_", "=_", "gdata_", "._", "GD", "ata", "Feed_", "._", "\\u", "attributes_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "gdata_", "._", "GD", "ata", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "deal", " ", "with", " ", "Entr", "y", " ", "element", "s", " ", "ours", "elv", "es_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "\\u", "children_", "[_", "'{", "%", "s", "}", "entry", "'_", "%_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "GP", "hot", "os", "Base", "Feed_", "(_", "gdata_", "._", "GD", "ata", "Feed_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "contributor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "generator_", "=_", "None_", ",_", "icon_", "=_", "None_", ",_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "logo_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rights_", "=_", "None_", ",_", "subtitle_", "=_", "None_", ",_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "=_", "None_", ",_", "total", "\\u", "results_", "=_", "None_", ",_", "start", "\\u", "index_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "items", "\\u", "per", "\\u", "page_", "=_", "None_", ",_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdata_", "._", "GD", "ata", "Feed_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contributor_", "=_", "contributor_", ",_", "generator_", "=_", "generator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon_", "=_", "icon_", ",_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logo_", "=_", "logo_", ",_", "rights_", "=_", "rights_", ",_", "subtitle_", "=_", "subtitle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "updated_", "=_", "updated_", ",_", "entry_", "=_", "entry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "results_", "=_", "total", "\\u", "results_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "index_", "=_", "start", "\\u", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "items", "\\u", "per", "\\u", "page_", "=_", "items", "\\u", "per", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GP", "hot", "os", "Base", "Feed_", "(_", "gdata_", "._", "GD", "ata", "Feed_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", "s", " ", "the", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "category_", "[_", "0_", "]_", "._", "term_", "._", "split_", "(_", "'#'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GP", "hot", "os", "Base", "Feed_", "(_", "gdata_", "._", "GD", "ata", "Feed_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\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", "feed", "Uri_", "(_", "self_", ",_", "kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Conve", "nie", "nce", " ", "method", " ", "to", " ", "return", " ", "a", " ", "uri", " ", "to", " ", "a", " ", "feed", " ", "of", " ", "a", " ", "special", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "kind_", "in_", "(_", "'", "album", "'_", ",_", "'", "tag", "'_", ",_", "'", "photo", "'_", ",_", "'", "comment", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "here", "\\u", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "kind", "=", "%", "s", "'_", "%_", "kind_", "in_", "here", "\\u", "href_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "here", "\\u", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "kind", "='_", "in_", "here", "\\u", "href_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sep_", "=_", "'?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'?'_", "in_", "here", "\\u", "href_", ":_", "sep_", "=_", "'&'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "here", "\\u", "href_", "+_", "\"%", "skin", "d", "=", "%", "s", "\"_", "%_", "(_", "sep_", ",_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx_", "=_", "re_", "._", "match_", "(_", "'.*", "(", "kind", "=", ")(", "album", "|", "tag", "|", "photo", "|", "comment", ")'_", ",_", "here", "\\u", "href_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "here", "\\u", "href_", "[_", ":_", "rx_", "._", "end_", "(_", "1_", ")_", "]_", "+_", "kind_", "+_", "here", "\\u", "href_", "[_", "rx_", "._", "end_", "(_", "2_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GP", "hot", "os", "Base", "Feed_", "(_", "gdata_", "._", "GD", "ata", "Feed_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Convert", "Element", "Tree", "To", "Member_", "(_", "self_", ",_", "child", "\\u", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Re", "-", "implement", "ing", " ", "the", " ", "method", " ", "from", " ", "Atom", "Base", ",", " ", "sinc", "e", " ", "we", " ", "deal", " ", "with", "\\", "10", ";", " ", " ", "Entr", "y", " ", "element", "s", " ", "special", "ly", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "child", "\\u", "tree_", "._", "find_", "(_", "'{", "%", "s", "}", "category", "'_", "%_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Atom", "Base_", "._", "\\u", "Convert", "Element", "Tree", "To", "Member_", "(_", "self_", ",_", "child", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", ",_", "kind_", "=_", "category_", "._", "get_", "(_", "'", "term", "'_", ")_", "._", "split_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "namespace_", "!=_", "PHOTO", "S", "\\u", "NAMESPACE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Atom", "Base_", "._", "\\u", "Convert", "Element", "Tree", "To", "Member_", "(_", "self_", ",_", "child", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", ":", " ", "is", " ", "it", " ", "safe", " ", "to", " ", "use", " ", "getattr", " ", "on", " ", "gdat", "a", ".", "photo", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry", "\\u", "class_", "=_", "getattr_", "(_", "gdata_", "._", "photos_", ",_", "'%", "s", "Entr", "y", "'_", "%_", "kind_", "._", "title_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'", "entry", "'_", ")_", "or_", "self_", "._", "entry_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "entry_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "entry_", "._", "append_", "(_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "class_", ",_", "child", "\\u", "tree_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "GP", "hot", "os", "Base", "Entry_", "(_", "gdata_", "._", "GD", "ata", "Entry_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Base", " ", "class", " ", "for", " ", "all", " ", "Entr", "y", " ", "element", "s", " ", "in", " ", "gdat", "a", ".", "photo", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "tag_", "=_", "'", "entry", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "kind_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "namespace_", "=_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "gdata_", "._", "GD", "ata", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "attributes_", "=_", "gdata_", "._", "GD", "ata", "Entry_", "._", "\\u", "attributes_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "GP", "hot", "os", "Base", "Entry_", "(_", "gdata_", "._", "GD", "ata", "Entry_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "ed", "\\u", "property_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdata_", "._", "GD", "ata", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "published_", ",_", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updated_", "=_", "updated_", ",_", "text_", "=_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "category_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "atom_", "._", "Category_", "(_", "scheme_", "=_", "'", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "#", "kind", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "term_", "=_", "'", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "photo", "s", "/", "2007", "#", "%", "s", "'_", "%_", "self_", "._", "\\u", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GP", "hot", "os", "Base", "Entry_", "(_", "gdata_", "._", "GD", "ata", "Entry_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", "s", " ", "the", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "category_", "[_", "0_", "]_", "._", "term_", "._", "split_", "(_", "'#'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GP", "hot", "os", "Base", "Entry_", "(_", "gdata_", "._", "GD", "ata", "Entry_", ",_", "gdata_", "._", "Link", "Finder_", ")_", ":_", "\\u\\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", "feed", "Uri_", "(_", "self_", ",_", "kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Conve", "nie", "nce", " ", "method", " ", "to", " ", "get", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "entry", "'", "s", " ", "feed", " ", "of", " ", "the", " ", "some", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "href_", "=_", "self_", "._", "Get", "Feed", "Link_", "(_", ")_", "._", "href_", "\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sep_", "=_", "'?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'?'_", "in_", "href_", ":_", "sep_", "=_", "'&'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "%", "skin", "d", "=", "%", "s", "'_", "%_", "(_", "href_", ",_", "sep_", ",_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Photos", "Base", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Photos", "Base", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "GP", "hot", "os", "Base", "Data_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Access_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Access", "'", " ", "element", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "album", "'", "s", " ", "access", " ", "level", ".", " ", "Valid", " ", "values", " ", "are", " ", "`", "public", "'", " ", "or", " ", "`", "private", "'.", "\\", "10", ";", " ", " ", "In", " ", "documentation", ",", " ", "access", " ", "level", " ", "is", " ", "als", "o", " ", "referred", " ", "to", " ", "as", " ", "`", "visi", "bilit", "y", ".'", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "access", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Access", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Access_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Alb", "umi", "d_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Alb", "umi", "d", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "album", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Alb", "umi", "d", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Alb", "umi", "d_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Byte", "s", "Used_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Byte", "s", "Us", "ed", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "bytes", "Us", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "s", "Us", "ed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Byte", "s", "Used_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Client_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Client", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "client", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Client", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Client_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Checksum", "_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Checksum", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "checks", "um", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Checksum", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Checksum", "_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comme", "nt", "Count_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Comme", "nt", "Count", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "comment", "Count", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Comme", "nt", "Count", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Comme", "nt", "Count_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comme", "ntin", "g", "Enabled_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Comme", "ntin", "g", "Enable", "d", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "comment", "ing", "Enable", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Comme", "ntin", "g", "Enable", "d", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Comme", "ntin", "g", "Enabled_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Height_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Hei", "ght", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "height", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Hei", "ght", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Height_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Id_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Id", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Id", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Id_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Location_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Locat", "ion", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "location", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Locat", "ion", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Location_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Max", "Photos", "Per", "Album_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Max", "Photos", "Per", "Alb", "um", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "max", "Photos", "Per", "Alb", "um", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Max", "Photos", "Per", "Alb", "um", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Max", "Photos", "Per", "Album_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Name_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Name", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Name", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Name_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Nick", "name_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Nick", "name", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "nick", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Nick", "name", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Nick", "name_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Num", "photos_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Num", "photo", "s", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "nump", "hot", "os", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Num", "photo", "s", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Num", "photos_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Num", "photo", "sre", "main", "ing_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Num", "photo", "sre", "main", "ing", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "nump", "hot", "osr", "ema", "inin", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Num", "photo", "sre", "main", "ing", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Num", "photo", "sre", "main", "ing_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Position_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Position", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "position", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Position", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Position_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Photo", "id_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Photo", "id", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "photo", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Photo", "id", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Photo", "id_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quota", "current_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Quota", "current", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "quot", "acu", "rren", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Quota", "current", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Quota", "current_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quota", "limit_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Quota", "limit", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "quot", "ali", "mit", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Quota", "limit", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Quota", "limit_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rotation_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Rot", "ation", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "rotati", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Rot", "ation", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Rotation_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Size_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Size", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Size", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Size_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Snippet", "_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "snippet", "'", " ", "element", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Whe", "n", " ", "search", "ing", ",", " ", "the", " ", "snippet", " ", "element", " ", "will", " ", "contain", " ", "a", " ", "\\", "10", ";", " ", " ", "string", " ", "with", " ", "the", " ", "word", " ", "you", "'", "re", " ", "look", "ing", " ", "for", ",", " ", "highlighted", " ", "in", " ", "html", " ", "markup", "\\", "10", ";", " ", " ", "E", ".", "g", ".", " ", "whe", "n", " ", "your", " ", "query", " ", "is", " ", "`", "ha", "fj", "ell", "',", " ", "this", " ", "element", " ", "may", " ", "contain", ":", "\\", "10", ";", " ", " ", "`.", "..", " ", "here", " ", "at", " ", "<", "b", ">", "Ha", "fj", "ell", "</", "b", ">.", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", "You", "'", "ll", " ", "find", " ", "this", " ", "element", " ", "in", " ", "searche", "s", " ", "--", " ", "tha", "t", " ", "is", ",", " ", "feed", "s", " ", "tha", "t", " ", "combin", "e", " ", "the", " ", "\\", "10", ";", " ", " ", "`", "kind", "=", "photo", "'", " ", "and", " ", "`", "q", "=", "your", "search", "'", " ", "parameter", "s", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "als", "o", " ", "gp", "hot", "o", ":", "truncat", "ed", " ", "and", " ", "gp", "hot", "o", ":", "snippet", "type", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "snippet", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Snippet", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Snippet", "_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Snippet", "type_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Snippet", "type", "'", " ", "element", "\\", "10", ";", "\\", "10", ";", " ", " ", "Whe", "n", " ", "search", "ing", ",", " ", "this", " ", "element", " ", "will", " ", "tell", " ", "you", " ", "the", " ", "type", " ", "of", " ", "element", " ", "tha", "t", " ", "matche", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "You", "'", "ll", " ", "find", " ", "this", " ", "element", " ", "in", " ", "searche", "s", " ", "--", " ", "tha", "t", " ", "is", ",", " ", "feed", "s", " ", "tha", "t", " ", "combin", "e", " ", "the", " ", "\\", "10", ";", " ", " ", "`", "kind", "=", "photo", "'", " ", "and", " ", "`", "q", "=", "your", "search", "'", " ", "parameter", "s", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "als", "o", " ", "gp", "hot", "o", ":", "snippet", " ", "and", " ", "gp", "hot", "o", ":", "truncat", "ed", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Poss", "ibl", "e", " ", "values", " ", "and", " ", "thei", "r", " ", "interpretation", ":", " ", "\\", "10", ";", " ", " ", "o", " ", "ALB", "UM", "\\u", "TIT", "LE", " ", " ", " ", "-", " ", "The", " ", "album", " ", "title", " ", "matche", "s", " ", "\\", "10", ";", " ", " ", "o", " ", "PHOTO", "\\u", "TAG", "S", " ", " ", " ", " ", "-", " ", "The", " ", "match", " ", "is", " ", "a", " ", "tag", "/", "keyw", "ord", "\\", "10", ";", " ", " ", "o", " ", "PHOTO", "\\u", "DESCRIPT", "ION", " ", "-", " ", "The", " ", "match", " ", "is", " ", "in", " ", "the", " ", "photo", "'", "s", " ", "description", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "you", " ", "discove", "r", " ", "a", " ", "value", " ", "not", " ", "liste", "d", " ", "here", ",", " ", "plea", "se", " ", "submit", " ", "a", " ", "patch", " ", "to", " ", "update", " ", "this", " ", "docstr", "ing", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "snippet", "type", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Snippet", "type", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Snippet", "type_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Thumb", "nail", "_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Thumb", "nail", "'", " ", "element", "\\", "10", ";", "\\", "10", ";", " ", " ", "Us", "ed", " ", "to", " ", "display", " ", "user", "'", "s", " ", "photo", " ", "thumbnail", " ", "(", "hacke", "rg", "ot", "chi", ").", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "(", "Not", " ", "to", " ", "be", " ", "conf", "used", " ", "with", " ", "the", " ", "<", "media", ":", "thumbnail", ">", " ", "element", ",", " ", "whi", "ch", " ", "give", "s", " ", "you", "\\", "10", ";", " ", " ", "small", " ", "version", "s", " ", "of", " ", "the", " ", "photo", " ", "object", ".)", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "thumbnail", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Thumb", "nail", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Thumb", "nail", "_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Timestamp_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Timest", "amp", "'", " ", "element", "\\", "10", ";", " ", " ", "Represent", "ed", " ", "as", " ", "the", " ", "number", " ", "of", " ", "milliseconds", " ", "sinc", "e", " ", "Januar", "y", " ", "1s", "t", ",", " ", "197", "0.", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "the", " ", "convenien", "ce", " ", "method", "s", " ", ".", "isof", "ormat", "()", " ", "and", " ", ".", "datetime", "():", "\\", "10", ";", "\\", "10", ";", " ", " ", "photo", "\\u", "epoch", " ", "=", " ", "Time", ".", "text", " ", " ", " ", " ", "#", " ", "118", "029", "433", "7000", "\\", "10", ";", " ", " ", "photo", "\\u", "iso", "string", " ", "=", " ", "Time", ".", "isof", "ormat", "()", " ", "#", " ", "'", "2007", "-0", "5", "-", "2", "7", "T1", "9", ":", "32", ":", "17.", "000", "Z", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", "Alternative", "ly", ":", " ", "\\", "10", ";", " ", " ", "photo", "\\u", "datetime", " ", " ", "=", " ", "Time", ".", "datetime", "()", " ", " ", "#", " ", "(", "require", "s", " ", "python", " ", ">=", " ", "2.3", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "timestamp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Timestamp_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "isoformat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "string", ")", " ", "Return", " ", "the", " ", "timestamp", " ", "as", " ", "a", " ", "ISO", " ", "860", "1", " ", "format", "ted", " ", "string", ",", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "'", "2007", "-0", "5", "-", "2", "7", "T1", "9", ":", "32", ":", "17.", "000", "Z", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epoch_", "=_", "float_", "(_", "self_", "._", "text_", ")_", "/_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "time_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", ".00", "0", "Z", "'_", ",_", "time_", "._", "gmtime_", "(_", "epoch_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Timestamp_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "datetime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "datetime", ".", "datetime", ")", " ", "Return", " ", "the", " ", "timestamp", " ", "as", " ", "a", " ", "datetime", ".", "datetime", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ires", " ", "python", " ", "2.3", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epoch_", "=_", "float_", "(_", "self_", "._", "text_", ")_", "/_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "epoch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Timest", "amp", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Timestamp_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Truncate", "d_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Truncate", "d", "'", " ", "element", "\\", "10", ";", "\\", "10", ";", " ", " ", "You", "'", "ll", " ", "find", " ", "this", " ", "element", " ", "in", " ", "searche", "s", " ", "--", " ", "tha", "t", " ", "is", ",", " ", "feed", "s", " ", "tha", "t", " ", "combin", "e", " ", "the", " ", "\\", "10", ";", " ", " ", "`", "kind", "=", "photo", "'", " ", "and", " ", "`", "q", "=", "your", "search", "'", " ", "parameter", "s", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "als", "o", " ", "gp", "hot", "o", ":", "snippet", " ", "and", " ", "gp", "hot", "o", ":", "snippet", "type", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Poss", "ibl", "e", " ", "values", " ", "and", " ", "thei", "r", " ", "interpretation", ":", "\\", "10", ";", " ", " ", "0", " ", "--", " ", "unknown", " ", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "Truncate", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Truncate", "d", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Truncate", "d_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "User", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "User", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "User_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Version_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Version", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "version", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Version", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Version_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Width_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Wid", "th", "'", " ", "element", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "tag_", "=_", "'", "widt", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Wid", "th", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Width_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Weight_", "(_", "Photos", "Base", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Goo", "gle", " ", "Photo", " ", "`", "Weig", "ht", "'", " ", "element", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "weight", " ", "of", " ", "the", " ", "tag", " ", "is", " ", "the", " ", "number", " ", "of", " ", "times", " ", "the", " ", "tag", "\\", "10", ";", " ", " ", "appear", "s", " ", "in", " ", "the", " ", "collection", " ", "of", " ", "tags", " ", "currentl", "y", " ", "bei", "ng", " ", "viewed", ".", "\\", "10", ";", " ", " ", "The", " ", "default", " ", "weight", " ", "is", " ", "1", ",", " ", "in", " ", "whi", "ch", " ", "case", " ", "this", " ", "tags", " ", "is", " ", "omit", "ted", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "tag_", "=_", "'", "weight", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Weig", "ht", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Weight_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comme", "nt", "Author_", "(_", "atom_", "._", "Author_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Atom", " ", "`", "Author", "'", " ", "element", " ", "in", " ", "Comme", "nt", "Entr", "y", " ", "entri", "es", " ", "is", " ", "augmented", " ", "to", "\\", "10", ";", " ", " ", "contain", " ", "element", "s", " ", "from", " ", "the", " ", "PHOTO", "S", "\\u", "NAMESPACE", "\\", "10", ";", "\\", "10", ";", " ", " ", "http", "://", "group", "s", ".", "google", ".", "com", "/", "group", "/", "Goo", "gle", "-", "Pic", "asa", "-", "Data", "-", "API", "/", "msg", "/", "819", "b0", "025", "b5", "ff", "5e", "3", "8", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "atom_", "._", "Author_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "user", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "user", "'_", ",_", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "nick", "name", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "nick", "name", "'_", ",_", "Nick", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "thumbnail", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "thumbnail", "'_", ",_", "Thumb", "nail", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Comme", "nt", "Author", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Comme", "nt", "Author_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Alb", "um", "Data_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "children_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "gp", "hot", "o", "\\u", "id", "'_", ",_", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "name", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "name", "'_", ",_", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "location", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "location", "'_", ",_", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "access", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "access", "'_", ",_", "Access_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "bytes", "Us", "ed", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "bytes", "Us", "ed", "'_", ",_", "Byte", "s", "Used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "timestamp", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "timestamp", "'_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "nump", "hot", "os", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "nump", "hot", "os", "'_", ",_", "Num", "photos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "nump", "hot", "osr", "ema", "inin", "g", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "nump", "hot", "osr", "ema", "inin", "g", "'_", ",_", "Num", "photo", "sre", "main", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "user", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "user", "'_", ",_", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "nick", "name", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "nick", "name", "'_", ",_", "Nick", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "comment", "ing", "Enable", "d", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "comment", "ing", "Enable", "d", "'_", ",_", "Comme", "ntin", "g", "Enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "comment", "Count", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "comment", "Count", "'_", ",_", "Comme", "nt", "Count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "media", ":", "group", " ", "as", " ", "self", ".", "media", ",", " ", "to", " ", "create", " ", "a", " ", "self", "-", "explain", "ing", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "Used_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nump", "hot", "os_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nump", "hot", "osr", "ema", "inin", "g_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nickname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "ing", "Enabled_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "Count_", "=_", "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_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Alb", "um", "\\", "10", ";", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "Alb", "um", "Data", " ", "for", " ", "metadata", " ", "accessible", " ", "as", " ", "attribute", "s", " ", "to", " ", "this", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Not", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "avoid", " ", "name", " ", "clas", "hes", ",", " ", "and", " ", "to", " ", "create", " ", "a", " ", "more", " ", "sensi", "ble", " ", "api", ",", " ", "some", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "have", " ", "names", " ", "tha", "t", " ", "differ", " ", "from", " ", "the", " ", "original", " ", "element", "s", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "media", ":", "group", " ", "->", " ", "self", ".", "media", ",", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "geo", ":", "where", " ", "->", " ", "self", ".", "geo", ",", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "photo", ":", "id", " ", "->", " ", "self", ".", "gp", "hot", "o", "\\u", "id", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "kind_", "=_", "'", "album", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Alb", "um", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "child", " ", "tags", " ", "only", " ", "for", " ", "Alb", "um", " ", "entri", "es", ",", " ", "not", " ", "feeds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "where", "'_", "%_", "GEO", "RSS", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "geo", "'_", ",_", "Geo", "_", "._", "Whe", "re_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "group", "'_", "%_", "MEDIA", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "media", "'_", ",_", "Media_", "._", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media_", "=_", "Media_", "._", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo_", "=_", "Geo", "_", "._", "Whe", "re_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "GP", "HOT", "O", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "location_", "=_", "None_", ",_", "access_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "None_", ",_", "nump", "hot", "os_", "=_", "None_", ",_", "user_", "=_", "None_", ",_", "nickname_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "ing", "Enabled_", "=_", "None_", ",_", "comment", "Count_", "=_", "None_", ",_", "thumbnail_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MEDIA", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "media_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GEO", "RSS", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "geo_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "ed", "\\u", "property_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GP", "hot", "os", "Base", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "published_", ",_", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updated_", "=_", "updated_", ",_", "text_", "=_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "photo", ":", "id", " ", "as", " ", "self", ".", "gp", "hot", "o", "\\u", "id", ",", " ", "to", " ", "avoid", " ", "name", " ", "clas", "h", " ", "with", " ", "atom", ":", "id_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gp", "hot", "o", "\\u", "id_", "=_", "gp", "hot", "o", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "=_", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "access_", "=_", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nump", "hot", "os_", "=_", "nump", "hot", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nickname_", "=_", "nickname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comment", "ing", "Enabled_", "=_", "comment", "ing", "Enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comment", "Count_", "=_", "comment", "Count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thumbnail_", "=_", "thumbnail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extend", "ed", "\\u", "property_", "=_", "extend", "ed", "\\u", "property_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "media", ":", "group", " ", "as", " ", "self", ".", "media", ",", " ", "and", " ", "geo", ":", "where", " ", "as", " ", "geo", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "to", " ", "create", " ", "a", " ", "self", "-", "explain", "ing", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "media_", "=_", "media_", "or_", "Media_", "._", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "geo_", "=_", "geo_", "or_", "Geo", "_", "._", "Whe", "re_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Alb", "um", "Id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", " ", "the", " ", "id", " ", "of", " ", "this", " ", "album", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "Get", "Feed", "Link_", "(_", ")_", "._", "href_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Photos", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "album", "s", " ", "feed", " ", "of", " ", "the", " ", "Photo", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "photo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "album", "s", " ", "feed", " ", "of", " ", "the", " ", "Comme", "nt", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "album", "s", " ", "feed", " ", "of", " ", "the", " ", "Ta", "g", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Alb", "um", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Alb", "um", "Entry_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Alb", "um", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Alb", "um", ",", " ", "inclu", "ding", " ", "its", " ", "sub", "-", "element", "s", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Thi", "s", " ", "feed", " ", "represent", "s", " ", "an", " ", "album", " ", "as", " ", "the", " ", "container", " ", "for", " ", "other", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "Alb", "um", " ", "feed", " ", "contain", "s", " ", "entri", "es", " ", "of", "\\", "10", ";", " ", " ", "Photo", "Entr", "y", ",", " ", "Comme", "nt", "Entr", "y", " ", "or", " ", "Ta", "g", "Entr", "y", ",", "\\", "10", ";", " ", " ", "depend", "ing", " ", "on", " ", "the", " ", "`", "kind", "'", " ", "parameter", " ", "in", " ", "the", " ", "original", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "Alb", "um", "Data", " ", "for", " ", "accessible", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Alb", "um", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Alb", "um", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Get", "Photos", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "same", " ", "feed", ",", " ", "but", " ", "of", " ", "the", " ", "Photo", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "photo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "same", " ", "feed", ",", " ", "but", " ", "of", " ", "the", " ", "Ta", "g", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alb", "um", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Alb", "um", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "same", " ", "feed", ",", " ", "but", " ", "of", " ", "the", " ", "Comme", "nt", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Alb", "um", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Alb", "um", "Feed_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Photo", "Data_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "children_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "photo", ":", "id", " ", "as", " ", "self", ".", "gp", "hot", "o", "\\u", "id", ",", " ", "to", " ", "avoid", " ", "name", " ", "clas", "h", " ", "with", " ", "atom", ":", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "gp", "hot", "o", "\\u", "id", "'_", ",_", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "album", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "album", "id", "'_", ",_", "Alb", "umi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "checks", "um", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "checks", "um", "'_", ",_", "Checksum", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "client", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "client", "'_", ",_", "Client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "height", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "height", "'_", ",_", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "position", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "position", "'_", ",_", "Position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "rotati", "on", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "rotati", "on", "'_", ",_", "Rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "size", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "size", "'_", ",_", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "timestamp", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "timestamp", "'_", ",_", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "version", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "version", "'_", ",_", "Version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "widt", "h", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "widt", "h", "'_", ",_", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "comment", "ing", "Enable", "d", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "comment", "ing", "Enable", "d", "'_", ",_", "Comme", "ntin", "g", "Enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "comment", "Count", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "comment", "Count", "'_", ",_", "Comme", "nt", "Count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "media", ":", "group", " ", "as", " ", "self", ".", "media", ",", " ", "exif", ":", "tags", " ", "as", " ", "self", ".", "exif", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "geo", ":", "where", " ", "as", " ", "self", ".", "geo", ",", " ", "to", " ", "create", " ", "a", " ", "self", "-", "explain", "ing", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "tags", "'_", "%_", "EX", "IF", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "exif", "'_", ",_", "Exi", "f_", "._", "Tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "where", "'_", "%_", "GEO", "RSS", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "geo", "'_", ",_", "Geo", "_", "._", "Whe", "re_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "group", "'_", "%_", "MEDIA", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "media", "'_", ",_", "Media_", "._", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "element", "s", " ", "show", " ", "up", " ", "in", " ", "search", " ", "feed", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "snippet", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "snippet", "'_", ",_", "Snippet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "snippet", "type", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "snippet", "type", "'_", ",_", "Snippet", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "truncat", "ed", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "truncat", "ed", "'_", ",_", "Truncate", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "album", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checksum_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rotation_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "ing", "Enabled_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "Count_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snippet_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snippet", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "truncat", "ed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media_", "=_", "Media_", "._", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo_", "=_", "Geo", "_", "._", "Whe", "re_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "Exi", "f_", "._", "Tags_", "(_", ")_", "\\u\\u\\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_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Photo", "\\", "10", ";", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "Photo", "Data", " ", "for", " ", "metadata", " ", "accessible", " ", "as", " ", "attribute", "s", " ", "to", " ", "this", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Not", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "avoid", " ", "name", " ", "clas", "hes", ",", " ", "and", " ", "to", " ", "create", " ", "a", " ", "more", " ", "sensi", "ble", " ", "api", ",", " ", "some", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "have", " ", "names", " ", "tha", "t", " ", "differ", " ", "from", " ", "the", " ", "original", " ", "element", "s", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "media", ":", "group", " ", "->", " ", "self", ".", "media", ",", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "exif", ":", "tags", " ", "->", " ", "self", ".", "exif", ",", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "geo", ":", "where", " ", "->", " ", "self", ".", "geo", ",", "\\", "10", ";", " ", " ", " ", " ", "o", " ", "photo", ":", "id", " ", "->", " ", "self", ".", "gp", "hot", "o", "\\u", "id", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "kind_", "=_", "'", "photo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Photo", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "text_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GP", "HOT", "O", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", ",_", "album", "id_", "=_", "None_", ",_", "checksum_", "=_", "None_", ",_", "client_", "=_", "None_", ",_", "height_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "None_", ",_", "rotation_", "=_", "None_", ",_", "size_", "=_", "None_", ",_", "timestamp_", "=_", "None_", ",_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "None_", ",_", "comment", "Count_", "=_", "None_", ",_", "comment", "ing", "Enabled_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MEDIA", "RSS", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "media_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EX", "IF", "\\u", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "exif", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GEO", "RSS", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "geo_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GP", "hot", "os", "Base", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "published_", "=_", "published_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "updated_", "=_", "updated_", ",_", "text_", "=_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "photo", ":", "id", " ", "as", " ", "self", ".", "gp", "hot", "o", "\\u", "id", ",", " ", "to", " ", "avoid", " ", "name", " ", "clas", "h", " ", "with", " ", "atom", ":", "id_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gp", "hot", "o", "\\u", "id_", "=_", "gp", "hot", "o", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "album", "id_", "=_", "album", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "checksum_", "=_", "checksum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "height_", "=_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotation_", "=_", "rotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "width_", "=_", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comment", "ing", "Enabled_", "=_", "comment", "ing", "Enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comment", "Count_", "=_", "comment", "Count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "media", ":", "group", " ", "as", " ", "self", ".", "media", ",", " ", "to", " ", "create", " ", "a", " ", "self", "-", "explain", "ing", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "media_", "=_", "media_", "or_", "Media_", "._", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exif", "_", "=_", "exif", "_", "or_", "Exi", "f_", "._", "Tags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "geo_", "=_", "geo_", "or_", "Geo", "_", "._", "Whe", "re_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Post", "Link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "photo", "'", "s", " ", "`", "POST", "'", " ", "link", " ", "(", "use", " ", "it", " ", "for", " ", "update", "s", " ", "of", " ", "the", " ", "object", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "Get", "Feed", "Link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "photo", "'", "s", " ", "feed", " ", "of", " ", "Comme", "nt", "Entr", "y", " ", "comment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "photo", "'", "s", " ", "feed", " ", "of", " ", "Ta", "g", "Entr", "y", " ", "tags", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photo", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Alb", "um", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "Alb", "um", "Entr", "y", " ", "contain", "ing", " ", "this", " ", "photo", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "href_", "[_", ":_", "href_", "._", "find_", "(_", "'/", "photo", "id", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Photo", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Photo", "Entry_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Photo", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Photo", ",", " ", "inclu", "ding", " ", "its", " ", "sub", "-", "element", "s", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Thi", "s", " ", "feed", " ", "represent", "s", " ", "a", " ", "photo", " ", "as", " ", "the", " ", "container", " ", "for", " ", "other", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "Photo", " ", "feed", " ", "contain", "s", " ", "entri", "es", " ", "of", "\\", "10", ";", " ", " ", "Comme", "nt", "Entr", "y", " ", "or", " ", "Ta", "g", "Entr", "y", ",", "\\", "10", ";", " ", " ", "depend", "ing", " ", "on", " ", "the", " ", "`", "kind", "'", " ", "parameter", " ", "in", " ", "the", " ", "original", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "Photo", "Data", " ", "for", " ", "metadata", " ", "accessible", " ", "as", " ", "attribute", "s", " ", "to", " ", "this", " ", "object", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Photo", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\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_", "Photo", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "same", " ", "feed", ",", " ", "but", " ", "of", " ", "the", " ", "Ta", "g", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photo", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Photo", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "same", " ", "feed", ",", " ", "but", " ", "of", " ", "the", " ", "Comme", "nt", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Photo", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Photo", "Feed_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ta", "g", "Data_", "(_", "GP", "hot", "os", "Base", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "children_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "weight", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "weight", "'_", ",_", "Weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight_", "=_", "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_", "Ta", "g", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Ta", "g", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Ta", "g", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "actual", " ", "tag", " ", "is", " ", "store", "d", " ", "in", " ", "the", " ", ".", "title", ".", "text", " ", "attribute", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "kind_", "=_", "'", "tag", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Ta", "g", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ta", "g", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Ta", "g", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GP", "HOT", "O", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "ed", "\\u", "property_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GP", "hot", "os", "Base", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "published_", "=_", "published_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "updated_", "=_", "updated_", ",_", "text_", "=_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "weight_", "=_", "weight_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ta", "g", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Ta", "g", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Alb", "um", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "Alb", "um", "Entr", "y", " ", "contain", "ing", " ", "this", " ", "tag", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "href_", "._", "find_", "(_", "'/", "photo", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "href_", "[_", ":_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ta", "g", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Ta", "g", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Photo", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "Photo", "Entr", "y", " ", "contain", "ing", " ", "this", " ", "tag", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "href_", "._", "find_", "(_", "'/", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "href_", "[_", ":_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ta", "g", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Ta", "g", "Entry_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ta", "g", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Ta", "g", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Ta", "g", ",", " ", "inclu", "ding", " ", "its", " ", "sub", "-", "element", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Ta", "g", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ta", "g", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Ta", "g", "Feed_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comme", "nt", "Data_", "(_", "GP", "hot", "os", "Base", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "children_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "NOTE", ":", " ", "stor", "ing", " ", "photo", ":", "id", " ", "as", " ", "self", ".", "gp", "hot", "o", "\\u", "id", ",", " ", "to", " ", "avoid", " ", "name", " ", "clas", "h", " ", "with", " ", "atom", ":", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "gp", "hot", "o", "\\u", "id", "'_", ",_", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "album", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "album", "id", "'_", ",_", "Alb", "umi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "photo", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "photo", "id", "'_", ",_", "Photo", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "author", "'_", "%_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "author", "'_", ",_", "[_", "Comme", "nt", "Author_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "album", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "photo", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author_", "=_", "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_", "Comme", "nt", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Comme", "nt", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", "The", " ", "comment", " ", "is", " ", "store", "d", " ", "in", " ", "the", " ", ".", "content", ".", "text", " ", "attribute", ",", "\\", "10", ";", " ", " ", "with", " ", "a", " ", "content", " ", "type", " ", "in", " ", ".", "content", ".", "type", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "kind_", "=_", "'", "comment", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Comme", "nt", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GP", "HOT", "O", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", ",_", "album", "id_", "=_", "None_", ",_", "photo", "id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "ed", "\\u", "property_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GP", "hot", "os", "Base", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "published_", "=_", "published_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "updated_", "=_", "updated_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gp", "hot", "o", "\\u", "id_", "=_", "gp", "hot", "o", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "album", "id_", "=_", "album", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "photo", "id_", "=_", "photo", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nt", "Id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "global", "ly", " ", "unique", " ", "id", " ", "of", " ", "this", " ", "comment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Alb", "um", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "Alb", "um", "Entr", "y", " ", "contain", "ing", " ", "this", " ", "comment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "href_", "[_", ":_", "href_", "._", "find_", "(_", "'/", "photo", "id", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Photo", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "uri", " ", "to", " ", "the", " ", "Photo", "Entr", "y", " ", "contain", "ing", " ", "this", " ", "comment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "href_", "=_", "self_", "._", "Get", "Self", "Link_", "(_", ")_", "._", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "href_", "[_", ":_", "href_", "._", "find_", "(_", "'/", "comment", "id", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Comme", "nt", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Comme", "nt", "Entry_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comme", "nt", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "Comme", "nt", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "Comme", "nt", ",", " ", "inclu", "ding", " ", "its", " ", "sub", "-", "element", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "Comme", "nt", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Comme", "nt", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "Comme", "nt", "Feed_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Data_", "(_", "GP", "hot", "os", "Base", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "children_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "max", "Photos", "Per", "Alb", "um", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "max", "Photos", "Per", "Alb", "um", "'_", ",_", "Max", "Photos", "Per", "Album_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "nick", "name", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "nick", "name", "'_", ",_", "Nick", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "quot", "ali", "mit", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "quot", "ali", "mit", "'_", ",_", "Quota", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "quot", "acu", "rren", "t", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "quot", "acu", "rren", "t", "'_", ",_", "Quota", "current_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "thumbnail", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "thumbnail", "'_", ",_", "Thumb", "nail", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "user", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "user", "'_", ",_", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "[_", "'{", "%", "s", "}", "id", "'_", "%_", "PHOTO", "S", "\\u", "NAMESPACE_", "]_", "=_", "(_", "'", "gp", "hot", "o", "\\u", "id", "'_", ",_", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Photos", "Per", "Album_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nickname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quot", "ali", "mit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quot", "acu", "rren", "t_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumbnail_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "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_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", " ", "metadata", " ", "for", " ", "a", " ", "Goo", "gle", " ", "Photos", " ", "User", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "entry", " ", "represent", "s", " ", "an", " ", "album", " ", "owner", " ", "and", " ", "all", " ", "appropr", "iate", " ", "metadata", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Tak", "e", " ", "a", " ", "look", " ", "at", " ", "at", " ", "the", " ", "attribute", "s", " ", "of", " ", "the", " ", "User", "Data", " ", "for", " ", "metadata", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Entry_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "User", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "kind_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "None_", ",_", "category_", "=_", "None_", ",_", "content_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "None_", ",_", "link_", "=_", "None_", ",_", "published_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "None_", ",_", "updated_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GP", "HOT", "O", " ", "NAMESPACE", ":_", "\\u\\u\\uNL\\u\\u\\u_", "gp", "hot", "o", "\\u", "id_", "=_", "None_", ",_", "max", "Photos", "Per", "Album_", "=_", "None_", ",_", "nickname_", "=_", "None_", ",_", "quot", "ali", "mit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "acu", "rren", "t_", "=_", "None_", ",_", "thumbnail_", "=_", "None_", ",_", "user_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "ed", "\\u", "property_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "None_", ",_", "extensi", "on", "\\u", "attributes_", "=_", "None_", ",_", "text_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GP", "hot", "os", "Base", "Entry_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "author_", "=_", "author_", ",_", "category_", "=_", "category_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom", "\\u", "id_", "=_", "atom", "\\u", "id_", ",_", "link_", "=_", "link_", ",_", "published_", "=_", "published_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "updated_", "=_", "updated_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "elements_", "=_", "extensi", "on", "\\u", "elements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "attributes_", "=_", "extensi", "on", "\\u", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gp", "hot", "o", "\\u", "id_", "=_", "gp", "hot", "o", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "Photos", "Per", "Album_", "=_", "max", "Photos", "Per", "Album_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nickname_", "=_", "nickname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quot", "ali", "mit_", "=_", "quot", "ali", "mit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quot", "acu", "rren", "t_", "=_", "quot", "acu", "rren", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thumbnail_", "=_", "thumbnail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Alb", "um", "s", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "user", "'", "s", " ", "feed", " ", "of", " ", "the", " ", "Alb", "um", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "album", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Photos", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "user", "'", "s", " ", "feed", " ", "of", " ", "the", " ", "Photo", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "photo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "user", "'", "s", " ", "feed", " ", "of", " ", "the", " ", "Comme", "nt", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Entry_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"(", "string", ")", " ", "Return", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "user", "'", "s", " ", "feed", " ", "of", " ", "the", " ", "Ta", "g", "Entr", "y", " ", "kind", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "User", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "User", "Entry_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Feed", " ", "for", " ", "a", " ", "User", " ", "in", " ", "the", " ", "google", " ", "photo", "s", " ", "api", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "feed", " ", "represent", "s", " ", "a", " ", "user", " ", "as", " ", "the", " ", "container", " ", "for", " ", "other", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "User", " ", "feed", " ", "contain", "s", " ", "entri", "es", " ", "of", "\\", "10", ";", " ", " ", "Alb", "um", "Entr", "y", ",", " ", "Photo", "Entr", "y", ",", " ", "Comme", "nt", "Entr", "y", ",", " ", "User", "Entr", "y", " ", "or", " ", "Ta", "g", "Entr", "y", ",", "\\", "10", ";", " ", " ", "depend", "ing", " ", "on", " ", "the", " ", "`", "kind", "'", " ", "parameter", " ", "in", " ", "the", " ", "original", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "user", " ", "feed", " ", "its", "elf", " ", "als", "o", " ", "contain", "s", " ", "all", " ", "of", " ", "the", " ", "metadata", " ", "avail", "able", "\\", "10", ";", " ", " ", "as", " ", "part", " ", "of", " ", "a", " ", "User", "Data", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "=_", "GP", "hot", "os", "Base", "Feed_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "children_", "._", "update_", "(_", "User", "Data_", "._", "\\u", "children_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "User", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Get", "Alb", "um", "s", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "feed", ",", " ", "but", " ", "with", " ", "entri", "es", " ", "of", " ", "the", " ", "Alb", "um", "Entr", "y", " ", "kind", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "album", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Ta", "gs", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "feed", ",", " ", "but", " ", "with", " ", "entri", "es", " ", "of", " ", "the", " ", "Ta", "g", "Entr", "y", " ", "kind", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Photos", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "feed", ",", " ", "but", " ", "with", " ", "entri", "es", " ", "of", " ", "the", " ", "Photos", "Entr", "y", " ", "kind", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "photo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Feed_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "User", "Data_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Comme", "nts", "Uri_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "uri", " ", "to", " ", "this", " ", "feed", ",", " ", "but", " ", "with", " ", "entri", "es", " ", "of", " ", "the", " ", "Comme", "nts", "Entr", "y", " ", "kind", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "feed", "Uri_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "User", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "Creat", "e", "Class", "Fro", "m", "XML", "String_", "(_", "User", "Feed_", ",_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Any", "Feed", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "appropr", "iate", " ", "feed", " ", "class", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "xml", " ", "string", " ", "content", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "xml", "\\u", "string", ":", " ", "str", " ", "A", " ", "string", " ", "whi", "ch", " ", "contain", "s", " ", "valid", " ", "XML", ".", " ", "The", " ", "root", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "XML", " ", "string", " ", "shou", "ld", " ", "match", " ", "the", " ", "tag", " ", "and", " ", "namespace", " ", "of", " ", "the", " ", "desi", "red", "\\", "10", ";", " ", " ", " ", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "of", " ", "the", " ", "target", " ", "class", " ", "with", " ", "member", "s", " ", "assign", "ed", " ", "according", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "content", "s", " ", "of", " ", "the", " ", "XML", " ", "-", " ", "or", " ", "a", " ", "basic", " ", "gdat", "a", ".", "GD", "ata", "Feed", " ", "instance", " ", "if", " ", "it", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "impossible", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "appropr", "iate", " ", "class", " ", "(", "look", " ", "for", " ", "extra", " ", "element", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "GD", "ata", "Feed", "'", "s", " ", ".", "Fin", "d", "Ext", "ensi", "ons", "()", " ", "and", " ", "extensi", "on", "\\u", "element", "s", "[]", " ", ").", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "Element", "Tree_", "._", "fromstring_", "(_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "tree_", "._", "find_", "(_", "'{", "%", "s", "}", "category", "'_", "%_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "this", " ", "the", " ", "best", " ", "way", " ", "to", " ", "handle", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", ",_", "kind_", "=_", "category_", "._", "get_", "(_", "'", "term", "'_", ")_", "._", "split_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "namespace_", "!=_", "PHOTO", "S", "\\u", "NAMESPACE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "this", " ", "the", " ", "best", " ", "way", " ", "to", " ", "handle", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "GP", "hot", "os", "Base", "Feed_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", ":", " ", "is", " ", "getattr", " ", "safe", " ", "this", " ", "way", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feed", "\\u", "class_", "=_", "getattr_", "(_", "gdata_", "._", "photos_", ",_", "'%", "s", "Feed", "'_", "%_", "kind_", "._", "title_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "feed", "\\u", "class_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Any", "Entr", "y", "Fro", "m", "String_", "(_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "appropr", "iate", " ", "entry", " ", "class", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "xml", " ", "string", " ", "content", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "xml", "\\u", "string", ":", " ", "str", " ", "A", " ", "string", " ", "whi", "ch", " ", "contain", "s", " ", "valid", " ", "XML", ".", " ", "The", " ", "root", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "XML", " ", "string", " ", "shou", "ld", " ", "match", " ", "the", " ", "tag", " ", "and", " ", "namespace", " ", "of", " ", "the", " ", "desi", "red", "\\", "10", ";", " ", " ", " ", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "of", " ", "the", " ", "target", " ", "class", " ", "with", " ", "member", "s", " ", "assign", "ed", " ", "according", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "content", "s", " ", "of", " ", "the", " ", "XML", " ", "-", " ", "or", " ", "a", " ", "basic", " ", "gdat", "a", ".", "GD", "ata", "End", "ry", " ", "instance", " ", "if", " ", "it", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "impossible", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "appropr", "iate", " ", "class", " ", "(", "look", " ", "for", " ", "extra", " ", "element", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "GD", "ata", "Entr", "y", "'", "s", " ", ".", "Fin", "d", "Ext", "ensi", "ons", "()", " ", "and", " ", "extensi", "on", "\\u", "element", "s", "[]", " ", ").", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "Element", "Tree_", "._", "fromstring_", "(_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "tree_", "._", "find_", "(_", "'{", "%", "s", "}", "category", "'_", "%_", "atom_", "._", "ATOM", "\\u", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "this", " ", "the", " ", "best", " ", "way", " ", "to", " ", "handle", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", ",_", "kind_", "=_", "category_", "._", "get_", "(_", "'", "term", "'_", ")_", "._", "split_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "namespace_", "!=_", "PHOTO", "S", "\\u", "NAMESPACE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "this", " ", "the", " ", "best", " ", "way", " ", "to", " ", "handle", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "GP", "hot", "os", "Base", "Entry_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", ":", " ", "is", " ", "getattr", " ", "safe", " ", "this", " ", "way", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feed", "\\u", "class_", "=_", "getattr_", "(_", "gdata_", "._", "photos_", ",_", "'%", "s", "Entr", "y", "'_", "%_", "kind_", "._", "title_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "atom_", "._", "\\u", "Creat", "e", "Class", "Fro", "m", "Element", "Tree_", "(_", "feed", "\\u", "class_", ",_", "tree_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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25/bacpypes/bvllservice.py
[ { "content": " def process_task(self):\n # look for foreign device registrations that have expired\n for i in range(len(self.bbmdFDT)-1, -1, -1):\n fdte = self.bbmdFDT[i]\n fdte.fdRemain -= 1\n\n # delete it if it expired\n if fdte.fdRemain <= 0:\n if _debug: BIPBBMD._debug(\"foreign device expired: %r\", fdte.fdAddress)\n del self.bbmdFDT[i]", "metadata": "root.BIPBBMD.process_task", "header": "['class', 'BIPBBMD', '(', 'BIPSAP', ',', 'Client', ',', 'Server', ',', 'RecurringTask', ',', 'DebugContents', ')', ':', '___EOS___']", "index": 820 } ]
[]
[]
0
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "BI", "PB", "BM", "D_", "(_", "BI", "PS", "AP_", ",_", "Client_", ",_", "Server_", ",_", "Recu", "rri", "ng", "Task_", ",_", "Deb", "ug", "Contents_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "look", " ", "for", " ", "foreign", " ", "device", " ", "registration", "s", " ", "tha", "t", " ", "have", " ", "expired_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "bb", "md", "FD", "T_", ")_", "-_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd", "te_", "=_", "self_", "._", "bb", "md", "FD", "T_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd", "te_", "._", "fd", "Rema", "in_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "it", " ", "if", " ", "it", " ", "expired_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fd", "te_", "._", "fd", "Rema", "in_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "BI", "PB", "BM", "D_", "._", "\\u", "debug_", "(_", "\"", "foreign", " ", "device", " ", "expir", "ed", ":", " ", "%", "r", "\"_", ",_", "fd", "te_", "._", "fd", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "bb", "md", "FD", "T_", "[_", "i_", "]_", "\\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 ]
Testing equality to None
Calysto/metakernel/metakernel/pexpect.py
[ { "content": " def _winread(self, size, timeout):\n t0 = time.time()\n buf = ''\n if timeout is None or timeout == -1:\n timeout = 30\n while len(buf) < size:\n try:\n incoming = self._read_queue.get(True, 1e-3)\n except Queue.Empty:\n break\n except KeyboardInterrupt:\n self.sendintr()\n break\n else:\n if not incoming:\n self.flag_eof = True\n raise EOF('End of File')\n\n buf += incoming\n\n if (time.time() - t0) >= timeout:\n break\n\n if len(buf) > size:\n self.buffer = buf[size:]\n buf = buf[:size]\n\n buf = self._coerce_read_string(buf)\n self._log(buf, 'read')\n return buf", "metadata": "root.spawn._winread", "header": "['class', 'spawn', '(', 'object', ')', ':', '___EOS___']", "index": 1030 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "spawn_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "winr", "ead_", "(_", "self_", ",_", "size_", ",_", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "is_", "None_", "or_", "timeout_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "len_", "(_", "buf_", ")_", "<_", "size_", ":_", "\\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 ", " _", "incoming_", "=_", "self_", "._", "\\u", "read", "\\u", "queue_", "._", "get_", "(_", "True_", ",_", "1e-3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sendin", "tr_", "(_", ")_", "\\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 ", " _", "if_", "not_", "incoming_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "flag", "\\u", "eof_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "EOF_", "(_", "'", "End", " ", "of", " ", "File", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "+=_", "incoming_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "t0_", ")_", ">=_", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer_", "=_", "buf_", "[_", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "buf_", "[_", ":_", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "=_", "self_", "._", "\\u", "coerce", "\\u", "read", "\\u", "string_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "buf_", ",_", "'", "read", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buf_", "\\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 ]
Unreachable code
RoseOu/flasky/venv/lib/python2.7/site-packages/mako/template.py
[ { "content": " def __init__(self, module,\n module_filename=None,\n template=None,\n template_filename=None,\n module_source=None,\n template_source=None,\n output_encoding=None,\n encoding_errors='strict',\n disable_unicode=False,\n bytestring_passthrough=False,\n format_exceptions=False,\n error_handler=None,\n lookup=None,\n cache_args=None,\n cache_impl='beaker',\n cache_enabled=True,\n cache_type=None,\n cache_dir=None,\n cache_url=None,\n ):\n self.module_id = re.sub(r'\\W', \"_\", module._template_uri)\n self.uri = module._template_uri\n self.input_encoding = module._source_encoding\n self.output_encoding = output_encoding\n self.encoding_errors = encoding_errors\n self.disable_unicode = disable_unicode\n self.bytestring_passthrough = bytestring_passthrough or disable_unicode\n self.enable_loop = module._enable_loop\n\n if compat.py3k and disable_unicode:\n raise exceptions.UnsupportedError(\n \"Mako for Python 3 does not \"\n \"support disabling Unicode\")\n elif output_encoding and disable_unicode:\n raise exceptions.UnsupportedError(\n \"output_encoding must be set to \"\n \"None when disable_unicode is used.\")\n\n self.module = module\n self.filename = template_filename\n ModuleInfo(module,\n module_filename,\n self,\n template_filename,\n module_source,\n template_source)\n\n self.callable_ = self.module.render_body\n self.format_exceptions = format_exceptions\n self.error_handler = error_handler\n self.lookup = lookup\n self._setup_cache_args(\n cache_impl, cache_enabled, cache_args,\n cache_type, cache_dir, cache_url\n )", "metadata": "root.ModuleTemplate.__init__", "header": "['class', 'ModuleTemplate', '(', 'Template', ')', ':', '___EOS___']", "index": 499 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Modul", "e", "Template_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "filename_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "filename_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "source_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "source_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "encoding_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding", "\\u", "errors_", "=_", "'", "strict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disable", "\\u", "unicode_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytestr", "ing", "\\u", "passthrough", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format\\u", "exceptions_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "handler_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lookup_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "args_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "impl_", "=_", "'", "bea", "ker", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "enabled_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "dir_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "url_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u", "id_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\", "W", "'_", ",_", "\"\\u\"_", ",_", "module_", "._", "\\u", "template", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "uri_", "=_", "module_", "._", "\\u", "template", "\\u", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "input", "\\u", "encoding_", "=_", "module_", "._", "\\u", "source", "\\u", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "encoding_", "=_", "output", "\\u", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encoding", "\\u", "errors_", "=_", "encoding", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "disable", "\\u", "unicode_", "=_", "disable", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bytestr", "ing", "\\u", "passthrough", "_", "=_", "bytestr", "ing", "\\u", "passthrough", "_", "or_", "disable", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "loop_", "=_", "module_", "._", "\\u", "enable", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compat_", "._", "py3", "k_", "and_", "disable", "\\u", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Unsu", "ppo", "rted", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ma", "ko", " ", "for", " ", "Pyth", "on", " ", "3", " ", "doe", "s", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "support", " ", "disa", "blin", "g", " ", "Unic", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "output", "\\u", "encoding_", "and_", "disable", "\\u", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Unsu", "ppo", "rted", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "encoding", " ", "must", " ", "be", " ", "set", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Non", "e", " ", "whe", "n", " ", "disable", "\\u", "unicode", " ", "is", " ", "used", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "module_", "=_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "template", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Modul", "e", "Info_", "(_", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "callable\\u", "_", "=_", "self_", "._", "module_", "._", "render", "\\u", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "format\\u", "exceptions_", "=_", "format\\u", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "handler_", "=_", "error", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lookup_", "=_", "lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "cache", "\\u", "args_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "impl_", ",_", "cache", "\\u", "enabled_", ",_", "cache", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "type_", ",_", "cache", "\\u", "dir_", ",_", "cache", "\\u", "url_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
dimagi/commcare-hq/custom/opm/tests/test_windows_and_months.py
[ { "content": " def test_one_day_early(self):\n self.assertNotInRange(2014, 5, 31, months_before=1)\n self.assertNotInRange(2014, 3, 31, months_before=3)", "metadata": "root.TestFormFiltering.test_one_day_early", "header": "['class', 'TestFormFiltering', '(', 'TestCase', ')', ':', '___EOS___']", "index": 223 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "Form", "Filtering", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "one", "\\u", "day", "\\u", "ear", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Not", "In", "Range_", "(_", "2014_", ",_", "5_", ",_", "31_", ",_", "month", "s", "\\u", "before_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In", "Range_", "(_", "2014_", ",_", "3_", ",_", "31_", ",_", "month", "s", "\\u", "before_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
berdario/pew/pew/_utils.py
[ { "content": "def own(path):\n if sys.platform == 'win32':\n # Even if run by an administrator, the permissions will be set\n # correctly on Windows, no need to check\n return True\n while not path.exists():\n path = path.parent\n return path.stat().st_uid == os.getuid()", "metadata": "root.own", "header": "['module', '___EOS___']", "index": 71 } ]
[]
[]
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_", "own_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Even", " ", "if", " ", "run", " ", "by", " ", "an", " ", "administrat", "or", ",", " ", "the", " ", "permissi", "ons", " ", "will", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", "ly", " ", "on", " ", "Window", "s", ",", " ", "no", " ", "need", " ", "to", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "path_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "path_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path_", "._", "stat_", "(_", ")_", "._", "st", "\\u", "uid_", "==_", "os_", "._", "getu", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cloudaice/simple-data/misc/virtenv/lib/python2.7/site-packages/tornado/test/concurrent_test.py
[ { "content": " def test_callback_kw(self):\n future = self.sync_future(callback=self.stop)\n result = self.wait()\n self.assertEqual(result, 42)\n self.assertEqual(future.result(), 42)", "metadata": "root.ReturnFutureTest.test_callback_kw", "header": "['class', 'ReturnFutureTest', '(', 'AsyncTestCase', ')', ':', '___EOS___']", "index": 73 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Return", "Fu", "ture", "Test_", "(_", "Async", "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", "callback", "\\u", "kw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "future_", "=_", "self_", "._", "sync", "\\u", "future_", "(_", "callback_", "=_", "self_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "future_", "._", "result_", "(_", ")_", ",_", "42_", ")_", "\\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 ]
Unused import
fabianp/memory_profiler/examples/plot_memory.py
[ { "content": "\"\"\"\nPlot memory usage of a numeric computation using numpy and scipy\n\"\"\"\nimport pylab as pl\nimport numpy as np\nfrom memory_profiler import memory_usage\nfrom scipy import linalg\n\nX = np.random.randn(1000, 1000)\n\nmem = memory_usage((linalg.qr, (X,)))\nx = np.linspace(0, len(mem) * .1, len(mem))\n\np = pl.fill_between(x, mem)\n\npl.xlabel('time')\npl.ylabel('Memory consumption (in MB)')\npl.show()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Plot", " ", "memory", " ", "usage", " ", "of", " ", "a", " ", "numeri", "c", " ", "computation", " ", "usi", "ng", " ", "nump", "y", " ", "and", " ", "sci", "py", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pylab_", "as_", "pl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "memory", "\\u", "profiler_", "import_", "memory", "\\u", "usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "linalg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "1000_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mem_", "=_", "memory", "\\u", "usage_", "(_", "(_", "linalg_", "._", "qr_", ",_", "(_", "X_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "linspace_", "(_", "0_", ",_", "len_", "(_", "mem_", ")_", "*_", ".1_", ",_", "len_", "(_", "mem_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "pl_", "._", "fill", "\\u", "between_", "(_", "x_", ",_", "mem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "Memo", "ry", " ", "consum", "ption", " ", "(", "in", " ", "MB", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
azoft-dev-team/imagrium/env/Demo/applet/deprecated/ListDemo.py
[ { "content": " def change(self, e):\n\tlist = e.source\n\tif e.stateChange == ItemEvent.SELECTED:\n\t select = 'Select'\n\telse: \n\t select = 'Deselect'\n\n\ttext = '%s event occurred on item #%d (%s) in %s.\\n'\n\tparams = (select, e.item, list.getItem(e.item), self.language[list])\n\tself.output.append(text % params)", "metadata": "root.ListDemo.change", "header": "['class', 'ListDemo', '(', 'applet', '.', 'Applet', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "List", "Demo", "_", "(_", "applet", "_", "._", "Apple", "t_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change_", "(_", "self_", ",_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "list_", "=_", "e_", "._", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "state", "Change_", "==_", "Item", "Event_", "._", "SELECTED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "select_", "=_", "'", "Select", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "select_", "=_", "'", "Des", "elect", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "'%", "s", " ", "event", " ", "occur", "red", " ", "on", " ", "item", " ", "#", "%", "d", " ", "(%", "s", ")", " ", "in", " ", "%", "s", ".\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "(_", "select_", ",_", "e_", "._", "item_", ",_", "list_", "._", "get", "Item_", "(_", "e_", "._", "item_", ")_", ",_", "self_", "._", "language_", "[_", "list_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output_", "._", "append_", "(_", "text_", "%_", "params_", ")_", "\\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 ]
Except block handles 'BaseException'
amarandon/smeuhsocial/apps/blog/views.py
[ { "content": "import datetime\n\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect, Http404\nfrom django.shortcuts import render_to_response, get_object_or_404\nfrom django.template import RequestContext\nfrom django.utils.translation import ugettext, ugettext_lazy as _\n\nfrom django.contrib import messages\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.decorators import login_required\n\nfrom blog.models import Post\nfrom blog.forms import *\n\nif \"notification\" in settings.INSTALLED_APPS:\n from notification import models as notification\nelse:\n notification = None\ntry:\n from friends.models import Friendship\n friends = True\nexcept ImportError:\n friends = False\n\n\n\n\n\n\n\n\n\n\n\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_", "datetime_", "\\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_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", ",_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", ",_", "get", "\\u", "object\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", ",_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "blog_", "._", "models_", "import_", "Post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blog_", "._", "forms_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "notification", "\"_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "notification_", "import_", "models_", "as_", "notification_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notification_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "friends_", "._", "models_", "import_", "Friends", "hip", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "friends_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "friends_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 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 ]
Unused import
openstack/sahara/sahara/utils/openstack/base.py
[ { "content": "# Copyright (c) 2013 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 keystoneclient import exceptions as keystone_ex\nfrom keystoneclient import service_catalog as keystone_service_catalog\nfrom oslo_config import cfg\nfrom oslo_log import log as logging\nfrom oslo_serialization import jsonutils as json\nfrom six.moves.urllib import parse as urlparse\n\nfrom sahara import context\nfrom sahara import exceptions as ex\nfrom sahara.i18n import _LW\n\nLOG = logging.getLogger(__name__)\n\n# List of the errors, that can be retried\nERRORS_TO_RETRY = [408, 413, 429, 500, 502, 503, 504]\n\nopts = [\n cfg.IntOpt('retries_number',\n default=5,\n help='Number of times to retry the request to client before '\n 'failing'),\n cfg.IntOpt('retry_after',\n default=10,\n help='Time between the retries to client (in seconds).')\n]\n\nretries = cfg.OptGroup(name='retries',\n title='OpenStack clients calls retries')\n\nCONF = cfg.CONF\nCONF.register_group(retries)\nCONF.register_opts(opts, group=retries)\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def url_for(service_catalog=None, service_type='identity',\n endpoint_type=\"internalURL\"):\n if not service_catalog:\n service_catalog = context.current().service_catalog\n try:\n return keystone_service_catalog.ServiceCatalogV2(\n {'serviceCatalog': json.loads(service_catalog)}).url_for(\n service_type=service_type, endpoint_type=endpoint_type,\n region_name=CONF.os_region_name)\n except keystone_ex.EndpointNotFound:\n return keystone_service_catalog.ServiceCatalogV3(\n context.get_auth_token(),\n {'catalog': json.loads(service_catalog)}).url_for(\n service_type=service_type, endpoint_type=endpoint_type,\n region_name=CONF.os_region_name)", "metadata": "root.url_for", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def retrieve_auth_url(endpoint_type=\"internalURL\"):\n version = 'v3' if CONF.use_identity_api_v3 else 'v2.0'\n ctx = context.current()\n if ctx.service_catalog:\n info = urlparse.urlparse(url_for(ctx.service_catalog, 'identity',\n endpoint_type))\n else:\n info = urlparse.urlparse(CONF.keystone_authtoken.auth_uri)\n return \"%s://%s/%s\" % (info[:2] + (version,))", "metadata": "root.retrieve_auth_url", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def execute_with_retries(method, *args, **kwargs):\n attempts = CONF.retries.retries_number + 1\n while attempts > 0:\n try:\n return method(*args, **kwargs)\n except Exception as e:\n error_code = getattr(e, 'http_status', None) or getattr(\n e, 'status_code', None) or getattr(e, 'code', None)\n if error_code in ERRORS_TO_RETRY:\n LOG.warning(_LW('Occasional error occurred during \"{method}\" '\n 'execution: {error_msg} ({error_code}). '\n 'Operation will be retried.').format(\n method=method.__name__,\n error_msg=e,\n error_code=error_code))\n attempts -= 1\n retry_after = getattr(e, 'retry_after', 0)\n context.sleep(max(retry_after, CONF.retries.retry_after))\n else:\n LOG.debug('Permanent error occurred during \"{method}\" '\n 'execution: {error_msg}.'.format(\n method=method.__name__, error_msg=e))\n raise e\n else:\n raise ex.MaxRetriesExceeded(attempts, method.__name__)", "metadata": "root.execute_with_retries", "header": "['module', '___EOS___']", "index": 77 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "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_", "keystone", "client_", "import_", "exceptions_", "as_", "keystone", "\\u", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keystone", "client_", "import_", "service", "\\u", "catalog_", "as_", "keystone", "\\u", "service", "\\u", "catalog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "log_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "serialization_", "import_", "jsonutils_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "urllib_", "import_", "parse_", "as_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sahara", "_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "import_", "exceptions_", "as_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "i18n_", "import_", "\\u", "LW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "the", " ", "error", "s", ",", " ", "tha", "t", " ", "can", " ", "be", " ", "retrie", "d_", "\\u\\u\\uNL\\u\\u\\u_", "ERRORS", "\\u", "TO", "\\u", "RETRY", "_", "=_", "[_", "408", "_", ",_", "413_", ",_", "429", "_", ",_", "500_", ",_", "502_", ",_", "503_", ",_", "504_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "Int", "Opt_", "(_", "'", "retrie", "s", "\\u", "number", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Number", " ", "of", " ", "times", " ", "to", " ", "retr", "y", " ", "the", " ", "request", " ", "to", " ", "client", " ", "bef", "ore", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "faili", "ng", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "Int", "Opt_", "(_", "'", "retr", "y", "\\u", "after", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Time", " ", "bet", "ween", " ", "the", " ", "retrie", "s", " ", "to", " ", "client", " ", "(", "in", " ", "second", "s", ").'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retries_", "=_", "cfg_", "._", "Opt", "Group_", "(_", "name_", "=_", "'", "retrie", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "'", "Open", "Stack", " ", "clients", " ", "calls", " ", "retrie", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "cfg_", "._", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "._", "register", "\\u", "group_", "(_", "retries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "._", "register", "\\u", "opts_", "(_", "opts_", ",_", "group_", "=_", "retries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "url", "\\u", "for_", "(_", "service", "\\u", "catalog_", "=_", "None_", ",_", "service", "\\u", "type_", "=_", "'", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "\"", "internal", "URL", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "service", "\\u", "catalog_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "catalog_", "=_", "context_", "._", "current_", "(_", ")_", "._", "service", "\\u", "catalog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "keystone", "\\u", "service", "\\u", "catalog_", "._", "Service", "Catalog", "V2_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "service", "Catalog", "'_", ":_", "json_", "._", "loads_", "(_", "service", "\\u", "catalog_", ")_", "}_", ")_", "._", "url", "\\u", "for_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "type_", "=_", "service", "\\u", "type_", ",_", "endpoint", "\\u", "type_", "=_", "endpoint", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "name_", "=_", "CONF_", "._", "os", "\\u", "region", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "keystone", "\\u", "ex_", "._", "End", "point", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "keystone", "\\u", "service", "\\u", "catalog_", "._", "Service", "Catalog", "V3_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "get", "\\u", "auth", "\\u", "token_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "catal", "og", "'_", ":_", "json_", "._", "loads_", "(_", "service", "\\u", "catalog_", ")_", "}_", ")_", "._", "url", "\\u", "for_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "type_", "=_", "service", "\\u", "type_", ",_", "endpoint", "\\u", "type_", "=_", "endpoint", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "name_", "=_", "CONF_", "._", "os", "\\u", "region", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retrieve", "\\u", "auth", "\\u", "url_", "(_", "endpoint", "\\u", "type_", "=_", "\"", "internal", "URL", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "'", "v", "3", "'_", "if_", "CONF_", "._", "use", "\\u", "identi", "ty", "\\u", "api", "\\u", "v3_", "else_", "'", "v2", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "context_", "._", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ctx_", "._", "service", "\\u", "catalog_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "urlparse_", "._", "urlparse_", "(_", "url", "\\u", "for_", "(_", "ctx_", "._", "service", "\\u", "catalog_", ",_", "'", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "urlparse_", "._", "urlparse_", "(_", "CONF_", "._", "keystone", "\\u", "autht", "oken", "_", "._", "auth", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"%", "s", "://", "%", "s", "/", "%", "s", "\"_", "%_", "(_", "info_", "[_", ":_", "2_", "]_", "+_", "(_", "version_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "with", "\\u", "retries_", "(_", "method_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attempts_", "=_", "CONF_", "._", "retries_", "._", "retrie", "s", "\\u", "number_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "attempts_", ">_", "0_", ":_", "\\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_", "method_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "code_", "=_", "getattr_", "(_", "e_", ",_", "'", "http", "\\u", "status", "'_", ",_", "None_", ")_", "or_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "e_", ",_", "'", "status", "\\u", "code", "'_", ",_", "None_", ")_", "or_", "getattr_", "(_", "e_", ",_", "'", "code", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error", "\\u", "code_", "in_", "ERRORS", "\\u", "TO", "\\u", "RETRY", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warning_", "(_", "\\u", "LW", "_", "(_", "'", "Oc", "casi", "onal", " ", "error", " ", "occur", "red", " ", "dur", "ing", " ", "\"{", "method", "}\"", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "executi", "on", ":", " ", "{", "error", "\\u", "msg", "}", " ", "({", "error", "\\u", "code", "}).", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "tion", " ", "will", " ", "be", " ", "retrie", "d", ".'_", ")_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "msg_", "=_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "code_", "=_", "error", "\\u", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attempts_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retr", "y", "\\u", "after_", "=_", "getattr_", "(_", "e_", ",_", "'", "retr", "y", "\\u", "after", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "sleep_", "(_", "max_", "(_", "retr", "y", "\\u", "after_", ",_", "CONF_", "._", "retries_", "._", "retr", "y", "\\u", "after_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "debug_", "(_", "'", "Permanent", " ", "error", " ", "occur", "red", " ", "dur", "ing", " ", "\"{", "method", "}\"", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "executi", "on", ":", " ", "{", "error", "\\u", "msg", "}.'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "error", "\\u", "msg_", "=_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ex_", "._", "Max", "Retri", "es", "Exce", "eded", "_", "(_", "attempts_", ",_", "method_", "._", "\\u\\u", "name\\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, 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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 import
dimagi/commcare-hq/corehq/apps/userreports/sql/adapter.py
[ { "content": "import sqlalchemy\nfrom sqlalchemy.exc import IntegrityError, ProgrammingError\nfrom corehq.apps.userreports.exceptions import TableRebuildError, TableNotFoundWarning\nfrom corehq.apps.userreports.sql.columns import column_to_sql\nfrom corehq.apps.userreports.sql.connection import get_engine_id\nfrom corehq.apps.userreports.sql.util import get_table_name\nfrom corehq.sql_db.connections import connection_manager\nfrom dimagi.utils.decorators.memoized import memoized\nfrom dimagi.utils.logging import notify_exception\n\n\nmetadata = sqlalchemy.MetaData()\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IndicatorSqlAdapter(object):\n\n\n\n\n\n\n\n\n", "metadata": "root.IndicatorSqlAdapter", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, config):\n self.config = config\n self.engine_id = get_engine_id(config)\n self.session_helper = connection_manager.get_session_helper(self.engine_id)\n self.engine = self.session_helper.engine", "metadata": "root.IndicatorSqlAdapter.__init__", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": " @memoized\n def get_table(self):\n return get_indicator_table(self.config)", "metadata": "root.IndicatorSqlAdapter.get_table", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def rebuild_table(self):\n self.session_helper.Session.remove()\n try:\n rebuild_table(self.engine, self.get_table())\n except ProgrammingError, e:\n raise TableRebuildError('problem rebuilding UCR table {}: {}'.format(self.config, e))\n finally:\n self.session_helper.Session.commit()", "metadata": "root.IndicatorSqlAdapter.rebuild_table", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 26 }, { "content": " def drop_table(self):\n # this will hang if there are any open sessions, so go ahead and close them\n self.session_helper.Session.remove()\n with self.engine.begin() as connection:\n self.get_table().drop(connection, checkfirst=True)", "metadata": "root.IndicatorSqlAdapter.drop_table", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def get_query_object(self):\n \"\"\"\n Get a sqlalchemy query object ready to query this table\n \"\"\"\n return self.session_helper.Session.query(self.get_table())", "metadata": "root.IndicatorSqlAdapter.get_query_object", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def best_effort_save(self, doc):\n \"\"\"\n Does a best-effort save of the document. Will fail silently if the save is not successful.\n\n For certain known, expected errors this will do no additional logging.\n For unexpected errors it will log them.\n \"\"\"\n try:\n self.save(doc)\n except IntegrityError:\n pass # can be due to users messing up their tables/data so don't bother logging\n except Exception as e:\n self.handle_exception(doc, e)", "metadata": "root.IndicatorSqlAdapter.best_effort_save", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def handle_exception(self, doc, exception):\n notify_exception(None, u'unexpected error saving UCR doc: {}. domain: {}, doc: {}, table {}'.format(\n exception,\n self.config.domain,\n doc.get('_id', '<unknown>'),\n '{} ({})'.format(self.config.display_name, self.config._id)\n ))", "metadata": "root.IndicatorSqlAdapter.handle_exception", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def save(self, doc):\n \"\"\"\n Saves the document. Should bubble up known errors.\n \"\"\"\n indicator_rows = self.config.get_all_values(doc)\n if indicator_rows:\n table = self.get_table()\n with self.engine.begin() as connection:\n # delete all existing rows for this doc to ensure we aren't left with stale data\n delete = table.delete(table.c.doc_id == doc['_id'])\n connection.execute(delete)\n for indicator_row in indicator_rows:\n all_values = {i.column.database_column_name: i.value for i in indicator_row}\n insert = table.insert().values(**all_values)\n connection.execute(insert)", "metadata": "root.IndicatorSqlAdapter.save", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def delete(self, doc):\n table = self.get_table()\n with self.engine.begin() as connection:\n delete = table.delete(table.c.doc_id == doc['_id'])\n connection.execute(delete)", "metadata": "root.IndicatorSqlAdapter.delete", "header": "['class', 'IndicatorSqlAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 85 }, { "content": "class ErrorRaisingIndicatorSqlAdapter(IndicatorSqlAdapter):", "metadata": "root.ErrorRaisingIndicatorSqlAdapter", "header": "['module', '___EOS___']", "index": 92 }, { "content": " def handle_exception(self, doc, exception):\n if isinstance(exception, ProgrammingError):\n orig = getattr(exception, 'orig')\n if orig:\n error_code = getattr(orig, 'pgcode')\n if error_code == '42P01': # http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html\n raise TableNotFoundWarning\n\n super(ErrorRaisingIndicatorSqlAdapter, self).handle_exception(doc, exception)", "metadata": "root.ErrorRaisingIndicatorSqlAdapter.handle_exception", "header": "['class', 'ErrorRaisingIndicatorSqlAdapter', '(', 'IndicatorSqlAdapter', ')', ':', '___EOS___']", "index": 93 }, { "content": "def get_indicator_table(indicator_config, custom_metadata=None):\n sql_columns = [column_to_sql(col) for col in indicator_config.get_columns()]\n table_name = get_table_name(indicator_config.domain, indicator_config.table_id)\n # todo: needed to add extend_existing=True to support multiple calls to this function for the same table.\n # is that valid?\n return sqlalchemy.Table(\n table_name,\n custom_metadata or metadata,\n extend_existing=True,\n *sql_columns\n )", "metadata": "root.get_indicator_table", "header": "['module', '___EOS___']", "index": 104 }, { "content": "def rebuild_table(engine, table):\n with engine.begin() as connection:\n table.drop(connection, checkfirst=True)\n table.create(connection)", "metadata": "root.rebuild_table", "header": "['module', '___EOS___']", "index": 117 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sqlalchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "exc_", "import_", "Int", "egr", "it", "y", "Error_", ",_", "Programm", "ing", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "user", "reports_", "._", "exceptions_", "import_", "Table", "Reb", "uild", "Error_", ",_", "Table", "Not", "Foun", "d", "Warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "user", "reports_", "._", "sql_", "._", "columns_", "import_", "column", "\\u", "to", "\\u", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "user", "reports_", "._", "sql_", "._", "connection_", "import_", "get", "\\u", "eng", "ine", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "user", "reports_", "._", "sql_", "._", "util_", "import_", "get", "\\u", "table", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "sql", "\\u", "db_", "._", "connections_", "import_", "connecti", "on", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "decorators_", "._", "memoized", "_", "import_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "logging_", "import_", "notif", "y", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "sqlalchemy_", "._", "Meta", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "eng", "ine", "\\u", "id_", "=_", "get", "\\u", "eng", "ine", "\\u", "id_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "\\u", "helper_", "=_", "connecti", "on", "\\u", "manager_", "._", "get", "\\u", "session", "\\u", "helper_", "(_", "self_", "._", "eng", "ine", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "=_", "self_", "._", "session", "\\u", "helper_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "indicat", "or", "\\u", "table_", "(_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rebu", "ild", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session", "\\u", "helper_", "._", "Session_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebu", "ild", "\\u", "table_", "(_", "self_", "._", "engine_", ",_", "self_", "._", "get", "\\u", "table_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Programm", "ing", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Table", "Reb", "uild", "Error_", "(_", "'", "problem", " ", "rebu", "ild", "ing", " ", "UC", "R", " ", "table", " ", "{}:", " ", "{}'_", "._", "format_", "(_", "self_", "._", "config_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session", "\\u", "helper_", "._", "Session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "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_", "drop", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "hang", " ", "if", " ", "there", " ", "are", " ", "any", " ", "open", " ", "session", "s", ",", " ", "so", " ", "go", " ", "ahe", "ad", " ", "and", " ", "close", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session", "\\u", "helper_", "._", "Session_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "engine_", "._", "begin_", "(_", ")_", "as_", "connection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "table_", "(_", ")_", "._", "drop_", "(_", "connection_", ",_", "check", "first_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "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", "query", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "a", " ", "sqla", "lche", "my", " ", "query", " ", "object", " ", "read", "y", " ", "to", " ", "query", " ", "this", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "session", "\\u", "helper_", "._", "Session_", "._", "query_", "(_", "self_", "._", "get", "\\u", "table_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "best", "\\u", "effort", "\\u", "save_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Do", "es", " ", "a", " ", "best", "-", "effort", " ", "save", " ", "of", " ", "the", " ", "document", ".", " ", "Wil", "l", " ", "fail", " ", "silently", " ", "if", " ", "the", " ", "save", " ", "is", " ", "not", " ", "success", "ful", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "cert", "ain", " ", "know", "n", ",", " ", "expected", " ", "error", "s", " ", "this", " ", "will", " ", "do", " ", "no", " ", "addition", "al", " ", "logg", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "unexpected", " ", "error", "s", " ", "it", " ", "will", " ", "log", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "save_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "can", " ", "be", " ", "due", " ", "to", " ", "users", " ", "mess", "ing", " ", "up", " ", "thei", "r", " ", "tables", "/", "data", " ", "so", " ", "don", "'", "t", " ", "bot", "her", " ", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle", "\\u", "exception_", "(_", "doc_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "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_", "handle", "\\u", "exception_", "(_", "self_", ",_", "doc_", ",_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notif", "y", "\\u", "exception_", "(_", "None_", ",_", "u", "'", "unexpected", " ", "error", " ", "saving", " ", "UC", "R", " ", "doc", ":", " ", "{}.", " ", "domain", ":", " ", "{}", ",", " ", "doc", ":", " ", "{}", ",", " ", "table", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "config_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "get_", "(_", "'\\u", "id", "'_", ",_", "'<", "unknown", ">'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{}", " ", "({})'_", "._", "format_", "(_", "self_", "._", "config_", "._", "display", "\\u", "name_", ",_", "self_", "._", "config_", "._", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Save", "s", " ", "the", " ", "document", ".", " ", "Sho", "ul", "d", " ", "bubble", " ", "up", " ", "know", "n", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indicat", "or", "\\u", "rows_", "=_", "self_", "._", "config_", "._", "get", "\\u", "all", "\\u", "values_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indicat", "or", "\\u", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "self_", "._", "get", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "engine_", "._", "begin_", "(_", ")_", "as_", "connection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "all", " ", "exist", "ing", " ", "rows", " ", "for", " ", "this", " ", "doc", " ", "to", " ", "ensure", " ", "we", " ", "are", "n", "'", "t", " ", "left", " ", "with", " ", "stale", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete_", "=_", "table_", "._", "delete_", "(_", "table_", "._", "c_", "._", "doc", "\\u", "id_", "==_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "execute_", "(_", "delete_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "indicat", "or", "\\u", "row_", "in_", "indicat", "or", "\\u", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "values_", "=_", "{_", "i_", "._", "column_", "._", "databa", "se", "\\u", "column", "\\u", "name_", ":_", "i_", "._", "value_", "for_", "i_", "in_", "indicat", "or", "\\u", "row_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert_", "=_", "table_", "._", "insert_", "(_", ")_", "._", "values_", "(_", "**_", "all", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "execute_", "(_", "insert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "self_", "._", "get", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "engine_", "._", "begin_", "(_", ")_", "as_", "connection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete_", "=_", "table_", "._", "delete_", "(_", "table_", "._", "c_", "._", "doc", "\\u", "id_", "==_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "execute_", "(_", "delete_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Error", "Rai", "sing", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "Indicat", "or", "Sq", "l", "Adapter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Rai", "sing", "Indicat", "or", "Sq", "l", "Adapter_", "(_", "Indicat", "or", "Sq", "l", "Adapter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "handle", "\\u", "exception_", "(_", "self_", ",_", "doc_", ",_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "exception_", ",_", "Programm", "ing", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig_", "=_", "getattr_", "(_", "exception_", ",_", "'", "orig", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "orig_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "code_", "=_", "getattr_", "(_", "orig_", ",_", "'", "pg", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error", "\\u", "code_", "==_", "'", "4", "2", "P0", "1", "'_", ":_", "#", " ", "http", "://", "www", ".", "postgres", "ql", ".", "org", "/", "docs", "/", "9.4", "/", "static", "/", "errcode", "s", "-", "appendi", "x", ".", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Table", "Not", "Foun", "d", "Warning_", "\\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_", "super_", "(_", "Error", "Rai", "sing", "Indicat", "or", "Sq", "l", "Adapter_", ",_", "self_", ")_", "._", "handle", "\\u", "exception_", "(_", "doc_", ",_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "indicat", "or", "\\u", "table_", "(_", "indicat", "or", "\\u", "config_", ",_", "custom", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql", "\\u", "columns_", "=_", "[_", "column", "\\u", "to", "\\u", "sql_", "(_", "col_", ")_", "for_", "col_", "in_", "indicat", "or", "\\u", "config_", "._", "get", "\\u", "columns_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "name_", "=_", "get", "\\u", "table", "\\u", "name_", "(_", "indicat", "or", "\\u", "config_", "._", "domain_", ",_", "indicat", "or", "\\u", "config_", "._", "table", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "todo", ":", " ", "need", "ed", " ", "to", " ", "add", " ", "extend", "\\u", "exist", "ing", "=", "Tru", "e", " ", "to", " ", "support", " ", "multiple", " ", "calls", " ", "to", " ", "this", " ", "function", " ", "for", " ", "the", " ", "same", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "tha", "t", " ", "valid", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "sqlalchemy_", "._", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "metadata_", "or_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "\\u", "existing_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "sql", "\\u", "columns_", "\\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_", "rebu", "ild", "\\u", "table_", "(_", "engine_", ",_", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "engine_", "._", "begin_", "(_", ")_", "as_", "connection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "drop_", "(_", "connection_", ",_", "check", "first_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "create_", "(_", "connection_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
major/supernova/setup.py
[ { "content": "#!/usr/bin/python\n#\n# Copyright 2014 Major Hayden\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nimport sys\n\n\nfrom setuptools import setup\n\n\nrequired_packages = [\n \"click\",\n \"configobj\",\n \"keyring\",\n \"python-novaclient<3.0.0\",\n \"secretstorage\",\n \"six\"\n]\n\nif sys.version_info < (2, 7):\n required_packages.append(\"importlib\")\n\noptional_packages = {\n 'rackspace': [\n 'rackspace-novaclient'\n ]\n}\n\nsetup(\n name='supernova',\n version='2.2.0',\n author='Major Hayden',\n author_email='major@mhtx.net',\n description=\"novaclient wrapper for multiple nova environments\",\n install_requires=required_packages,\n extras_require=optional_packages,\n packages=['supernova'],\n url='https://github.com/major/supernova',\n entry_points='''\n [console_scripts]\n supernova = supernova.executable:run_supernova\n supernova-keyring = supernova.executable:run_supernova_keyring\n '''\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Maj", "or", " ", "Ha", "yde", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "packages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "click", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "config", "obj", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "keyring", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "python", "-", "novaclient", "<", "3.0", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "secret", "storage", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "si", "x", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "require", "d\\u", "packages_", "._", "append_", "(_", "\"", "import", "lib", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option", "al", "\\u", "packages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "racks", "pace", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "racks", "pace", "-", "novaclient", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "super", "nova", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "2.2", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Maj", "or", " ", "Ha", "yde", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "major", "@", "mh", "tx", ".", "net", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "novaclient", " ", "wrapp", "er", " ", "for", " ", "multiple", " ", "nova", " ", "environ", "ment", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "require", "d\\u", "packages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "s", "\\u", "require_", "=_", "option", "al", "\\u", "packages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "super", "nova", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "major", "/", "super", "nova", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "points_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "[", "console", "\\u", "scripts", "]", "\\", "10", ";", " ", " ", " ", " ", "super", "nova", " ", "=", " ", "super", "nova", ".", "executable", ":", "run", "\\u", "super", "nova", "\\", "10", ";", " ", " ", " ", " ", "super", "nova", "-", "keyring", " ", "=", " ", "super", "nova", ".", "executable", ":", "run", "\\u", "super", "nova", "\\u", "keyring", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
adlibre/Adlibre-TMS/adlibre_tms/apps/saasu_client/models/base.py
[ { "content": "# -*- coding: utf-8 -*-\n\nimport os\nimport datetime\nfrom new import classobj\n\nfrom django.template.loader import Context, render_to_string\nfrom django.core.exceptions import ObjectDoesNotExist\n\nimport xml_models\nimport xml_models.xpath_twister as xpath\nimport rest_client\n\nfrom saasu_client import DEFAULT_POST_URL\n\n__all__ = ['BaseModel', 'GETResponseBase', 'POSTResponseBase']\n\n\n\n\n \nCollectionField = Collection\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 CollectionList(list):\n\n", "metadata": "root.CollectionList", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, type):\n self.type = type", "metadata": "root.CollectionList.__init__", "header": "['class', 'CollectionList', '(', 'list', ')', ':', '___EOS___']", "index": 20 }, { "content": " def append(self, item):\n if not isinstance(item, self.type):\n raise TypeError, 'item is not of type %s' % self.type\n super(CollectionList, self).append(self.type(xml=item._xml)) #append the item to itself (the list)", "metadata": "root.CollectionList.append", "header": "['class', 'CollectionList', '(', 'list', ')', ':', '___EOS___']", "index": 23 }, { "content": "class Collection(xml_models.BaseField):\n \"\"\"\n Returns a collection found by the xpath expression. Requires a\n field_type to be supplied, which can either be a field type,\n e.g. IntField, which returns a collection ints, or it can be a\n model type e.g. Person may contain a collection of Address\n objects.\n \"\"\"\n\n ", "metadata": "root.Collection", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, field_type, order_by=None, **kw):\n self.field_type = field_type\n self.order_by = order_by\n xml_models.BaseField.__init__(self,**kw)", "metadata": "root.Collection.__init__", "header": "['class', 'Collection', '(', 'xml_models', '.', 'BaseField', ')', ':', '___EOS___']", "index": 38 }, { "content": " def parse(self, xml, namespace):\n matches = xpath.find_all(xml, self.xpath, namespace)\n\n if not xml_models.BaseField in self.field_type.__bases__:\n results = CollectionList(type=self.field_type)\n for match in matches:\n results.append(self.field_type(xml=match))\n else:\n field = self.field_type(xpath = '.')\n results = [field.parse(xpath.domify(match), namespace) for match in matches]\n if self.order_by:\n results.sort(lambda a,b : cmp(getattr(a, self.order_by), getattr(b, self.order_by)))\n return results", "metadata": "root.Collection.parse", "header": "['class', 'Collection', '(', 'xml_models', '.', 'BaseField', ')', ':', '___EOS___']", "index": 43 }, { "content": "class Error(xml_models.Model):\n \"\"\" Error Message Entity \"\"\"\n\n error_type = xml_models.CharField(xpath=\"/error/type\")\n error_message = xml_models.CharField(xpath=\"/error/message\")", "metadata": "root.Error", "header": "['module', '___EOS___']", "index": 60 }, { "content": "class GETResponseBase(object):\n \"\"\" Error Response Entity \"\"\"\n\n", "metadata": "root.GETResponseBase", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def __init__(self, object=None, xml=None, dom=None):\n \"\"\" put docstring here \"\"\"\n self.__model__ = getattr(object, '__model__', None)\n self.object = object\n self.xml = xml\n self.dom = dom", "metadata": "root.GETResponseBase.__init__", "header": "['class', 'GETResponseBase', '(', 'object', ')', ':', '___EOS___']", "index": 70 }, { "content": " def register(self):\n \"\"\" put docstring here \"\"\"\n # autogenerated fields\n __model__ = self.__model__[0].lower() + self.__model__[1:]\n errors = xml_models.Collection(Error, order_by=\"error_type\", xpath=\"/%sResponse/errors/error\" % __model__)\n \n def validate_on_load(cls):\n for e in cls.errors:\n exception = classobj(str(e.error_type), (Exception,), {})\n raise exception, e.error_message\n\n # autogenerated class\n cls = classobj('GETResponse', (xml_models.Model,), {\n 'errors': errors,\n 'validate_on_load': validate_on_load,\n })\n #print self.xml\n return cls(xml=self.xml, dom=self.dom)", "metadata": "root.GETResponseBase.register", "header": "['class', 'GETResponseBase', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": "class POSTResponseBase(object):\n \"\"\" Base Tasks Response Entity \"\"\"\n\n", "metadata": "root.POSTResponseBase", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def __init__(self, object=None, xml=None, dom=None):\n \"\"\" put docstring here \"\"\"\n self.__model__ = getattr(object, '__model__', None)\n self.object = object\n self.xml = xml\n self.dom = dom", "metadata": "root.POSTResponseBase.__init__", "header": "['class', 'POSTResponseBase', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": " def register(self):\n \"\"\" put docstring here \"\"\"\n \n # If object already have 'uid' field update entry otherwise insert new\n if hasattr(self.object, 'uid') and self.object.uid:\n cmd = 'update'\n else:\n cmd = 'insert'\n\n # autogenerated fields\n uid = xml_models.IntField(xpath=\"/tasksResponse/%s%sResult/@%s\" % (\n cmd, self.__model__, {'insert': 'insertedEntityUid', 'update': 'updatedEntityUid'}[cmd]), default=None)\n lastUpdatedUid = xml_models.CharField(xpath=\"/tasksResponse/%s%sResult/@lastUpdatedUid\" % (cmd, self.__model__))\n errors = xml_models.Collection(Error, order_by=\"error_type\", xpath=\"/tasksResponse/%s%sResult/errors/error\" % (cmd, self.__model__))\n other_errors = xml_models.Collection(Error, order_by=\"error_type\", xpath=\"/tasksResponse/errors/error\")\n\n def validate_on_load(cls):\n for e in cls.errors:\n exception = classobj(str(e.error_type), (Exception,), {})\n raise exception, e.error_message\n for e in cls.other_errors:\n exception = classobj(str(e.error_type), (Exception,), {})\n raise exception, e.error_message\n\n # autogenerated class\n cls = classobj('POSTResponse', (xml_models.Model,), {\n 'uid': uid,\n 'lastUpdatedUid': lastUpdatedUid,\n 'errors': errors,\n 'other_errors': other_errors,\n 'validate_on_load': validate_on_load,\n })\n #print self.xml\n return cls(xml=self.xml, dom=self.dom)", "metadata": "root.POSTResponseBase.register", "header": "['class', 'POSTResponseBase', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": "class XmlModelManager(xml_models.XmlModelManager):\n", "metadata": "root.XmlModelManager", "header": "['module', '___EOS___']", "index": 143 }, { "content": " def create(self, **kw):\n \"\"\" put docstring here \"\"\"\n query = XmlModelQuery(self, self.model, headers=self.headers).create(**kw)\n return query", "metadata": "root.XmlModelManager.create", "header": "['class', 'XmlModelManager', '(', 'xml_models', '.', 'XmlModelManager', ')', ':', '___EOS___']", "index": 145 }, { "content": "class XmlModelQuery(xml_models.XmlModelQuery):\n", "metadata": "root.XmlModelQuery", "header": "['module', '___EOS___']", "index": 151 }, { "content": " def create(self, **kw):\n \"\"\" put docstring here \"\"\"\n object = classobj('Model', (BaseModel,), {})\n for key in kw.keys():\n setattr(object, key, kw[key])\n (filepath, filename) = os.path.split(self.model.template_name)\n (shortname, extension) = os.path.splitext(filename)\n template_name = os.path.join(filepath, '%s_initial%s' % (shortname, extension))\n context = Context(object)\n xml_response = render_to_string(template_name, dictionary=kw, context_instance = context)\n return self.model(xml=xml_response)", "metadata": "root.XmlModelQuery.create", "header": "['class', 'XmlModelQuery', '(', 'xml_models', '.', 'XmlModelQuery', ')', ':', '___EOS___']", "index": 153 }, { "content": "class ModelBase(xml_models.ModelBase):\n\n", "metadata": "root.ModelBase", "header": "['module', '___EOS___']", "index": 166 }, { "content": " def __init__(cls, name, bases, attrs):\n super(ModelBase, cls).__init__(name, bases, attrs)\n if not hasattr(cls, \"_fields\"):\n cls._fields = {}\n for field_name in attrs.keys():\n if isinstance(attrs[field_name], xml_models.BaseField):\n cls._fields[field_name] = attrs[field_name]\n if attrs.has_key(\"finders\"):\n setattr(cls, \"objects\", XmlModelManager(cls, attrs[\"finders\"]))\n else:\n setattr(cls, \"objects\", XmlModelManager(cls, {}))", "metadata": "root.ModelBase.__init__", "header": "['class', 'ModelBase', '(', 'xml_models', '.', 'ModelBase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def __setattr__(cls, attr, value):\n if isinstance(value, (datetime.datetime, datetime.date)) and cls._fields.has_key(attr):\n value = value.strftime(cls._fields[attr].date_format)\n super(ModelBase, cls).__setattr__(attr, value)", "metadata": "root.ModelBase.__setattr__", "header": "['class', 'ModelBase', '(', 'xml_models', '.', 'ModelBase', ')', ':', '___EOS___']", "index": 180 }, { "content": "class Model:\n __metaclass__ = ModelBase\n __doc__=\"\"\"A model can be constructed with either an xml string, or an appropriate document supplied by\n the xpath_twister.domify() method.\n \n An example:\n \n class Person(xml_models.Model):\n namespace=\"urn:my.default.namespace\"\n name = xml_models.CharField(xpath\"/Person/@Name\", default=\"John\")\n nicknames = xml_models.CollectionField(CharField, xpath=\"/Person/Nicknames/Name\")\n addresses = xml_models.CollectionField(Address, xpath=\"/Person/Addresses/Address\")\n date_of_birth = xml_models.DateField(xpath=\"/Person/@DateOfBirth\", date_format=\"%d-%m-%Y\")\n \"\"\"\n\n \"\"\"Override on your model to perform validation when the XML data is first passed in. This is to ensure the xml returned\n conforms to the validation rules. We use this because some records are no use to us if they don't contain certain\n data.\"\"\"\n\n \n ", "metadata": "root.Model", "header": "['module', '___EOS___']", "index": 186 }, { "content": " def __init__(self, xml=None, dom=None):\n self._xml = xml\n self._dom = dom\n self._cache = {}\n self.validate_on_load()", "metadata": "root.Model.__init__", "header": "['class', 'Model', ':', '___EOS___']", "index": 200 }, { "content": " def validate_on_load(self):\n pass", "metadata": "root.Model.validate_on_load", "header": "['class', 'Model', ':', '___EOS___']", "index": 209 }, { "content": " def _get_xml(self):\n if self._dom is None:\n try :\n self._dom = xpath.domify(self._xml)\n except Exception, e:\n print self._xml\n print str(e)\n raise e\n return self._dom", "metadata": "root.Model._get_xml", "header": "['class', 'Model', ':', '___EOS___']", "index": 212 }, { "content": " def _set_value(self, field, value):\n self._cache[field] = value", "metadata": "root.Model._set_value", "header": "['class', 'Model', ':', '___EOS___']", "index": 222 }, { "content": " def _parse_field(self, field):\n if not self._cache.has_key(field):\n namespace = None\n if hasattr(self, 'namespace'):\n namespace = self.namespace\n self._cache[field] = field.parse(self._get_xml(), namespace)\n return self._cache[field]", "metadata": "root.Model._parse_field", "header": "['class', 'Model', ':', '___EOS___']", "index": 225 }, { "content": "class BaseModel(Model):\n \"\"\" Base Model Entity \"\"\"\n\n __model__ = '__not_implemented__'\n template_name = '__not_implemented__'\n\n\n", "metadata": "root.BaseModel", "header": "['module', '___EOS___']", "index": 234 }, { "content": " def process_response(self, payload=None, headers={}, prefix='tasks'):\n \"\"\" put docstring here \"\"\"\n response = rest_client.Client(\"\").POST(url=DEFAULT_POST_URL % prefix, payload=payload, headers=headers)\n if not response.content:\n raise ObjectDoesNotExist, self\n if response.response_code == 404:\n raise ObjectDoesNotExist, self\n content = response.content.read()\n if not content:\n raise ObjectDoesNotExist, self\n return content", "metadata": "root.BaseModel.process_response", "header": "['class', 'BaseModel', '(', 'Model', ')', ':', '___EOS___']", "index": 240 }, { "content": " def validate_on_load(self):\n \"\"\" put docstring here \"\"\"\n GETResponseBase(object=self, xml=self._xml).register()", "metadata": "root.BaseModel.validate_on_load", "header": "['class', 'BaseModel', '(', 'Model', ')', ':', '___EOS___']", "index": 252 }, { "content": " def save(self, commit=True):\n \"\"\" put docstring here \"\"\"\n # was:\n #output = render_to_string(self.template_name, {'object': self})\n context = Context()\n context.update(\n {\n 'object':self,\n 'date': self.date,\n }\n )\n output = render_to_string(self.template_name, context_instance = context)\n if commit == True:\n tasks_response = POSTResponseBase(object=self, xml=self.process_response(payload=output)).register()\n self.uid = tasks_response.uid\n self.lastUpdatedUid = tasks_response.lastUpdatedUid\n return self", "metadata": "root.BaseModel.save", "header": "['class', 'BaseModel', '(', 'Model', ')', ':', '___EOS___']", "index": 256 } ]
[]
[]
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_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "new_", "import_", "class", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "Context_", ",_", "render", "\\u", "to", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "xml", "\\u", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml", "\\u", "models_", "._", "xpa", "th", "\\u", "twist", "er_", "as_", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rest", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sa", "asu", "\\u", "client_", "import_", "DEF", "AUL", "T", "\\u", "POST", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Base", "Model", "'_", ",_", "'", "GET", "Respons", "e", "Base", "'_", ",_", "'", "POST", "Respons", "e", "Base", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Collecti", "on", "Field_", "=_", "Collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Collecti", "on", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "List_", "(_", "list_", ")_", ":_", "\\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_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "type_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "item_", ",_", "self_", "._", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "'", "item", " ", "is", " ", "not", " ", "of", " ", "type", " ", "%", "s", "'_", "%_", "self_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Collecti", "on", "List_", ",_", "self_", ")_", "._", "append_", "(_", "self_", "._", "type_", "(_", "xml_", "=_", "item_", "._", "\\u", "xml_", ")_", ")_", "#", "append", " ", "the", " ", "item", " ", "to", " ", "its", "elf", " ", "(", "the", " ", "list", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Collection_", "(_", "xml", "\\u", "models_", "._", "Base", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "collection", " ", "found", " ", "by", " ", "the", " ", "xpa", "th", " ", "express", "ion", ".", " ", " ", "Requ", "ires", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "field", "\\u", "type", " ", "to", " ", "be", " ", "supplie", "d", ",", " ", "whi", "ch", " ", "can", " ", "eit", "her", " ", "be", " ", "a", " ", "field", " ", "type", ",", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "Int", "Field", ",", " ", "whi", "ch", " ", "return", "s", " ", "a", " ", "collection", " ", "ints", ",", " ", "or", " ", "it", " ", "can", " ", "be", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "model", " ", "type", " ", "e", ".", "g", ".", " ", "Person", " ", "may", " ", "contain", " ", "a", " ", "collection", " ", "of", " ", "Address", "\\", "10", ";", " ", " ", " ", " ", "object", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "xml", "\\u", "models_", "._", "Base", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "field", "\\u", "type_", ",_", "order", "\\u", "by_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "field", "\\u", "type_", "=_", "field", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "order", "\\u", "by_", "=_", "order", "\\u", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "models_", "._", "Base", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "xml", "\\u", "models_", "._", "Base", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "xml_", ",_", "namespace_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matches_", "=_", "xpath_", "._", "find", "\\u", "all_", "(_", "xml_", ",_", "self_", "._", "xpath_", ",_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "xml", "\\u", "models_", "._", "Base", "Field_", "in_", "self_", "._", "field", "\\u", "type_", "._", "\\u\\u", "bases\\u", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "Collecti", "on", "List_", "(_", "type_", "=_", "self_", "._", "field", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "self_", "._", "field", "\\u", "type_", "(_", "xml_", "=_", "match_", ")_", ")_", "\\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 ", " _", "field_", "=_", "self_", "._", "field", "\\u", "type_", "(_", "xpath_", "=_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "field_", "._", "parse_", "(_", "xpath_", "._", "dom", "ify_", "(_", "match_", ")_", ",_", "namespace_", ")_", "for_", "match_", "in_", "matches_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "order", "\\u", "by_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "sort_", "(_", "lambda_", "a_", ",_", "b_", ":_", "cmp_", "(_", "getattr_", "(_", "a_", ",_", "self_", "._", "order", "\\u", "by_", ")_", ",_", "getattr_", "(_", "b_", ",_", "self_", "._", "order", "\\u", "by_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Error_", "(_", "xml", "\\u", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Error", " ", "Messag", "e", " ", "Entit", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "type_", "=_", "xml", "\\u", "models_", "._", "Char", "Field_", "(_", "xpath_", "=_", "\"/", "error", "/", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "message_", "=_", "xml", "\\u", "models_", "._", "Char", "Field_", "(_", "xpath_", "=_", "\"/", "error", "/", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "GET", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Error", " ", "Respons", "e", " ", "Entit", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "GET", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "object_", "=_", "None_", ",_", "xml_", "=_", "None_", ",_", "dom_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "model", "\\u\\u_", "=_", "getattr_", "(_", "object_", ",_", "'\\u", "\\u", "model", "\\u\\u'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object_", "=_", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml_", "=_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dom_", "=_", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GET", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "model", "\\u\\u_", "=_", "self_", "._", "\\u\\u", "model", "\\u\\u_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "+_", "self_", "._", "\\u\\u", "model", "\\u\\u_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "xml", "\\u", "models_", "._", "Collection_", "(_", "Error_", ",_", "order", "\\u", "by_", "=_", "\"", "error", "\\u", "type", "\"_", ",_", "xpath_", "=_", "\"/%", "s", "Respons", "e", "/", "error", "s", "/", "error", "\"_", "%_", "\\u\\u", "model", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "on", "\\u", "load_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "cls_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exception_", "=_", "class", "obj_", "(_", "str_", "(_", "e_", "._", "error", "\\u", "type_", ")_", ",_", "(_", "Exception_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", ",_", "e_", "._", "error", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "=_", "class", "obj_", "(_", "'", "GET", "Respons", "e", "'_", ",_", "(_", "xml", "\\u", "models_", "._", "Model_", ",_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "validat", "e\\u", "on", "\\u", "load", "'_", ":_", "validat", "e\\u", "on", "\\u", "load_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "self", ".", "xml_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "(_", "xml_", "=_", "self_", "._", "xml_", ",_", "dom_", "=_", "self_", "._", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "POST", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Base", " ", "Task", "s", " ", "Respons", "e", " ", "Entit", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "POST", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "object_", "=_", "None_", ",_", "xml_", "=_", "None_", ",_", "dom_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "model", "\\u\\u_", "=_", "getattr_", "(_", "object_", ",_", "'\\u", "\\u", "model", "\\u\\u'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object_", "=_", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml_", "=_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dom_", "=_", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "POST", "Respons", "e", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "object", " ", "alr", "ead", "y", " ", "have", " ", "'", "uid", "'", " ", "field", " ", "update", " ", "entry", " ", "other", "wis", "e", " ", "insert", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "object_", ",_", "'", "uid", "'_", ")_", "and_", "self_", "._", "object_", "._", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "update", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "insert", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uid_", "=_", "xml", "\\u", "models_", "._", "Int", "Field_", "(_", "xpath_", "=_", "\"/", "task", "s", "Respons", "e", "/", "%", "s", "%", "s", "Result", "/", "@", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", ",_", "self_", "._", "\\u\\u", "model", "\\u\\u_", ",_", "{_", "'", "insert", "'_", ":_", "'", "inserted", "Entit", "y", "Ui", "d", "'_", ",_", "'", "update", "'_", ":_", "'", "update", "d", "Entit", "y", "Ui", "d", "'_", "}_", "[_", "cmd_", "]_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Update", "d", "Ui", "d_", "=_", "xml", "\\u", "models_", "._", "Char", "Field_", "(_", "xpath_", "=_", "\"/", "task", "s", "Respons", "e", "/", "%", "s", "%", "s", "Result", "/", "@", "last", "Update", "d", "Ui", "d", "\"_", "%_", "(_", "cmd_", ",_", "self_", "._", "\\u\\u", "model", "\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "xml", "\\u", "models_", "._", "Collection_", "(_", "Error_", ",_", "order", "\\u", "by_", "=_", "\"", "error", "\\u", "type", "\"_", ",_", "xpath_", "=_", "\"/", "task", "s", "Respons", "e", "/", "%", "s", "%", "s", "Result", "/", "error", "s", "/", "error", "\"_", "%_", "(_", "cmd_", ",_", "self_", "._", "\\u\\u", "model", "\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "errors_", "=_", "xml", "\\u", "models_", "._", "Collection_", "(_", "Error_", ",_", "order", "\\u", "by_", "=_", "\"", "error", "\\u", "type", "\"_", ",_", "xpath_", "=_", "\"/", "task", "s", "Respons", "e", "/", "error", "s", "/", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "on", "\\u", "load_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "cls_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exception_", "=_", "class", "obj_", "(_", "str_", "(_", "e_", "._", "error", "\\u", "type_", ")_", ",_", "(_", "Exception_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", ",_", "e_", "._", "error", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "e_", "in_", "cls_", "._", "other", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exception_", "=_", "class", "obj_", "(_", "str_", "(_", "e_", "._", "error", "\\u", "type_", ")_", ",_", "(_", "Exception_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", ",_", "e_", "._", "error", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "=_", "class", "obj_", "(_", "'", "POST", "Respons", "e", "'_", ",_", "(_", "xml", "\\u", "models_", "._", "Model_", ",_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "Update", "d", "Ui", "d", "'_", ":_", "last", "Update", "d", "Ui", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", "\\u", "error", "s", "'_", ":_", "other", "\\u", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "validat", "e\\u", "on", "\\u", "load", "'_", ":_", "validat", "e\\u", "on", "\\u", "load_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "self", ".", "xml_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "(_", "xml_", "=_", "self_", "._", "xml_", ",_", "dom_", "=_", "self_", "._", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Xm", "l", "Model", "Manager_", "(_", "xml", "\\u", "models_", "._", "Xm", "l", "Model", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Xm", "l", "Model", "Manager_", "(_", "xml", "\\u", "models_", "._", "Xm", "l", "Model", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "Xm", "l", "Model", "Query_", "(_", "self_", ",_", "self_", "._", "model_", ",_", "headers_", "=_", "self_", "._", "headers_", ")_", "._", "create_", "(_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Xm", "l", "Model", "Query_", "(_", "xml", "\\u", "models_", "._", "Xm", "l", "Model", "Query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Xm", "l", "Model", "Query_", "(_", "xml", "\\u", "models_", "._", "Xm", "l", "Model", "Query_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "=_", "class", "obj_", "(_", "'", "Model", "'_", ",_", "(_", "Base", "Model_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "kw_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "object_", ",_", "key_", ",_", "kw_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "filepath_", ",_", "filename_", ")_", "=_", "os_", "._", "path_", "._", "split_", "(_", "self_", "._", "model_", "._", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "shortname_", ",_", "extension_", ")_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filepath_", ",_", "'%", "s", "\\u", "initial", "%", "s", "'_", "%_", "(_", "shortname_", ",_", "extension_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "Context_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "response_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "template", "\\u", "name_", ",_", "dictionary_", "=_", "kw_", ",_", "context", "\\u", "instance_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "model_", "(_", "xml_", "=_", "xml", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Model", "Base_", "(_", "xml", "\\u", "models_", "._", "Model", "Base_", ")_", ":_", "\\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_", "Model", "Base_", "(_", "xml", "\\u", "models_", "._", "Model", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Model", "Base_", ",_", "cls_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "bases_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "cls_", ",_", "\"\\u", "fields", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "field", "\\u", "name_", "in_", "attrs_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "attrs_", "[_", "field", "\\u", "name_", "]_", ",_", "xml", "\\u", "models_", "._", "Base", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "fields_", "[_", "field", "\\u", "name_", "]_", "=_", "attrs_", "[_", "field", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "attrs_", "._", "has", "\\u", "key_", "(_", "\"", "finde", "rs", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "cls_", ",_", "\"", "object", "s", "\"_", ",_", "Xm", "l", "Model", "Manager_", "(_", "cls_", ",_", "attrs_", "[_", "\"", "finde", "rs", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "cls_", ",_", "\"", "object", "s", "\"_", ",_", "Xm", "l", "Model", "Manager_", "(_", "cls_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Base_", "(_", "xml", "\\u", "models_", "._", "Model", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "cls_", ",_", "attr_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "(_", "datetime_", "._", "datetime_", ",_", "datetime_", "._", "date_", ")_", ")_", "and_", "cls_", "._", "\\u", "fields_", "._", "has", "\\u", "key_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strftime_", "(_", "cls_", "._", "\\u", "fields_", "[_", "attr_", "]_", "._", "date", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Model", "Base_", ",_", "cls_", ")_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "attr_", ",_", "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_", "Model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "metaclass\\u\\u_", "=_", "Model", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "doc\\u\\u_", "=_", "\"\"\"", "A", " ", "model", " ", "can", " ", "be", " ", "construct", "ed", " ", "with", " ", "eit", "her", " ", "an", " ", "xml", " ", "string", ",", " ", "or", " ", "an", " ", "appropr", "iate", " ", "document", " ", "supplie", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "xpa", "th", "\\u", "twist", "er", ".", "dom", "if", "y", "()", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "example", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Person", "(", "xml", "\\u", "model", "s", ".", "Model", "):", "\\", "10", ";", " ", " ", " ", " ", "namespace", "=\"", "urn", ":", "my", ".", "default", ".", "namespace", "\"", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "=", " ", "xml", "\\u", "model", "s", ".", "Char", "Field", "(", "xpa", "th", "\"/", "Person", "/", "@", "Name", "\",", " ", "default", "=\"", "Joh", "n", "\")", "\\", "10", ";", " ", " ", " ", " ", "nick", "names", " ", "=", " ", "xml", "\\u", "model", "s", ".", "Collecti", "on", "Field", "(", "Char", "Field", ",", " ", "xpa", "th", "=\"", "/", "Person", "/", "Nick", "names", "/", "Name", "\")", "\\", "10", ";", " ", " ", " ", " ", "addresse", "s", " ", "=", " ", "xml", "\\u", "model", "s", ".", "Collecti", "on", "Field", "(", "Address", ",", " ", "xpa", "th", "=\"", "/", "Person", "/", "Address", "es", "/", "Address", "\")", "\\", "10", ";", " ", " ", " ", " ", "date", "\\u", "of", "\\u", "birth", " ", "=", " ", "xml", "\\u", "model", "s", ".", "Date", "Field", "(", "xpa", "th", "=\"", "/", "Person", "/", "@", "Date", "Of", "Birth", "\",", " ", "date", "\\u", "format", "=\"", "%", "d", "-%", "m", "-%", "Y", "\")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "Override", " ", "on", " ", "your", " ", "model", " ", "to", " ", "perform", " ", "validation", " ", "whe", "n", " ", "the", " ", "XML", " ", "data", " ", "is", " ", "first", " ", "pass", "ed", " ", "in", ".", " ", "Thi", "s", " ", "is", " ", "to", " ", "ensure", " ", "the", " ", "xml", " ", "return", "ed", "\\", "10", ";", " ", " ", " ", "conform", "s", " ", "to", " ", "the", " ", "validation", " ", "rule", "s", ".", " ", " ", "We", " ", "use", " ", "this", " ", "bec", "aus", "e", " ", "some", " ", "record", "s", " ", "are", " ", "no", " ", "use", " ", "to", " ", "us", " ", "if", " ", "the", "y", " ", "don", "'", "t", " ", "contain", " ", "cert", "ain", "\\", "10", ";", " ", " ", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "xml_", "=_", "None_", ",_", "dom_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "xml_", "=_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dom_", "=_", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validat", "e\\u", "on", "\\u", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "validat", "e\\u", "on", "\\u", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "dom_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dom_", "=_", "xpath_", "._", "dom", "ify_", "(_", "self_", "._", "\\u", "xml_", ")_", "\\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 ", " _", "print_", "self_", "._", "\\u", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "value_", "(_", "self_", ",_", "field_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cache_", "[_", "field_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "field_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "cache_", "._", "has", "\\u", "key_", "(_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "namespace", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", "=_", "self_", "._", "namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "cache_", "[_", "field_", "]_", "=_", "field_", "._", "parse_", "(_", "self_", "._", "\\u", "get", "\\u", "xml_", "(_", ")_", ",_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Base", " ", "Model", " ", "Entit", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "model", "\\u\\u_", "=_", "'\\u", "\\u", "not", "\\u", "implemented", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'\\u", "\\u", "not", "\\u", "implemented", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "response_", "(_", "self_", ",_", "payload_", "=_", "None_", ",_", "headers_", "=_", "{_", "}_", ",_", "prefix_", "=_", "'", "task", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "rest", "\\u", "client_", "._", "Client_", "(_", "\"\"_", ")_", "._", "POST_", "(_", "url_", "=_", "DEF", "AUL", "T", "\\u", "POST", "\\u", "URL_", "%_", "prefix_", ",_", "payload_", "=_", "payload_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "response_", "._", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Object", "Do", "es", "Not", "Exist_", ",_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "response", "\\u", "code_", "==_", "404_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Object", "Do", "es", "Not", "Exist_", ",_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content_", "=_", "response_", "._", "content_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Object", "Do", "es", "Not", "Exist_", ",_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "on", "\\u", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GET", "Respons", "e", "Base_", "(_", "object_", "=_", "self_", ",_", "xml_", "=_", "self_", "._", "\\u", "xml_", ")_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "put", " ", "docstr", "ing", " ", "here", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "was", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", " ", "=", " ", "render", "\\u", "to", "\\u", "string", "(", "self", ".", "template", "\\u", "name", ",", " ", "{", "'", "object", "':", " ", "self", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "Context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "self_", "._", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "self_", "._", "template", "\\u", "name_", ",_", "context", "\\u", "instance_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "commit_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "s", "\\u", "response_", "=_", "POST", "Respons", "e", "Base_", "(_", "object_", "=_", "self_", ",_", "xml_", "=_", "self_", "._", "process", "\\u", "response_", "(_", "payload_", "=_", "output_", ")_", ")_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "uid_", "=_", "task", "s", "\\u", "response_", "._", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Update", "d", "Ui", "d_", "=_", "task", "s", "\\u", "response_", "._", "last", "Update", "d", "Ui", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
twidi/django-adv-cache-tag/adv_cache_tag/tests/testproject/adv_cache_test_app/templatetags/other_tags.py
[ { "content": "from django import template\n\n\nregister = template.Library()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.simple_tag\ndef insert_foo():\n return 'FoOoO'", "metadata": "root.insert_foo", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "._", "simple", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "insert", "\\u", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Fo", "Oo", "O", "'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
cloudera/hue/apps/beeswax/src/beeswax/views.py
[ { "content": "@login_notrequired\ndef query_done_cb(request, server_id):\n \"\"\"\n A callback for query completion notification. When the query is done,\n BeeswaxServer notifies us by sending a GET request to this view.\n \"\"\"\n message_template = '<html><head></head>%(message)s<body></body></html>'\n message = {'message': 'error'}\n\n try:\n query_history = QueryHistory.objects.get(server_id=server_id + '\\n')\n\n # Update the query status\n query_history.set_to_available()\n\n # Find out details about the query\n if not query_history.notify:\n message['message'] = 'email_notify is false'\n return HttpResponse(message_template % message)\n\n design = query_history.design\n user = query_history.owner\n subject = _(\"Beeswax query completed.\")\n\n if design:\n subject += \": %s\" % (design.name,)\n\n link = \"%s%s\" % \\\n (get_desktop_uri_prefix(),\n reverse(get_app_name(request) + ':watch_query_history', kwargs={'query_history_id': query_history.id}))\n body = _(\"%(subject)s. See the results here: %(link)s\\n\\nQuery:\\n%(query)s\") % {\n 'subject': subject, 'link': link, 'query': query_history.query\n }\n\n user.email_user(subject, body)\n message['message'] = 'sent'\n except Exception, ex:\n msg = \"Failed to send query completion notification via e-mail: %s\" % (ex)\n LOG.error(msg)\n message['message'] = msg\n return HttpResponse(message_template % message)", "metadata": "root.query_done_cb", "header": "['module', '___EOS___']", "index": 597 } ]
[]
[]
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_", "@_", "login", "\\u", "not", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "query", "\\u", "don", "e\\u", "cb_", "(_", "request_", ",_", "server", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "A", " ", "callback", " ", "for", " ", "query", " ", "completion", " ", "notification", ".", " ", "Whe", "n", " ", "the", " ", "query", " ", "is", " ", "don", "e", ",", "\\", "10", ";", " ", " ", "Bee", "swa", "x", "Server", " ", "notifi", "es", " ", "us", " ", "by", " ", "sendin", "g", " ", "a", " ", "GET", " ", "request", " ", "to", " ", "this", " ", "view", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "template_", "=_", "'<", "html", "><", "head", "><", "/", "head", ">", "%", "(", "message", ")", "s", "<", "body", "><", "/", "body", "><", "/", "html", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "{_", "'", "message", "'_", ":_", "'", "error", "'_", "}_", "\\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 ", " _", "query", "\\u", "history_", "=_", "Query", "History_", "._", "objects_", "._", "get_", "(_", "server", "\\u", "id_", "=_", "server", "\\u", "id_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "query", " ", "status_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "history_", "._", "set\\u", "to", "\\u", "available_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "out", " ", "deta", "il", "s", " ", "abo", "ut", " ", "the", " ", "query_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "query", "\\u", "history_", "._", "notify_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "[_", "'", "message", "'_", "]_", "=_", "'", "email", "\\u", "notif", "y", " ", "is", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "message", "\\u", "template_", "%_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "design_", "=_", "query", "\\u", "history_", "._", "design_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "query", "\\u", "history_", "._", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "\\u_", "(_", "\"", "Bee", "swa", "x", " ", "query", " ", "complete", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "design_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "+=_", "\":", " ", "%", "s", "\"_", "%_", "(_", "design_", "._", "name_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "get", "\\u", "desk", "top", "\\u", "uri", "\\u", "prefix_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "get", "\\u", "app", "\\u", "name_", "(_", "request_", ")_", "+_", "':", "watch", "\\u", "query", "\\u", "histo", "ry", "'_", ",_", "kwargs_", "=_", "{_", "'", "query", "\\u", "histo", "ry", "\\u", "id", "'_", ":_", "query", "\\u", "history_", "._", "id_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "\\u_", "(_", "\"%", "(", "subject", ")", "s", ".", " ", "See", " ", "the", " ", "results", " ", "here", ":", " ", "%", "(", "link", ")", "s", "\\\\", "n", "\\\\", "n", "Query", ":\\\\", "n", "%", "(", "query", ")", "s", "\"_", ")_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "subject_", ",_", "'", "link", "'_", ":_", "link_", ",_", "'", "query", "'_", ":_", "query", "\\u", "history_", "._", "query_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "._", "email", "\\u", "user_", "(_", "subject_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "[_", "'", "message", "'_", "]_", "=_", "'", "sent", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Fail", "ed", " ", "to", " ", "send", " ", "query", " ", "completion", " ", "notification", " ", "via", " ", "e-", "mail", ":", " ", "%", "s", "\"_", "%_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "[_", "'", "message", "'_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "message", "\\u", "template_", "%_", "message_", ")_", "\\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,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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 ]
Testing equality to None
scipy/scipy/scipy/special/generate_ufuncs.py
[ { "content": " def __init__(self, name, signatures, headers):\n self.name = name\n self.signatures = self._parse_signatures(signatures, headers)\n self.doc = add_newdocs.get(\"scipy.special.\" + name)\n if self.doc is None:\n raise ValueError(\"No docstring for ufunc %r\" % name)\n self.doc = textwrap.dedent(self.doc).strip()\n self.function_name_overrides = {}", "metadata": "root.Ufunc.__init__", "header": "['class', 'Ufunc', '(', 'object', ')', ':', '___EOS___']", "index": 683 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Uf", "unc_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "signatures_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "signatures_", "=_", "self_", "._", "\\u", "parse", "\\u", "signatures_", "(_", "signatures_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "add", "\\u", "newd", "ocs", "_", "._", "get_", "(_", "\"", "sci", "py", ".", "special", ".\"_", "+_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "doc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "No", " ", "docstr", "ing", " ", "for", " ", "ufunc", " ", "%", "r", "\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "doc_", "=_", "textwrap_", "._", "dedent_", "(_", "self_", "._", "doc_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "function", "\\u", "name", "\\u", "overrides_", "=_", "{_", "}_", "\\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 ]
Unreachable code
yildizberkay/MongoApp/libs/watchdog/observers/kqueue.py
[ { "content": "def is_modified(kev):\n \"\"\"Determines whether the given kevent represents modification.\"\"\"\n fflags = kev.fflags\n return (fflags & select.KQ_NOTE_EXTEND) or (fflags & select.KQ_NOTE_WRITE)", "metadata": "root.is_modified", "header": "['module', '___EOS___']", "index": 155 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "modified_", "(_", "ke", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "give", "n", " ", "ke", "vent", " ", "represent", "s", " ", "modification", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ffl", "ags_", "=_", "ke", "v_", "._", "ffl", "ags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "ffl", "ags_", "&_", "select_", "._", "KQ", "\\u", "NOTE", "\\u", "EXTEND", "_", ")_", "or_", "(_", "ffl", "ags_", "&_", "select_", "._", "KQ", "\\u", "NOTE", "\\u", "WRITE_", ")_", "\\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 ]
Use of the return value of a procedure
platformio/platformio-api/platformio_api/util.py
[ { "content": "def get_c_sources(in_dir):\n return glob(join(in_dir, '*.c')) + glob(join(in_dir, '*.cpp')) \\\n + glob(join(in_dir, '*.h'))", "metadata": "root.get_c_sources", "header": "['module', '___EOS___']", "index": 166 } ]
[]
[]
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_", "def_", "get", "\\u", "c\\u", "sources_", "(_", "in", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "glob_", "(_", "join_", "(_", "in", "\\u", "dir_", ",_", "'*", ".", "c", "'_", ")_", ")_", "+_", "glob_", "(_", "join_", "(_", "in", "\\u", "dir_", ",_", "'*", ".", "cpp", "'_", ")_", ")_", "+_", "glob_", "(_", "join_", "(_", "in", "\\u", "dir_", ",_", "'*", ".", "h", "'_", ")_", ")_", "\\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 ]
Unused local variable
rvanlaar/easy-transifex/src/transifex/transifex/resources/tests/views/views.py
[ { "content": " def test_delete_resource_translations(self):\n \"\"\"\n Test resource translation deletion\n \"\"\"\n # Create primary language translation. This is needed to push\n # additional translations\n source_trans = Translation(\n source_entity=self.source_entity, language=self.language,\n string=\"foobar\", resource=self.resource\n )\n source_trans.save()\n\n trans_lang = 'el'\n trans = \"foo\"\n # Create new translation\n resp = self.client['maintainer'].post(reverse('push_translation',\n args=[self.project.slug, trans_lang]),\n json.dumps({'strings':[{'id':source_trans.id,\n 'translations': { 'other': trans}}]}),\n content_type='application/json')\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang, string =trans).count(), 1)\n\n # Delete Translations\n # Delete source language translations\n delete_url = reverse('resource_translations_delete',\n args=[self.project.slug, self.resource.slug,self.language.code])\n resp = self.client['maintainer'].get(delete_url)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_translations_confirm_delete.html')\n\n resp = self.client['maintainer'].post(delete_url, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language = self.language).count(), 0)\n\n # Delete target language translations\n delete_url_el = reverse('resource_translations_delete',\n args=[self.project.slug, self.resource.slug, trans_lang])\n resp = self.client['maintainer'].get(delete_url_el)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_translations_confirm_delete.html')\n\n resp = self.client['maintainer'].post(delete_url_el, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, 'resources/resource_detail.html')\n self.assertEqual(Translation.objects.filter(source_entity__resource=self.resource,\n language__code = trans_lang).count(), 0)", "metadata": "root.CoreViewsTest.test_delete_resource_translations", "header": "['class', 'CoreViewsTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 165 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Core", "View", "s", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "resource", "\\u", "translations_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "resource", " ", "translatio", "n", " ", "deletion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "primary", " ", "language", " ", "translatio", "n", ".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "to", " ", "push_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "trans_", "=_", "Translation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "entity_", "=_", "self_", "._", "source", "\\u", "entity_", ",_", "language_", "=_", "self_", "._", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "string_", "=_", "\"", "fooba", "r", "\"_", ",_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "trans_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans", "\\u", "lang_", "=_", "'", "el", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "\"", "foo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "new", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "reverse_", "(_", "'", "push", "\\u", "translatio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "{_", "'", "string", "s", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "source", "\\u", "trans_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "translatio", "ns", "'_", ":_", "{_", "'", "other", "'_", ":_", "trans_", "}_", "}_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ",_", "string_", "=_", "trans_", ")_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "Translat", "ions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "source", " ", "language", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "url_", "=_", "reverse_", "(_", "'", "resource", "\\u", "translatio", "ns", "\\u", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "delete", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "translatio", "ns", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "delete", "\\u", "url_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "self_", "._", "language_", ")_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "target", " ", "language", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "url", "\\u", "el_", "=_", "reverse_", "(_", "'", "resource", "\\u", "translatio", "ns", "\\u", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "self_", "._", "resource_", "._", "slug_", ",_", "trans", "\\u", "lang_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "delete", "\\u", "url", "\\u", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "translatio", "ns", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "delete", "\\u", "url", "\\u", "el_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Translation_", "._", "objects_", "._", "filter_", "(_", "source", "\\u", "entity", "\\u\\u", "resource_", "=_", "self_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language", "\\u\\u", "code_", "=_", "trans", "\\u", "lang_", ")_", "._", "count_", "(_", ")_", ",_", "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,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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 ]
Variable defined multiple times
mayan-edms/mayan-edms/mayan/apps/linking/views.py
[ { "content": "def smart_link_condition_edit(request, smart_link_condition_pk):\n smart_link_condition = get_object_or_404(\n SmartLinkCondition, pk=smart_link_condition_pk\n )\n\n try:\n Permission.check_permissions(\n request.user, (permission_smart_link_edit,)\n )\n except PermissionDenied:\n AccessControlList.objects.check_access(\n (permission_smart_link_edit,), request.user,\n smart_link_condition.smart_link\n )\n\n next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', reverse(settings.LOGIN_REDIRECT_URL))))\n previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', reverse(settings.LOGIN_REDIRECT_URL))))\n\n if request.method == 'POST':\n form = SmartLinkConditionForm(\n request.POST, instance=smart_link_condition\n )\n if form.is_valid():\n smart_link_condition = form.save()\n messages.success(\n request, _(\n 'Smart link condition: \"%s\" edited successfully.'\n ) % smart_link_condition\n )\n return HttpResponseRedirect(next)\n else:\n form = SmartLinkConditionForm(instance=smart_link_condition)\n\n return render_to_response('appearance/generic_form.html', {\n 'condition': smart_link_condition,\n 'form': form,\n 'navigation_object_list': ('object', 'condition'),\n 'next': next,\n 'object': smart_link_condition.smart_link,\n 'previous': previous,\n 'title': _('Edit smart link condition'),\n }, context_instance=RequestContext(request))", "metadata": "root.smart_link_condition_edit", "header": "['module', '___EOS___']", "index": 271 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "smart", "\\u", "link", "\\u", "condition", "\\u", "edit_", "(_", "request_", ",_", "smart", "\\u", "link", "\\u", "condition", "\\u", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "smart", "\\u", "link", "\\u", "condition_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Sma", "rt", "Link", "Condition_", ",_", "pk_", "=_", "smart", "\\u", "link", "\\u", "condition", "\\u", "pk_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Permission_", "._", "check", "\\u", "permissions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "(_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "edit_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Permi", "ssion", "Denied_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Access", "Control", "List_", "._", "objects_", "._", "check", "\\u", "access_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "edit_", ",_", ")_", ",_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "smart", "\\u", "link", "\\u", "condition_", "._", "smart", "\\u", "link_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "next", "'_", ",_", "request_", "._", "GET_", "._", "get_", "(_", "'", "next", "'_", ",_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "REFE", "RER", "'_", ",_", "reverse_", "(_", "settings_", "._", "LOGIN", "\\u", "REDIRECT", "\\u", "URL_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previous_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "previ", "ous", "'_", ",_", "request_", "._", "GET_", "._", "get_", "(_", "'", "previ", "ous", "'_", ",_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "REFE", "RER", "'_", ",_", "reverse_", "(_", "settings_", "._", "LOGIN", "\\u", "REDIRECT", "\\u", "URL_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Sma", "rt", "Link", "Cond", "ition", "Form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "POST_", ",_", "instance_", "=_", "smart", "\\u", "link", "\\u", "condition_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "smart", "\\u", "link", "\\u", "condition_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sma", "rt", " ", "link", " ", "condition", ":", " ", "\"%", "s", "\"", " ", "edited", " ", "success", "full", "y", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "%_", "smart", "\\u", "link", "\\u", "condition_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Sma", "rt", "Link", "Cond", "ition", "Form_", "(_", "instance_", "=_", "smart", "\\u", "link", "\\u", "condition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "appearance", "/", "gener", "ic", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "'_", ":_", "smart", "\\u", "link", "\\u", "condition_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "navigation", "\\u", "object\\u", "list", "'_", ":_", "(_", "'", "object", "'_", ",_", "'", "condition", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "'_", ":_", "next_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "smart", "\\u", "link", "\\u", "condition_", "._", "smart", "\\u", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "previ", "ous", "'_", ":_", "previous_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "\\u_", "(_", "'", "Edit", " ", "smart", " ", "link", " ", "condition", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
ronnix/fabtools/fabtools/tests/test_redis.py
[ { "content": " def test_parse_version(self):\n\n from fabtools.require.redis import _parse_version\n\n self.assertEqual(\n _parse_version('2.6.14'),\n (2, 6, 14)\n )", "metadata": "root.RedisTestCase.test_parse_version", "header": "['class', 'RedisTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 5 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Red", "is", "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", "parse", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "fab", "tools_", "._", "require_", "._", "redis_", "import_", "\\u", "parse", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "parse", "\\u", "version_", "(_", "'", "2.6", ".1", "4", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "6_", ",_", "14_", ")_", "\\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 ]
Comparison of constants
biocore/scikit-bio/skbio/io/format/tests/test_fastq.py
[ { "content": " def test_fastq_to_tabular_msa(self):\n class CustomSequence(GrammaredSequence):\n @classproperty\n @overrides(GrammaredSequence)\n def gap_chars(cls):\n return set('-.')\n\n @classproperty\n @overrides(GrammaredSequence)\n def default_gap_char(cls):\n return '-'\n\n @classproperty\n @overrides(GrammaredSequence)\n def definite_chars(cls):\n return set(string.ascii_letters)\n\n @classproperty\n @overrides(GrammaredSequence)\n def degenerate_map(cls):\n return {}\n\n for valid_files, kwargs, components in self.valid_configurations:\n for valid in valid_files:\n for observed_kwargs in kwargs:\n _drop_kwargs(observed_kwargs, 'seq_num')\n if 'constructor' not in observed_kwargs:\n observed_kwargs['constructor'] = CustomSequence\n constructor = observed_kwargs['constructor']\n\n expected_kwargs = {}\n expected_kwargs['lowercase'] = 'introns'\n observed_kwargs['lowercase'] = 'introns'\n\n expected = TabularMSA(\n [constructor(\n c[2], metadata={'id': c[0],\n 'description': c[1]},\n positional_metadata={'quality': np.array(c[3],\n dtype=np.uint8)},\n **expected_kwargs)\n for c in components])\n\n observed = _fastq_to_tabular_msa(valid, **observed_kwargs)\n self.assertEqual(observed, expected)", "metadata": "root.TestReaders.test_fastq_to_tabular_msa", "header": "['class', 'TestReaders', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 392 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Test", "Read", "ers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fastq", "\\u", "to", "\\u", "tabular", "\\u", "msa", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Custom", "Sequence_", "(_", "Gram", "mar", "ed", "Sequence_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "overrides_", "(_", "Gram", "mar", "ed", "Sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gap", "\\u", "chars_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set_", "(_", "'-", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "overrides_", "(_", "Gram", "mar", "ed", "Sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default", "\\u", "gap", "\\u", "char_", "(_", "cls_", ")_", ":_", "\\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_", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "overrides_", "(_", "Gram", "mar", "ed", "Sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "definit", "e\\u", "chars_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set_", "(_", "string_", "._", "ascii", "\\u", "letters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "overrides_", "(_", "Gram", "mar", "ed", "Sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "deg", "enera", "te", "\\u", "map_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "valid", "\\u", "files_", ",_", "kwargs_", ",_", "components_", "in_", "self_", "._", "valid", "\\u", "configurations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "valid_", "in_", "valid", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "observe", "d\\u", "kwargs_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "drop", "\\u", "kwargs_", "(_", "observe", "d\\u", "kwargs_", ",_", "'", "seq", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "construct", "or", "'_", "not_", "in_", "observe", "d\\u", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "observe", "d\\u", "kwargs_", "[_", "'", "construct", "or", "'_", "]_", "=_", "Custom", "Sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "constructor_", "=_", "observe", "d\\u", "kwargs_", "[_", "'", "construct", "or", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "kwargs_", "[_", "'", "lower", "case", "'_", "]_", "=_", "'", "intron", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observe", "d\\u", "kwargs_", "[_", "'", "lower", "case", "'_", "]_", "=_", "'", "intron", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "Tab", "ular", "MS", "A_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "constructor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "2_", "]_", ",_", "metadata_", "=_", "{_", "'", "id", "'_", ":_", "c_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "c_", "[_", "1_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "positional", "\\u", "metadata_", "=_", "{_", "'", "quali", "ty", "'_", ":_", "np_", "._", "array_", "(_", "c_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "expected", "\\u", "kwargs_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "c_", "in_", "components_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observed_", "=_", "\\u", "fastq", "\\u", "to", "\\u", "tabular", "\\u", "msa", "_", "(_", "valid_", ",_", "**_", "observe", "d\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "observed_", ",_", "expected_", ")_",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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 ]
Unnecessary pass
omab/python-social-auth/social/apps/webpy_app/models.py
[ { "content": "class Nonce(WebpySocialBase, SQLAlchemyNonceMixin, SocialBase):\n \"\"\"One use numbers\"\"\"\n pass", "metadata": "root.Nonce", "header": "['module', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Non", "ce_", "(_", "Web", "py", "Soci", "al", "Base_", ",_", "SQL", "Al", "chem", "y", "Non", "ce", "Mixin_", ",_", "Soci", "al", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "One", " ", "use", " ", "numbers", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Special method has incorrect signature
ChrisBeaumont/soupy/soupy.py
[ { "content": " def __iter__(self):\n for item in self._items:\n yield item", "metadata": "root.Chain.__iter__", "header": "['class', 'Chain', '(', 'Expression', ')', ':', '___EOS___']", "index": 1547 } ]
[]
[]
0
true
[ "[CLS]_", "Special", "_", "method_", "has_", "incorrect", "_", "signature_", "[SEP]_", "class_", "Chain_", "(_", "Expression_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "self_", "._", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
edgewall/trac/trac/ticket/roadmap.py
[ { "content": " def save_milestone(self, req, milestone):\n # Instead of raising one single error, check all the constraints and\n # let the user fix them by going back to edit mode showing the warnings\n warnings = []\n def warn(msg):\n add_warning(req, msg)\n warnings.append(msg)\n\n milestone.description = req.args.get('description', '')\n\n if 'due' in req.args:\n duedate = req.args.get('duedate')\n milestone.due = user_time(req, parse_date, duedate,\n hint='datetime') \\\n if duedate else None\n else:\n milestone.due = None\n\n # -- check completed date\n if 'completed' in req.args:\n completed = req.args.get('completeddate', '')\n completed = user_time(req, parse_date, completed,\n hint='datetime') if completed else None\n if completed and completed > datetime_now(utc):\n warn(_('Completion date may not be in the future'))\n else:\n completed = None\n milestone.completed = completed\n\n # -- check the name\n # If the name has changed, check that the milestone doesn't already\n # exist\n # FIXME: the whole .exists business needs to be clarified\n # (#4130) and should behave like a WikiPage does in\n # this respect.\n new_name = req.args.get('name')\n try:\n new_milestone = Milestone(self.env, new_name)\n except ResourceNotFound:\n milestone.name = new_name\n else:\n if new_milestone.name != milestone.name:\n if new_milestone.name:\n warn(_('Milestone \"%(name)s\" already exists, please '\n 'choose another name.', name=new_milestone.name))\n else:\n warn(_(\"You must provide a name for the milestone.\"))\n\n if warnings:\n return False\n\n # -- actually save changes\n if milestone.exists:\n milestone.update(author=req.authname)\n if completed and 'retarget' in req.args:\n comment = req.args.get('comment', '')\n retarget_to = req.args.get('target') or None\n retargeted_tickets = \\\n milestone.move_tickets(retarget_to, req.authname,\n comment, exclude_closed=True)\n add_notice(req, _('The open tickets associated with '\n 'milestone \"%(name)s\" have been retargeted '\n 'to milestone \"%(retarget)s\".',\n name=milestone.name, retarget=retarget_to))\n new_values = {'milestone': retarget_to}\n comment = comment or \\\n _(\"Open tickets retargeted after milestone closed\")\n event = BatchTicketChangeEvent(retargeted_tickets, None,\n req.authname, comment,\n new_values, None)\n try:\n NotificationSystem(self.env).notify(event)\n except Exception as e:\n self.log.error(\"Failure sending notification on ticket \"\n \"batch change: %s\",\n exception_to_unicode(e))\n add_warning(req, tag_(\"The changes have been saved, but \"\n \"an error occurred while sending \"\n \"notifications: %(message)s\",\n message=to_unicode(e)))\n add_notice(req, _(\"Your changes have been saved.\"))\n else:\n milestone.insert()\n add_notice(req, _('The milestone \"%(name)s\" has been added.',\n name=milestone.name))\n\n return True", "metadata": "root.MilestoneModule.save_milestone", "header": "['class', 'MilestoneModule', '(', 'Component', ')', ':', '___EOS___']", "index": 733 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Mile", "stone", "Module_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "milestone", "_", "(_", "self_", ",_", "req_", ",_", "milestone", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ins", "tea", "d", " ", "of", " ", "rais", "ing", " ", "one", " ", "single", " ", "error", ",", " ", "check", " ", "all", " ", "the", " ", "constraint", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", " ", "the", " ", "user", " ", "fix", " ", "them", " ", "by", " ", "goi", "ng", " ", "back", " ", "to", " ", "edit", " ", "mode", " ", "showin", "g", " ", "the", " ", "warnings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "warn_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "warning_", "(_", "req_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "append_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "milestone", "_", "._", "description_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "description", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "due", "'_", "in_", "req_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "due", "date_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "due", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "milestone", "_", "._", "due", "_", "=_", "user", "\\u", "time_", "(_", "req_", ",_", "parse", "\\u", "date_", ",_", "due", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hint_", "=_", "'", "datetime", "'_", ")_", "if_", "due", "date_", "else_", "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 ", " _", "milestone", "_", "._", "due", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "check", " ", "complete", "d", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "complete", "d", "'_", "in_", "req_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "completed_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "complete", "dda", "te", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completed_", "=_", "user", "\\u", "time_", "(_", "req_", ",_", "parse", "\\u", "date_", ",_", "completed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hint_", "=_", "'", "datetime", "'_", ")_", "if_", "completed_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "completed_", "and_", "completed_", ">_", "datetime", "\\u", "now_", "(_", "utc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn_", "(_", "\\u_", "(_", "'", "Completi", "on", " ", "date", " ", "may", " ", "not", " ", "be", " ", "in", " ", "the", " ", "future", "'_", ")_", ")_", "\\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 ", " _", "completed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "milestone", "_", "._", "completed_", "=_", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "check", " ", "the", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "name", " ", "has", " ", "change", "d", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "milestone", " ", "doe", "sn", "'", "t", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "the", " ", "whole", " ", ".", "exist", "s", " ", "business", " ", "need", "s", " ", "to", " ", "be", " ", "clari", "fied", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "#", "413", "0", ")", " ", "and", " ", "shou", "ld", " ", "behave", " ", "like", " ", "a", " ", "Wiki", "Page", " ", "doe", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "respec", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "name_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "milestone", "_", "=_", "Mile", "stone", "_", "(_", "self_", "._", "env_", ",_", "new", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Reso", "urc", "e", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "milestone", "_", "._", "name_", "=_", "new", "\\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 ", " _", "if_", "new", "\\u", "milestone", "_", "._", "name_", "!=_", "milestone", "_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "\\u", "milestone", "_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "warn_", "(_", "\\u_", "(_", "'", "Mile", "stone", " ", "\"%", "(", "name", ")", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "plea", "se", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choose", " ", "anot", "her", " ", "name", ".'_", ",_", "name_", "=_", "new", "\\u", "milestone", "_", "._", "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 ", " ", "_", "warn_", "(_", "\\u_", "(_", "\"", "You", " ", "must", " ", "provide", " ", "a", " ", "name", " ", "for", " ", "the", " ", "milestone", ".\"_", ")_", ")_", "\\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_", "warnings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "actual", "ly", " ", "save", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "milestone", "_", "._", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "milestone", "_", "._", "update_", "(_", "author_", "=_", "req_", "._", "auth", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "completed_", "and_", "'", "reta", "rget", "'_", "in_", "req_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "comment", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reta", "rget", "\\u", "to_", "=_", "req_", "._", "args_", "._", "get_", "(_", "'", "target", "'_", ")_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reta", "rget", "ed", "\\u", "tickets_", "=_", "milestone", "_", "._", "move", "\\u", "tickets_", "(_", "reta", "rget", "\\u", "to_", ",_", "req_", "._", "auth", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", ",_", "exclu", "de", "\\u", "closed_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "notice_", "(_", "req_", ",_", "\\u_", "(_", "'", "The", " ", "open", " ", "tick", "ets", " ", "associate", "d", " ", "with", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "milestone", " ", "\"%", "(", "name", ")", "s", "\"", " ", "have", " ", "bee", "n", " ", "reta", "rget", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "milestone", " ", "\"%", "(", "reta", "rget", ")", "s", "\".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "milestone", "_", "._", "name_", ",_", "reta", "rget", "_", "=_", "reta", "rget", "\\u", "to_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "values_", "=_", "{_", "'", "milestone", "'_", ":_", "reta", "rget", "\\u", "to_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "comment_", "or_", "\\u_", "(_", "\"", "Open", " ", "tick", "ets", " ", "reta", "rget", "ed", " ", "after", " ", "milestone", " ", "close", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "Bat", "ch", "Ticke", "t", "Change", "Event_", "(_", "reta", "rget", "ed", "\\u", "tickets_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "._", "auth", "name_", ",_", "comment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "values_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Notifi", "cation", "System_", "(_", "self_", "._", "env_", ")_", "._", "notify_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "._", "error_", "(_", "\"", "Fail", "ure", " ", "sendin", "g", " ", "notification", " ", "on", " ", "tick", "et", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "batch", " ", "change", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exception", "\\u", "to", "\\u", "unicode_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "warning_", "(_", "req_", ",_", "tag", "\\u_", "(_", "\"", "The", " ", "change", "s", " ", "have", " ", "bee", "n", " ", "saved", ",", " ", "but", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "an", " ", "error", " ", "occur", "red", " ", "whi", "le", " ", "sendin", "g", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "notification", "s", ":", " ", "%", "(", "message", ")", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "to", "\\u", "unicode_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "\\u", "notice_", "(_", "req_", ",_", "\\u_", "(_", "\"", "You", "r", " ", "change", "s", " ", "have", " ", "bee", "n", " ", "saved", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "milestone", "_", "._", "insert_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "notice_", "(_", "req_", ",_", "\\u_", "(_", "'", "The", " ", "milestone", " ", "\"%", "(", "name", ")", "s", "\"", " ", "has", " ", "bee", "n", " ", "adde", "d", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "milestone", "_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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]
Unreachable code
google/python-adb/adb/adb_debug.py
[ { "content": "def main():\n common = common_cli.GetCommonArguments()\n common.add_argument(\n '--rsa_key_path', action='append', default=[],\n metavar='~/.android/adbkey',\n help='RSA key(s) to use, use multiple times to load mulitple keys')\n common.add_argument(\n '--auth_timeout_s', default=60., metavar='60', type=int,\n help='Seconds to wait for the dialog to be accepted when using '\n 'authenticated ADB.')\n device = common_cli.GetDeviceArguments()\n parents = [common, device]\n\n parser = argparse.ArgumentParser(\n description=sys.modules[__name__].__doc__, parents=[common])\n subparsers = parser.add_subparsers(title='Commands', dest='command_name')\n\n subparser = subparsers.add_parser(\n name='help', help='Prints the commands available')\n subparser = subparsers.add_parser(\n name='devices', help='Lists the available devices', parents=[common])\n subparser.add_argument(\n '--output_port_path', action='store_true',\n help='Outputs the port_path alongside the serial')\n\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.Install)\n common_cli.MakeSubparser(subparsers, parents, List)\n common_cli.MakeSubparser(subparsers, parents, Logcat)\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.Push,\n {'source_file': 'Filename or directory to push to the device.'})\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.Pull,\n {\n 'dest_file': 'Filename to write to on the host, if not specified, '\n 'prints the content to stdout.',\n })\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.Reboot)\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.RebootBootloader)\n common_cli.MakeSubparser(\n subparsers, parents, adb_commands.AdbCommands.Remount)\n common_cli.MakeSubparser(subparsers, parents, adb_commands.AdbCommands.Root)\n common_cli.MakeSubparser(subparsers, parents, Shell)\n\n if len(sys.argv) == 1:\n parser.print_help()\n return 2\n\n args = parser.parse_args()\n if args.verbose:\n logging.basicConfig(level=logging.DEBUG)\n if not args.rsa_key_path:\n default = os.path.expanduser('~/.android/adbkey')\n if os.path.isfile(default):\n args.rsa_key_path = [default]\n if args.rsa_key_path and not rsa_signer:\n parser.error('Please install either M2Crypto or python-rsa')\n # Hacks so that the generated doc is nicer.\n if args.command_name == 'devices':\n return Devices(args)\n if args.command_name == 'help':\n parser.print_help()\n return 0\n if args.command_name == 'logcat':\n args.positional = args.options\n elif args.command_name == 'shell':\n args.positional = args.command\n\n return common_cli.StartCli(\n args,\n adb_commands.AdbCommands.ConnectDevice,\n auth_timeout_ms=args.auth_timeout_s * 1000,\n rsa_keys=[rsa_signer(path) for path in args.rsa_key_path])", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 98 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "common_", "=_", "common", "\\u", "cli_", "._", "Get", "Common", "Arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "rsa", "\\u", "key", "\\u", "path", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "default_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "~", "/.", "android", "/", "adb", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "RSA", " ", "key", "(", "s", ")", " ", "to", " ", "use", ",", " ", "use", " ", "multiple", " ", "times", " ", "to", " ", "load", " ", "mul", "it", "ple", " ", "keys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "auth", "\\u", "timeo", "ut", "\\u", "s", "'_", ",_", "default_", "=_", "60._", ",_", "metavar_", "=_", "'", "60", "'_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Second", "s", " ", "to", " ", "wait", " ", "for", " ", "the", " ", "dialog", " ", "to", " ", "be", " ", "accept", "ed", " ", "whe", "n", " ", "usi", "ng", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authenticat", "ed", " ", "AD", "B", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "=_", "common", "\\u", "cli_", "._", "Get", "Dev", "ice", "Arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "[_", "common_", ",_", "device_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "sys_", "._", "modules_", "[_", "\\u\\u", "name\\u\\u_", "]_", "._", "\\u\\u", "doc\\u\\u_", ",_", "parents_", "=_", "[_", "common_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparsers_", "=_", "parser_", "._", "add", "\\u", "subparsers_", "(_", "title_", "=_", "'", "Command", "s", "'_", ",_", "dest_", "=_", "'", "command", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subparser_", "=_", "subparsers_", "._", "add", "\\u", "parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "help", "'_", ",_", "help_", "=_", "'", "Print", "s", " ", "the", " ", "command", "s", " ", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparser_", "=_", "subparsers_", "._", "add", "\\u", "parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "device", "s", "'_", ",_", "help_", "=_", "'", "List", "s", " ", "the", " ", "avail", "able", " ", "device", "s", "'_", ",_", "parents_", "=_", "[_", "common_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "output", "\\u", "port", "\\u", "path", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Output", "s", " ", "the", " ", "port", "\\u", "path", " ", "along", "side", " ", "the", " ", "serial", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Install_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "subparsers_", ",_", "parents_", ",_", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "subparsers_", ",_", "parents_", ",_", "Log", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Push", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "source", "\\u", "file", "'_", ":_", "'", "File", "name", " ", "or", " ", "director", "y", " ", "to", " ", "push", " ", "to", " ", "the", " ", "device", ".'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Pul", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "\\u", "file", "'_", ":_", "'", "File", "name", " ", "to", " ", "write", " ", "to", " ", "on", " ", "the", " ", "host", ",", " ", "if", " ", "not", " ", "specified", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "print", "s", " ", "the", " ", "content", " ", "to", " ", "stdout", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Reboot", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Reboot", "Boot", "loader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Remo", "unt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "subparsers_", ",_", "parents_", ",_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "cli_", "._", "Make", "Subp", "arser", "_", "(_", "subparsers_", ",_", "parents_", ",_", "Shell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", "._", "rsa", "\\u", "key", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "android", "/", "adb", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "rsa", "\\u", "key", "\\u", "path_", "=_", "[_", "default_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "rsa", "\\u", "key", "\\u", "path_", "and_", "not_", "rsa", "\\u", "signer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "error_", "(_", "'", "Ple", "ase", " ", "install", " ", "eit", "her", " ", "M2", "Crypto", " ", "or", " ", "python", "-", "rsa", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hack", "s", " ", "so", " ", "tha", "t", " ", "the", " ", "generat", "ed", " ", "doc", " ", "is", " ", "nice", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "command", "\\u", "name_", "==_", "'", "device", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Devices_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "command", "\\u", "name_", "==_", "'", "help", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "command", "\\u", "name_", "==_", "'", "logc", "at", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "positional", "_", "=_", "args_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "command", "\\u", "name_", "==_", "'", "shell", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "positional", "_", "=_", "args_", "._", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "common", "\\u", "cli_", "._", "Start", "Cli", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "adb", "\\u", "commands_", "._", "Ad", "b", "Commands_", "._", "Connect", "Device_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "timeo", "ut", "\\u", "ms_", "=_", "args_", "._", "auth", "\\u", "timeo", "ut", "\\u", "s_", "*_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsa", "\\u", "keys_", "=_", "[_", "rsa", "\\u", "signer_", "(_", "path_", ")_", "for_", "path_", "in_", "args_", "._", "rsa", "\\u", "key", "\\u", "path_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
mozilla/addons-server/src/olympia/search/views.py
[ { "content": " def _build_fields(self, item, fields):\n data = {}\n for key, prop in fields.iteritems():\n if isinstance(prop, dict):\n data[key] = self._build_fields(item, prop)\n else:\n # prop is a tuple like: ('method', 'arg1, 'argN').\n if isinstance(prop, tuple):\n val = getattr(item, prop[0])(*prop[1:])\n else:\n val = getattr(item, prop, '')\n if callable(val):\n val = val()\n data[key] = unicode(val)\n return data", "metadata": "root.BaseAjaxSearch._build_fields", "header": "['class', 'BaseAjaxSearch', '(', 'object', ')', ':', '___EOS___']", "index": 174 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Base", "Ajax", "Search_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "fields_", "(_", "self_", ",_", "item_", ",_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "prop_", "in_", "fields_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "prop_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "key_", "]_", "=_", "self_", "._", "\\u", "build", "\\u", "fields_", "(_", "item_", ",_", "prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prop", " ", "is", " ", "a", " ", "tuple", " ", "like", ":", " ", "('", "method", "',", " ", "'", "arg", "1", ",", " ", "'", "arg", "N", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "prop_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "getattr_", "(_", "item_", ",_", "prop_", "[_", "0_", "]_", ")_", "(_", "*_", "prop_", "[_", "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 ", " ", "_", "val_", "=_", "getattr_", "(_", "item_", ",_", "prop_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "val_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "key_", "]_", "=_", "unicode_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
marcusbuffett/command-line-chess/build/lib/chess/AI.py
[ { "content": "import sys\nfrom Coordinate import Coordinate as C\nfrom Move import Move\nfrom Piece import Piece\nfrom Board import Board\nfrom MoveNode import MoveNode\nfrom InputParser import InputParser\nimport copy\nimport random\nfrom multiprocessing import Queue, Pool, Process\n\n\nWHITE = True\nBLACK = False\n\n\n\n\nif __name__ == \"__main__\":\n mainBoard = Board()\n ai = AI(mainBoard, True, 3)\n print(mainBoard)\n ai.makeBestMove()\n print(mainBoard)\n print(ai.movesAnalyzed)\n print(mainBoard.movesMade)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Coordinate_", "import_", "Coordinate_", "as_", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Move_", "import_", "Move_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Piece_", "import_", "Piece_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Board_", "import_", "Board_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Move", "Node_", "import_", "Move", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Inp", "ut", "Parser_", "import_", "Inp", "ut", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multiprocessing_", "import_", "Queue_", ",_", "Pool_", ",_", "Process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WHITE_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLACK_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "Board_", "=_", "Board_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ai_", "=_", "AI_", "(_", "main", "Board_", ",_", "True_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "main", "Board_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ai_", "._", "make", "Bes", "t", "Move_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "main", "Board_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ai_", "._", "moves", "Analy", "zed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "main", "Board_", "._", "moves", "Made", "_", ")_", "\\u\\u\\uDEDENT\\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 ]
Except block handles 'BaseException'
openelections/openelections-core/openelex/tests/test_ia_loader.py
[ { "content": " def test_parse_office(self):\n office_district = [\n \"Attorney General\",\n \"Auditor of State\",\n \"Governor and Lieutenant Governor\",\n \"Secretary of Agriculture\",\n \"Secretary of State\",\n \"Treasurer of State\",\n (\"State Representative District 058\", \"State Representative\", \"058\"),\n (\"State Senator District 29\", \"State Senator\", \"29\"),\n (\"United States Representative District 5\",\n \"United States Representative\", \"5\"),\n ]\n\n for office in office_district:\n try:\n office_in, expected_office, expected_district = office\n except ValueError:\n office_in = office\n expected_office = office\n expected_district = None\n\n office_out, district = self.loader._parse_office(office_in)\n self.assertEqual(office_out, expected_office)\n self.assertEqual(district, expected_district)", "metadata": "root.TestExcelPrecinctPre2010ResultLoader.test_parse_office", "header": "['class', 'TestExcelPrecinctPre2010ResultLoader', '(', 'LoaderPrepMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 200 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Exce", "l", "Prec", "inc", "t", "Pre", "2010", "Result", "Loader_", "(_", "Load", "er", "Prep", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "parse", "\\u", "office", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "office", "\\u", "district_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Att", "orn", "ey", " ", "General", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Audi", "tor", " ", "of", " ", "State", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Gov", "ern", "or", " ", "and", " ", "Lie", "ute", "nant", " ", "Gov", "ern", "or", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sec", "reta", "ry", " ", "of", " ", "Agr", "icult", "ure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sec", "reta", "ry", " ", "of", " ", "State", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Tre", "asu", "rer", " ", "of", " ", "State", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "State", " ", "Represent", "ative", " ", "Distr", "ict", " ", "058", "\"_", ",_", "\"", "State", " ", "Represent", "ative", "\"_", ",_", "\"", "058", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "State", " ", "Sen", "ator", " ", "Distr", "ict", " ", "2", "9", "\"_", ",_", "\"", "State", " ", "Sen", "ator", "\"_", ",_", "\"", "2", "9", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Unit", "ed", " ", "State", "s", " ", "Represent", "ative", " ", "Distr", "ict", " ", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Unit", "ed", " ", "State", "s", " ", "Represent", "ative", "\"_", ",_", "\"", "5", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "office", "_", "in_", "office", "\\u", "district_", ":_", "\\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 ", " _", "office", "\\u", "in_", ",_", "expected", "\\u", "office", "_", ",_", "expected", "\\u", "district_", "=_", "office", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "office", "\\u", "in_", "=_", "office", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "office", "_", "=_", "office", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "district_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "office", "\\u", "out_", ",_", "district_", "=_", "self_", "._", "loader_", "._", "\\u", "parse", "\\u", "office", "_", "(_", "office", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "office", "\\u", "out_", ",_", "expected", "\\u", "office", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "district_", ",_", "expected", "\\u", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
wangjeaf/CSSCheckStyle/ckstyle/command/CommandFileParser.py
[ { "content": "def get(config, group, attr, default, lowerFlag = False):\n if config.has_option(group, attr):\n try:\n result = config.get(group, attr)\n if lowerFlag:\n result = result.lower()\n return result\n except Exception:\n console.log('%s of %s in config file should be valid string' % (attr, group))\n return default", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 30 } ]
[]
[]
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_", "get_", "(_", "config_", ",_", "group_", ",_", "attr_", ",_", "default_", ",_", "lower", "Flag_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "._", "has", "\\u", "option_", "(_", "group_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "config_", "._", "get_", "(_", "group_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lower", "Flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\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 ", " _", "console_", "._", "log_", "(_", "'%", "s", " ", "of", " ", "%", "s", " ", "in", " ", "config", " ", "file", " ", "shou", "ld", " ", "be", " ", "valid", " ", "string", "'_", "%_", "(_", "attr_", ",_", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "default_", "\\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 ]
Unused import
twisted/vertex/vertex/ptcp.py
[ { "content": "# -*- test-case-name: vertex.test.test_ptcp -*-\n\nimport struct\n\nfrom binascii import crc32 # used to use zlib.crc32 - but that gives different\n # results on 64-bit platforms!!\n\nimport itertools\n\nfrom twisted.python.failure import Failure\nfrom twisted.internet.defer import Deferred\nfrom twisted.internet import protocol, error, reactor, defer\nfrom twisted.internet.main import CONNECTION_DONE\nfrom twisted.python import log, util\n\nfrom vertex import tcpdfa\nfrom vertex.statemachine import StateError\n\n\ngenConnID = itertools.count(8).next\n\nMAX_PSEUDO_PORT = (2 ** 16)\n\n_packetFormat = ('!' # WTF did you think\n 'H' # sourcePseudoPort\n 'H' # destPseudoPort\n 'L' # sequenceNumber\n 'L' # acknowledgementNumber\n 'L' # window\n 'B' # flags\n 'l' # checksum\n # (signed because of binascii.crc32)\n 'H' # dlen\n )\n_fixedSize = struct.calcsize(_packetFormat)\n\n_SYN, _ACK, _FIN, _RST, _STB = [1 << n for n in range(5)]\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 _flagprop(flag):\n def setter(self, value):\n if value:\n self.flags |= flag\n else:\n self.flags &= ~flag\n return property(lambda self: bool(self.flags & flag), setter)", "metadata": "root._flagprop", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def relativeSequence(wireSequence, initialSequence, lapNumber):\n \"\"\" Compute a relative sequence number from a wire sequence number so that we\n can use natural Python comparisons on it, such as <, >, ==.\n\n @param wireSequence: the sequence number received on the wire.\n\n @param initialSequence: the ISN for this sequence, negotiated at SYN time.\n\n @param lapNumber: the number of times that this value has wrapped around\n 2**32.\n \"\"\"\n return (wireSequence + (lapNumber * (2**32))) - initialSequence", "metadata": "root.relativeSequence", "header": "['module', '___EOS___']", "index": 46 }, { "content": "class PTCPPacket(util.FancyStrMixin, object):\n showAttributes = (\n ('sourcePseudoPort', 'sourcePseudoPort', '%d'),\n ('destPseudoPort', 'destPseudoPort', '%d'),\n ('shortdata', 'data', '%r'),\n ('niceflags', 'flags', '%s'),\n ('dlen', 'dlen', '%d'),\n ('seqNum', 'seq', '%d'),\n ('ackNum', 'ack', '%d'),\n ('checksum', 'checksum', '%x'),\n ('peerAddressTuple', 'peerAddress', '%r'),\n ('retransmitCount', 'retransmitCount', '%d'),\n )\n\n syn = _flagprop(_SYN)\n ack = _flagprop(_ACK)\n fin = _flagprop(_FIN)\n rst = _flagprop(_RST)\n stb = _flagprop(_STB)\n\n # Number of retransmit attempts left for this segment. When it reaches\n # zero, this segment is dead.\n retransmitCount = 50\n\n shortdata = property(*shortdata())\n\n niceflags = property(*niceflags())\n\n create = classmethod(create)\n\n\n\n\n\n\n\n\n\n decode = classmethod(decode)\n\n\n", "metadata": "root.PTCPPacket", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def shortdata():\n def get(self):\n if len(self.data) > 13:\n return self.data[:5] + '...' + self.data[-5:]\n else:\n return self.data\n return get,", "metadata": "root.PTCPPacket.shortdata", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def niceflags():\n def get(self):\n res = []\n for (f, v) in [\n (self.syn, 'S'), (self.ack, 'A'), (self.fin, 'F'),\n (self.rst, 'R'), (self.stb, 'T')]:\n res.append(f and v or '.')\n return ''.join(res)\n return get,", "metadata": "root.PTCPPacket.niceflags", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def create(cls,\n sourcePseudoPort, destPseudoPort,\n seqNum, ackNum, data,\n window=(1 << 15),\n syn=False, ack=False, fin=False,\n rst=False, stb=False,\n destination=None):\n i = cls(sourcePseudoPort, destPseudoPort,\n seqNum, ackNum, window,\n 0, 0, len(data), data)\n i.syn = syn\n i.ack = ack\n i.fin = fin\n i.rst = rst\n i.stb = stb\n i.checksum = i.computeChecksum()\n i.destination = destination\n return i", "metadata": "root.PTCPPacket.create", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 103 }, { "content": " def __init__(self,\n sourcePseudoPort,\n destPseudoPort,\n seqNum, ackNum, window, flags,\n checksum, dlen, data, peerAddressTuple=None,\n seqOffset=0, ackOffset=0, seqLaps=0, ackLaps=0):\n self.sourcePseudoPort = sourcePseudoPort\n self.destPseudoPort = destPseudoPort\n self.seqNum = seqNum\n self.ackNum = ackNum\n self.window = window\n self.flags = flags\n self.checksum = checksum\n self.dlen = dlen\n self.data = data\n self.peerAddressTuple = peerAddressTuple # None if local\n\n self.seqOffset = seqOffset\n self.ackOffset = ackOffset\n self.seqLaps = seqLaps\n self.ackLaps = ackLaps", "metadata": "root.PTCPPacket.__init__", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 124 }, { "content": " def segmentLength(self):\n \"\"\"RFC page 26: 'The segment length (SEG.LEN) includes both data and sequence\n space occupying controls'\n \"\"\"\n return self.dlen + self.syn + self.fin", "metadata": "root.PTCPPacket.segmentLength", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 146 }, { "content": " def relativeSeq(self):\n return relativeSequence(self.seqNum, self.seqOffset, self.seqLaps)", "metadata": "root.PTCPPacket.relativeSeq", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 152 }, { "content": " def relativeAck(self):\n return relativeSequence(self.ackNum, self.ackOffset, self.ackLaps)", "metadata": "root.PTCPPacket.relativeAck", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def verifyChecksum(self):\n if len(self.data) != self.dlen:\n if len(self.data) > self.dlen:\n raise GarbageDataError(self)\n else:\n raise TruncatedDataError(self)\n expected = self.computeChecksum()\n received = self.checksum\n if expected != received:\n raise ChecksumMismatchError(expected, received)", "metadata": "root.PTCPPacket.verifyChecksum", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 159 }, { "content": " def computeChecksum(self):\n return crc32(self.data)", "metadata": "root.PTCPPacket.computeChecksum", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def decode(cls, bytes, hostPortPair):\n fields = struct.unpack(_packetFormat, bytes[:_fixedSize])\n sourcePseudoPort, destPseudoPort, seq, ack, window, flags, checksum, dlen = fields\n data = bytes[_fixedSize:]\n pkt = cls(sourcePseudoPort, destPseudoPort, seq, ack, window, flags,\n checksum, dlen, data, hostPortPair)\n return pkt", "metadata": "root.PTCPPacket.decode", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 173 }, { "content": " def mustRetransmit(self):\n \"\"\"Check to see if this packet must be retransmitted until it was received.\n \"\"\"\n if self.syn or self.fin or self.dlen:\n return True\n return False", "metadata": "root.PTCPPacket.mustRetransmit", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 182 }, { "content": " def encode(self):\n dlen = len(self.data)\n checksum = self.computeChecksum()\n return struct.pack(\n _packetFormat,\n self.sourcePseudoPort, self.destPseudoPort,\n self.seqNum, self.ackNum, self.window,\n self.flags, checksum, dlen) + self.data", "metadata": "root.PTCPPacket.encode", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 189 }, { "content": " def fragment(self, mtu):\n if self.dlen < mtu:\n return [self]\n assert not self.syn, \"should not be originating syn packets w/ data\"\n seqOfft = 0\n L = []\n # XXX TODO: need to take seqLaps into account, etc.\n for chunk in iterchunks(self.data, mtu):\n last = self.create(self.sourcePseudoPort,\n self.destPseudoPort,\n self.seqNum + seqOfft,\n self.ackNum,\n chunk,\n self.window,\n destination=self.destination,\n ack=self.ack)\n L.append(last)\n seqOfft += len(chunk)\n if self.fin:\n last.fin = self.fin\n last.checksum = last.computeChecksum()\n return L", "metadata": "root.PTCPPacket.fragment", "header": "['class', 'PTCPPacket', '(', 'util', '.', 'FancyStrMixin', ',', 'object', ')', ':', '___EOS___']", "index": 198 }, { "content": "def iterchunks(data, chunksize):\n \"\"\"iterate chunks of data\n \"\"\"\n offt = 0\n while offt < len(data):\n yield data[offt:offt+chunksize]\n offt += chunksize", "metadata": "root.iterchunks", "header": "['module', '___EOS___']", "index": 222 }, { "content": "def ISN():\n \"\"\"\n Initial Sequence Number generator.\n \"\"\"\n # return int((time.time() * 1000000) / 4) % 2**32\n return 0", "metadata": "root.ISN", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def segmentAcceptable(RCV_NXT, RCV_WND, SEG_SEQ, SEG_LEN):\n # RFC page 26.\n if SEG_LEN == 0 and RCV_WND == 0:\n return SEG_SEQ == RCV_NXT\n if SEG_LEN == 0 and RCV_WND > 0:\n return ((RCV_NXT <= SEG_SEQ) and (SEG_SEQ < RCV_NXT + RCV_WND))\n if SEG_LEN > 0 and RCV_WND == 0:\n return False\n if SEG_LEN > 0 and RCV_WND > 0:\n return (( (RCV_NXT <= SEG_SEQ) and (SEG_SEQ < RCV_NXT + RCV_WND))\n or ((RCV_NXT <= SEG_SEQ+SEG_LEN-1) and\n (SEG_SEQ+SEG_LEN-1 < RCV_NXT + RCV_WND)))\n assert 0, 'Should be impossible to get here.'\n return False", "metadata": "root.segmentAcceptable", "header": "['module', '___EOS___']", "index": 239 }, { "content": "class BadPacketError(Exception):\n \"\"\"\n A packet was bad for some reason.\n \"\"\"", "metadata": "root.BadPacketError", "header": "['module', '___EOS___']", "index": 254 }, { "content": "class ChecksumMismatchError(Exception):\n \"\"\"\n The checksum and data received did not match.\n \"\"\"", "metadata": "root.ChecksumMismatchError", "header": "['module', '___EOS___']", "index": 259 }, { "content": "class TruncatedDataError(Exception):\n \"\"\"\n The packet was truncated in transit, and all of the data did not arrive.\n \"\"\"", "metadata": "root.TruncatedDataError", "header": "['module', '___EOS___']", "index": 264 }, { "content": "class GarbageDataError(Exception):\n \"\"\"\n Too much data was received (???)\n \"\"\"", "metadata": "root.GarbageDataError", "header": "['module', '___EOS___']", "index": 269 }, { "content": "class PTCPConnection(tcpdfa.TCP):\n \"\"\"\n Implementation of RFC 793 state machine.\n\n @ivar oldestUnackedSendSeqNum: (TCP RFC: SND.UNA) The oldest (relative)\n sequence number referring to an octet which we have sent or may send which\n is unacknowledged. This begins at 0, which is special because it is not\n for an octet, but rather for the initial SYN packet. Unless it is 0, this\n represents the sequence number of self._outgoingBytes[0].\n\n @ivar nextSendSeqNum: (TCP RFC: SND.NXT) The next (relative) sequence\n number that we will send to our peer after the current buffered segments\n have all been acknowledged. This is the sequence number of the\n not-yet-extant octet in the stream at\n self._outgoingBytes[len(self._outgoingBytes)].\n\n @ivar nextRecvSeqNum: (TCP RFC: RCV.NXT) The next (relative) sequence\n number that the peer should send to us if they want to send more data;\n their first unacknowledged sequence number as far as we are concerned; the\n left or lower edge of the receive window; the sequence number of the first\n octet that has not been delivered to the application. changed whenever we\n receive an appropriate ACK.\n\n @ivar peerSendISN: the initial sequence number that the peer sent us during\n the negotiation phase. All peer-relative sequence numbers are computed\n using this. (see C{relativeSequence}).\n\n @ivar hostSendISN: the initial sequence number that the we sent during the\n negotiation phase. All host-relative sequence numbers are computed using\n this. (see C{relativeSequence})\n\n @ivar retransmissionQueue: a list of packets to be re-sent until their\n acknowledgements come through.\n\n @ivar recvWindow: (TCP RFC: RCV.WND) - the size [in octets] of the current\n window allowed by this host, to be in transit from the other host.\n\n @ivar sendWindow: (TCP RFC: SND.WND) - the size [in octets] of the current\n window allowed by our peer, to be in transit from us.\n\n \"\"\"\n\n mtu = 512 - _fixedSize\n\n recvWindow = mtu\n sendWindow = mtu\n sendWindowRemaining = mtu * 2\n\n protocol = None\n\n\n peerSendISN = None\n\n\n\n\n\n _outgoingBytes = ''\n _nagle = None\n\n\n\n\n\n\n\n\n _retransmitter = None\n _retransmitTimeout = 0.5\n\n\n\n\n disconnecting = False # This is *TWISTED* level state-machine stuff,\n # not TCP-level.\n\n\n\n\n\n\n\n disconnected = False\n producer = None\n producerPaused = False\n streamingProducer = False\n\n\n\n _paused = False\n\n\n\n\n # State machine transition definitions, hooray.\n\n\n wasEverListen = False\n\n\n\n _timeWaitCall = None\n _timeWaitTimeout = 0.01 # REALLY fast timeout, right now this is for\n # the tests...\n\n\n\n peerAddressTuple = None\n\n\n# def invalidInput(self, datum):\n# print self, self.protocol, 'invalid input', datum\n\n pseudoPortPair = property(*pseudoPortPair())\n\n\n\n\n _closeWaitLoseConnection = None\n\n\n\n\n\n\n", "metadata": "root.PTCPConnection", "header": "['module', '___EOS___']", "index": 274 }, { "content": " def __init__(self,\n hostPseudoPort, peerPseudoPort,\n ptcp, factory, peerAddressTuple):\n tcpdfa.TCP.__init__(self)\n self.hostPseudoPort = hostPseudoPort\n self.peerPseudoPort = peerPseudoPort\n self.ptcp = ptcp\n self.factory = factory\n self._receiveBuffer = []\n self.retransmissionQueue = []\n self.peerAddressTuple = peerAddressTuple\n\n self.oldestUnackedSendSeqNum = 0\n self.nextSendSeqNum = 0\n self.hostSendISN = 0\n self.nextRecvSeqNum = 0\n self.peerSendISN = 0\n self.setPeerISN = False", "metadata": "root.PTCPConnection.__init__", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 324 }, { "content": " def packetReceived(self, packet):\n # XXX TODO: probably have to do something to the packet here to\n # identify its relative sequence number.\n\n # print 'received', self, packet\n\n if packet.stb:\n # Shrink the MTU\n [self.mtu] = struct.unpack('!H', packet.data)\n rq = []\n for pkt in self.retransmissionQueue:\n rq.extend(pkt.fragment(self.mtu))\n self.retransmissionQueue = rq\n return\n\n if self._paused:\n return\n\n generatedStateMachineInput = False\n if packet.syn:\n if packet.dlen:\n # Whoops, what? SYNs probably can contain data, I think, but I\n # certainly don't see anything in the spec about how to deal\n # with this or in ethereal for how linux deals with it -glyph\n raise BadPacketError(\n \"currently no data allowed in SYN packets: %r\"\n % (packet,))\n else:\n assert packet.segmentLength() == 1\n if self.peerAddressTuple is None:\n # we're a server\n assert self.wasEverListen, \"Clients must specify a connect address.\"\n self.peerAddressTuple = packet.peerAddressTuple\n else:\n # we're a client\n assert self.peerAddressTuple == packet.peerAddressTuple\n if self.setPeerISN:\n if self.peerSendISN != packet.seqNum:\n raise BadPacketError(\n \"Peer ISN was already set to %s but incoming packet \"\n \"tried to set it to %s\" % (\n self.peerSendISN, packet.seqNum))\n if not self.retransmissionQueue:\n # If our retransmissionQueue is hot, we are going to send\n # them an ACK to this with the next packet we send them\n # anyway; as a bonus, this will properly determine whether\n # we're sending a SYN+ACK or merely an ACK; the only time\n # we send an ACK is when we have nothing to say to them and\n # they're blocked on getting a response to their SYN+ACK\n # from us. -glyph\n self.originate(ack=True)\n return\n self.setPeerISN = True\n self.peerSendISN = packet.seqNum\n # syn, fin, and data are mutually exclusive, so this relative\n # sequence-number increment is done both here, and below in the\n # data/fin processing block.\n self.nextRecvSeqNum += packet.segmentLength()\n if not packet.ack:\n generatedStateMachineInput = True\n self.input(tcpdfa.SYN)\n\n SEG_ACK = packet.relativeAck() # aliasing this for easier reading w/\n # the RFC\n if packet.ack:\n if (self.oldestUnackedSendSeqNum < SEG_ACK and\n SEG_ACK <= self.nextSendSeqNum):\n # According to the spec, an 'acceptable ack\n rq = self.retransmissionQueue\n while rq:\n segmentOnQueue = rq[0]\n qSegSeq = segmentOnQueue.relativeSeq()\n if qSegSeq + segmentOnQueue.segmentLength() <= SEG_ACK:\n # fully acknowledged, as per RFC!\n rq.pop(0)\n sminput = None\n self.sendWindowRemaining += segmentOnQueue.segmentLength()\n # print 'inc send window', self, self.sendWindowRemaining\n if segmentOnQueue.syn:\n if packet.syn:\n sminput = tcpdfa.SYN_ACK\n else:\n sminput = tcpdfa.ACK\n elif segmentOnQueue.fin:\n sminput = tcpdfa.ACK\n if sminput is not None:\n # print 'ack input:', segmentOnQueue, packet, sminput\n generatedStateMachineInput = True\n self.input(sminput)\n else:\n break\n else:\n # write buffer is empty; alert the application layer.\n self._writeBufferEmpty()\n self.oldestUnackedSendSeqNum = SEG_ACK\n\n if packet.syn:\n assert generatedStateMachineInput\n return\n\n # XXX TODO: examine 'window' field and adjust sendWindowRemaining\n # is it 'occupying a portion of valid receive sequence space'? I think\n # this means 'packet which might acceptably contain useful data'\n if not packet.segmentLength():\n assert packet.ack, \"What the _HELL_ is wrong with this packet:\" +str(packet)\n return\n\n if not segmentAcceptable(self.nextRecvSeqNum,\n self.recvWindow,\n packet.relativeSeq(),\n packet.segmentLength()):\n # We have to transmit an ack here since it's old data. We probably\n # need to ack in more states than just ESTABLISHED... but which\n # ones?\n if not self.retransmissionQueue:\n self.originate(ack=True)\n return\n\n # OK! It's acceptable! Let's process the various bits of data.\n # Where is the useful data in the packet?\n if packet.relativeSeq() > self.nextRecvSeqNum:\n # XXX: Here's what's going on. Data can be 'in the window', but\n # still in the future. For example, if I have a window of length 3\n # and I send segments DATA1(len 1) DATA2(len 1) FIN and you receive\n # them in the order FIN DATA1 DATA2, you don't actually want to\n # process the FIN until you've processed the data.\n\n # For the moment we are just dropping anything that isn't exactly\n # the next thing we want to process. This is perfectly valid;\n # these packets might have been dropped, so the other end will have\n # to retransmit them anyway.\n return\n\n if packet.dlen:\n assert not packet.syn, 'no seriously I _do not_ know how to handle this'\n usefulData = packet.data[self.nextRecvSeqNum - packet.relativeSeq():]\n # DONT check/slice the window size here, the acceptability code\n # checked it, we can over-ack if the other side is buggy (???)\n if self.protocol is not None:\n try:\n self.protocol.dataReceived(usefulData)\n except:\n log.err()\n self.loseConnection()\n\n self.nextRecvSeqNum += packet.segmentLength()\n if self.state == tcpdfa.ESTABLISHED:\n # In all other states, the state machine takes care of sending ACKs\n # in its output process.\n self.originate(ack=True)\n\n if packet.fin:\n self.input(tcpdfa.FIN)", "metadata": "root.PTCPConnection.packetReceived", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 345 }, { "content": " def getHost(self):\n tupl = self.ptcp.transport.getHost()\n return PTCPAddress((tupl.host, tupl.port),\n self.pseudoPortPair)", "metadata": "root.PTCPConnection.getHost", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 500 }, { "content": " def getPeer(self):\n return PTCPAddress(self.peerAddressTuple,\n self.pseudoPortPair)", "metadata": "root.PTCPConnection.getPeer", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 505 }, { "content": " def write(self, bytes):\n assert not self.disconnected, 'Writing to a transport that was already disconnected.'\n self._outgoingBytes += bytes\n self._writeLater()", "metadata": "root.PTCPConnection.write", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 512 }, { "content": " def writeSequence(self, seq):\n self.write(''.join(seq))", "metadata": "root.PTCPConnection.writeSequence", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 518 }, { "content": " def _writeLater(self):\n if self._nagle is None:\n self._nagle = reactor.callLater(0.001, self._reallyWrite)", "metadata": "root.PTCPConnection._writeLater", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 522 }, { "content": " def _originateOneData(self):\n amount = min(self.sendWindowRemaining, self.mtu)\n sendOut = self._outgoingBytes[:amount]\n # print 'originating data packet', len(sendOut)\n self._outgoingBytes = self._outgoingBytes[amount:]\n self.sendWindowRemaining -= len(sendOut)\n self.originate(ack=True, data=sendOut)", "metadata": "root.PTCPConnection._originateOneData", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 526 }, { "content": " def _reallyWrite(self):\n # print self, 'really writing', self._paused\n self._nagle = None\n if self._outgoingBytes:\n # print 'window and bytes', self.sendWindowRemaining, len(self._outgoingBytes)\n while self.sendWindowRemaining and self._outgoingBytes:\n self._originateOneData()", "metadata": "root.PTCPConnection._reallyWrite", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 534 }, { "content": " def _retransmitLater(self):\n assert self.state != tcpdfa.CLOSED\n if self._retransmitter is None:\n self._retransmitter = reactor.callLater(self._retransmitTimeout, self._reallyRetransmit)", "metadata": "root.PTCPConnection._retransmitLater", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 545 }, { "content": " def _stopRetransmitting(self):\n # used both as a quick-and-dirty test shutdown hack and a way to shut\n # down when we die...\n if self._retransmitter is not None:\n self._retransmitter.cancel()\n self._retransmitter = None\n if self._nagle is not None:\n self._nagle.cancel()\n self._nagle = None\n if self._closeWaitLoseConnection is not None:\n self._closeWaitLoseConnection.cancel()\n self._closeWaitLoseConnection = None", "metadata": "root.PTCPConnection._stopRetransmitting", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 550 }, { "content": " def _reallyRetransmit(self):\n # XXX TODO: packet fragmentation & coalescing.\n # print 'Wee a retransmit! What I got?', self.retransmissionQueue\n self._retransmitter = None\n if self.retransmissionQueue:\n for packet in self.retransmissionQueue:\n packet.retransmitCount -= 1\n if packet.retransmitCount:\n packet.ackNum = self.currentAckNum()\n self.ptcp.sendPacket(packet)\n else:\n self.input(tcpdfa.TIMEOUT)\n return\n self._retransmitLater()", "metadata": "root.PTCPConnection._reallyRetransmit", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 563 }, { "content": " def loseConnection(self):\n if not self.disconnecting:\n self.disconnecting = True\n if not self._outgoingBytes:\n self._writeBufferEmpty()", "metadata": "root.PTCPConnection.loseConnection", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 581 }, { "content": " def _writeBufferEmpty(self):\n if self._outgoingBytes:\n self._reallyWrite()\n elif self.producer is not None:\n if (not self.streamingProducer) or self.producerPaused:\n self.producerPaused = False\n self.producer.resumeProducing()\n elif self.disconnecting and (not self.disconnected\n or self.state == tcpdfa.CLOSE_WAIT):\n self.input(tcpdfa.APP_CLOSE)", "metadata": "root.PTCPConnection._writeBufferEmpty", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 588 }, { "content": " def _writeBufferFull(self):\n # print 'my write buffer is full'\n if (self.producer is not None\n and not self.producerPaused):\n self.producerPaused = True\n # print 'producer pausing'\n self.producer.pauseProducing()\n # print 'producer paused'\n else:\n # print 'but I am not telling my producer to pause!'\n # print ' ', self.producer, self.streamingProducer, self.producerPaused\n pass", "metadata": "root.PTCPConnection._writeBufferFull", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 600 }, { "content": " def registerProducer(self, producer, streaming):\n if self.producer is not None:\n raise RuntimeError(\n \"Cannot register producer %s, \"\n \"because producer %s was never unregistered.\"\n % (producer, self.producer))\n if self.disconnected:\n producer.stopProducing()\n else:\n self.producer = producer\n self.streamingProducer = streaming\n if not streaming and not self._outgoingBytes:\n producer.resumeProducing()", "metadata": "root.PTCPConnection.registerProducer", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 619 }, { "content": " def unregisterProducer(self):\n self.producer = None\n if not self._outgoingBytes:\n self._writeBufferEmpty()", "metadata": "root.PTCPConnection.unregisterProducer", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 633 }, { "content": " def pauseProducing(self):\n self._paused = True", "metadata": "root.PTCPConnection.pauseProducing", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 639 }, { "content": " def resumeProducing(self):\n self._paused = False", "metadata": "root.PTCPConnection.resumeProducing", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 642 }, { "content": " def currentAckNum(self):\n return (self.nextRecvSeqNum + self.peerSendISN) % (2**32)", "metadata": "root.PTCPConnection.currentAckNum", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 645 }, { "content": " def originate(self, data='', syn=False, ack=False, fin=False):\n if syn:\n # We really should be randomizing the ISN but until we finish the\n # implementations of the various bits of wraparound logic that were\n # started with relativeSequence\n assert self.nextSendSeqNum == 0\n assert self.hostSendISN == 0\n p = PTCPPacket.create(self.hostPseudoPort,\n self.peerPseudoPort,\n seqNum=(self.nextSendSeqNum + self.hostSendISN) % (2**32),\n ackNum=self.currentAckNum(),\n data=data,\n window=self.recvWindow,\n syn=syn, ack=ack, fin=fin,\n destination=self.peerAddressTuple)\n # do we want to enqueue this packet for retransmission?\n sl = p.segmentLength()\n self.nextSendSeqNum += sl\n\n if p.mustRetransmit():\n # print self, 'originating retransmittable packet', len(self.retransmissionQueue)\n if self.retransmissionQueue:\n if self.retransmissionQueue[-1].fin:\n raise AssertionError(\"Sending %r after FIN??!\" % (p,))\n # print 'putting it on the queue'\n self.retransmissionQueue.append(p)\n # print 'and sending it later'\n self._retransmitLater()\n if not self.sendWindowRemaining: # len(self.retransmissionQueue) > 5:\n # print 'oh no my queue is too big'\n # This is a random number (5) because I ought to be summing the\n # packet lengths or something.\n self._writeBufferFull()\n else:\n # print 'my queue is still small enough', len(self.retransmissionQueue), self, self.sendWindowRemaining\n pass\n self.ptcp.sendPacket(p)", "metadata": "root.PTCPConnection.originate", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 648 }, { "content": " def transition_SYN_SENT_to_CLOSED(self):\n \"\"\"\n The connection never got anywhere. Goodbye.\n \"\"\"\n # XXX CONNECTOR API OMFG\n self.factory.clientConnectionFailed(None, error.TimeoutError())", "metadata": "root.PTCPConnection.transition_SYN_SENT_to_CLOSED", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 687 }, { "content": " def enter_LISTEN(self):\n # Spec says this is necessary for RST handling; we need it for making\n # sure it's OK to bind port numbers.\n self.wasEverListen = True", "metadata": "root.PTCPConnection.enter_LISTEN", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 697 }, { "content": " def enter_CLOSED(self):\n self.ptcp.connectionClosed(self)\n self._stopRetransmitting()\n if self._timeWaitCall is not None:\n self._timeWaitCall.cancel()\n self._timeWaitCall = None", "metadata": "root.PTCPConnection.enter_CLOSED", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 702 }, { "content": " def enter_TIME_WAIT(self):\n self._stopRetransmitting()\n self._timeWaitCall = reactor.callLater(self._timeWaitTimeout, self._do2mslTimeout)", "metadata": "root.PTCPConnection.enter_TIME_WAIT", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 713 }, { "content": " def _do2mslTimeout(self):\n self._timeWaitCall = None\n self.input(tcpdfa.TIMEOUT)", "metadata": "root.PTCPConnection._do2mslTimeout", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 717 }, { "content": " def transition_LISTEN_to_SYN_SENT(self):\n \"\"\"\n Uh, what? We were listening and we tried to send some bytes.\n This is an error for PTCP.\n \"\"\"\n raise StateError(\"You can't write anything until someone connects to you.\")", "metadata": "root.PTCPConnection.transition_LISTEN_to_SYN_SENT", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 723 }, { "content": " def pseudoPortPair():\n def get(self):\n return (self.hostPseudoPort,\n self.peerPseudoPort)\n return get,", "metadata": "root.PTCPConnection.pseudoPortPair", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 733 }, { "content": " def enter_ESTABLISHED(self):\n \"\"\"\n We sent out SYN, they acknowledged it. Congratulations, you\n have a new baby connection.\n \"\"\"\n assert not self.disconnecting\n assert not self.disconnected\n try:\n p = self.factory.buildProtocol(PTCPAddress(\n self.peerAddressTuple, self.pseudoPortPair))\n p.makeConnection(self)\n except:\n log.msg(\"Exception during PTCP connection setup.\")\n log.err()\n self.loseConnection()\n else:\n self.protocol = p", "metadata": "root.PTCPConnection.enter_ESTABLISHED", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 740 }, { "content": " def exit_ESTABLISHED(self):\n assert not self.disconnected\n self.disconnected = True\n try:\n self.protocol.connectionLost(Failure(CONNECTION_DONE))\n except:\n log.err()\n self.protocol = None\n\n if self.producer is not None:\n try:\n self.producer.stopProducing()\n except:\n log.err()\n self.producer = None", "metadata": "root.PTCPConnection.exit_ESTABLISHED", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 758 }, { "content": " def enter_CLOSE_WAIT(self):\n # Twisted automatically reacts to network half-close by issuing a full\n # close.\n self._closeWaitLoseConnection = reactor.callLater(0.01, self._loseConnectionBecauseOfCloseWait)", "metadata": "root.PTCPConnection.enter_CLOSE_WAIT", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 777 }, { "content": " def _loseConnectionBecauseOfCloseWait(self):\n self._closeWaitLoseConnection = None\n self.loseConnection()", "metadata": "root.PTCPConnection._loseConnectionBecauseOfCloseWait", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 782 }, { "content": " def immediateShutdown(self):\n \"\"\"_IMMEDIATELY_ shut down this connection, sending one (non-retransmitted)\n app-close packet, emptying our buffers, clearing our producer and\n getting ready to die right after this call.\n \"\"\"\n self._outgoingBytes = ''\n if self.state == tcpdfa.ESTABLISHED:\n self.input(tcpdfa.APP_CLOSE)\n self._stopRetransmitting()\n self._reallyRetransmit()\n\n # All states that we can reasonably be in handle a timeout; force our\n # connection to think that it's become desynchronized with the other\n # end so that it will totally shut itself down.\n\n self.input(tcpdfa.TIMEOUT)\n assert self._retransmitter is None\n assert self._nagle is None", "metadata": "root.PTCPConnection.immediateShutdown", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 786 }, { "content": " def output_ACK(self):\n self.originate(ack=True)", "metadata": "root.PTCPConnection.output_ACK", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 805 }, { "content": " def output_FIN(self):\n self.originate(fin=True)", "metadata": "root.PTCPConnection.output_FIN", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 808 }, { "content": " def output_SYN_ACK(self):\n self.originate(syn=True, ack=True)", "metadata": "root.PTCPConnection.output_SYN_ACK", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 811 }, { "content": " def output_SYN(self):\n self.originate(syn=True)", "metadata": "root.PTCPConnection.output_SYN", "header": "['class', 'PTCPConnection', '(', 'tcpdfa', '.', 'TCP', ')', ':', '___EOS___']", "index": 814 }, { "content": "class PTCPAddress(object):\n # garbage\n\n", "metadata": "root.PTCPAddress", "header": "['module', '___EOS___']", "index": 817 }, { "content": " def __init__(self, (host, port), (pseudoHostPort, pseudoPeerPort)):\n self.host = host\n self.port = port\n self.pseudoHostPort = pseudoHostPort\n self.pseudoPeerPort = pseudoPeerPort", "metadata": "root.PTCPAddress.__init__", "header": "['class', 'PTCPAddress', '(', 'object', ')', ':', '___NEWLINE___', '# garbage', '___NL___', '___EOS___']", "index": 820 }, { "content": " def __repr__(self):\n return 'PTCPAddress((%r, %r), (%r, %r))' % (\n self.host, self.port,\n self.pseudoHostPort,\n self.pseudoPeerPort)", "metadata": "root.PTCPAddress.__repr__", "header": "['class', 'PTCPAddress', '(', 'object', ')', ':', '___NEWLINE___', '# garbage', '___NL___', '___EOS___']", "index": 826 }, { "content": "class _PendingEvent(object):\n\n\n\n\n\n", "metadata": "root._PendingEvent", "header": "['module', '___EOS___']", "index": 834 }, { "content": " def __init__(self):\n self.listeners = []", "metadata": "root._PendingEvent.__init__", "header": "['class', '_PendingEvent', '(', 'object', ')', ':', '___EOS___']", "index": 835 }, { "content": " def deferred(self):\n d = Deferred()\n self.listeners.append(d)\n return d", "metadata": "root._PendingEvent.deferred", "header": "['class', '_PendingEvent', '(', 'object', ')', ':', '___EOS___']", "index": 839 }, { "content": " def callback(self, result):\n l = self.listeners\n self.listeners = []\n for d in l:\n d.callback(result)", "metadata": "root._PendingEvent.callback", "header": "['class', '_PendingEvent', '(', 'object', ')', ':', '___EOS___']", "index": 845 }, { "content": " def errback(self, result=None):\n if result is None:\n result = Failure()\n l = self.listeners\n self.listeners = []\n for d in l:\n d.errback(result)", "metadata": "root._PendingEvent.errback", "header": "['class', '_PendingEvent', '(', 'object', ')', ':', '___EOS___']", "index": 852 }, { "content": "class PTCP(protocol.DatagramProtocol):\n \"\"\"\n L{PTCP} implements a strongly TCP-like protocol on top of UDP. It\n provides a transport which is connection-oriented, streaming,\n ordered, and reliable.\n\n @ivar factory: A L{ServerFactory} which is used to create\n L{IProtocol} providers whenever a new PTCP connection is made\n to this port.\n\n @ivar _connections: A mapping of endpoint addresses to connection\n objects. These are the active connections being multiplexed\n over this UDP port. Many PTCP connections may run over the\n same L{PTCP} instance, communicating with many different\n remote hosts as well as multiplexing different PTCP\n connections to the same remote host. The mapping keys,\n endpoint addresses, are three-tuples of:\n\n - The destination pseudo-port which is always C{1}\n - The source pseudo-port\n - A (host, port) tuple giving the UDP address of a PTCP\n peer holding the other side of the connection\n\n The mapping values, connection objects, are L{PTCPConnection}\n instances.\n @type _connections: C{dict}\n\n \"\"\"\n # External API\n\n\n\n\n\n\n # Internal stuff\n\n\n\n\n\n stopped = False\n\n\n", "metadata": "root.PTCP", "header": "['module', '___EOS___']", "index": 862 }, { "content": " def __init__(self, factory):\n self.factory = factory\n self._allConnectionsClosed = _PendingEvent()", "metadata": "root.PTCP.__init__", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 892 }, { "content": " def connect(self, factory, host, port, pseudoPort=1):\n \"\"\"\n Attempt to establish a new connection via PTCP to the given\n remote address.\n\n @param factory: A L{ClientFactory} which will be used to\n create an L{IProtocol} provider if the connection is\n successfully set up, or which will have failure callbacks\n invoked on it otherwise.\n\n @param host: The IP address of another listening PTCP port to\n connect to.\n @type host: C{str}\n\n @param port: The port number of that other listening PTCP port\n to connect to.\n @type port: C{int}\n\n @param pseudoPort: Not really implemented. Do not pass a\n value for this parameter or things will break.\n\n @return: A L{PTCPConnection} instance representing the new\n connection, but you really shouldn't use this for\n anything. Write a protocol!\n \"\"\"\n sourcePseudoPort = genConnID() % MAX_PSEUDO_PORT\n conn = self._connections[(pseudoPort, sourcePseudoPort, (host, port))\n ] = PTCPConnection(\n sourcePseudoPort, pseudoPort, self, factory, (host, port))\n conn.input(tcpdfa.APP_ACTIVE_OPEN)\n return conn", "metadata": "root.PTCP.connect", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 897 }, { "content": " def sendPacket(self, packet):\n if self.transportGoneAway:\n return\n self.transport.write(packet.encode(), packet.destination)", "metadata": "root.PTCP.sendPacket", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 929 }, { "content": " def startProtocol(self):\n self.transportGoneAway = False\n self._lastConnID = 10 # random.randrange(2 ** 32)\n self._connections = {}", "metadata": "root.PTCP.startProtocol", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 936 }, { "content": " def _finalCleanup(self):\n \"\"\"\n Clean up all of our connections by issuing application-level close and\n stop notifications, sending hail-mary final FIN packets (which may not\n reach the other end, but nevertheless can be useful) when possible.\n \"\"\"\n for conn in self._connections.values():\n conn.immediateShutdown()\n assert not self._connections", "metadata": "root.PTCP._finalCleanup", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 941 }, { "content": " def stopProtocol(self):\n \"\"\"\n Notification from twisted that our underlying port has gone away;\n make sure we're not going to try to send any packets through our\n transport and blow up, then shut down all of our protocols, issuing\n appr\n opriate application-level messages.\n \"\"\"\n self.transportGoneAway = True\n self._finalCleanup()", "metadata": "root.PTCP.stopProtocol", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 951 }, { "content": " def cleanupAndClose(self):\n \"\"\"\n Clean up all remaining connections, then close our transport.\n\n Although in a pinch we will do cleanup after our socket has gone away\n (if it does so unexpectedly, above in stopProtocol), we would really\n prefer to do cleanup while we still have access to a transport, since\n that way we can force out a few final packets and save the remote\n application an awkward timeout (if it happens to get through, which\n is generally likely).\n \"\"\"\n self._finalCleanup()\n return self._stop()", "metadata": "root.PTCP.cleanupAndClose", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 962 }, { "content": " def datagramReceived(self, bytes, addr):\n if len(bytes) < _fixedSize:\n # It can't be any good.\n return\n\n pkt = PTCPPacket.decode(bytes, addr)\n try:\n pkt.verifyChecksum()\n except TruncatedDataError:\n# print '(ptcp packet truncated: %r)' % (pkt,)\n self.sendPacket(\n PTCPPacket.create(\n pkt.destPseudoPort,\n pkt.sourcePseudoPort,\n 0,\n 0,\n struct.pack('!H', len(pkt.data)),\n stb=True,\n destination=addr))\n except GarbageDataError:\n print \"garbage data!\", pkt\n except ChecksumMismatchError, cme:\n print \"bad checksum\", pkt, cme\n print repr(pkt.data)\n print hex(pkt.checksum), hex(pkt.computeChecksum())\n else:\n self.packetReceived(pkt)", "metadata": "root.PTCP.datagramReceived", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 976 }, { "content": " def _stop(self, result=None):\n if not self.stopped:\n self.stopped = True\n return self.transport.stopListening()\n else:\n return defer.succeed(None)", "metadata": "root.PTCP._stop", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 1005 }, { "content": " def waitForAllConnectionsToClose(self):\n \"\"\"\n Wait for all currently-open connections to enter the 'CLOSED' state.\n Currently this is only usable from test fixtures.\n \"\"\"\n if not self._connections:\n return self._stop()\n return self._allConnectionsClosed.deferred().addBoth(self._stop)", "metadata": "root.PTCP.waitForAllConnectionsToClose", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 1012 }, { "content": " def connectionClosed(self, ptcpConn):\n packey = (ptcpConn.peerPseudoPort, ptcpConn.hostPseudoPort,\n ptcpConn.peerAddressTuple)\n del self._connections[packey]\n if ((not self.transportGoneAway) and\n (not self._connections) and\n self.factory is None):\n self._stop()\n if not self._connections:\n self._allConnectionsClosed.callback(None)", "metadata": "root.PTCP.connectionClosed", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 1021 }, { "content": " def packetReceived(self, packet):\n packey = (packet.sourcePseudoPort, packet.destPseudoPort, packet.peerAddressTuple)\n if packey not in self._connections:\n if packet.flags == _SYN and packet.destPseudoPort == 1: # SYN and _ONLY_ SYN set.\n conn = PTCPConnection(packet.destPseudoPort,\n packet.sourcePseudoPort, self,\n self.factory, packet.peerAddressTuple)\n conn.input(tcpdfa.APP_PASSIVE_OPEN)\n self._connections[packey] = conn\n else:\n log.msg(\"corrupted packet? %r %r %r\" % (packet,packey, self._connections))\n return\n try:\n self._connections[packey].packetReceived(packet)\n except:\n log.msg(\"PTCPConnection error on %r:\" % (packet,))\n log.err()\n del self._connections[packey]", "metadata": "root.PTCP.packetReceived", "header": "['class', 'PTCP', '(', 'protocol', '.', 'DatagramProtocol', ')', ':', '___EOS___']", "index": 1032 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "test", "-", "case", "-", "name", ":", " ", "vertex", ".", "test", ".", "test\\u", "pt", "cp", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "binascii_", "import_", "crc", "32_", "#", " ", "used", " ", "to", " ", "use", " ", "zli", "b", ".", "crc", "32", " ", "-", " ", "but", " ", "tha", "t", " ", "give", "s", " ", "different", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "results", " ", "on", " ", "64", "-", "bit", " ", "platform", "s", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "failure_", "import_", "Failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "defer_", "import_", "Deferred_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "protocol_", ",_", "error_", ",_", "reactor_", ",_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "main_", "import_", "CONNECTION", "\\u", "DONE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "log_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vertex_", "import_", "tcp", "dfa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vertex_", "._", "statem", "achi", "ne_", "import_", "State", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gen", "Con", "n", "ID_", "=_", "itertools_", "._", "count_", "(_", "8_", ")_", "._", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "PSE", "UD", "O", "\\u", "PORT_", "=_", "(_", "2_", "**_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "packet", "Format_", "=_", "(_", "'!'_", "#", " ", "WT", "F", " ", "did", " ", "you", " ", "think", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "H", "'_", "#", " ", "source", "Pse", "udo", "Port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "H", "'_", "#", " ", "dest", "Pse", "udo", "Port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "L", "'_", "#", " ", "sequence", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "'", "L", "'_", "#", " ", "acknowledge", "ment", "Number_", "\\u\\u\\uNL\\u\\u\\u_", "'", "L", "'_", "#", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "'", "B", "'_", "#", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "'", "l", "'_", "#", " ", "checksum_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "sign", "ed", " ", "bec", "aus", "e", " ", "of", " ", "bin", "ascii", ".", "crc", "32", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'", "H", "'_", "#", " ", "dle", "n_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fixed", "Size_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "packet", "Format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "SYN", "_", ",_", "\\u", "ACK_", ",_", "\\u", "FIN", "_", ",_", "\\u", "RST", "_", ",_", "\\u", "ST", "B_", "=_", "[_", "1_", "<<_", "n_", "for_", "n_", "in_", "range_", "(_", "5_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "flag", "prop_", "(_", "flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setter_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flags_", "|=_", "flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flags_", "&=_", "~_", "flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "property_", "(_", "lambda_", "self_", ":_", "bool_", "(_", "self_", "._", "flags_", "&_", "flag_", ")_", ",_", "setter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relative", "Sequence_", "(_", "wire", "Sequence_", ",_", "initial", "Sequence_", ",_", "lap", "Number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Compute", " ", "a", " ", "relative", " ", "sequence", " ", "number", " ", "from", " ", "a", " ", "wire", " ", "sequence", " ", "number", " ", "so", " ", "tha", "t", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "use", " ", "natur", "al", " ", "Pyth", "on", " ", "comparisons", " ", "on", " ", "it", ",", " ", "suc", "h", " ", "as", " ", "<", ",", " ", ">", ",", " ", "==", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "wire", "Sequ", "ence", ":", " ", "the", " ", "sequence", " ", "number", " ", "receive", "d", " ", "on", " ", "the", " ", "wire", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "initial", "Sequ", "ence", ":", " ", "the", " ", "IS", "N", " ", "for", " ", "this", " ", "sequence", ",", " ", "negotiat", "ed", " ", "at", " ", "SYN", " ", "time", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "lap", "Number", ":", " ", "the", " ", "number", " ", "of", " ", "times", " ", "tha", "t", " ", "this", " ", "value", " ", "has", " ", "wrapp", "ed", " ", "aro", "und", "\\", "10", ";", " ", " ", " ", " ", "2", "**", "32.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "wire", "Sequence_", "+_", "(_", "lap", "Number_", "*_", "(_", "2_", "**_", "32_", ")_", ")_", ")_", "-_", "initial", "Sequence_", "\\u\\u\\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_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "Attributes_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "source", "Pse", "udo", "Port", "'_", ",_", "'", "source", "Pse", "udo", "Port", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dest", "Pse", "udo", "Port", "'_", ",_", "'", "dest", "Pse", "udo", "Port", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "short", "data", "'_", ",_", "'", "data", "'_", ",_", "'%", "r", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "nice", "flags", "'_", ",_", "'", "flags", "'_", ",_", "'%", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dle", "n", "'_", ",_", "'", "dle", "n", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "seq", "Num", "'_", ",_", "'", "seq", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "ack", "Num", "'_", ",_", "'", "ack", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "checks", "um", "'_", ",_", "'", "checks", "um", "'_", ",_", "'%", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "peer", "Address", "Tup", "le", "'_", ",_", "'", "peer", "Address", "'_", ",_", "'%", "r", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "retra", "nsm", "it", "Count", "'_", ",_", "'", "retra", "nsm", "it", "Count", "'_", ",_", "'%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "syn_", "=_", "\\u", "flag", "prop_", "(_", "\\u", "SYN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ack_", "=_", "\\u", "flag", "prop_", "(_", "\\u", "ACK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fin_", "=_", "\\u", "flag", "prop_", "(_", "\\u", "FIN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst_", "=_", "\\u", "flag", "prop_", "(_", "\\u", "RST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stb", "_", "=_", "\\u", "flag", "prop_", "(_", "\\u", "ST", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", " ", "of", " ", "retra", "nsm", "it", " ", "atte", "mpt", "s", " ", "left", " ", "for", " ", "this", " ", "segment", ".", " ", " ", "Whe", "n", " ", "it", " ", "reache", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "zero", ",", " ", "this", " ", "segment", " ", "is", " ", "dead", "._", "\\u\\u\\uNL\\u\\u\\u_", "retra", "nsm", "it", "Count_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "short", "data_", "=_", "property_", "(_", "*_", "short", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nice", "flags_", "=_", "property_", "(_", "*_", "nice", "flags_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "classmethod_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "classmethod_", "(_", "decode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "short", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "data_", ")_", ">_", "13_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "[_", ":_", "5_", "]_", "+_", "'...'_", "+_", "self_", "._", "data_", "[_", "-_", "5_", ":_", "]_", "\\u\\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_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "nice", "flags_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "f_", ",_", "v_", ")_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "syn_", ",_", "'", "S", "'_", ")_", ",_", "(_", "self_", "._", "ack_", ",_", "'", "A", "'_", ")_", ",_", "(_", "self_", "._", "fin_", ",_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "rst_", ",_", "'", "R", "'_", ")_", ",_", "(_", "self_", "._", "stb", "_", ",_", "'", "T", "'_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "f_", "and_", "v_", "or_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Pse", "udo", "Port_", ",_", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "Num_", ",_", "ack", "Num_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "window_", "=_", "(_", "1_", "<<_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syn_", "=_", "False_", ",_", "ack_", "=_", "False_", ",_", "fin_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rst_", "=_", "False_", ",_", "stb", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "cls_", "(_", "source", "Pse", "udo", "Port_", ",_", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "Num_", ",_", "ack", "Num_", ",_", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "len_", "(_", "data_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "syn_", "=_", "syn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "ack_", "=_", "ack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "fin_", "=_", "fin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "rst_", "=_", "rst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "stb", "_", "=_", "stb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "checksum_", "=_", "i_", "._", "compute", "Checksum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "destination_", "=_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "Num_", ",_", "ack", "Num_", ",_", "window_", ",_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "checksum_", ",_", "dle", "n_", ",_", "data_", ",_", "peer", "Address", "Tuple_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "Offset_", "=_", "0_", ",_", "ack", "Offset_", "=_", "0_", ",_", "seq", "Lap", "s_", "=_", "0_", ",_", "ack", "Lap", "s_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source", "Pse", "udo", "Port_", "=_", "source", "Pse", "udo", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dest", "Pse", "udo", "Port_", "=_", "dest", "Pse", "udo", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seq", "Num_", "=_", "seq", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ack", "Num_", "=_", "ack", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "=_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "=_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "checksum_", "=_", "checksum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dle", "n_", "=_", "dle", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Address", "Tuple_", "=_", "peer", "Address", "Tuple_", "#", " ", "Non", "e", " ", "if", " ", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seq", "Offset_", "=_", "seq", "Offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ack", "Offset_", "=_", "ack", "Offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seq", "Lap", "s_", "=_", "seq", "Lap", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ack", "Lap", "s_", "=_", "ack", "Lap", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "RF", "C", " ", "page", " ", "2", "6", ":", " ", "'", "The", " ", "segment", " ", "length", " ", "(", "SEG", ".", "LEN", ")", " ", "include", "s", " ", "bot", "h", " ", "data", " ", "and", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "space", " ", "occu", "pyi", "ng", " ", "controls", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "dle", "n_", "+_", "self_", "._", "syn_", "+_", "self_", "._", "fin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relative", "Seq_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "relative", "Sequence_", "(_", "self_", "._", "seq", "Num_", ",_", "self_", "._", "seq", "Offset_", ",_", "self_", "._", "seq", "Lap", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relative", "Ack", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "relative", "Sequence_", "(_", "self_", "._", "ack", "Num_", ",_", "self_", "._", "ack", "Offset_", ",_", "self_", "._", "ack", "Lap", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "Checksum", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "data_", ")_", "!=_", "self_", "._", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "data_", ")_", ">_", "self_", "._", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Gar", "bage", "Data", "Error_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Truncate", "d", "Data", "Error_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected_", "=_", "self_", "._", "compute", "Checksum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "received_", "=_", "self_", "._", "checksum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expected_", "!=_", "received_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Checksum", "Mismatch", "Error_", "(_", "expected_", ",_", "received_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "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_", "compute", "Checksum", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crc", "32_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "cls_", ",_", "bytes_", ",_", "host", "Port", "Pair_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "struct_", "._", "unpack_", "(_", "\\u", "packet", "Format_", ",_", "bytes_", "[_", ":_", "\\u", "fixed", "Size_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Pse", "udo", "Port_", ",_", "dest", "Pse", "udo", "Port_", ",_", "seq_", ",_", "ack_", ",_", "window_", ",_", "flags_", ",_", "checksum_", ",_", "dle", "n_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "bytes_", "[_", "\\u", "fixed", "Size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkt_", "=_", "cls_", "(_", "source", "Pse", "udo", "Port_", ",_", "dest", "Pse", "udo", "Port_", ",_", "seq_", ",_", "ack_", ",_", "window_", ",_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "checksum_", ",_", "dle", "n_", ",_", "data_", ",_", "host", "Port", "Pair_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pkt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "must", "Retr", "ans", "mit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "packet", " ", "must", " ", "be", " ", "retra", "nsm", "itte", "d", " ", "unti", "l", " ", "it", " ", "was", " ", "receive", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "syn_", "or_", "self_", "._", "fin_", "or_", "self_", "._", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dle", "n_", "=_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checksum_", "=_", "self_", "._", "compute", "Checksum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "packet", "Format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "Pse", "udo", "Port_", ",_", "self_", "._", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seq", "Num_", ",_", "self_", "._", "ack", "Num_", ",_", "self_", "._", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "flags_", ",_", "checksum_", ",_", "dle", "n_", ")_", "+_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CPP", "acke", "t_", "(_", "util_", "._", "Fan", "cy", "Str", "Mixin_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fragment_", "(_", "self_", ",_", "mtu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "dle", "n_", "<_", "mtu_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "self_", "._", "syn_", ",_", "\"", "shou", "ld", " ", "not", " ", "be", " ", "originat", "ing", " ", "syn", " ", "packet", "s", " ", "w", "/", " ", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "Off", "t_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "TOD", "O", ":", " ", "need", " ", "to", " ", "take", " ", "seq", "Lap", "s", " ", "int", "o", " ", "account", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "chunk_", "in_", "iter", "chunks_", "(_", "self_", "._", "data_", ",_", "mtu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last_", "=_", "self_", "._", "create_", "(_", "self_", "._", "source", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seq", "Num_", "+_", "seq", "Off", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ack", "Num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", "=_", "self_", "._", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ack_", "=_", "self_", "._", "ack_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "._", "append_", "(_", "last_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "Off", "t_", "+=_", "len_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "fin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last_", "._", "fin_", "=_", "self_", "._", "fin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "._", "checksum_", "=_", "last_", "._", "compute", "Checksum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iter", "chunks_", "(_", "data_", ",_", "chunksize_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "iterate", " ", "chunks", " ", "of", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "off", "t_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "off", "t_", "<_", "len_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "data_", "[_", "off", "t_", ":_", "off", "t_", "+_", "chunksize_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "off", "t_", "+=_", "chunksize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "IS", "N_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "Sequ", "ence", " ", "Number", " ", "generat", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "int", "((", "time", ".", "time", "()", " ", "*", " ", "1000000", ")", " ", "/", " ", "4", ")", " ", "%", " ", "2", "**", "32_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Accepta", "ble_", "(_", "RC", "V", "\\u", "NX", "T_", ",_", "RC", "V", "\\u", "WN", "D_", ",_", "SEG", "\\u", "SEQ", "_", ",_", "SEG", "\\u", "LEN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "RF", "C", " ", "page", " ", "26.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "SEG", "\\u", "LEN_", "==_", "0_", "and_", "RC", "V", "\\u", "WN", "D_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SEG", "\\u", "SEQ", "_", "==_", "RC", "V", "\\u", "NX", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "SEG", "\\u", "LEN_", "==_", "0_", "and_", "RC", "V", "\\u", "WN", "D_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "RC", "V", "\\u", "NX", "T_", "<=_", "SEG", "\\u", "SEQ", "_", ")_", "and_", "(_", "SEG", "\\u", "SEQ", "_", "<_", "RC", "V", "\\u", "NX", "T_", "+_", "RC", "V", "\\u", "WN", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "SEG", "\\u", "LEN_", ">_", "0_", "and_", "RC", "V", "\\u", "WN", "D_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "SEG", "\\u", "LEN_", ">_", "0_", "and_", "RC", "V", "\\u", "WN", "D_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "(_", "RC", "V", "\\u", "NX", "T_", "<=_", "SEG", "\\u", "SEQ", "_", ")_", "and_", "(_", "SEG", "\\u", "SEQ", "_", "<_", "RC", "V", "\\u", "NX", "T_", "+_", "RC", "V", "\\u", "WN", "D_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "(_", "RC", "V", "\\u", "NX", "T_", "<=_", "SEG", "\\u", "SEQ", "_", "+_", "SEG", "\\u", "LEN_", "-_", "1_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SEG", "\\u", "SEQ", "_", "+_", "SEG", "\\u", "LEN_", "-_", "1_", "<_", "RC", "V", "\\u", "NX", "T_", "+_", "RC", "V", "\\u", "WN", "D_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "0_", ",_", "'", "Sho", "ul", "d", " ", "be", " ", "impossible", " ", "to", " ", "get", " ", "here", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ba", "d", "Packe", "t", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "packet", " ", "was", " ", "bad", " ", "for", " ", "some", " ", "reason", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Checksum", "Mismatch", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "checks", "um", " ", "and", " ", "data", " ", "receive", "d", " ", "did", " ", "not", " ", "match", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Truncate", "d", "Data", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "packet", " ", "was", " ", "truncat", "ed", " ", "in", " ", "transit", ",", " ", "and", " ", "all", " ", "of", " ", "the", " ", "data", " ", "did", " ", "not", " ", "arrive", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gar", "bage", "Data", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Too", " ", "muc", "h", " ", "data", " ", "was", " ", "receive", "d", " ", "(?", "??", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Implementation", " ", "of", " ", "RF", "C", " ", "793", " ", "state", " ", "machine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "oldest", "Una", "cked", "Sen", "d", "Seq", "Num", ":", " ", "(", "TC", "P", " ", "RF", "C", ":", " ", "SN", "D", ".", "UNA", ")", " ", "The", " ", "oldest", " ", "(", "relative", ")", "\\", "10", ";", " ", " ", " ", " ", "sequence", " ", "number", " ", "refer", "ring", " ", "to", " ", "an", " ", "oct", "et", " ", "whi", "ch", " ", "we", " ", "have", " ", "sent", " ", "or", " ", "may", " ", "send", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "una", "ck", "nowl", "edge", "d", ".", " ", " ", "Thi", "s", " ", "begins", " ", "at", " ", "0", ",", " ", "whi", "ch", " ", "is", " ", "special", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "an", " ", "oct", "et", ",", " ", "but", " ", "rat", "her", " ", "for", " ", "the", " ", "initial", " ", "SYN", " ", "packet", ".", " ", " ", "Un", "less", " ", "it", " ", "is", " ", "0", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "represent", "s", " ", "the", " ", "sequence", " ", "number", " ", "of", " ", "self", ".\\u", "outgoing", "Byte", "s", "[", "0", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "next", "Sen", "d", "Seq", "Num", ":", " ", "(", "TC", "P", " ", "RF", "C", ":", " ", "SN", "D", ".", "NX", "T", ")", " ", "The", " ", "next", " ", "(", "relative", ")", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "tha", "t", " ", "we", " ", "will", " ", "send", " ", "to", " ", "our", " ", "peer", " ", "after", " ", "the", " ", "current", " ", "buffered", " ", "segments", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "all", " ", "bee", "n", " ", "acknowledge", "d", ".", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "sequence", " ", "number", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "not", "-", "ye", "t", "-", "ext", "ant", " ", "oct", "et", " ", "in", " ", "the", " ", "stream", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "self", ".\\u", "outgoing", "Byte", "s", "[", "len", "(", "self", ".\\u", "outgoing", "Byte", "s", ")]", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "next", "Rec", "v", "Seq", "Num", ":", " ", "(", "TC", "P", " ", "RF", "C", ":", " ", "RC", "V", ".", "NX", "T", ")", " ", "The", " ", "next", " ", "(", "relative", ")", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "tha", "t", " ", "the", " ", "peer", " ", "shou", "ld", " ", "send", " ", "to", " ", "us", " ", "if", " ", "the", "y", " ", "want", " ", "to", " ", "send", " ", "more", " ", "data", ";", "\\", "10", ";", " ", " ", " ", " ", "thei", "r", " ", "first", " ", "una", "ck", "nowl", "edge", "d", " ", "sequence", " ", "number", " ", "as", " ", "far", " ", "as", " ", "we", " ", "are", " ", "concern", "ed", ";", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "left", " ", "or", " ", "lower", " ", "edge", " ", "of", " ", "the", " ", "receive", " ", "window", ";", " ", "the", " ", "sequence", " ", "number", " ", "of", " ", "the", " ", "first", "\\", "10", ";", " ", " ", " ", " ", "oct", "et", " ", "tha", "t", " ", "has", " ", "not", " ", "bee", "n", " ", "deliver", "ed", " ", "to", " ", "the", " ", "applica", "tion", ".", " ", " ", "change", "d", " ", "whe", "neve", "r", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "receive", " ", "an", " ", "appropr", "iate", " ", "AC", "K", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "peer", "Sen", "d", "IS", "N", ":", " ", "the", " ", "initial", " ", "sequence", " ", "number", " ", "tha", "t", " ", "the", " ", "peer", " ", "sent", " ", "us", " ", "dur", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "negotiat", "ion", " ", "phase", ".", " ", " ", "All", " ", "peer", "-", "relative", " ", "sequence", " ", "numbers", " ", "are", " ", "compute", "d", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "this", ".", " ", " ", "(", "see", " ", "C", "{", "relative", "Sequ", "ence", "}).", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "host", "Sen", "d", "IS", "N", ":", " ", "the", " ", "initial", " ", "sequence", " ", "number", " ", "tha", "t", " ", "the", " ", "we", " ", "sent", " ", "dur", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "negotiat", "ion", " ", "phase", ".", " ", " ", "All", " ", "host", "-", "relative", " ", "sequence", " ", "numbers", " ", "are", " ", "compute", "d", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "this", ".", " ", " ", "(", "see", " ", "C", "{", "relative", "Sequ", "ence", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "retra", "nsm", "ission", "Queue", ":", " ", "a", " ", "list", " ", "of", " ", "packet", "s", " ", "to", " ", "be", " ", "re", "-", "sent", " ", "unti", "l", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "acknowledge", "ment", "s", " ", "come", " ", "through", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "recv", "Window", ":", " ", "(", "TC", "P", " ", "RF", "C", ":", " ", "RC", "V", ".", "WN", "D", ")", " ", "-", " ", "the", " ", "size", " ", "[", "in", " ", "octets", "]", " ", "of", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", " ", "window", " ", "allow", "ed", " ", "by", " ", "this", " ", "host", ",", " ", "to", " ", "be", " ", "in", " ", "transit", " ", "from", " ", "the", " ", "other", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "send", "Window", ":", " ", "(", "TC", "P", " ", "RF", "C", ":", " ", "SN", "D", ".", "WN", "D", ")", " ", "-", " ", "the", " ", "size", " ", "[", "in", " ", "octets", "]", " ", "of", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", " ", "window", " ", "allow", "ed", " ", "by", " ", "our", " ", "peer", ",", " ", "to", " ", "be", " ", "in", " ", "transit", " ", "from", " ", "us", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mtu_", "=_", "512_", "-_", "\\u", "fixed", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recv", "Window_", "=_", "mtu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "Window_", "=_", "mtu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "Window", "Rema", "inin", "g_", "=_", "mtu_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "protocol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "peer", "Sen", "d", "IS", "N_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "outgoing", "Bytes_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "nag", "le_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u", "retra", "nsm", "itte", "r_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "retra", "nsm", "it", "Timeout_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "discon", "necti", "ng_", "=_", "False_", "#", " ", "Thi", "s", " ", "is", " ", "*", "TW", "ISTE", "D", "*", " ", "level", " ", "state", "-", "machine", " ", "stu", "ff", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "TC", "P", "-", "level", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "disconnected", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "producer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "producer", "Pause", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "ing", "Producer_", "=_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "paused_", "=_", "False_", "\\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_", "#", " ", "State", " ", "machine", " ", "transiti", "on", " ", "definit", "ion", "s", ",", " ", "hoo", "ray", "._", "\\u\\u\\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_", "was", "Eve", "r", "Listen", "_", "=_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "time", "Wait", "Call_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "time", "Wait", "Timeout_", "=_", "0.01_", "#", " ", "REAL", "LY", " ", "fast", " ", "timeo", "ut", ",", " ", "right", " ", "now", " ", "this", " ", "is", " ", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "tests", "..._", "\\u\\u\\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_", "peer", "Address", "Tuple_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "invalid", "Inp", "ut", "(", "self", ",", " ", "dat", "um", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "self", ",", " ", "self", ".", "protoc", "ol", ",", " ", "'", "invalid", " ", "input", "',", " ", "datum_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pseudo", "Port", "Pair_", "=_", "property_", "(_", "*_", "pseudo", "Port", "Pair_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "close", "Wait", "Lo", "se", "Connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "Pse", "udo", "Port_", ",_", "peer", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "cp_", ",_", "factory_", ",_", "peer", "Address", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tcp", "dfa", "_", "._", "TCP_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host", "Pse", "udo", "Port_", "=_", "host", "Pse", "udo", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Pse", "udo", "Port_", "=_", "peer", "Pse", "udo", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pt", "cp_", "=_", "pt", "cp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "=_", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "receive", "Buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "retra", "nsm", "ission", "Queue_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Address", "Tuple_", "=_", "peer", "Address", "Tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "oldest", "Una", "cked", "Sen", "d", "Seq", "Num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "Sen", "d", "Seq", "Num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host", "Sen", "d", "IS", "N_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Sen", "d", "IS", "N_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Peer", "IS", "N_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "packet", "Received_", "(_", "self_", ",_", "packet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "TOD", "O", ":", " ", "probab", "ly", " ", "have", " ", "to", " ", "do", " ", "somet", "hing", " ", "to", " ", "the", " ", "packet", " ", "here", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "identify", " ", "its", " ", "relative", " ", "sequence", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "receive", "d", "',", " ", "self", ",", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "packet_", "._", "stb", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sh", "rin", "k", " ", "the", " ", "MT", "U_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "self_", "._", "mtu_", "]_", "=_", "struct_", "._", "unpack_", "(_", "'!", "H", "'_", ",_", "packet_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pkt_", "in_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq_", "._", "extend_", "(_", "pkt_", "._", "fragment_", "(_", "self_", "._", "mtu_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "retra", "nsm", "ission", "Queue_", "=_", "rq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "paused_", ":_", "\\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_", "generat", "ed", "State", "Machine", "Input_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "packet_", "._", "syn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "packet_", "._", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Who", "ops", ",", " ", "what", "?", " ", " ", "SYN", "s", " ", "probab", "ly", " ", "can", " ", "contain", " ", "data", ",", " ", "I", " ", "think", ",", " ", "but", " ", "I_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cert", "ain", "ly", " ", "don", "'", "t", " ", "see", " ", "anyt", "hing", " ", "in", " ", "the", " ", "spec", " ", "abo", "ut", " ", "how", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "this", " ", "or", " ", "in", " ", "ether", "eal", " ", "for", " ", "how", " ", "linux", " ", "deal", "s", " ", "with", " ", "it", " ", "-", "glyph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Packe", "t", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "currentl", "y", " ", "no", " ", "data", " ", "allow", "ed", " ", "in", " ", "SYN", " ", "packet", "s", ":", " ", "%", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "packet_", ",_", ")_", ")_", "\\u\\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_", "packet_", "._", "segment", "Length_", "(_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "peer", "Address", "Tuple_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "a", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "was", "Eve", "r", "Listen", "_", ",_", "\"", "Client", "s", " ", "must", " ", "speci", "fy", " ", "a", " ", "connect", " ", "address", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Address", "Tuple_", "=_", "packet_", "._", "peer", "Address", "Tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "a", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "peer", "Address", "Tuple_", "==_", "packet_", "._", "peer", "Address", "Tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "set", "Peer", "IS", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "peer", "Sen", "d", "IS", "N_", "!=_", "packet_", "._", "seq", "Num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Ba", "d", "Packe", "t", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Peer", " ", "IS", "N", " ", "was", " ", "alr", "ead", "y", " ", "set", " ", "to", " ", "%", "s", " ", "but", " ", "inco", "ming", " ", "packet", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trie", "d", " ", "to", " ", "set", " ", "it", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "peer", "Sen", "d", "IS", "N_", ",_", "packet_", "._", "seq", "Num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "our", " ", "retra", "nsm", "ission", "Queue", " ", "is", " ", "hot", ",", " ", "we", " ", "are", " ", "goi", "ng", " ", "to", " ", "send_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "them", " ", "an", " ", "AC", "K", " ", "to", " ", "this", " ", "with", " ", "the", " ", "next", " ", "packet", " ", "we", " ", "send", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyway", ";", " ", "as", " ", "a", " ", "bonus", ",", " ", "this", " ", "will", " ", "proper", "ly", " ", "dete", "rmin", "e", " ", "whe", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "sendin", "g", " ", "a", " ", "SYN", "+", "AC", "K", " ", "or", " ", "mer", "el", "y", " ", "an", " ", "AC", "K", ";", " ", "the", " ", "only", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "send", " ", "an", " ", "AC", "K", " ", "is", " ", "whe", "n", " ", "we", " ", "have", " ", "not", "hing", " ", "to", " ", "say", " ", "to", " ", "them", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", "'", "re", " ", "block", "ed", " ", "on", " ", "getti", "ng", " ", "a", " ", "response", " ", "to", " ", "thei", "r", " ", "SYN", "+", "ACK_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "us", ".", " ", "-", "glyph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "originat", "e_", "(_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set", "Peer", "IS", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer", "Sen", "d", "IS", "N_", "=_", "packet_", "._", "seq", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "syn", ",", " ", "fin", ",", " ", "and", " ", "data", " ", "are", " ", "mutual", "ly", " ", "exclu", "sive", ",", " ", "so", " ", "this", " ", "relative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sequence", "-", "number", " ", "increment", " ", "is", " ", "don", "e", " ", "bot", "h", " ", "here", ",", " ", "and", " ", "belo", "w", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", "/", "fin", " ", "process", "ing", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", "+=_", "packet_", "._", "segment", "Length_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "packet_", "._", "ack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generat", "ed", "State", "Machine", "Input_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "SYN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SEG", "\\u", "ACK_", "=_", "packet_", "._", "relative", "Ack", "_", "(_", ")_", "#", " ", "alias", "ing", " ", "this", " ", "for", " ", "easi", "er", " ", "readi", "ng", " ", "w", "/_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "RF", "C_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "packet_", "._", "ack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "oldest", "Una", "cked", "Sen", "d", "Seq", "Num_", "<_", "SEG", "\\u", "ACK_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "SEG", "\\u", "ACK_", "<=_", "self_", "._", "next", "Sen", "d", "Seq", "Num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Acco", "rdin", "g", " ", "to", " ", "the", " ", "spec", ",", " ", "an", " ", "'", "acceptabl", "e", " ", "ack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq_", "=_", "self_", "._", "retra", "nsm", "ission", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "rq_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "segment", "On", "Queue_", "=_", "rq_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Seg", "Seq_", "=_", "segment", "On", "Queue_", "._", "relative", "Seq_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q", "Seg", "Seq_", "+_", "segment", "On", "Queue_", "._", "segment", "Length_", "(_", ")_", "<=_", "SEG", "\\u", "ACK_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "full", "y", " ", "acknowledge", "d", ",", " ", "as", " ", "per", " ", "RF", "C", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rq_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "smi", "nput", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Window", "Rema", "inin", "g_", "+=_", "segment", "On", "Queue_", "._", "segment", "Length_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "inc", " ", "send", " ", "window", "',", " ", "self", ",", " ", "self", ".", "send", "Window", "Rema", "inin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "segment", "On", "Queue_", "._", "syn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "packet_", "._", "syn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "smi", "nput", "_", "=_", "tcp", "dfa", "_", "._", "SYN", "\\u", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "smi", "nput", "_", "=_", "tcp", "dfa", "_", "._", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "segment", "On", "Queue_", "._", "fin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "smi", "nput", "_", "=_", "tcp", "dfa", "_", "._", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "smi", "nput", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "ack", " ", "input", ":'", ",", " ", "segment", "On", "Queue", ",", " ", "packet", ",", " ", "smi", "nput", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "generat", "ed", "State", "Machine", "Input_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "input_", "(_", "smi", "nput", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "write", " ", "buffer", " ", "is", " ", "empty", ";", " ", "alert", " ", "the", " ", "applica", "tion", " ", "layer", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "write", "Buffer", "Empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "oldest", "Una", "cked", "Sen", "d", "Seq", "Num_", "=_", "SEG", "\\u", "ACK_", "\\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_", "packet_", "._", "syn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "generat", "ed", "State", "Machine", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "TOD", "O", ":", " ", "examine", " ", "'", "window", "'", " ", "field", " ", "and", " ", "adjust", " ", "send", "Window", "Rema", "inin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "it", " ", "'", "occu", "pyi", "ng", " ", "a", " ", "porti", "on", " ", "of", " ", "valid", " ", "receive", " ", "sequence", " ", "space", "'?", " ", " ", "I", " ", "think", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "means", " ", "'", "packet", " ", "whi", "ch", " ", "mig", "ht", " ", "acceptabl", "y", " ", "contain", " ", "usef", "ul", " ", "data", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "packet_", "._", "segment", "Length_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "packet_", "._", "ack_", ",_", "\"", "What", " ", "the", " ", "\\u", "HELL", "\\u", " ", "is", " ", "wrong", " ", "with", " ", "this", " ", "packet", ":\"_", "+_", "str_", "(_", "packet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "segment", "Accepta", "ble_", "(_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "recv", "Window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packet_", "._", "relative", "Seq_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packet_", "._", "segment", "Length_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "to", " ", "transmit", " ", "an", " ", "ack", " ", "here", " ", "sinc", "e", " ", "it", "'", "s", " ", "old", " ", "data", ".", " ", " ", "We", " ", "probab", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "ack", " ", "in", " ", "more", " ", "state", "s", " ", "than", " ", "just", " ", "EST", "AB", "LIS", "HED", "...", " ", "but", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OK", "!", " ", " ", "It", "'", "s", " ", "acceptabl", "e", "!", " ", " ", "Let", "'", "s", " ", "process", " ", "the", " ", "vari", "ous", " ", "bits", " ", "of", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "is", " ", "the", " ", "usef", "ul", " ", "data", " ", "in", " ", "the", " ", "packet", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "packet_", "._", "relative", "Seq_", "(_", ")_", ">_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Her", "e", "'", "s", " ", "what", "'", "s", " ", "goi", "ng", " ", "on", ".", " ", " ", "Data", " ", "can", " ", "be", " ", "'", "in", " ", "the", " ", "window", "',", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "in", " ", "the", " ", "future", ".", " ", " ", "For", " ", "example", ",", " ", "if", " ", "I", " ", "have", " ", "a", " ", "window", " ", "of", " ", "length", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "I", " ", "send", " ", "segments", " ", "DATA", "1", "(", "len", " ", "1", ")", " ", "DATA", "2", "(", "len", " ", "1", ")", " ", "FIN", " ", "and", " ", "you", " ", "receive_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "them", " ", "in", " ", "the", " ", "order", " ", "FIN", " ", "DATA", "1", " ", "DATA", "2", ",", " ", "you", " ", "don", "'", "t", " ", "actual", "ly", " ", "want", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "the", " ", "FIN", " ", "unti", "l", " ", "you", "'", "ve", " ", "process", "ed", " ", "the", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "the", " ", "moment", " ", "we", " ", "are", " ", "just", " ", "drop", "ping", " ", "anyt", "hing", " ", "tha", "t", " ", "isn", "'", "t", " ", "exact", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "next", " ", "thing", " ", "we", " ", "want", " ", "to", " ", "process", ".", " ", " ", "Thi", "s", " ", "is", " ", "perfect", "ly", " ", "valid", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "packet", "s", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "dropped", ",", " ", "so", " ", "the", " ", "other", " ", "end", " ", "will", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "retra", "nsm", "it", " ", "them", " ", "anyway", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "packet_", "._", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "packet_", "._", "syn_", ",_", "'", "no", " ", "seri", "ously", " ", "I", " ", "\\u", "do", " ", "not", "\\u", " ", "know", " ", "how", " ", "to", " ", "handle", " ", "this", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usef", "ul", "Data_", "=_", "packet_", "._", "data_", "[_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", "-_", "packet_", "._", "relative", "Seq_", "(_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DON", "T", " ", "check", "/", "slice", " ", "the", " ", "window", " ", "size", " ", "here", ",", " ", "the", " ", "accept", "abilit", "y", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "checke", "d", " ", "it", ",", " ", "we", " ", "can", " ", "over", "-", "ack", " ", "if", " ", "the", " ", "other", " ", "side", " ", "is", " ", "bug", "gy", " ", "(?", "??", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "protocol_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "protocol_", "._", "data", "Received_", "(_", "usef", "ul", "Data_", ")_", "\\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 ", " ", "_", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", "+=_", "packet_", "._", "segment", "Length_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "state_", "==_", "tcp", "dfa", "_", "._", "EST", "AB", "LIS", "HED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "all", " ", "other", " ", "state", "s", ",", " ", "the", " ", "state", " ", "machine", " ", "take", "s", " ", "care", " ", "of", " ", "sendin", "g", " ", "AC", "Ks", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "its", " ", "output", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "packet_", "._", "fin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "FIN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\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", "Host_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tup", "l_", "=_", "self_", "._", "pt", "cp_", "._", "transport_", "._", "get", "Host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "PT", "CP", "Address_", "(_", "(_", "tup", "l_", "._", "host_", ",_", "tup", "l_", "._", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pseudo", "Port", "Pair_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Peer", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PT", "CP", "Address_", "(_", "self_", "._", "peer", "Address", "Tuple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pseudo", "Port", "Pair_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "self_", "._", "disconnected", "_", ",_", "'", "Writ", "ing", " ", "to", " ", "a", " ", "transport", " ", "tha", "t", " ", "was", " ", "alr", "ead", "y", " ", "disconnected", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "outgoing", "Bytes_", "+=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "Later_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Sequence_", "(_", "self_", ",_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "''_", "._", "join_", "(_", "seq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "Later_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "nag", "le_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "nag", "le_", "=_", "reactor_", "._", "call", "Later_", "(_", "0.001_", ",_", "self_", "._", "\\u", "reall", "y", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\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", "originat", "e", "One", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amount_", "=_", "min_", "(_", "self_", "._", "send", "Window", "Rema", "inin", "g_", ",_", "self_", "._", "mtu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "Out_", "=_", "self_", "._", "\\u", "outgoing", "Bytes_", "[_", ":_", "amount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "originat", "ing", " ", "data", " ", "packet", "',", " ", "len", "(", "send", "Out", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "outgoing", "Bytes_", "=_", "self_", "._", "\\u", "outgoing", "Bytes_", "[_", "amount_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Window", "Rema", "inin", "g_", "-=_", "len_", "(_", "send", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "originat", "e_", "(_", "ack_", "=_", "True_", ",_", "data_", "=_", "send", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "reall", "y", "Write_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "self", ",", " ", "'", "reall", "y", " ", "writ", "ing", "',", " ", "self", ".\\u", "paused_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "nag", "le_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "window", " ", "and", " ", "bytes", "',", " ", "self", ".", "send", "Window", "Rema", "inin", "g", ",", " ", "len", "(", "self", ".\\u", "outgoing", "Byte", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "send", "Window", "Rema", "inin", "g_", "and_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "originat", "e", "One", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "retra", "nsm", "it", "Later_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "state_", "!=_", "tcp", "dfa", "_", "._", "CLOSED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "=_", "reactor_", "._", "call", "Later_", "(_", "self_", "._", "\\u", "retra", "nsm", "it", "Timeout_", ",_", "self_", "._", "\\u", "reall", "y", "Retr", "ans", "mit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\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", "stop", "Retr", "ans", "mit", "ting_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "used", " ", "bot", "h", " ", "as", " ", "a", " ", "quick", "-", "and", "-", "dir", "ty", " ", "test", " ", "shut", "down", " ", "hack", " ", "and", " ", "a", " ", "way", " ", "to", " ", "shut", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "down", " ", "whe", "n", " ", "we", " ", "die", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "nag", "le_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "nag", "le_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nag", "le_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "close", "Wait", "Lo", "se", "Connection_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "Wait", "Lo", "se", "Connection_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "close", "Wait", "Lo", "se", "Connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\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", "reall", "y", "Retr", "ans", "mit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "TOD", "O", ":", " ", "packet", " ", "fragment", "ation", " ", "&", " ", "coal", "esc", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "We", "e", " ", "a", " ", "retra", "nsm", "it", "!", " ", " ", "What", " ", "I", " ", "got", "?'", ",", " ", "self", ".", "retra", "nsm", "ission", "Queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "packet_", "in_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packet_", "._", "retra", "nsm", "it", "Count_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "packet_", "._", "retra", "nsm", "it", "Count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "packet_", "._", "ack", "Num_", "=_", "self_", "._", "current", "Ack", "Num_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pt", "cp_", "._", "send", "Packet_", "(_", "packet_", ")_", "\\u\\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_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "retra", "nsm", "it", "Later_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "lose", "Connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "discon", "necti", "ng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "discon", "necti", "ng_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "Buffer", "Empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\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", "write", "Buffer", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reall", "y", "Write_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "producer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "stream", "ing", "Producer_", ")_", "or_", "self_", "._", "producer", "Pause", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "producer", "Pause", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "producer_", "._", "resum", "e", "Produ", "cing", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "discon", "necti", "ng_", "and_", "(_", "not_", "self_", "._", "disconnected", "_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "self_", "._", "state_", "==_", "tcp", "dfa", "_", "._", "CLOSE", "\\u", "WAIT", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "APP", "\\u", "CLOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\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", "write", "Buffer", "Full_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "my", " ", "write", " ", "buffer", " ", "is", " ", "full", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "producer_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "producer", "Pause", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "producer", "Pause", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "producer", " ", "paus", "ing", "'_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "producer_", "._", "paus", "e", "Produ", "cing", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "producer", " ", "paus", "ed", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "but", " ", "I", " ", "am", " ", "not", " ", "tell", "ing", " ", "my", " ", "producer", " ", "to", " ", "paus", "e", "!'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", " ", " ", "',", " ", "self", ".", "producer", ",", " ", "self", ".", "stream", "ing", "Producer", ",", " ", "self", ".", "producer", "Pause", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "register", "Producer_", "(_", "self_", ",_", "producer_", ",_", "streaming_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "producer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cann", "ot", " ", "register", " ", "producer", " ", "%", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bec", "aus", "e", " ", "producer", " ", "%", "s", " ", "was", " ", "neve", "r", " ", "unregister", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "producer_", ",_", "self_", "._", "producer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "disconnected", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "producer_", "._", "stop", "Produ", "cing", "_", "(_", ")_", "\\u\\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_", "._", "producer_", "=_", "producer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stream", "ing", "Producer_", "=_", "streaming_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "streaming_", "and_", "not_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "producer_", "._", "resum", "e", "Produ", "cing", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\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_", "unregister", "Producer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "producer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "outgoing", "Bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "Buffer", "Empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "paus", "e", "Produ", "cing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "paused_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resum", "e", "Produ", "cing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "paused_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "Ack", "Num_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "next", "Rec", "v", "Seq", "Num_", "+_", "self_", "._", "peer", "Sen", "d", "IS", "N_", ")_", "%_", "(_", "2_", "**_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "originat", "e_", "(_", "self_", ",_", "data_", "=_", "''_", ",_", "syn_", "=_", "False_", ",_", "ack_", "=_", "False_", ",_", "fin_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "syn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "reall", "y", " ", "shou", "ld", " ", "be", " ", "random", "izi", "ng", " ", "the", " ", "IS", "N", " ", "but", " ", "unti", "l", " ", "we", " ", "finish", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implementation", "s", " ", "of", " ", "the", " ", "vari", "ous", " ", "bits", " ", "of", " ", "wrap", "aro", "und", " ", "logic", " ", "tha", "t", " ", "wer", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "ed", " ", "with", " ", "relative", "Sequence_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "next", "Sen", "d", "Seq", "Num_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "host", "Sen", "d", "IS", "N_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "PT", "CPP", "acke", "t_", "._", "create_", "(_", "self_", "._", "host", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "peer", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "Num_", "=_", "(_", "self_", "._", "next", "Sen", "d", "Seq", "Num_", "+_", "self_", "._", "host", "Sen", "d", "IS", "N_", ")_", "%_", "(_", "2_", "**_", "32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ack", "Num_", "=_", "self_", "._", "current", "Ack", "Num_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "window_", "=_", "self_", "._", "recv", "Window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syn_", "=_", "syn_", ",_", "ack_", "=_", "ack_", ",_", "fin_", "=_", "fin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", "=_", "self_", "._", "peer", "Address", "Tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "we", " ", "want", " ", "to", " ", "enqueue", " ", "this", " ", "packet", " ", "for", " ", "retra", "nsm", "ission", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "sl_", "=_", "p_", "._", "segment", "Length_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "Sen", "d", "Seq", "Num_", "+=_", "sl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p_", "._", "must", "Retr", "ans", "mit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "self", ",", " ", "'", "originat", "ing", " ", "retra", "nsm", "itt", "able", " ", "packet", "',", " ", "len", "(", "self", ".", "retra", "nsm", "ission", "Queue", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "retra", "nsm", "ission", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "retra", "nsm", "ission", "Queue_", "[_", "-_", "1_", "]_", "._", "fin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Sen", "ding", " ", "%", "r", " ", "after", " ", "FIN", "??", "!\"_", "%_", "(_", "p_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "put", "ting", " ", "it", " ", "on", " ", "the", " ", "queue", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "retra", "nsm", "ission", "Queue_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "and", " ", "sendin", "g", " ", "it", " ", "late", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "retra", "nsm", "it", "Later_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "send", "Window", "Rema", "inin", "g_", ":_", "#", " ", "len", "(", "self", ".", "retra", "nsm", "ission", "Queue", ")", " ", ">", " ", "5", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "oh", " ", "no", " ", "my", " ", "queue", " ", "is", " ", "too", " ", "big", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "random", " ", "number", " ", "(", "5", ")", " ", "bec", "aus", "e", " ", "I", " ", "ou", "ght", " ", "to", " ", "be", " ", "summ", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "packet", " ", "length", "s", " ", "or", " ", "somet", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "Buffer", "Full_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "my", " ", "queue", " ", "is", " ", "still", " ", "small", " ", "eno", "ugh", "',", " ", "len", "(", "self", ".", "retra", "nsm", "ission", "Queue", "),", " ", "self", ",", " ", "self", ".", "send", "Window", "Rema", "inin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pt", "cp_", "._", "send", "Packet_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transiti", "on", "\\u", "SYN", "\\u", "SENT", "\\u", "to", "\\u", "CLOSED", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "connecti", "on", " ", "neve", "r", " ", "got", " ", "any", "where", ".", " ", " ", "Good", "bye", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "CONNECT", "OR", " ", "API", " ", "OM", "FG", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "client", "Connect", "ion", "Failed_", "(_", "None_", ",_", "error_", "._", "Time", "out", "Error_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "enter", "\\u", "LISTEN", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Spec", " ", "say", "s", " ", "this", " ", "is", " ", "necessar", "y", " ", "for", " ", "RST", " ", "handling", ";", " ", "we", " ", "need", " ", "it", " ", "for", " ", "mak", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sure", " ", "it", "'", "s", " ", "OK", " ", "to", " ", "bind", " ", "port", " ", "numbers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "was", "Eve", "r", "Listen", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enter", "\\u", "CLOSED", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pt", "cp_", "._", "connecti", "on", "Closed_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stop", "Retr", "ans", "mit", "ting_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "time", "Wait", "Call_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "time", "Wait", "Call_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "time", "Wait", "Call_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "enter", "\\u", "TIME", "\\u", "WAIT", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stop", "Retr", "ans", "mit", "ting_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "time", "Wait", "Call_", "=_", "reactor_", "._", "call", "Later_", "(_", "self_", "._", "\\u", "time", "Wait", "Timeout_", ",_", "self_", "._", "\\u", "do", "2m", "sl", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "do", "2m", "sl", "Timeout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "time", "Wait", "Call_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transiti", "on", "\\u", "LISTEN", "\\u", "to", "\\u", "SYN", "\\u", "SENT", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "U", "h", ",", " ", "what", "?", " ", " ", "We", " ", "wer", "e", " ", "listen", "ing", " ", "and", " ", "we", " ", "trie", "d", " ", "to", " ", "send", " ", "some", " ", "bytes", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "error", " ", "for", " ", "PT", "CP", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "State", "Error_", "(_", "\"", "You", " ", "can", "'", "t", " ", "write", " ", "anyt", "hing", " ", "unti", "l", " ", "some", "one", " ", "connects", " ", "to", " ", "you", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pseudo", "Port", "Pair_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "host", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "peer", "Pse", "udo", "Port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "enter", "\\u", "EST", "AB", "LIS", "HED", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "sent", " ", "out", " ", "SYN", ",", " ", "the", "y", " ", "acknowledge", "d", " ", "it", ".", " ", " ", "Cong", "rat", "ulation", "s", ",", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "a", " ", "new", " ", "baby", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "discon", "necti", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "disconnected", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "factory_", "._", "build", "Protocol_", "(_", "PT", "CP", "Address_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "peer", "Address", "Tuple_", ",_", "self_", "._", "pseudo", "Port", "Pair_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "make", "Connection_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "msg_", "(_", "\"", "Except", "ion", " ", "dur", "ing", " ", "PT", "CP", " ", "connecti", "on", " ", "setup", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lose", "Connection_", "(_", ")_", "\\u\\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_", "._", "protocol_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exit", "\\u", "EST", "AB", "LIS", "HED", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "self_", "._", "disconnected", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "disconnected", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "protocol_", "._", "connecti", "on", "Lost", "_", "(_", "Failure_", "(_", "CONNECTION", "\\u", "DONE_", ")_", ")_", "\\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 ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "protocol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "producer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "producer_", "._", "stop", "Produ", "cing", "_", "(_", ")_", "\\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 ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "producer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "enter", "\\u", "CLOSE", "\\u", "WAIT", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Twi", "sted", " ", "automati", "call", "y", " ", "react", "s", " ", "to", " ", "network", " ", "half", "-", "close", " ", "by", " ", "issu", "ing", " ", "a", " ", "full_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "close", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "Wait", "Lo", "se", "Connection_", "=_", "reactor_", "._", "call", "Later_", "(_", "0.01_", ",_", "self_", "._", "\\u", "lose", "Connect", "ion", "Be", "caus", "e", "Of", "Clos", "e", "Wait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "lose", "Connect", "ion", "Be", "caus", "e", "Of", "Clos", "e", "Wait_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "Wait", "Lo", "se", "Connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "immediate", "Shut", "down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u", "IMM", "EDI", "ATE", "LY", "\\u", " ", "shut", " ", "down", " ", "this", " ", "connecti", "on", ",", " ", "sendin", "g", " ", "one", " ", "(", "non", "-", "retra", "nsm", "itte", "d", ")", "\\", "10", ";", " ", " ", " ", " ", "app", "-", "close", " ", "packet", ",", " ", "empty", "ing", " ", "our", " ", "buffer", "s", ",", " ", "clear", "ing", " ", "our", " ", "producer", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "getti", "ng", " ", "read", "y", " ", "to", " ", "die", " ", "right", " ", "after", " ", "this", " ", "call", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "outgoing", "Bytes_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "state_", "==_", "tcp", "dfa", "_", "._", "EST", "AB", "LIS", "HED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "APP", "\\u", "CLOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stop", "Retr", "ans", "mit", "ting_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reall", "y", "Retr", "ans", "mit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "state", "s", " ", "tha", "t", " ", "we", " ", "can", " ", "reason", "abl", "y", " ", "be", " ", "in", " ", "handle", " ", "a", " ", "timeo", "ut", ";", " ", "force", " ", "our_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", " ", "to", " ", "think", " ", "tha", "t", " ", "it", "'", "s", " ", "bec", "ome", " ", "des", "ync", "hro", "niz", "ed", " ", "with", " ", "the", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "end", " ", "so", " ", "tha", "t", " ", "it", " ", "will", " ", "total", "ly", " ", "shut", " ", "its", "elf", " ", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "retra", "nsm", "itte", "r_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "nag", "le_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "output", "\\u", "ACK_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "output", "\\u", "FIN", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "fin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "output", "\\u", "SYN", "\\u", "ACK_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "syn_", "=_", "True_", ",_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Connection_", "(_", "tcp", "dfa", "_", "._", "TCP_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "output", "\\u", "SYN", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "originat", "e_", "(_", "syn_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PT", "CP", "Address_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gar", "bage", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Address_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gar", "bage", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "(_", "host_", ",_", "port_", ")_", ",_", "(_", "pseudo", "Host", "Port_", ",_", "pseudo", "Peer", "Port_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pseudo", "Host", "Port_", "=_", "pseudo", "Host", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pseudo", "Peer", "Port_", "=_", "pseudo", "Peer", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP", "Address_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gar", "bage", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "PT", "CP", "Address", "((", "%", "r", ",", " ", "%", "r", "),", " ", "(%", "r", ",", " ", "%", "r", "))'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "host_", ",_", "self_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pseudo", "Host", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pseudo", "Peer", "Port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Pend", "ing", "Event_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pend", "ing", "Event_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "listeners_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pend", "ing", "Event_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deferred_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deferred_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "listeners_", "._", "append_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pend", "ing", "Event_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "callback_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "listeners_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "listeners_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "callback_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pend", "ing", "Event_", "(_", "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_", "errback", "_", "(_", "self_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "l_", "=_", "self_", "._", "listeners_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "listeners_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "errback", "_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "PT", "CP", "}", " ", "implement", "s", " ", "a", " ", "strong", "ly", " ", "TC", "P", "-", "like", " ", "protoc", "ol", " ", "on", " ", "top", " ", "of", " ", "UD", "P", ".", " ", " ", "It", "\\", "10", ";", " ", " ", " ", " ", "provide", "s", " ", "a", " ", "transport", " ", "whi", "ch", " ", "is", " ", "connecti", "on", "-", "orient", "ed", ",", " ", "stream", "ing", ",", "\\", "10", ";", " ", " ", " ", " ", "order", "ed", ",", " ", "and", " ", "reliab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "factor", "y", ":", " ", "A", " ", "L", "{", "Server", "Factor", "y", "}", " ", "whi", "ch", " ", "is", " ", "used", " ", "to", " ", "create", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "IP", "roto", "col", "}", " ", "provide", "rs", " ", "whe", "neve", "r", " ", "a", " ", "new", " ", "PT", "CP", " ", "connecti", "on", " ", "is", " ", "made", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "this", " ", "port", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "connections", ":", " ", "A", " ", "mapping", " ", "of", " ", "endpoint", " ", "addresse", "s", " ", "to", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "object", "s", ".", " ", " ", "The", "se", " ", "are", " ", "the", " ", "active", " ", "connections", " ", "bei", "ng", " ", "multiple", "xed", "\\", "10", ";", " ", " ", " ", " ", "over", " ", "this", " ", "UD", "P", " ", "port", ".", " ", " ", "Many", " ", "PT", "CP", " ", "connections", " ", "may", " ", "run", " ", "over", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "L", "{", "PT", "CP", "}", " ", "instance", ",", " ", "communicati", "ng", " ", "with", " ", "many", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "remote", " ", "host", "s", " ", "as", " ", "well", " ", "as", " ", "multiple", "xin", "g", " ", "different", " ", "PT", "CP", "\\", "10", ";", " ", " ", " ", " ", "connections", " ", "to", " ", "the", " ", "same", " ", "remote", " ", "host", ".", " ", " ", "The", " ", "mapping", " ", "keys", ",", "\\", "10", ";", " ", " ", " ", " ", "endpoint", " ", "addresse", "s", ",", " ", "are", " ", "three", "-", "tuple", "s", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "destinat", "ion", " ", "pseudo", "-", "port", " ", "whi", "ch", " ", "is", " ", "alw", "ay", "s", " ", "C", "{", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "source", " ", "pseudo", "-", "port", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "A", " ", "(", "host", ",", " ", "port", ")", " ", "tuple", " ", "gi", "ving", " ", "the", " ", "UD", "P", " ", "address", " ", "of", " ", "a", " ", "PT", "CP", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "peer", " ", "holding", " ", "the", " ", "other", " ", "side", " ", "of", " ", "the", " ", "connecti", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mapping", " ", "values", ",", " ", "connecti", "on", " ", "object", "s", ",", " ", "are", " ", "L", "{", "PT", "CP", "Connect", "ion", "}", "\\", "10", ";", " ", " ", " ", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "connections", ":", " ", "C", "{", "dict", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exter", "nal", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Intern", "al", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "stopped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "factory_", "=_", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "all", "Connect", "ion", "s", "Closed_", "=_", "\\u", "Pend", "ing", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ",_", "factory_", ",_", "host_", ",_", "port_", ",_", "pseudo", "Port_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", " ", "to", " ", "establish", " ", "a", " ", "new", " ", "connecti", "on", " ", "via", " ", "PT", "CP", " ", "to", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "remote", " ", "address", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "factor", "y", ":", " ", "A", " ", "L", "{", "Client", "Factor", "y", "}", " ", "whi", "ch", " ", "will", " ", "be", " ", "used", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "an", " ", "L", "{", "IP", "roto", "col", "}", " ", "provide", "r", " ", "if", " ", "the", " ", "connecti", "on", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "success", "full", "y", " ", "set", " ", "up", ",", " ", "or", " ", "whi", "ch", " ", "will", " ", "have", " ", "fail", "ure", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "invoke", "d", " ", "on", " ", "it", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "host", ":", " ", "The", " ", "IP", " ", "address", " ", "of", " ", "anot", "her", " ", "listen", "ing", " ", "PT", "CP", " ", "port", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "connect", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "host", ":", " ", "C", "{", "str", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "port", ":", " ", "The", " ", "port", " ", "number", " ", "of", " ", "tha", "t", " ", "other", " ", "listen", "ing", " ", "PT", "CP", " ", "port", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "connect", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "port", ":", " ", "C", "{", "int", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "pseudo", "Port", ":", " ", "Not", " ", "reall", "y", " ", "implemented", ".", " ", " ", "Do", " ", "not", " ", "pass", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "for", " ", "this", " ", "parameter", " ", "or", " ", "thing", "s", " ", "will", " ", "break", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "A", " ", "L", "{", "PT", "CP", "Connect", "ion", "}", " ", "instance", " ", "represent", "ing", " ", "the", " ", "new", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", ",", " ", "but", " ", "you", " ", "reall", "y", " ", "shou", "ld", "n", "'", "t", " ", "use", " ", "this", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "anyt", "hing", ".", " ", " ", "Write", " ", "a", " ", "protoc", "ol", "!", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Pse", "udo", "Port_", "=_", "gen", "Con", "n", "ID_", "(_", ")_", "%_", "MAX", "\\u", "PSE", "UD", "O", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "self_", "._", "\\u", "connections_", "[_", "(_", "pseudo", "Port_", ",_", "source", "Pse", "udo", "Port_", ",_", "(_", "host_", ",_", "port_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "=_", "PT", "CP", "Connection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Pse", "udo", "Port_", ",_", "pseudo", "Port_", ",_", "self_", ",_", "factory_", ",_", "(_", "host_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "APP", "\\u", "ACTI", "VE", "\\u", "OPEN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "Packet_", "(_", "self_", ",_", "packet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "transport", "Gon", "e", "Awa", "y_", ":_", "\\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_", "._", "transport_", "._", "write_", "(_", "packet_", "._", "encode_", "(_", ")_", ",_", "packet_", "._", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "Protocol_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport", "Gon", "e", "Awa", "y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "Con", "n", "ID_", "=_", "10_", "#", " ", "random", ".", "rand", "range", "(", "2", " ", "**", " ", "32", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connections_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "final", "Cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clean", " ", "up", " ", "all", " ", "of", " ", "our", " ", "connections", " ", "by", " ", "issu", "ing", " ", "applica", "tion", "-", "level", " ", "close", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "stop", " ", "notification", "s", ",", " ", "sendin", "g", " ", "hai", "l", "-", "mar", "y", " ", "final", " ", "FIN", " ", "packet", "s", " ", "(", "whi", "ch", " ", "may", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "reach", " ", "the", " ", "other", " ", "end", ",", " ", "but", " ", "neve", "rt", "hel", "ess", " ", "can", " ", "be", " ", "usef", "ul", ")", " ", "whe", "n", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "conn_", "in_", "self_", "._", "\\u", "connections_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "immediate", "Shut", "down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "self_", "._", "\\u", "connections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "Protocol_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Notifi", "cation", " ", "from", " ", "twist", "ed", " ", "tha", "t", " ", "our", " ", "underl", "ying", " ", "port", " ", "has", " ", "gone", " ", "awa", "y", ";", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "sure", " ", "we", "'", "re", " ", "not", " ", "goi", "ng", " ", "to", " ", "try", " ", "to", " ", "send", " ", "any", " ", "packet", "s", " ", "through", " ", "our", "\\", "10", ";", " ", " ", " ", " ", "transport", " ", "and", " ", "blow", " ", "up", ",", " ", "then", " ", "shut", " ", "down", " ", "all", " ", "of", " ", "our", " ", "protoc", "ols", ",", " ", "issu", "ing", "\\", "10", ";", " ", " ", " ", " ", "app", "r", "\\", "10", ";", " ", " ", " ", " ", "opr", "iate", " ", "applica", "tion", "-", "level", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport", "Gon", "e", "Awa", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "final", "Cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "up", "And", "Close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clean", " ", "up", " ", "all", " ", "rema", "inin", "g", " ", "connections", ",", " ", "then", " ", "close", " ", "our", " ", "transport", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Alt", "hou", "gh", " ", "in", " ", "a", " ", "pin", "ch", " ", "we", " ", "will", " ", "do", " ", "clean", "up", " ", "after", " ", "our", " ", "socket", " ", "has", " ", "gone", " ", "awa", "y", "\\", "10", ";", " ", " ", " ", " ", "(", "if", " ", "it", " ", "doe", "s", " ", "so", " ", "unexpected", "ly", ",", " ", "above", " ", "in", " ", "stop", "Proto", "col", "),", " ", "we", " ", "wou", "ld", " ", "reall", "y", "\\", "10", ";", " ", " ", " ", " ", "prefer", " ", "to", " ", "do", " ", "clean", "up", " ", "whi", "le", " ", "we", " ", "still", " ", "have", " ", "access", " ", "to", " ", "a", " ", "transport", ",", " ", "sinc", "e", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "way", " ", "we", " ", "can", " ", "force", " ", "out", " ", "a", " ", "few", " ", "final", " ", "packet", "s", " ", "and", " ", "save", " ", "the", " ", "remote", "\\", "10", ";", " ", " ", " ", " ", "applica", "tion", " ", "an", " ", "aw", "kwa", "rd", " ", "timeo", "ut", " ", "(", "if", " ", "it", " ", "happ", "ens", " ", "to", " ", "get", " ", "through", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "genera", "ll", "y", " ", "like", "ly", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "final", "Cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "datagram", "Received_", "(_", "self_", ",_", "bytes_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "bytes_", ")_", "<_", "\\u", "fixed", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "can", "'", "t", " ", "be", " ", "any", " ", "good", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pkt_", "=_", "PT", "CPP", "acke", "t_", "._", "decode_", "(_", "bytes_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkt_", "._", "verify", "Checksum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Truncate", "d", "Data", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "'(", "pt", "cp", " ", "packet", " ", "truncat", "ed", ":", " ", "%", "r", ")'", " ", "%", " ", "(", "pkt", ",)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "Packet_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PT", "CPP", "acke", "t_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pkt_", "._", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pkt_", "._", "source", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "H", "'_", ",_", "len_", "(_", "pkt_", "._", "data_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stb", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destination_", "=_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Gar", "bage", "Data", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "gar", "bage", " ", "data", "!\"_", ",_", "pkt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Checksum", "Mismatch", "Error_", ",_", "cm", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "bad", " ", "checks", "um", "\"_", ",_", "pkt_", ",_", "cm", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "repr_", "(_", "pkt_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hex_", "(_", "pkt_", "._", "checksum_", ")_", ",_", "hex_", "(_", "pkt_", "._", "compute", "Checksum", "_", "(_", ")_", ")_", "\\u\\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_", "._", "packet", "Received_", "(_", "pkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "stop_", "(_", "self_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "stopped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stopped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "transport_", "._", "stop", "Listen", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "defer_", "._", "succeed_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait", "For", "All", "Connect", "ion", "s", "To", "Close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Wait", " ", "for", " ", "all", " ", "currentl", "y", "-", "open", " ", "connections", " ", "to", " ", "enter", " ", "the", " ", "'", "CLOSED", "'", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", "ly", " ", "this", " ", "is", " ", "only", " ", "usable", " ", "from", " ", "test", " ", "fixture", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "all", "Connect", "ion", "s", "Closed_", "._", "deferred_", "(_", ")_", "._", "add", "Bot", "h_", "(_", "self_", "._", "\\u", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Closed_", "(_", "self_", ",_", "pt", "cp", "Conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pack", "ey_", "=_", "(_", "pt", "cp", "Conn_", "._", "peer", "Pse", "udo", "Port_", ",_", "pt", "cp", "Conn_", "._", "host", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "cp", "Conn_", "._", "peer", "Address", "Tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "connections_", "[_", "pack", "ey_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "not_", "self_", "._", "transport", "Gon", "e", "Awa", "y_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "self_", "._", "\\u", "connections_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "all", "Connect", "ion", "s", "Closed_", "._", "callback_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PT", "CP_", "(_", "protocol_", "._", "Data", "gram", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "packet", "Received_", "(_", "self_", ",_", "packet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pack", "ey_", "=_", "(_", "packet_", "._", "source", "Pse", "udo", "Port_", ",_", "packet_", "._", "dest", "Pse", "udo", "Port_", ",_", "packet_", "._", "peer", "Address", "Tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pack", "ey_", "not_", "in_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "packet_", "._", "flags_", "==_", "\\u", "SYN", "_", "and_", "packet_", "._", "dest", "Pse", "udo", "Port_", "==_", "1_", ":_", "#", " ", "SYN", " ", "and", " ", "\\u", "ONL", "Y", "\\u", " ", "SYN", " ", "set", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "PT", "CP", "Connection_", "(_", "packet_", "._", "dest", "Pse", "udo", "Port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packet_", "._", "source", "Pse", "udo", "Port_", ",_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", ",_", "packet_", "._", "peer", "Address", "Tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "input_", "(_", "tcp", "dfa", "_", "._", "APP", "\\u", "PASS", "IV", "E", "\\u", "OPEN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connections_", "[_", "pack", "ey_", "]_", "=_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "msg_", "(_", "\"", "corrupted", " ", "packet", "?", " ", "%", "r", " ", "%", "r", " ", "%", "r", "\"_", "%_", "(_", "packet_", ",_", "pack", "ey_", ",_", "self_", "._", "\\u", "connections_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "connections_", "[_", "pack", "ey_", "]_", "._", "packet", "Received_", "(_", "packet_", ")_", "\\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 ", " _", "log_", "._", "msg_", "(_", "\"", "PT", "CP", "Connect", "ion", " ", "error", " ", "on", " ", "%", "r", ":\"_", "%_", "(_", "packet_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "connections_", "[_", "pack", "ey_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
apiad/sublime-browser-integration/selenium/webdriver/remote/errorhandler.py
[ { "content": "# Copyright 2010 WebDriver committers\n# Copyright 2010 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom selenium.common.exceptions import ElementNotSelectableException\nfrom selenium.common.exceptions import ElementNotVisibleException\nfrom selenium.common.exceptions import InvalidCookieDomainException\nfrom selenium.common.exceptions import InvalidElementStateException\nfrom selenium.common.exceptions import InvalidSelectorException\nfrom selenium.common.exceptions import ImeNotAvailableException\nfrom selenium.common.exceptions import ImeActivationFailedException\nfrom selenium.common.exceptions import NoSuchElementException\nfrom selenium.common.exceptions import NoSuchFrameException\nfrom selenium.common.exceptions import NoSuchWindowException\nfrom selenium.common.exceptions import StaleElementReferenceException\nfrom selenium.common.exceptions import UnableToSetCookieException\nfrom selenium.common.exceptions import UnexpectedAlertPresentException\nfrom selenium.common.exceptions import NoAlertPresentException\nfrom selenium.common.exceptions import ErrorInResponseException\nfrom selenium.common.exceptions import TimeoutException\nfrom selenium.common.exceptions import WebDriverException\nfrom selenium.common.exceptions import MoveTargetOutOfBoundsException\n\ntry:\n basestring\nexcept NameError: # Python 3.x\n basestring = str\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_", "#", " ", "Copy", "right", " ", "2010", " ", "Web", "Drive", "r", " ", "committer", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Element", "Not", "Select", "able", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Element", "Not", "Vis", "ibl", "e", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Inva", "lid", "Cooki", "e", "Doma", "in", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Inva", "lid", "Element", "State", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Inva", "lid", "Select", "or", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Im", "e", "Not", "Avail", "able", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Im", "e", "Activat", "ion", "Fail", "ed", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "No", "Suc", "h", "Element", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "No", "Suc", "h", "Frame", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "No", "Suc", "h", "Window", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Sta", "le", "Element", "Reference", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Una", "ble", "To", "Set", "Cooki", "e", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Une", "xpe", "cte", "d", "Alert", "Present", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "No", "Alert", "Present", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Error", "In", "Respons", "e", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Time", "out", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Web", "Drive", "r", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Move", "Target", "Out", "Of", "Bound", "s", "Exception_", "\\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 ", " _", "basestring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "#", " ", "Pyth", "on", " ", "3", ".", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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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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 ]
Unreachable code
dragondjf/QMarkdowner/markdown/extensions/toc.py
[ { "content": "def nest_toc_tokens(toc_list):\n \"\"\"Given an unsorted list with errors and skips, return a nested one.\n [{'level': 1}, {'level': 2}]\n =>\n [{'level': 1, 'children': [{'level': 2, 'children': []}]}]\n\n A wrong list is also converted:\n [{'level': 2}, {'level': 1}]\n =>\n [{'level': 2, 'children': []}, {'level': 1, 'children': []}]\n \"\"\"\n\n ordered_list = []\n if len(toc_list):\n # Initialize everything by processing the first entry\n last = toc_list.pop(0)\n last['children'] = []\n levels = [last['level']]\n ordered_list.append(last)\n parents = []\n\n # Walk the rest nesting the entries properly\n while toc_list:\n t = toc_list.pop(0)\n current_level = t['level']\n t['children'] = []\n\n # Reduce depth if current level < last item's level\n if current_level < levels[-1]:\n # Pop last level since we know we are less than it\n levels.pop()\n\n # Pop parents and levels we are less than or equal to\n to_pop = 0\n for p in reversed(parents):\n if current_level <= p['level']:\n to_pop += 1\n else: # pragma: no cover\n break\n if to_pop:\n levels = levels[:-to_pop]\n parents = parents[:-to_pop]\n\n # Note current level as last\n levels.append(current_level)\n\n # Level is the same, so append to\n # the current parent (if available)\n if current_level == levels[-1]:\n (parents[-1]['children'] if parents\n else ordered_list).append(t)\n\n # Current level is > last item's level,\n # So make last item a parent and append current as child\n else:\n last['children'].append(t)\n parents.append(last)\n levels.append(current_level)\n last = t\n\n return ordered_list", "metadata": "root.nest_toc_tokens", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nest", "\\u", "toc", "\\u", "tokens_", "(_", "toc", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "an", " ", "unsorted", " ", "list", " ", "with", " ", "error", "s", " ", "and", " ", "skips", ",", " ", "return", " ", "a", " ", "nest", "ed", " ", "one", ".", "\\", "10", ";", " ", " ", " ", " ", "[{", "'", "level", "':", " ", "1", "},", " ", "{", "'", "level", "':", " ", "2", "}]", "\\", "10", ";", " ", " ", " ", " ", "=>", "\\", "10", ";", " ", " ", " ", " ", "[{", "'", "level", "':", " ", "1", ",", " ", "'", "child", "ren", "':", " ", "[{", "'", "level", "':", " ", "2", ",", " ", "'", "child", "ren", "':", " ", "[]", "}]", "}]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "wrong", " ", "list", " ", "is", " ", "als", "o", " ", "convert", "ed", ":", "\\", "10", ";", " ", " ", " ", " ", "[{", "'", "level", "':", " ", "2", "},", " ", "{", "'", "level", "':", " ", "1", "}]", "\\", "10", ";", " ", " ", " ", " ", "=>", "\\", "10", ";", " ", " ", " ", " ", "[{", "'", "level", "':", " ", "2", ",", " ", "'", "child", "ren", "':", " ", "[]", "},", " ", "{", "'", "level", "':", " ", "1", ",", " ", "'", "child", "ren", "':", " ", "[]", "}]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order", "ed", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "toc", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "every", "thing", " ", "by", " ", "process", "ing", " ", "the", " ", "first", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last_", "=_", "toc", "\\u", "list_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "[_", "'", "child", "ren", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "levels_", "=_", "[_", "last_", "[_", "'", "level", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "\\u", "list_", "._", "append_", "(_", "last_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Walk", " ", "the", " ", "rest", " ", "nesting", " ", "the", " ", "entri", "es", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "toc", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "toc", "\\u", "list_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "level_", "=_", "t_", "[_", "'", "level", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "[_", "'", "child", "ren", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reduce", " ", "depth", " ", "if", " ", "current", " ", "level", " ", "<", " ", "last", " ", "item", "'", "s", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "current", "\\u", "level_", "<_", "levels_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pop", " ", "last", " ", "level", " ", "sinc", "e", " ", "we", " ", "know", " ", "we", " ", "are", " ", "less", " ", "than", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "levels_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pop", " ", "parents", " ", "and", " ", "level", "s", " ", "we", " ", "are", " ", "less", " ", "than", " ", "or", " ", "equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "pop_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "reversed_", "(_", "parents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "current", "\\u", "level_", "<=_", "p_", "[_", "'", "level", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "to", "\\u", "pop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "\\u", "pop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "levels_", "=_", "levels_", "[_", ":_", "-_", "to", "\\u", "pop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "parents_", "[_", ":_", "-_", "to", "\\u", "pop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "current", " ", "level", " ", "as", " ", "last_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "levels_", "._", "append_", "(_", "current", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Leve", "l", " ", "is", " ", "the", " ", "same", ",", " ", "so", " ", "append", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "current", " ", "parent", " ", "(", "if", " ", "avail", "able", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current", "\\u", "level_", "==_", "levels_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "parents_", "[_", "-_", "1_", "]_", "[_", "'", "child", "ren", "'_", "]_", "if_", "parents_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "order", "ed", "\\u", "list_", ")_", "._", "append_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curr", "ent", " ", "level", " ", "is", " ", ">", " ", "last", " ", "item", "'", "s", " ", "level", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "make", " ", "last", " ", "item", " ", "a", " ", "parent", " ", "and", " ", "append", " ", "current", " ", "as", " ", "child_", "\\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 ", " _", "last_", "[_", "'", "child", "ren", "'_", "]_", "._", "append_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "._", "append_", "(_", "last_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "levels_", "._", "append_", "(_", "current", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "t_", "\\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_", "order", "ed", "\\u", "list_", "\\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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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 ]
Imprecise assert
azoft-dev-team/imagrium/env/Lib/test/test_strptime_jy.py
[ { "content": " def test_iso8601(self):\n now = datetime.utcnow().replace(microsecond=0)\n self.assertEqual(now, datetime.strptime(now.isoformat('T'), \"%Y-%m-%dT%H:%M:%S\"))\n # tests bug 1662\n self.assertEqual(now, datetime.strptime(now.isoformat('T') + 'Z', \"%Y-%m-%dT%H:%M:%SZ\"))", "metadata": "root.ParsingTests.test_iso8601", "header": "['class', 'ParsingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pars", "ing", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "iso8601_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "now_", ",_", "datetime_", "._", "strptime_", "(_", "now_", "._", "isoformat_", "(_", "'", "T", "'_", ")_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tests", " ", "bug", " ", "166", "2_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "now_", ",_", "datetime_", "._", "strptime_", "(_", "now_", "._", "isoformat_", "(_", "'", "T", "'_", ")_", "+_", "'", "Z", "'_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "SZ", "\"_", ")_", ")_", "\\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 ]
First parameter of a method is not named 'self'
kuri65536/python-for-android/python-modules/twisted/twisted/python/modules.py
[ { "content": " def __init__(self, filePath, pythonPath):\n \"\"\"\n Create a PathEntry. This is a private constructor.\n \"\"\"\n self.filePath = filePath\n self.pythonPath = pythonPath", "metadata": "root.PathEntry.__init__", "header": "['class', 'PathEntry', '(', '_ModuleIteratorHelper', ')', ':', '___EOS___']", "index": 446 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Path", "Entry_", "(_", "\\u", "Modul", "e", "Iterat", "or", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "file", "Path_", ",_", "python", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "Path", "Entr", "y", ".", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "private", " ", "construct", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "Path_", "=_", "file", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "python", "Path_", "=_", "python", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
gregorynicholas/flask-telegram/flask_telegram.py
[ { "content": " def deliver(\n self, recipient, sender=None, in_reply_to=None, references=None,\n provider=None, **context):\n \"\"\"\n deliver message to a recipient.\n\n :param recipient: string address of the recipient\n :param sender: string address of the sender\n :param in_reply_to: string id of a conversation thread to reference\n :param references: reference of a conversation thread\n :param provider: string name of the `TransportProvider`\n :param **context: dict of replacements to set for the message being sent,\n if one or more required paramaters for the template specified is\n missing, raises a `ValueError`\n \"\"\"\n if sender is None:\n sender = self.template.sender\n\n # get config values defined in the flask app..\n flaskapp = current_app._get_current_object()\n #: boolean flag to send through app engine's taskqueue api\n send_as_task = flaskapp.config.get(\"telegram_send_as_task\")\n\n # merge the contexts..\n if context is None:\n context = {}\n context['sender'] = sender\n context['recipient'] = recipient\n\n if not provider:\n provider = flaskapp.config[\"telegram_transport_provider\"]\n\n transporter = load_transport_provider(provider)\n msgtransport = MessageTransport(\n sender=sender,\n recipient=recipient,\n subject=self.subject(context),\n body_text=self.body_text(context),\n body_html=self.body_html(context),\n in_reply_to=in_reply_to,\n references=references)\n\n log.debug(\n \"telegram.deliver recipient: %s, sender: %s, context: %s, \"\n \"transorter: %s, msgtransport: %s\",\n recipient, sender, context, transporter, msgtransport)\n\n # dispatch signal event hook..\n delivery_dispatched.send(msgtransport, transporter=transporter)\n\n if send_as_task:\n from google.appengine.ext import deferred\n #: string name of the taskqueue\n queue_name = flaskapp.config.get(\n \"telegram_taskqueue_name\", 'default')\n deferred.defer(transporter, msgtransport, _queue=queue_name)\n else:\n transporter(msgtransport)", "metadata": "root.Message.deliver", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 148 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deliver", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "recipient_", ",_", "sender_", "=_", "None_", ",_", "in", "\\u", "repl", "y", "\\u", "to_", "=_", "None_", ",_", "references_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provider_", "=_", "None_", ",_", "**_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "deliver", " ", "message", " ", "to", " ", "a", " ", "recip", "ient", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", ":", "param", " ", "recip", "ient", ":", " ", "string", " ", "address", " ", "of", " ", "the", " ", "recip", "ient", "\\", "10", ";", " ", " ", ":", "param", " ", "sender", ":", " ", "string", " ", "address", " ", "of", " ", "the", " ", "sender", "\\", "10", ";", " ", " ", ":", "param", " ", "in", "\\u", "repl", "y", "\\u", "to", ":", " ", "string", " ", "id", " ", "of", " ", "a", " ", "conversation", " ", "thread", " ", "to", " ", "reference", "\\", "10", ";", " ", " ", ":", "param", " ", "reference", "s", ":", " ", "reference", " ", "of", " ", "a", " ", "conversation", " ", "thread", "\\", "10", ";", " ", " ", ":", "param", " ", "provide", "r", ":", " ", "string", " ", "name", " ", "of", " ", "the", " ", "`", "Transp", "ort", "Provider", "`", "\\", "10", ";", " ", " ", ":", "param", " ", "**", "context", ":", " ", "dict", " ", "of", " ", "replace", "ment", "s", " ", "to", " ", "set", " ", "for", " ", "the", " ", "message", " ", "bei", "ng", " ", "sent", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "one", " ", "or", " ", "more", " ", "require", "d", " ", "param", "ater", "s", " ", "for", " ", "the", " ", "template", " ", "specified", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "missi", "ng", ",", " ", "raise", "s", " ", "a", " ", "`", "Value", "Error", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sender_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sender_", "=_", "self_", "._", "template_", "._", "sender_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "config", " ", "values", " ", "defin", "ed", " ", "in", " ", "the", " ", "fla", "sk", " ", "app", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fla", "ska", "pp_", "=_", "current", "\\u", "app_", "._", "\\u", "get", "\\u", "current", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "boolean", " ", "flag", " ", "to", " ", "send", " ", "through", " ", "app", " ", "eng", "ine", "'", "s", " ", "task", "queue", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "send", "\\u", "as", "\\u", "task_", "=_", "fla", "ska", "pp_", "._", "config_", "._", "get_", "(_", "\"", "tele", "gram", "\\u", "send", "\\u", "as", "\\u", "task", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "merge", " ", "the", " ", "context", "s", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "sender", "'_", "]_", "=_", "sender_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "recip", "ient", "'_", "]_", "=_", "recipient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "provider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provider_", "=_", "fla", "ska", "pp_", "._", "config_", "[_", "\"", "tele", "gram", "\\u", "transport", "\\u", "provide", "r", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transport", "er_", "=_", "load", "\\u", "transport", "\\u", "provider_", "(_", "provider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgt", "rans", "port_", "=_", "Messag", "e", "Transport_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sender_", "=_", "sender_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipient_", "=_", "recipient_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "self_", "._", "subject_", "(_", "context_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body", "\\u", "text_", "=_", "self_", "._", "body", "\\u", "text_", "(_", "context_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body", "\\u", "html_", "=_", "self_", "._", "body", "\\u", "html_", "(_", "context_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "repl", "y", "\\u", "to_", "=_", "in", "\\u", "repl", "y", "\\u", "to_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "references_", "=_", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tele", "gram", ".", "deliver", " ", " ", "recip", "ient", ":", " ", "%", "s", ",", " ", "sender", ":", " ", "%", "s", ",", " ", "context", ":", " ", "%", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trans", "orte", "r", ":", " ", "%", "s", ",", " ", "msgt", "rans", "port", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipient_", ",_", "sender_", ",_", "context_", ",_", "transport", "er_", ",_", "msgt", "rans", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dispatch", " ", "signal", " ", "event", " ", "hook", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "delivery", "\\u", "dispatch", "ed_", "._", "send_", "(_", "msgt", "rans", "port_", ",_", "transport", "er_", "=_", "transport", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "send", "\\u", "as", "\\u", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "deferred_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "string", " ", "name", " ", "of", " ", "the", " ", "task", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "fla", "ska", "pp_", "._", "config_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tele", "gram", "\\u", "task", "queue", "\\u", "name", "\"_", ",_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deferred_", "._", "defer_", "(_", "transport", "er_", ",_", "msgt", "rans", "port_", ",_", "\\u", "queue_", "=_", "queue", "\\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 ", " _", "transport", "er_", "(_", "msgt", "rans", "port_", ")_", "\\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,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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 ]
Unused import
silverlogic/djangorestframework-timed-auth-token/tests/app/users/migrations/0002_customuser_is_active.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('users', '0001_initial'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='customuser',\n name='is_active',\n field=models.BooleanField(default=True),\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "users", "'_", ",_", "'", "0001", "\\u", "initial", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "custom", "user", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "is", "\\u", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jasonkeene/python-ubersmith/ubersmith/api.py
[ { "content": "\"\"\"Lower level API, configuration, and HTTP stuff.\"\"\"\nimport six\nimport time\nfrom ubersmith.compat import total_ordering, file_type\n\nimport requests\n\nfrom ubersmith.exceptions import (\n RequestError,\n ResponseError,\n UpdatingTokenResponse,\n MaintenanceResponse,\n)\nfrom ubersmith.utils import (\n append_qs,\n to_nested_php_args,\n get_filename,\n)\n\n__all__ = [\n 'METHODS',\n 'RequestHandler',\n 'get_default_request_handler',\n 'set_default_request_handler',\n]\n\n_DEFAULT_REQUEST_HANDLER = None\n\n\"\"\"A dict of all methods returned by uber.method_list()\"\"\"\nMETHODS = {\n u'client.ach_add': u'Add a New Bank Account',\n u'client.ach_delete': u'Delete a Bank Account',\n u'client.ach_update': u'Update a Bank Account',\n u'client.add': u'Add a New Client',\n u'client.avatar_get': u\"Retrieve a Client Avatar\",\n u'client.avatar_set': u\"Set a Client Avatar\",\n u'client.cc_add': u'Add a New Credit Card',\n u'client.cc_delete': u'Delete a Credit Card',\n u'client.cc_info': u\"List a Client's Credit Card Details\",\n u'client.cc_update': u'Update a Credit Card',\n u'client.comment_list': u\"List a Client's Comments\",\n u'client.contact_add': u'Add a New Contact',\n u'client.contact_delete': u'Delete a Contact',\n u'client.contact_get': u'Get Contact Details',\n u'client.contact_list': u\"List a Client's Contacts\",\n u'client.contact_metadata_get': u\"Get a Contact's Metadata\",\n u'client.contact_metadata_single': u\"Get a Contact's Metadata Value\",\n u'client.contact_update': u'Update a Contact',\n u'client.count': u'Count Active Clients',\n u'client.credit_add': u'Add an Account Credit',\n u'client.credit_apply': u\"Apply a Credit to an Invoice\",\n u'client.credit_comment_list': u\"List a Credit's Comments\",\n u'client.credit_deactivate': u'Deactivate an Account Credit',\n u'client.credit_list': u\"List a Client's Credits\",\n u'client.deactivate': u'Deactivate a Client',\n u'client.domain_add': u'Add a Domain',\n u'client.domain_list': u\"List a Client's Domains\",\n u'client.domain_lookup': u'Look Up a Domain',\n u'client.domain_register': u'Register a Domain',\n u'client.domain_transfer': u'Transfer a Domain',\n u'client.get': u'Get Client Details',\n u'client.invoice_charge': u'Charge an Invoice',\n u'client.invoice_count': u'Count Invoices',\n u'client.invoice_disregard': u'Disregard an Invoice',\n u'client.invoice_generate': u'Generate an Invoice',\n u'client.invoice_get': u'Get an Invoice',\n u'client.invoice_list': u\"List a Client's Invoices\",\n u'client.invoice_payments': u\"List an Invoice's Payments\",\n u'client.invoice_post_gw_payment': u'Record a Payment',\n u'client.latest_client': u'Get the Latest Client',\n u'client.list': u'List Clients',\n u'client.lookup': u'Look Up a Client',\n u'client.metadata_get': u\"Get a Client's Metadata\",\n u'client.metadata_single': u\"Get a Client's Metadata Value\",\n u'client.payment_method_list': u\"List a Client's Payment Methods\",\n u'client.payment_refund': u'Refund a payment.',\n u'client.reactivate': u'Reactivate a Client',\n u'client.renewal_list': u'List Services for Renewal',\n u'client.send_welcome': u'Send a Welcome Letter',\n u'client.service_add': u'Add a New Service',\n u'client.service_comment_list': u\"List a Service's Comments\",\n u'client.service_deactivate': u'Deactivate a Service',\n u'client.service_get': u'Get a Service',\n u'client.service_list': u\"List a Client's Services\",\n u'client.service_metadata_get': u\"Get a Service's Metadata\",\n u'client.service_metadata_single': u\"Get a Service's Metadata Value\",\n u'client.service_module_call': u'Call a Service Module Function',\n u'client.service_prorate': u'Prorate a Service',\n u'client.service_update': u'Update a Service',\n u'client.set_login': u\"Set a Client's Login\",\n u'client.tax_exemption_add': u\"Add a new Tax Exemption\",\n u'client.tax_exemption_get': u\"Get a Client's Tax Exemption\",\n u'client.tax_exemption_list': u\"List a Client's Tax Exemptions\",\n u'client.tax_exemption_update': u\"Update a Client's Tax Exemption\",\n u'client.update': u'Update a Client',\n u'device.add': u'Add a New Device',\n u'device.comment_list': u\"List a Device's Comments\",\n u'device.connection_list': u\"List a Device's Connections\",\n u'device.cpanel_add': u'Add a cPanel Account',\n u'device.delete': u'Delete a Device',\n u'device.event_list': u'List Device Events',\n u'device.facility_list': u'List Device Facilities',\n u'device.get': u'Get a Device',\n u'device.hostname_get': u'Get a Device Hostname',\n u'device.ip_assign': u'Assign an IP to a Device',\n u'device.ip_assignment_add': u'Create a New IP Assignment',\n u'device.ip_assignment_delete': u'Delete a Device IP Assignment',\n u'device.ip_assignment_list': u'List Device IP Assignments',\n u'device.ip_assignment_update': u'Update a Device IP Assignment',\n u'device.ip_block_list': u\"List IP Blocks\",\n u'device.ip_get_available': u'List Available IP Addresses',\n u'device.ip_get_unassigned': u'Get Unassigned IP Addresses',\n u'device.ip_group_add': u'Add a Device IP Group',\n u'device.ip_group_delete': u'Delete a Device IP Group',\n u'device.ip_group_list': u'List a Device IP Group',\n u'device.ip_group_update': u'Update a Device IP Group',\n u'device.ip_lookup': u'Look Up a Device IP',\n u'device.ip_pool_list': u\"List IP Pools\",\n u'device.ip_unassign': u'Unassign a Device IP',\n u'device.list': u'List Devices',\n u'device.module_call': u'Call a Device Module Function',\n u'device.module_call_aggregate': u'Call an Aggregate Device Module Function',\n u'device.module_graph': u'Generate Device Module Graph',\n u'device.monitor_add': u'Add a New Device Monitor',\n u'device.monitor_delete': u'Delete a Device Monitor',\n u'device.monitor_disable': u'Disable a Device Monitor',\n u'device.monitor_enable': u'Enable a Device Monitor',\n u'device.monitor_list': u'List Device Monitors',\n u'device.monitor_update': u'Update a Device Monitor',\n u'device.reboot': u\"Set a Device's Power State\",\n u'device.reboot_graph': u'Get a Reboot Graph',\n u'device.tag': u'Tag a Device',\n u'device.type_list': u'List Device Types',\n u'device.untag': u'Untag a Device',\n u'device.update': u'Update a Device',\n u'device.vlan_get_available': u'List Available VLANs',\n u'order.cancel': u'Cancel an Order',\n u'order.client_respond': u'Post a Client/Lead Order Response',\n u'order.coupon_get': u'Get Order Coupon Details',\n u'order.create': u'Create a New Order',\n u'order.get': u'Get Order Details',\n u'order.list': u'List Orders',\n u'order.process': u'Process an Order',\n u'order.queue_list': u'List Order Queues',\n u'order.respond': u'Post an Order Response',\n u'order.submit': u'Submit An Order',\n u'order.update': u'Update an Order',\n u'sales.opportunity_add': u'Add an Opportunity',\n u'sales.opportunity_list': u'List Opportunities',\n u'sales.opportunity_stage_list': u'List Opportunity Stages',\n u'sales.opportunity_status_list': u'List Opportunity Statuses',\n u'sales.opportunity_type_list': u'List Opportunity Types',\n u'sales.opportunity_update': u'Update an Opportunity',\n u'support.department_get': u'Get Ticket Departments',\n u'support.department_list': u'List Ticket Departments',\n u'support.ticket_count': u'Count Support Tickets',\n u'support.ticket_get': u'Get Support Ticket Details',\n u'support.ticket_list': u'Get a List of Tickets',\n u'support.ticket_merge': u'Merge Tickets',\n u'support.ticket_post_client_response': u'Post a Client Response to a Ticket',\n u'support.ticket_post_list': u'Get all Posts for a Ticket',\n u'support.ticket_post_staff_response': u'Post a Staff Response to a Ticket',\n u'support.ticket_submit': u'Submit a New Ticket',\n u'support.ticket_submit_outgoing': u'Create a New Outgoing Ticket',\n u'support.ticket_type_list': u\"Get a List of Ticket Types\",\n u'support.ticket_update': u'Update a Ticket',\n u'uber.admin_avatar_get': u\"Retrieve an Admin Avatar\",\n u'uber.admin_avatar_set': u\"Set an Admin Avatar\",\n u'uber.admin_get': u\"User Information\",\n u'uber.admin_list': u\"List User Logins\",\n u'uber.api_export': u'Export Data',\n u'uber.attachment_get': u'Get an attachment',\n u'uber.attachment_list': u'List Attachments',\n u'uber.check_login': u'Verify a login and password',\n u'uber.client_permission_list': u\"List available permissions\",\n u'uber.client_welcome_stats': u'Display Client Statistics',\n u'uber.comment_add': u'Add Comment',\n u'uber.comment_delete': u'Delete Comment',\n u'uber.comment_get': u'Get Comments',\n u'uber.comment_list': u'List Comments',\n u'uber.comment_update': u'Update Comment',\n u'uber.documentation': u'Download API Documentation',\n u'uber.event_list': u'Access the Event Log',\n u'uber.file_add': u\"Add a file\",\n u'uber.file_delete': u\"Delete a file\",\n u'uber.file_get': u\"Get a File\",\n u'uber.file_list': u\"Get a List of Files\",\n u'uber.file_update': u\"Update a file\",\n u'uber.forgot_pass': u'Send a Password Reminder',\n u'uber.login_list': u'List User Logins',\n u'uber.mail_get': u'Get an Email From the Log',\n u'uber.mail_list': u'Access the Mail Log',\n u'uber.message_list': u'List Message Board Messages',\n u'uber.metadata_bulk_get': u'Bulk Get Metadata Values',\n u'uber.metadata_get': u'Get Metadata Values',\n u'uber.method_get': u'Get API Method Details',\n u'uber.method_list': u'List Available API Methods',\n u'uber.quick_stats': u'Get Quick System Stats',\n u'uber.quick_stats_detail': u'Get Detailed System Stats',\n u'uber.service_plan_get': u'Get Service Plan Details',\n u'uber.service_plan_list': u'List Service Plans',\n u'uber.tax_exemption_type_get': u\"Get a Tax Exemption Type\",\n u'uber.tax_exemption_type_list': u\"List Tax Exemption Types\",\n u'uber.user_exists': u'Check whether a Client Exists',\n u'uber.username_exists': u'Check Whether a Username Exists',\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 _ProxyModule(object):\n", "metadata": "root._ProxyModule", "header": "['module', '___EOS___']", "index": 208 }, { "content": " def __init__(self, handler, module):\n self.handler = handler\n self.module = module", "metadata": "root._ProxyModule.__init__", "header": "['class', '_ProxyModule', '(', 'object', ')', ':', '___EOS___']", "index": 209 }, { "content": " def __getattr__(self, name):\n \"\"\"Return the call with request_handler prefilled.\"\"\"\n call_func = getattr(self.module, name)\n if callable(call_func):\n call_p = call_func.handler(self.handler)\n # store partial on proxy so it doesn't have to be created again\n setattr(self, name, call_p)\n return call_p\n raise AttributeError(\"'{0}' object has no attribute '{1}'\".format(\n type(self).__name__, name))", "metadata": "root._ProxyModule.__getattr__", "header": "['class', '_ProxyModule', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": "class RequestHandler(object):\n \"\"\"Handles HTTP requests and authentication.\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.RequestHandler", "header": "['module', '___EOS___']", "index": 225 }, { "content": " def __init__(self, base_url, username=None, password=None, verify=True,\n session=None):\n \"\"\"Initialize HTTP request handler with optional authentication.\n\n base_url: URL to send API requests\n username: Username for API access\n password: Password for API access\n verify: Verify HTTPS certificate\n session: requests.Session to send requests with\n\n \"\"\"\n self.base_url = base_url\n self.username = username\n self.password = password\n self.verify = verify\n\n if session is None:\n session = requests.session()\n self._session = session", "metadata": "root.RequestHandler.__init__", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 228 }, { "content": " @property\n def session(self):\n return self._session", "metadata": "root.RequestHandler.session", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 248 }, { "content": " def process_request(self, method, data=None):\n \"\"\"Process request over HTTP to ubersmith instance.\n\n method: Ubersmith API method string\n data: dict of method arguments\n\n \"\"\"\n # make sure requested method is valid\n self._validate_request_method(method)\n\n # attempt the request multiple times\n attempts = 3\n for i in range(attempts):\n response = self._send_request(method, data)\n\n # handle case where ubersmith is 'updating token'\n # see: https://github.com/jasonkeene/python-ubersmith/issues/1\n if self._is_token_response(response):\n if i < attempts - 1:\n # wait 2 secs before retrying request\n time.sleep(2)\n continue\n else:\n raise UpdatingTokenResponse\n break\n\n resp = BaseResponse(response)\n\n # test for error in json response\n if response.headers.get('content-type') == 'application/json':\n if not resp.json.get('status'):\n if all([\n resp.json.get('error_code') == 1,\n resp.json.get('error_message') == u\"We are currently \"\n \"undergoing maintenance, please check back shortly.\",\n ]):\n raise MaintenanceResponse(response=resp.json)\n else:\n raise ResponseError(response=resp.json)\n return resp", "metadata": "root.RequestHandler.process_request", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": " @staticmethod\n def _is_token_response(response):\n return ('text/html' in response.headers.get('content-type', '') and\n 'Updating Token' in response.content)", "metadata": "root.RequestHandler._is_token_response", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 293 }, { "content": " def _send_request(self, method, data):\n url = append_qs(self.base_url, {'method': method})\n data, files, headers = self._encode_data(data)\n return self.session.post(url, data=data, files=files, headers=headers,\n auth=(self.username, self.password),\n verify=self.verify)", "metadata": "root.RequestHandler._send_request", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 298 }, { "content": " @staticmethod\n def _validate_request_method(method):\n \"\"\"Make sure requested method is valid.\"\"\"\n if method not in METHODS:\n raise RequestError(\"Requested method is not valid.\")", "metadata": "root.RequestHandler._validate_request_method", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 305 }, { "content": " @staticmethod\n def _encode_data(data):\n \"\"\"URL encode data.\"\"\"\n data = data if data is not None else {}\n data = to_nested_php_args(data)\n files = dict([\n (key, value) for key, value in\n data.items() if isinstance(value, file_type)])\n for fname in files:\n del data[fname]\n return data, files or None, None", "metadata": "root.RequestHandler._encode_data", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 311 }, { "content": " def __getattr__(self, name):\n \"\"\"If attribute accessed is a call module, return a proxy.\"\"\"\n if name in set(m.split('.')[0] for m in METHODS):\n module_name = 'ubersmith.{0}'.format(name)\n module = __import__(module_name, fromlist=[''])\n proxy = _ProxyModule(self, module)\n # store proxy on handler so it doesn't have to be created again\n setattr(self, name, proxy)\n return proxy\n raise AttributeError(\"'{0}' object has no attribute '{1}'\".format(\n type(self).__name__, name))", "metadata": "root.RequestHandler.__getattr__", "header": "['class', 'RequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 323 }, { "content": "class BaseResponse(object):\n \"\"\"Wraps response object and emulates different types.\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.BaseResponse", "header": "['module', '___EOS___']", "index": 336 }, { "content": " def __init__(self, response):\n self.response = response # requests' response object", "metadata": "root.BaseResponse.__init__", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 338 }, { "content": " @classmethod\n def from_cleaned(cls, response, cleaned):\n resp = cls(response.response)\n resp.cleaned = cleaned\n return resp", "metadata": "root.BaseResponse.from_cleaned", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 341 }, { "content": " @property\n def json(self):\n return self.response.json()", "metadata": "root.BaseResponse.json", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 347 }, { "content": " @property\n def data(self):\n if hasattr(self, \"cleaned\"):\n return self.cleaned\n else:\n return self.json['data']", "metadata": "root.BaseResponse.data", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 351 }, { "content": " @property\n def type(self):\n return self.response.headers.get('content-type')", "metadata": "root.BaseResponse.type", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 358 }, { "content": " def __str__(self):\n return str(self.data)", "metadata": "root.BaseResponse.__str__", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 362 }, { "content": " def __repr__(self):\n return repr(self.data)", "metadata": "root.BaseResponse.__repr__", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def __nonzero__(self):\n return bool(self.data)", "metadata": "root.BaseResponse.__nonzero__", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 368 }, { "content": " def __json__(self):\n \"\"\"This method returns the JSON-serializable representation of the\n Response. To utilize this, create a JSONEncoder which calls the\n __json__ methods of supporting objects. e.g.::\n\n import json\n class MyJSONEncoder(json.JSONEncoder):\n def default(self, o):\n if hasattr(obj, '__json__') and callable(obj.__json__):\n return obj.__json__()\n else:\n return super(MyJSONEncoder, self).default(o)\n\n json.dumps(my_response, cls=MyJSONEncoder)\n \"\"\"\n return self.data", "metadata": "root.BaseResponse.__json__", "header": "['class', 'BaseResponse', '(', 'object', ')', ':', '___EOS___']", "index": 371 }, { "content": "@total_ordering\nclass DictResponse(BaseResponse):\n __marker = object()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.DictResponse", "header": "['module', '___EOS___']", "index": 389 }, { "content": " def keys(self):\n return self.data.keys()", "metadata": "root.DictResponse.keys", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 393 }, { "content": " def iterkeys(self):\n return six.iterkeys(self.data)", "metadata": "root.DictResponse.iterkeys", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 396 }, { "content": " def values(self):\n return self.data.values()", "metadata": "root.DictResponse.values", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 399 }, { "content": " def itervalues(self):\n return six.itervalues(self.data)", "metadata": "root.DictResponse.itervalues", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 402 }, { "content": " def items(self):\n return self.data.items()", "metadata": "root.DictResponse.items", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 405 }, { "content": " def iteritems(self):\n return six.iteritems(self.data)", "metadata": "root.DictResponse.iteritems", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 408 }, { "content": " def get(self, key, default=None):\n return self.data.get(key, default)", "metadata": "root.DictResponse.get", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 411 }, { "content": " def update(self, d):\n self.data.update(d)", "metadata": "root.DictResponse.update", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 414 }, { "content": " def setdefault(self, key, value):\n self.data.setdefault(key, value)", "metadata": "root.DictResponse.setdefault", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 417 }, { "content": " def pop(self, key, default=__marker):\n if default is self.__marker:\n return self.data.pop(key)\n else:\n return self.data.pop(key, default)", "metadata": "root.DictResponse.pop", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 420 }, { "content": " def popitem(self):\n return self.data.popitem()", "metadata": "root.DictResponse.popitem", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 426 }, { "content": " def clear(self):\n self.data.clear()", "metadata": "root.DictResponse.clear", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 429 }, { "content": " def __setitem__(self, key, value):\n self.data[key] = value", "metadata": "root.DictResponse.__setitem__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 432 }, { "content": " def __iter__(self):\n return iter(self.data)", "metadata": "root.DictResponse.__iter__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 435 }, { "content": " def __getitem__(self, key):\n return self.data[key]", "metadata": "root.DictResponse.__getitem__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 438 }, { "content": " def __len__(self):\n return len(self.data)", "metadata": "root.DictResponse.__len__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 441 }, { "content": " def __eq__(self, other):\n return self.data == other", "metadata": "root.DictResponse.__eq__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 444 }, { "content": " def __lt__(self, other):\n return self.data < other", "metadata": "root.DictResponse.__lt__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 447 }, { "content": " def __contains__(self, item):\n return item in self.data", "metadata": "root.DictResponse.__contains__", "header": "['class', 'DictResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 450 }, { "content": "@total_ordering\nclass IntResponse(BaseResponse):\n\n\n\n\n\n\n __index__ = __long__ = __trunc__ = __int__\n\n\n\n\n\n\n __radd__ = __add__\n\n\n\n __rmul__ = __mul__\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n __rand__ = __and__\n\n __ror__ = __or__\n\n __rxor__ = __xor__\n\n\n\n\n\n", "metadata": "root.IntResponse", "header": "['module', '___EOS___']", "index": 454 }, { "content": " @property\n def numerator(self):\n return self.data", "metadata": "root.IntResponse.numerator", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 456 }, { "content": " @property\n def denominator(self):\n return 1", "metadata": "root.IntResponse.denominator", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 460 }, { "content": " @property\n def real(self):\n return self.data", "metadata": "root.IntResponse.real", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 464 }, { "content": " @property\n def imag(self):\n return 0", "metadata": "root.IntResponse.imag", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 468 }, { "content": " def bit_length(self):\n if hasattr(self.data, 'bit_length'):\n return self.data.bit_length()\n else:\n return len(bin(abs(self.data))) - 2", "metadata": "root.IntResponse.bit_length", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 472 }, { "content": " def conjugate(self):\n return self.data", "metadata": "root.IntResponse.conjugate", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 478 }, { "content": " def __int__(self):\n return self.data", "metadata": "root.IntResponse.__int__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 481 }, { "content": " def __float__(self):\n return float(self.data)", "metadata": "root.IntResponse.__float__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 485 }, { "content": " def __oct__(self):\n return oct(self.data)", "metadata": "root.IntResponse.__oct__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 488 }, { "content": " def __hex__(self):\n return hex(self.data)", "metadata": "root.IntResponse.__hex__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 491 }, { "content": " def __eq__(self, other):\n return self.data == other", "metadata": "root.IntResponse.__eq__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 494 }, { "content": " def __lt__(self, other):\n return self.data < other", "metadata": "root.IntResponse.__lt__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 497 }, { "content": " def __add__(self, other):\n return int(self) + other", "metadata": "root.IntResponse.__add__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 500 }, { "content": " def __sub__(self, other):\n return int(self) - other", "metadata": "root.IntResponse.__sub__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 504 }, { "content": " def __rsub__(self, other):\n return other - int(self)", "metadata": "root.IntResponse.__rsub__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 507 }, { "content": " def __mul__(self, other):\n return int(self) * other", "metadata": "root.IntResponse.__mul__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 510 }, { "content": " def __div__(self, other):\n return int(self) / other", "metadata": "root.IntResponse.__div__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 514 }, { "content": " def __rdiv__(self, other):\n return other / int(self)", "metadata": "root.IntResponse.__rdiv__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 517 }, { "content": " def __floordiv__(self, other):\n return int(self) // other", "metadata": "root.IntResponse.__floordiv__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 520 }, { "content": " def __rfloordiv__(self, other):\n return other // int(self)", "metadata": "root.IntResponse.__rfloordiv__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 523 }, { "content": " def __truediv__(self, other):\n return float(self) / other", "metadata": "root.IntResponse.__truediv__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 526 }, { "content": " def __rtruediv__(self, other):\n return other / float(self)", "metadata": "root.IntResponse.__rtruediv__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 529 }, { "content": " def __mod__(self, other):\n return int(self) % other", "metadata": "root.IntResponse.__mod__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 532 }, { "content": " def __rmod__(self, other):\n return other % int(self)", "metadata": "root.IntResponse.__rmod__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 535 }, { "content": " def __pow__(self, other):\n return int(self) ** other", "metadata": "root.IntResponse.__pow__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 538 }, { "content": " def __rpow__(self, other):\n return other ** int(self)", "metadata": "root.IntResponse.__rpow__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 541 }, { "content": " def __abs__(self):\n return abs(self.data)", "metadata": "root.IntResponse.__abs__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 544 }, { "content": " def __neg__(self):\n return -self.data", "metadata": "root.IntResponse.__neg__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 547 }, { "content": " def __pos__(self):\n return self.data", "metadata": "root.IntResponse.__pos__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 550 }, { "content": " def __divmod__(self, other):\n return self // other, self % other", "metadata": "root.IntResponse.__divmod__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 553 }, { "content": " def __rdivmod__(self, other):\n return other // self, other % self", "metadata": "root.IntResponse.__rdivmod__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 556 }, { "content": " def __and__(self, other):\n return self.data & other", "metadata": "root.IntResponse.__and__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 559 }, { "content": " def __or__(self, other):\n return self.data | other", "metadata": "root.IntResponse.__or__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 563 }, { "content": " def __xor__(self, other):\n return self.data ^ other", "metadata": "root.IntResponse.__xor__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 567 }, { "content": " def __lshift__(self, other):\n return self.data << other", "metadata": "root.IntResponse.__lshift__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 571 }, { "content": " def __rlshift__(self, other):\n return other << self.data", "metadata": "root.IntResponse.__rlshift__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 574 }, { "content": " def __rshift__(self, other):\n return self.data >> other", "metadata": "root.IntResponse.__rshift__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 577 }, { "content": " def __rrshift__(self, other):\n return other >> self.data", "metadata": "root.IntResponse.__rrshift__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 580 }, { "content": " def __invert__(self):\n return ~self.data", "metadata": "root.IntResponse.__invert__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 583 }, { "content": " def __nonzero__(self):\n return bool(self.data)", "metadata": "root.IntResponse.__nonzero__", "header": "['class', 'IntResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 586 }, { "content": "class FileResponse(BaseResponse):\n\n", "metadata": "root.FileResponse", "header": "['module', '___EOS___']", "index": 590 }, { "content": " @property\n def json(self):\n raise NotImplementedError", "metadata": "root.FileResponse.json", "header": "['class', 'FileResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 591 }, { "content": " @property\n def data(self):\n return self.response.content", "metadata": "root.FileResponse.data", "header": "['class', 'FileResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 595 }, { "content": " @property\n def filename(self):\n disposition = self.response.headers.get('content-disposition')\n return get_filename(disposition)", "metadata": "root.FileResponse.filename", "header": "['class', 'FileResponse', '(', 'BaseResponse', ')', ':', '___EOS___']", "index": 599 }, { "content": "def get_default_request_handler():\n \"\"\"Return the default request handler.\"\"\"\n if not _DEFAULT_REQUEST_HANDLER:\n raise Exception(\"Request handler required but no default was found.\")\n return _DEFAULT_REQUEST_HANDLER", "metadata": "root.get_default_request_handler", "header": "['module', '___EOS___']", "index": 605 }, { "content": "def set_default_request_handler(request_handler):\n \"\"\"Set the default request handler.\"\"\"\n if not isinstance(request_handler, RequestHandler):\n raise TypeError(\n \"Attempted to set an invalid request handler as default.\")\n global _DEFAULT_REQUEST_HANDLER\n _DEFAULT_REQUEST_HANDLER = request_handler", "metadata": "root.set_default_request_handler", "header": "['module', '___EOS___']", "index": 612 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Lower", " ", "level", " ", "API", ",", " ", "configura", "tion", ",", " ", "and", " ", "HTTP", " ", "stu", "ff", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "uber", "smit", "h_", "._", "compat_", "import_", "total", "\\u", "ordering_", ",_", "file", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "uber", "smit", "h_", "._", "exceptions_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Respons", "e", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Up", "dati", "ng", "Token", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Maint", "ena", "nce", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "uber", "smit", "h_", "._", "utils_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "append", "\\u", "qs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "nest", "ed", "\\u", "php", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "METH", "OD", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Request", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "\\u", "default", "\\u", "request", "\\u", "handler", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "default", "\\u", "request", "\\u", "handler", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DEF", "AUL", "T", "\\u", "REQUEST", "\\u", "HANDLER", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "A", " ", "dict", " ", "of", " ", "all", " ", "method", "s", " ", "return", "ed", " ", "by", " ", "uber", ".", "method", "\\u", "list", "()\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "METHODS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "ach", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Bank", " ", "Account", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "ach", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Bank", " ", "Account", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "ach", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Bank", " ", "Account", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "avat", "ar", "\\u", "get", "'_", ":_", "u", "\"", "Retrieve", " ", "a", " ", "Client", " ", "Ava", "tar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "avat", "ar", "\\u", "set", "'_", ":_", "u", "\"", "Set", " ", "a", " ", "Client", " ", "Ava", "tar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "cc", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Credit", " ", "Card", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "cc", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Credit", " ", "Card", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "cc", "\\u", "info", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Credit", " ", "Card", " ", "Det", "ail", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "cc", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Credit", " ", "Card", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "comment", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Comme", "nts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Conta", "ct", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Conta", "ct", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Conta", "ct", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Conta", "ct", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "metadata", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Conta", "ct", "'", "s", " ", "Meta", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "metadata", "\\u", "single", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Conta", "ct", "'", "s", " ", "Meta", "data", " ", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "contact", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Conta", "ct", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "count", "'_", ":_", "u", "'", "Count", " ", "Activ", "e", " ", "Client", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "credit", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "an", " ", "Account", " ", "Credit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "credit", "\\u", "appl", "y", "'_", ":_", "u", "\"", "Apply", " ", "a", " ", "Credit", " ", "to", " ", "an", " ", "Invoice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "credit", "\\u", "comment", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Credit", "'", "s", " ", "Comme", "nts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "credit", "\\u", "deactivate", "'_", ":_", "u", "'", "Dea", "ctivat", "e", " ", "an", " ", "Account", " ", "Credit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "credit", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Credit", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "deactivate", "'_", ":_", "u", "'", "Dea", "ctivat", "e", " ", "a", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "domain", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "Doma", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "domain", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Doma", "ins", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "domain", "\\u", "look", "up", "'_", ":_", "u", "'", "Look", " ", "Up", " ", "a", " ", "Doma", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "domain", "\\u", "register", "'_", ":_", "u", "'", "Register", " ", "a", " ", "Doma", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "domain", "\\u", "transfer", "'_", ":_", "u", "'", "Transfer", " ", "a", " ", "Doma", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "get", "'_", ":_", "u", "'", "Get", " ", "Client", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "charge", "'_", ":_", "u", "'", "Charge", " ", "an", " ", "Invoice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "count", "'_", ":_", "u", "'", "Count", " ", "Invoice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "dis", "rega", "rd", "'_", ":_", "u", "'", "Dis", "rega", "rd", " ", "an", " ", "Invoice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "generat", "e", "'_", ":_", "u", "'", "Generate", " ", "an", " ", "Invoice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "get", "'_", ":_", "u", "'", "Get", " ", "an", " ", "Invoice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Invoice", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "payments", "'_", ":_", "u", "\"", "List", " ", "an", " ", "Invoice", "'", "s", " ", "Payment", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "invoic", "e\\u", "post", "\\u", "gw", "\\u", "pay", "ment", "'_", ":_", "u", "'", "Record", " ", "a", " ", "Payment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "late", "st", "\\u", "client", "'_", ":_", "u", "'", "Get", " ", "the", " ", "Late", "st", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "list", "'_", ":_", "u", "'", "List", " ", "Client", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "look", "up", "'_", ":_", "u", "'", "Look", " ", "Up", " ", "a", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "metadata", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Client", "'", "s", " ", "Meta", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "metadata", "\\u", "single", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Client", "'", "s", " ", "Meta", "data", " ", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "pay", "ment", "\\u", "method", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Payment", " ", "Meth", "ods", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "pay", "ment", "\\u", "refund", "'_", ":_", "u", "'", "Refu", "nd", " ", "a", " ", "pay", "ment", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "reacti", "vat", "e", "'_", ":_", "u", "'", "React", "iva", "te", " ", "a", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "renew", "al", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Service", "s", " ", "for", " ", "Ren", "ewa", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "send", "\\u", "welcome", "'_", ":_", "u", "'", "Sen", "d", " ", "a", " ", "Wel", "come", " ", "Letter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "comment", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Service", "'", "s", " ", "Comme", "nts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "deactivate", "'_", ":_", "u", "'", "Dea", "ctivat", "e", " ", "a", " ", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "a", " ", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Service", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "metadata", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Service", "'", "s", " ", "Meta", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "metadata", "\\u", "single", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Service", "'", "s", " ", "Meta", "data", " ", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "module", "\\u", "call", "'_", ":_", "u", "'", "Call", " ", "a", " ", "Service", " ", "Modul", "e", " ", "Function", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "pro", "rate", "'_", ":_", "u", "'", "Pro", "rate", " ", "a", " ", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "service", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "set\\u", "login", "'_", ":_", "u", "\"", "Set", " ", "a", " ", "Client", "'", "s", " ", "Logi", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "tax", "\\u", "exemp", "tion", "\\u", "add", "'_", ":_", "u", "\"", "Add", " ", "a", " ", "new", " ", "Tax", " ", "Exe", "mption", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "tax", "\\u", "exemp", "tion", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Client", "'", "s", " ", "Tax", " ", "Exe", "mption", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "tax", "\\u", "exemp", "tion", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Client", "'", "s", " ", "Tax", " ", "Exe", "mption", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "tax", "\\u", "exemp", "tion", "\\u", "update", "'_", ":_", "u", "\"", "Update", " ", "a", " ", "Client", "'", "s", " ", "Tax", " ", "Exe", "mption", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "client", ".", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "comment", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Dev", "ice", "'", "s", " ", "Comme", "nts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "connecti", "on", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "a", " ", "Dev", "ice", "'", "s", " ", "Connect", "ion", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "cpa", "nel", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "c", "Pane", "l", " ", "Account", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "event", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ice", " ", "Event", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "facilit", "y", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ice", " ", "Faci", "lities", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "get", "'_", ":_", "u", "'", "Get", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "host", "name", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "a", " ", "Dev", "ice", " ", "Host", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "assign", "'_", ":_", "u", "'", "Assign", " ", "an", " ", "IP", " ", "to", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "assign", "ment", "\\u", "add", "'_", ":_", "u", "'", "Creat", "e", " ", "a", " ", "New", " ", "IP", " ", "Assign", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "assign", "ment", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Assign", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "assign", "ment", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ice", " ", "IP", " ", "Assign", "ment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "assign", "ment", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Assign", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "block", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "IP", " ", "Block", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "get", "\\u", "avail", "able", "'_", ":_", "u", "'", "List", " ", "Avail", "able", " ", "IP", " ", "Address", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "get", "\\u", "unassign", "ed", "'_", ":_", "u", "'", "Get", " ", "Una", "ssi", "gned", " ", "IP", " ", "Address", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "group", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "group", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "group", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "group", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Dev", "ice", " ", "IP", " ", "Group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "look", "up", "'_", ":_", "u", "'", "Look", " ", "Up", " ", "a", " ", "Dev", "ice", " ", "IP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "pool", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "IP", " ", "Pools", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "ip", "\\u", "unassign", "'_", ":_", "u", "'", "Una", "ssi", "gn", " ", "a", " ", "Dev", "ice", " ", "IP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ices", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "module", "\\u", "call", "'_", ":_", "u", "'", "Call", " ", "a", " ", "Dev", "ice", " ", "Modul", "e", " ", "Function", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "module", "\\u", "call", "\\u", "aggre", "gate", "'_", ":_", "u", "'", "Call", " ", "an", " ", "Aggregate", " ", "Dev", "ice", " ", "Modul", "e", " ", "Function", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "module", "\\u", "graph", "'_", ":_", "u", "'", "Generate", " ", "Dev", "ice", " ", "Modul", "e", " ", "Graph", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "a", " ", "New", " ", "Dev", "ice", " ", "Monitor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "a", " ", "Dev", "ice", " ", "Monitor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "disable", "'_", ":_", "u", "'", "Disa", "ble", " ", "a", " ", "Dev", "ice", " ", "Monitor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "enable", "'_", ":_", "u", "'", "Enable", " ", "a", " ", "Dev", "ice", " ", "Monitor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ice", " ", "Monitor", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "monit", "or", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Dev", "ice", " ", "Monitor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "rebo", "ot", "'_", ":_", "u", "\"", "Set", " ", "a", " ", "Dev", "ice", "'", "s", " ", "Power", " ", "State", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "rebo", "ot", "\\u", "graph", "'_", ":_", "u", "'", "Get", " ", "a", " ", "Reboot", " ", "Graph", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "tag", "'_", ":_", "u", "'", "Ta", "g", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "type", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Dev", "ice", " ", "Type", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "unta", "g", "'_", ":_", "u", "'", "Unt", "ag", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Dev", "ice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "device", ".", "vlan", "\\u", "get", "\\u", "avail", "able", "'_", ":_", "u", "'", "List", " ", "Avail", "able", " ", "VLAN", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "cancel", "'_", ":_", "u", "'", "Cancel", " ", "an", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "client", "\\u", "respond", "'_", ":_", "u", "'", "Post", " ", "a", " ", "Client", "/", "Lead", " ", "Order", " ", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "coupon", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Order", " ", "Coup", "on", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "create", "'_", ":_", "u", "'", "Creat", "e", " ", "a", " ", "New", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "get", "'_", ":_", "u", "'", "Get", " ", "Order", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "list", "'_", ":_", "u", "'", "List", " ", "Order", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "process", "'_", ":_", "u", "'", "Process", " ", "an", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "queue", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Order", " ", "Queue", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "respond", "'_", ":_", "u", "'", "Post", " ", "an", " ", "Order", " ", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "submit", "'_", ":_", "u", "'", "Submit", " ", "An", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "order", ".", "update", "'_", ":_", "u", "'", "Update", " ", "an", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "an", " ", "Oppo", "rtu", "nit", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Oppo", "rtu", "niti", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "stage", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Oppo", "rtu", "nit", "y", " ", "Stage", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "status", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Oppo", "rtu", "nit", "y", " ", "Status", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "type", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Oppo", "rtu", "nit", "y", " ", "Type", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "sales", ".", "opportunit", "y", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "an", " ", "Oppo", "rtu", "nit", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "department", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Ticke", "t", " ", "Depart", "ment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "department", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Ticke", "t", " ", "Depart", "ment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "count", "'_", ":_", "u", "'", "Count", " ", "Supp", "ort", " ", "Ticke", "ts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Supp", "ort", " ", "Ticke", "t", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "list", "'_", ":_", "u", "'", "Get", " ", "a", " ", "List", " ", "of", " ", "Ticke", "ts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "merge", "'_", ":_", "u", "'", "Merge", " ", "Ticke", "ts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "post", "\\u", "client", "\\u", "response", "'_", ":_", "u", "'", "Post", " ", "a", " ", "Client", " ", "Respons", "e", " ", "to", " ", "a", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "post", "\\u", "list", "'_", ":_", "u", "'", "Get", " ", "all", " ", "Posts", " ", "for", " ", "a", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "post", "\\u", "sta", "ff", "\\u", "response", "'_", ":_", "u", "'", "Post", " ", "a", " ", "Sta", "ff", " ", "Respons", "e", " ", "to", " ", "a", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "submit", "'_", ":_", "u", "'", "Submit", " ", "a", " ", "New", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "submit", "\\u", "outgoing", "'_", ":_", "u", "'", "Creat", "e", " ", "a", " ", "New", " ", "Out", "goi", "ng", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "type", "\\u", "list", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "List", " ", "of", " ", "Ticke", "t", " ", "Type", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "support", ".", "tick", "et", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "a", " ", "Ticke", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "admin", "\\u", "avat", "ar", "\\u", "get", "'_", ":_", "u", "\"", "Retrieve", " ", "an", " ", "Admi", "n", " ", "Ava", "tar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "admin", "\\u", "avat", "ar", "\\u", "set", "'_", ":_", "u", "\"", "Set", " ", "an", " ", "Admi", "n", " ", "Ava", "tar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "admin", "\\u", "get", "'_", ":_", "u", "\"", "User", " ", "Information", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "admin", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "User", " ", "Logi", "ns", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "api", "\\u", "export", "'_", ":_", "u", "'", "Export", " ", "Data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "attach", "ment", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "an", " ", "attach", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "attach", "ment", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Attach", "ment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "check", "\\u", "login", "'_", ":_", "u", "'", "Verify", " ", "a", " ", "login", " ", "and", " ", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "client", "\\u", "permissi", "on", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "avail", "able", " ", "permissi", "ons", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "client", "\\u", "welcome", "\\u", "stats", "'_", ":_", "u", "'", "Display", " ", "Client", " ", "Statistic", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "comment", "\\u", "add", "'_", ":_", "u", "'", "Add", " ", "Comme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "comment", "\\u", "delete", "'_", ":_", "u", "'", "Delete", " ", "Comme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "comment", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Comme", "nts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "comment", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Comme", "nts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "comment", "\\u", "update", "'_", ":_", "u", "'", "Update", " ", "Comme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "documentation", "'_", ":_", "u", "'", "Down", "load", " ", "API", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "event", "\\u", "list", "'_", ":_", "u", "'", "Access", " ", "the", " ", "Event", " ", "Log", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "file", "\\u", "add", "'_", ":_", "u", "\"", "Add", " ", "a", " ", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "file", "\\u", "delete", "'_", ":_", "u", "\"", "Delete", " ", "a", " ", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "file", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "File", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "file", "\\u", "list", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "List", " ", "of", " ", "Files", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "file", "\\u", "update", "'_", ":_", "u", "\"", "Update", " ", "a", " ", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "forgo", "t", "\\u", "pass", "'_", ":_", "u", "'", "Sen", "d", " ", "a", " ", "Passw", "ord", " ", "Remi", "nder", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "login", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "User", " ", "Logi", "ns", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "mail", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "an", " ", "Ema", "il", " ", "Fro", "m", " ", "the", " ", "Log", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "mail", "\\u", "list", "'_", ":_", "u", "'", "Access", " ", "the", " ", "Mail", " ", "Log", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "message", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Messag", "e", " ", "Boa", "rd", " ", "Messag", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "metadata", "\\u", "bul", "k", "\\u", "get", "'_", ":_", "u", "'", "Bul", "k", " ", "Get", " ", "Meta", "data", " ", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "metadata", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Meta", "data", " ", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "method", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "API", " ", "Meth", "od", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "method", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Avail", "able", " ", "API", " ", "Meth", "ods", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "quick", "\\u", "stats", "'_", ":_", "u", "'", "Get", " ", "Qui", "ck", " ", "System", " ", "Stat", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "quick", "\\u", "stats", "\\u", "deta", "il", "'_", ":_", "u", "'", "Get", " ", "Det", "ail", "ed", " ", "System", " ", "Stat", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "service", "\\u", "plan", "\\u", "get", "'_", ":_", "u", "'", "Get", " ", "Service", " ", "Plan", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "service", "\\u", "plan", "\\u", "list", "'_", ":_", "u", "'", "List", " ", "Service", " ", "Plan", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "tax", "\\u", "exemp", "tion", "\\u", "type", "\\u", "get", "'_", ":_", "u", "\"", "Get", " ", "a", " ", "Tax", " ", "Exe", "mption", " ", "Type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "tax", "\\u", "exemp", "tion", "\\u", "type", "\\u", "list", "'_", ":_", "u", "\"", "List", " ", "Tax", " ", "Exe", "mption", " ", "Type", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "user", "\\u", "exist", "s", "'_", ":_", "u", "'", "Check", " ", "whe", "ther", " ", "a", " ", "Client", " ", "Exist", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "uber", ".", "user", "name", "\\u", "exist", "s", "'_", ":_", "u", "'", "Check", " ", "Whe", "ther", " ", "a", " ", "User", "name", " ", "Exist", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u", "Pro", "xy", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pro", "xy", "Module_", "(_", "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_", ",_", "handler_", ",_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module_", "=_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pro", "xy", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "call", " ", "with", " ", "request", "\\u", "handler", " ", "prefi", "lle", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "func_", "=_", "getattr_", "(_", "self_", "._", "module_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "call", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "p_", "=_", "call", "\\u", "func_", "._", "handler_", "(_", "self_", "._", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "partial", " ", "on", " ", "proxy", " ", "so", " ", "it", " ", "doe", "sn", "'", "t", " ", "have", " ", "to", " ", "be", " ", "created", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "name_", ",_", "call", "\\u", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "call", "\\u", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "\"'{", "0", "}'", " ", "object", " ", "has", " ", "no", " ", "attribute", " ", "'{", "1", "}'\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "HTTP", " ", "request", "s", " ", "and", " ", "authenticat", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "base", "\\u", "url_", ",_", "username_", "=_", "None_", ",_", "password_", "=_", "None_", ",_", "verify_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "HTTP", " ", "request", " ", "handler", " ", "with", " ", "option", "al", " ", "authenticat", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "base", "\\u", "url", ":", " ", "URL", " ", "to", " ", "send", " ", "API", " ", "request", "s", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "User", "name", " ", "for", " ", "API", " ", "access", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "Passw", "ord", " ", "for", " ", "API", " ", "access", "\\", "10", ";", " ", " ", " ", " ", "verify", ":", " ", "Verify", " ", "HTTP", "S", " ", "certifica", "te", "\\", "10", ";", " ", " ", " ", " ", "session", ":", " ", "request", "s", ".", "Sess", "ion", " ", "to", " ", "send", " ", "request", "s", " ", "with", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base", "\\u", "url_", "=_", "base", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "username_", "=_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verify_", "=_", "verify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "requests_", "._", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "session_", "=_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "session_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "request_", "(_", "self_", ",_", "method_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Process", " ", "request", " ", "over", " ", "HTTP", " ", "to", " ", "uber", "smit", "h", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "method", ":", " ", "Ub", "ers", "mit", "h", " ", "API", " ", "method", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "data", ":", " ", "dict", " ", "of", " ", "method", " ", "argu", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "request", "ed", " ", "method", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "validat", "e\\u", "request", "\\u", "method_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "the", " ", "request", " ", "multiple", " ", "times_", "\\u\\u\\uNL\\u\\u\\u_", "attempts_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "attempts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u", "send", "\\u", "request_", "(_", "method_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", " ", "case", " ", "where", " ", "uber", "smit", "h", " ", "is", " ", "'", "updat", "ing", " ", "token", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "jas", "onk", "een", "e", "/", "python", "-", "uber", "smit", "h", "/", "issue", "s", "/", "1_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "token", "\\u", "response_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "<_", "attempts_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wait", " ", "2", " ", "secs", " ", "bef", "ore", " ", "retrying", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Up", "dati", "ng", "Token", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "Base", "Response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "for", " ", "error", " ", "in", " ", "json", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "headers_", "._", "get_", "(_", "'", "content", "-", "type", "'_", ")_", "==_", "'", "applica", "tion", "/", "json", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "resp_", "._", "json_", "._", "get_", "(_", "'", "status", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "all_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "._", "json_", "._", "get_", "(_", "'", "error", "\\u", "code", "'_", ")_", "==_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "._", "json_", "._", "get_", "(_", "'", "error", "\\u", "message", "'_", ")_", "==_", "u", "\"", "We", " ", "are", " ", "currentl", "y", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "under", "goi", "ng", " ", "maintenance", ",", " ", "plea", "se", " ", "check", " ", "back", " ", "short", "ly", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Maint", "ena", "nce", "Response_", "(_", "response_", "=_", "resp_", "._", "json_", ")_", "\\u\\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_", "Respons", "e", "Error_", "(_", "response_", "=_", "resp_", "._", "json_", ")_", "\\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_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "is", "\\u", "token", "\\u", "response_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "text", "/", "html", "'_", "in_", "response_", "._", "headers_", "._", "get_", "(_", "'", "content", "-", "type", "'_", ",_", "''_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Up", "dati", "ng", " ", "Token", "'_", "in_", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send", "\\u", "request_", "(_", "self_", ",_", "method_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "append", "\\u", "qs_", "(_", "self_", "._", "base", "\\u", "url_", ",_", "{_", "'", "method", "'_", ":_", "method_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", ",_", "files_", ",_", "headers_", "=_", "self_", "._", "\\u", "encode", "\\u", "data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "session_", "._", "post_", "(_", "url_", ",_", "data_", "=_", "data_", ",_", "files_", "=_", "files_", ",_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth_", "=_", "(_", "self_", "._", "username_", ",_", "self_", "._", "password_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verify_", "=_", "self_", "._", "verify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "validat", "e\\u", "request", "\\u", "method_", "(_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "sure", " ", "request", "ed", " ", "method", " ", "is", " ", "valid", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "method_", "not_", "in_", "METHODS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Request", "Error_", "(_", "\"", "Requeste", "d", " ", "method", " ", "is", " ", "not", " ", "valid", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "encode", "\\u", "data_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "URL", " ", "encode", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "if_", "data_", "is_", "not_", "None_", "else_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "to", "\\u", "nest", "ed", "\\u", "php", "\\u", "args_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", ",_", "value_", ")_", "for_", "key_", ",_", "value_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "items_", "(_", ")_", "if_", "isinstance_", "(_", "value_", ",_", "file", "\\u", "type_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fname_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "data_", "[_", "fname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", ",_", "files_", "or_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "attribute", " ", "accesse", "d", " ", "is", " ", "a", " ", "call", " ", "module", ",", " ", "return", " ", "a", " ", "proxy", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "set_", "(_", "m_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "for_", "m_", "in_", "METHODS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "name_", "=_", "'", "uber", "smit", "h", ".", "{", "0", "}'_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "module", "\\u", "name_", ",_", "froml", "ist_", "=_", "[_", "''_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy_", "=_", "\\u", "Pro", "xy", "Module_", "(_", "self_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "proxy", " ", "on", " ", "handler", " ", "so", " ", "it", " ", "doe", "sn", "'", "t", " ", "have", " ", "to", " ", "be", " ", "created", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "name_", ",_", "proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "\"'{", "0", "}'", " ", "object", " ", "has", " ", "no", " ", "attribute", " ", "'{", "1", "}'\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wra", "ps", " ", "response", " ", "object", " ", "and", " ", "emulate", "s", " ", "different", " ", "types", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "=_", "response_", "#", " ", "request", "s", "'", " ", "response", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "cleaned_", "(_", "cls_", ",_", "response_", ",_", "cleaned_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "cls_", "(_", "response_", "._", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "cleaned_", "=_", "cleaned_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "clean", "ed", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "cleaned_", "\\u\\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_", "._", "json_", "[_", "'", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response_", "._", "headers_", "._", "get_", "(_", "'", "content", "-", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "json", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "return", "s", " ", "the", " ", "JSO", "N", "-", "serializable", " ", "represent", "ation", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Respons", "e", ".", " ", "To", " ", "utiliz", "e", " ", "this", ",", " ", "create", " ", "a", " ", "JSO", "NE", "ncode", "r", " ", "whi", "ch", " ", "calls", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "json", "\\u\\u", " ", "method", "s", " ", "of", " ", "support", "ing", " ", "object", "s", ".", " ", "e", ".", "g", ".:", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "json", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "JSO", "NE", "ncode", "r", "(", "json", ".", "JSO", "NE", "ncode", "r", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "default", "(", "self", ",", " ", "o", "):", "\\", "10", ";", " ", " ", "if", " ", "has", "attr", "(", "obj", ",", " ", "'\\u", "\\u", "json", "\\u\\u'", ")", " ", "and", " ", "calla", "ble", "(", "obj", ".\\u", "\\u", "json", "\\u\\u)", ":", "\\", "10", ";", " ", " ", "return", " ", "obj", ".\\u", "\\u", "json", "\\u\\u()", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "return", " ", "super", "(", "My", "JSO", "NE", "ncode", "r", ",", " ", "self", ").", "default", "(", "o", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "json", ".", "dump", "s", "(", "my", "\\u", "response", ",", " ", "cls", "=", "My", "JSO", "NE", "ncode", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "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_", "@_", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "marker_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iterkeys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "six_", "._", "iterkeys_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "itervalues_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "six_", "._", "itervalues_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iteritems_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "six_", "._", "iteritems_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "get_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setdefault_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "setdefault_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "\\u\\u", "marker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "default_", "is_", "self_", "._", "\\u\\u", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "pop_", "(_", "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 ", " _", "return_", "self_", "._", "data_", "._", "pop_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "popi", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "popi", "tem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "item_", "in_", "self_", "._", "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_", "@_", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u", "index", "\\u\\u_", "=_", "\\u\\u", "long", "\\u\\u_", "=_", "\\u\\u", "trunc", "\\u\\u_", "=_", "\\u\\u", "int\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rad", "d\\u\\u_", "=_", "\\u\\u", "add\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rm", "ul", "\\u\\u_", "=_", "\\u\\u", "mul\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rand", "\\u\\u_", "=_", "\\u\\u", "and", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "ror", "\\u\\u_", "=_", "\\u\\u", "or\\u\\u", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rx", "or\\u\\u", "_", "=_", "\\u\\u", "xor", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "numerator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "denominator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "real_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "imag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bit", "\\u", "length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "data_", ",_", "'", "bit", "\\u", "length", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "bit", "\\u", "length_", "(_", ")_", "\\u\\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_", "len_", "(_", "bin_", "(_", "abs_", "(_", "self_", "._", "data_", ")_", ")_", ")_", "-_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "conjugate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "int\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "float", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "oct", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "oct", "_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hex", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hex_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "+_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "-_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rsu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "-_", "int_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "*_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "/_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rdi", "v", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "/_", "int_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "floor", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "//_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rfl", "oor", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "//_", "int_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "true", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "self_", ")_", "/_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rtr", "ued", "iv", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "/_", "float_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mod", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "%_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rmo", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "%_", "int_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pow", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", ")_", "**_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rpo", "w", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "**_", "int_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "abs", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "abs_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pos", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "div", "mod", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "//_", "other_", ",_", "self_", "%_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rdi", "vmo", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "//_", "self_", ",_", "other_", "%_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "and", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "&_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "or\\u\\u", "_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "|_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "xor", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "^_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "lsh", "ift", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "<<_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rls", "hift", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "<<_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rshi", "ft", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", ">>_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rr", "shift", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", ">>_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "invert", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "~_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "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_", "File", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "File", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Response_", "(_", "Base", "Response_", ")_", ":_", "\\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_", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disposition", "_", "=_", "self_", "._", "response_", "._", "headers_", "._", "get_", "(_", "'", "content", "-", "disposition", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "\\u", "filename_", "(_", "disposition", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "default", "\\u", "request", "\\u", "handler_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "default", " ", "request", " ", "handler", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "DEF", "AUL", "T", "\\u", "REQUEST", "\\u", "HANDLER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Request", " ", "handler", " ", "require", "d", " ", "but", " ", "no", " ", "default", " ", "was", " ", "found", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "DEF", "AUL", "T", "\\u", "REQUEST", "\\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_", "def_", "set\\u", "default", "\\u", "request", "\\u", "handler_", "(_", "request", "\\u", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "default", " ", "request", " ", "handler", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "request", "\\u", "handler_", ",_", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Atte", "mpte", "d", " ", "to", " ", "set", " ", "an", " ", "invalid", " ", "request", " ", "handler", " ", "as", " ", "default", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_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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 ]
Unused import
romanalexander/opendota/dotastats/ajax.py
[ { "content": "from dajax.core import Dajax\nfrom dajaxice.decorators import dajaxice_register\nfrom django.template.loader import render_to_string\nfrom dotastats.models import Heroes, SteamPlayer\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@dajaxice_register\ndef search_matches(request, search_request):\n if len(search_request) < 2:\n return None\n dajax = Dajax()\n dajax.add_data(\"<tr><td>TestData</td></tr>\", 'render_matches')\n return dajax.json()", "metadata": "root.search_matches", "header": "['module', '___EOS___']", "index": 5 }, { "content": "@dajaxice_register\ndef search_players(request, search_request):\n if len(search_request) < 2:\n return None\n dajax = Dajax()\n result_set = SteamPlayer.filter_by_name(name=search_request, profileurl=search_request, communityid=search_request)\n result_string = render_to_string('ajax/search_results_players.html', dictionary=dict({'results': result_set}))\n dajax.add_data(result_string, 'render_players')\n return dajax.json()", "metadata": "root.search_players", "header": "['module', '___EOS___']", "index": 13 }, { "content": "@dajaxice_register\ndef search_heroes(request, search_request):\n if len(search_request) < 2:\n return None\n dajax = Dajax()\n result_set = Heroes.objects.filter(dota2_name__icontains=search_request)[:25]\n result_string = render_to_string('ajax/search_results_hero.html', dictionary=dict({'results': result_set})) \n dajax.add_data(result_string, 'render_heroes')\n return dajax.json()", "metadata": "root.search_heroes", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "da", "jax_", "._", "core_", "import_", "Da", "jax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "da", "jax", "ice_", "._", "decorators_", "import_", "da", "jax", "ice", "\\u", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "render", "\\u", "to", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dot", "asta", "ts_", "._", "models_", "import_", "Hero", "es_", ",_", "Ste", "am", "Player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "da", "jax", "ice", "\\u", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "search", "\\u", "matches_", "(_", "request_", ",_", "search", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "search", "\\u", "request_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "jax_", "=_", "Da", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "jax_", "._", "add", "\\u", "data_", "(_", "\"<", "tr", "><", "td", ">", "Test", "Data", "</", "td", "><", "/", "tr", ">\"_", ",_", "'", "render", "\\u", "matche", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "da", "jax_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "da", "jax", "ice", "\\u", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "search", "\\u", "players_", "(_", "request_", ",_", "search", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "search", "\\u", "request_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "jax_", "=_", "Da", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "set_", "=_", "Ste", "am", "Player_", "._", "filter", "\\u", "by", "\\u", "name_", "(_", "name_", "=_", "search", "\\u", "request_", ",_", "profile", "url_", "=_", "search", "\\u", "request_", ",_", "communi", "ty", "id_", "=_", "search", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "string_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "'", "aja", "x", "/", "search", "\\u", "results", "\\u", "player", "s", ".", "html", "'_", ",_", "dictionary_", "=_", "dict_", "(_", "{_", "'", "results", "'_", ":_", "result", "\\u", "set_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "jax_", "._", "add", "\\u", "data_", "(_", "result", "\\u", "string_", ",_", "'", "render", "\\u", "player", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "da", "jax_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "da", "jax", "ice", "\\u", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "search", "\\u", "hero", "es_", "(_", "request_", ",_", "search", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "search", "\\u", "request_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "jax_", "=_", "Da", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "set_", "=_", "Hero", "es_", "._", "objects_", "._", "filter_", "(_", "dot", "a2", "\\u", "name", "\\u\\u", "icontains_", "=_", "search", "\\u", "request_", ")_", "[_", ":_", "25_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "string_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "'", "aja", "x", "/", "search", "\\u", "results", "\\u", "hero", ".", "html", "'_", ",_", "dictionary_", "=_", "dict_", "(_", "{_", "'", "results", "'_", ":_", "result", "\\u", "set_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "jax_", "._", "add", "\\u", "data_", "(_", "result", "\\u", "string_", ",_", "'", "render", "\\u", "hero", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "da", "jax_", "._", "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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
daviddrysdale/python-phonenumbers/python/phonenumbers/shortdata/region_TV.py
[ { "content": "\"\"\"Auto-generated file, do not edit by hand. TV metadata\"\"\"\nfrom ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata\n\nPHONE_METADATA_TV = PhoneMetadata(id='TV', country_code=None, international_prefix=None,\n general_desc=PhoneNumberDesc(national_number_pattern='[19]\\\\d{2}', possible_number_pattern='\\\\d{3}'),\n toll_free=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n premium_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n emergency=PhoneNumberDesc(national_number_pattern='911', possible_number_pattern='\\\\d{3}', example_number='911'),\n short_code=PhoneNumberDesc(national_number_pattern='1\\\\d{2}|911', possible_number_pattern='\\\\d{3}', example_number='911'),\n standard_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n carrier_specific=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n short_data=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Auto", "-", "generat", "ed", " ", "file", ",", " ", "do", " ", "not", " ", "edit", " ", "by", " ", "hand", ".", " ", "TV", " ", "metadata", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "phoneme", "tad", "ata_", "import_", "Number", "Format_", ",_", "Phone", "Number", "Desc_", ",_", "Phone", "Metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PHONE", "\\u", "METAD", "ATA", "\\u", "TV", "_", "=_", "Phone", "Metadata_", "(_", "id_", "=_", "'", "TV", "'_", ",_", "countr", "y", "\\u", "code_", "=_", "None_", ",_", "international", "\\u", "prefix_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "genera", "l\\u", "desc_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'[", "1", "9", "]\\\\", "\\\\", "d", "{", "2", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "3", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tol", "l\\u", "free_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "premium", "\\u", "rate_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "emergency", "_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "911", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "3", "}'_", ",_", "example", "\\u", "number_", "=_", "'", "911", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "short", "\\u", "code_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "1", "\\\\\\\\", "d", "{", "2", "}|", "911", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "3", "}'_", ",_", "example", "\\u", "number_", "=_", "'", "911", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "standard", "\\u", "rate_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "carrier", "\\u", "specific_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "short", "\\u", "data_", "=_", "True_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kmpm/django-collector/collector/apps/collector/tasks.py
[ { "content": "class ProcessResponses(PeriodicTask):\n run_every = timedelta(seconds=5)\n ", "metadata": "root.ProcessResponses", "header": "['module', '___EOS___']", "index": 35 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Process", "Responses", "_", "(_", "Period", "ic", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "\\u", "every_", "=_", "timedelta_", "(_", "seconds_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]