query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Unused import
chrippa/livestreamer/src/livestreamer/plugins/tv4play.py
[ { "content": "\"\"\"Plugin for TV4 Play, swedish TV channel TV4's streaming service.\"\"\"\n\nimport re\n\nfrom livestreamer.compat import urlparse\nfrom livestreamer.plugin import Plugin\nfrom livestreamer.plugin.api import http, validate\nfrom livestreamer.stream import HDSStream, RTMPStream\n\nASSET_URL = \"http://prima.tv4play.se/api/web/asset/{0}/play\"\nSWF_URL = \"http://www.tv4play.se/flash/tv4video.swf\"\n\n_url_re = re.compile(\"\"\"\n http(s)?://(www\\.)?\n (?:\n tv4play.se/program/[^\\?/]+\n )?\n (?:\n fotbollskanalen.se/video\n )?\n .+(video_id|videoid)=(?P<video_id>\\d+)\n\"\"\", re.VERBOSE)\n\n_asset_schema = validate.Schema(\n validate.xml_findall(\"items/item\"),\n [\n validate.all(\n validate.xml_findall(\"*\"),\n validate.map(lambda e: (e.tag, e.text)),\n validate.transform(dict),\n {\n \"base\": validate.text,\n \"bitrate\": validate.all(\n validate.text, validate.transform(int)\n ),\n \"url\": validate.text\n }\n )\n ]\n)\n\n\n\n__plugin__ = TV4Play\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TV4Play(Plugin):\n", "metadata": "root.TV4Play", "header": "['module', '___EOS___']", "index": 42 }, { "content": " @classmethod\n def can_handle_url(cls, url):\n return _url_re.match(url)", "metadata": "root.TV4Play.can_handle_url", "header": "['class', 'TV4Play', '(', 'Plugin', ')', ':', '___EOS___']", "index": 43 }, { "content": " def _get_streams(self):\n match = _url_re.match(self.url)\n video_id = match.group(\"video_id\")\n res = http.get(ASSET_URL.format(video_id))\n assets = http.xml(res, schema=_asset_schema)\n\n streams = {}\n for asset in assets:\n base = asset[\"base\"]\n url = asset[\"url\"]\n\n if urlparse(url).path.endswith(\".f4m\"):\n streams.update(\n HDSStream.parse_manifest(self.session, url, pvswf=SWF_URL)\n )\n elif base.startswith(\"rtmp\"):\n name = \"{0}k\".format(asset[\"bitrate\"])\n params = {\n \"rtmp\": asset[\"base\"],\n \"playpath\": url,\n \"live\": True\n }\n streams[name] = RTMPStream(self.session, params)\n\n return streams", "metadata": "root.TV4Play._get_streams", "header": "['class', 'TV4Play', '(', 'Plugin', ')', ':', '___EOS___']", "index": 47 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Plug", "in", " ", "for", " ", "TV", "4", " ", "Play", ",", " ", "swe", "dis", "h", " ", "TV", " ", "channel", " ", "TV", "4", "'", "s", " ", "stream", "ing", " ", "service", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lives", "tream", "er_", "._", "compat_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lives", "tream", "er_", "._", "plugin_", "import_", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lives", "tream", "er_", "._", "plugin_", "._", "api_", "import_", "http_", ",_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lives", "tream", "er_", "._", "stream_", "import_", "HD", "SS", "tream_", ",_", "RTM", "PS", "tream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ASSET", "\\u", "URL_", "=_", "\"", "http", "://", "prima", ".", "tv", "4", "play", ".", "se", "/", "api", "/", "web", "/", "asset", "/{", "0", "}/", "play", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SW", "F", "\\u", "URL_", "=_", "\"", "http", "://", "www", ".", "tv", "4", "play", ".", "se", "/", "flash", "/", "tv", "4", "video", ".", "swf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "url", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "http", "(", "s", ")?", "://", "(", "www", "\\\\.)", "?", "\\", "10", ";", " ", " ", " ", " ", "(?:", "\\", "10", ";", " ", " ", " ", " ", "tv", "4", "play", ".", "se", "/", "program", "/", "[", "^", "\\\\?", "/]+", "\\", "10", ";", " ", " ", " ", " ", ")?", "\\", "10", ";", " ", " ", " ", " ", "(?:", "\\", "10", ";", " ", " ", " ", " ", "fot", "bol", "ls", "kana", "len", ".", "se", "/", "video", "\\", "10", ";", " ", " ", " ", " ", ")?", "\\", "10", ";", " ", " ", " ", " ", ".+", "(", "video", "\\u", "id", "|", "videoi", "d", ")=", "(?", "P", "<", "video", "\\u", "id", ">\\\\", "d", "+)", "\\", "10", ";\"\"\"_", ",_", "re_", "._", "VERBOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "asset", "\\u", "schema_", "=_", "validate_", "._", "Schema_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "xml", "\\u", "findall_", "(_", "\"", "items", "/", "item", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "all_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "xml", "\\u", "findall_", "(_", "\"*\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "map_", "(_", "lambda_", "e_", ":_", "(_", "e_", "._", "tag_", ",_", "e_", "._", "text_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "transform_", "(_", "dict_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\"_", ":_", "validate_", "._", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bit", "rate", "\"_", ":_", "validate_", "._", "all_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "._", "text_", ",_", "validate_", "._", "transform_", "(_", "int_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "validate_", "._", "text_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "plugin", "\\u\\u_", "=_", "TV", "4", "Play_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "TV", "4", "Play_", "(_", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TV", "4", "Play_", "(_", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "can", "\\u", "handle", "\\u", "url_", "(_", "cls_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "url", "\\u", "re_", "._", "match_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TV", "4", "Play_", "(_", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "streams_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "url", "\\u", "re_", "._", "match_", "(_", "self_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "video", "\\u", "id_", "=_", "match_", "._", "group_", "(_", "\"", "video", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "http_", "._", "get_", "(_", "ASSET", "\\u", "URL_", "._", "format_", "(_", "video", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assets_", "=_", "http_", "._", "xml_", "(_", "res_", ",_", "schema_", "=_", "\\u", "asset", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "streams_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "asset_", "in_", "assets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "asset_", "[_", "\"", "base", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "asset_", "[_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "urlparse_", "(_", "url_", ")_", "._", "path_", "._", "endswith_", "(_", "\".", "f4", "m", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "streams_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "HD", "SS", "tream_", "._", "parse", "\\u", "manifest_", "(_", "self_", "._", "session_", ",_", "url_", ",_", "pvs", "wf_", "=_", "SW", "F", "\\u", "URL_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "base_", "._", "startswith_", "(_", "\"", "rtmp", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"{", "0", "}", "k", "\"_", "._", "format_", "(_", "asset_", "[_", "\"", "bit", "rate", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rtmp", "\"_", ":_", "asset_", "[_", "\"", "base", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "play", "path", "\"_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "live", "\"_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "streams_", "[_", "name_", "]_", "=_", "RTM", "PS", "tream_", "(_", "self_", "._", "session_", ",_", "params_", ")_", "\\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_", "streams_", "\\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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mayan-edms/mayan-edms/mayan/apps/linking/permissions.py
[ { "content": "from __future__ import absolute_import, unicode_literals\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom permissions import PermissionNamespace\n\nnamespace = PermissionNamespace('linking', _('Smart links'))\n\npermission_smart_link_view = namespace.add_permission(\n name='smart_link_view', label=_('View existing smart links')\n)\npermission_smart_link_create = namespace.add_permission(\n name='smart_link_create', label=_('Create new smart links')\n)\npermission_smart_link_delete = namespace.add_permission(\n name='smart_link_delete', label=_('Delete smart links')\n)\npermission_smart_link_edit = namespace.add_permission(\n name='smart_link_edit', label=_('Edit smart links')\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "permissions_", "import_", "Permi", "ssion", "Namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "Permi", "ssion", "Namespace_", "(_", "'", "linking", "'_", ",_", "\\u_", "(_", "'", "Sma", "rt", " ", "link", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "view_", "=_", "namespace_", "._", "add", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "smart", "\\u", "link", "\\u", "view", "'_", ",_", "label_", "=_", "\\u_", "(_", "'", "View", " ", "exist", "ing", " ", "smart", " ", "link", "s", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "create_", "=_", "namespace_", "._", "add", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "smart", "\\u", "link", "\\u", "create", "'_", ",_", "label_", "=_", "\\u_", "(_", "'", "Creat", "e", " ", "new", " ", "smart", " ", "link", "s", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "delete_", "=_", "namespace_", "._", "add", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "smart", "\\u", "link", "\\u", "delete", "'_", ",_", "label_", "=_", "\\u_", "(_", "'", "Delete", " ", "smart", " ", "link", "s", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "smart", "\\u", "link", "\\u", "edit_", "=_", "namespace_", "._", "add", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "smart", "\\u", "link", "\\u", "edit", "'_", ",_", "label_", "=_", "\\u_", "(_", "'", "Edit", " ", "smart", " ", "link", "s", "'_", ")_", "\\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 ]
Unused import
dvarrazzo/pgxnclient/pgxnclient/utils/__init__.py
[ { "content": "\"\"\"\npgxnclient -- misc utilities package\n\"\"\"\n\n# Copyright (C) 2011-2012 Daniele Varrazzo\n\n# This file is part of the PGXN client\n\n\n__all__ = ['OrderedDict', 'load_json', 'load_jsons', 'sha1', 'b',\n 'find_executable']\n\n\nimport sys\nimport os\n\n# OrderedDict available from Python 2.7\nif sys.version_info >= (2, 7):\n from collections import OrderedDict\nelse:\n from pgxnclient.utils.ordereddict import OrderedDict\n\n\n# Import the proper JSON library.\n#\n# Dependencies note: simplejson is certified for Python 2.5. Support for\n# Python 2.4 was available up to version 2.0.9, but this version doesn't\n# support ordered dicts. In Py 2.6 the package is in stdlib, but without\n# orddict support, so we use simplejson 2.1 again. From Python 2.7 the stdlilb\n# json module has orddict support so we don't need the external dependency.\nif sys.version_info >= (2, 7):\n import json\nelse:\n import simplejson as json\n\n\n\n\n# Import the sha1 object without warnings\nfrom hashlib import sha1\n\n\n# For compatibility from Python 2.4 to 3.x\n# b('str') is equivalent to b'str' but works on Python < 2.6 too\nif sys.version_info < (3,):\nelse:\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def load_json(f):\n data = f.read()\n if not isinstance(data, unicode):\n data = data.decode('utf-8')\n return load_jsons(data)", "metadata": "root.load_json", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def load_jsons(data):\n return json.loads(data, object_pairs_hook=OrderedDict)", "metadata": "root.load_jsons", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def b(s):\n return s", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def b(s):\n return s.encode('utf8')", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def find_executable(name):\n \"\"\"\n Find executable by ``name`` by inspecting PATH environment variable, return\n ``None`` if nothing found.\n \"\"\"\n for dir in os.environ.get('PATH', '').split(os.pathsep):\n if not dir:\n continue\n fn = os.path.abspath(os.path.join(dir, name))\n if os.path.exists(fn):\n return os.path.abspath(fn)", "metadata": "root.find_executable", "header": "['module', '___EOS___']", "index": 59 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "pg", "xn", "client", " ", "--", " ", "misc", " ", "util", "iti", "es", " ", "package", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2012", " ", "Dan", "iel", "e", " ", "Var", "raz", "zo", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "the", " ", "PG", "XN", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Order", "ed", "Dict", "'_", ",_", "'", "load", "\\u", "json", "'_", ",_", "'", "load", "\\u", "jsons", "'_", ",_", "'", "sha1", "'_", ",_", "'", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "find", "\\u", "executable", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Order", "ed", "Dict", " ", "avail", "able", " ", "from", " ", "Pyth", "on", " ", "2.7", "_", "\\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 ", " _", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pg", "xn", "client_", "._", "utils_", "._", "order", "eddi", "ct_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "proper", " ", "JSO", "N", " ", "librar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dependenc", "ies", " ", "note", ":", " ", "simple", "json", " ", "is", " ", "certi", "fied", " ", "for", " ", "Pyth", "on", " ", "2.5", ".", " ", " ", "Supp", "ort", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.4", " ", "was", " ", "avail", "able", " ", "up", " ", "to", " ", "version", " ", "2.0", ".9", ",", " ", "but", " ", "this", " ", "version", " ", "doe", "sn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "order", "ed", " ", "dict", "s", ".", " ", "In", " ", "Py", " ", "2.6", " ", "the", " ", "package", " ", "is", " ", "in", " ", "stdlib", ",", " ", "but", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ord", "dict", " ", "support", ",", " ", "so", " ", "we", " ", "use", " ", "simple", "json", " ", "2.1", " ", "again", ".", " ", "Fro", "m", " ", "Pyth", "on", " ", "2.7", " ", "the", " ", "std", "lil", "b_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "json", " ", "module", " ", "has", " ", "ord", "dict", " ", "support", " ", "so", " ", "we", " ", "don", "'", "t", " ", "need", " ", "the", " ", "external", " ", "dependen", "cy", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Import", " ", "the", " ", "sha1", " ", "object", " ", "with", "out", " ", "warnings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "hashlib_", "import_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "compatibility", " ", "from", " ", "Pyth", "on", " ", "2.4", " ", "to", " ", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "b", "('", "str", "')", " ", "is", " ", "equivalent", " ", "to", " ", "b", "'", "str", "'", " ", "but", " ", "works", " ", "on", " ", "Pyth", "on", " ", "<", " ", "2.6", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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_", "load", "\\u", "json_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "data_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "load", "\\u", "jsons", "_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "jsons", "_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "loads_", "(_", "data_", ",_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "Order", "ed", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "executable_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "executable", " ", "by", " ", "``", "name", "``", " ", "by", " ", "inspect", "ing", " ", "PATH", " ", "environ", "ment", " ", "variab", "le", ",", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "``", "Non", "e", "``", " ", "if", " ", "not", "hing", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dir_", "in_", "os_", "._", "environ_", "._", "get_", "(_", "'", "PATH", "'_", ",_", "''_", ")_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dir_", ":_", "\\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_", "fn_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dir_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "abspath_", "(_", "fn_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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{ "content": " def _color_json(self):\n out_file = NamedTemporaryFile()\n out_file.write(json.dumps(self.data, sort_keys=True))\n out_file.flush()\n pjson_cmd = 'cat ' + out_file.name + '| pjson'\n os.system(pjson_cmd)", "metadata": "root.DataOutput._color_json", "header": "['class', 'DataOutput', '(', 'object', ')', ':', '___EOS___']", "index": 51 } ]
[]
[]
0
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "class_", "Data", "Output_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "color", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "file_", "=_", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "self_", "._", "data_", ",_", "sort", "\\u", "keys_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pj", "son", "\\u", "cmd_", "=_", "'", "cat", " ", "'_", "+_", "out", "\\u", "file_", "._", "name_", "+_", "'|", " ", "pj", "son", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "pj", "son", "\\u", "cmd_", ")_", "\\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 ]
Unused import
python-openxml/opc-diag/tests/test_model.py
[ { "content": "# -*- coding: utf-8 -*-\n\n\"\"\"\nUnit tests for model module\n\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport sys\n\nfrom lxml import etree\n\nfrom opcdiag.model import Package, PkgItem\nfrom opcdiag.phys_pkg import PhysPkg\n\nimport pytest\n\nfrom mock import call\n\nfrom .unitutil import class_mock, instance_mock\n\n\nDIRPATH = 'dirpath'\nPACKAGE_PATH = 'package_path'\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DescribePackage(object):\n\n\n\n\n\n\n\n\n\n # fixtures -------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.DescribePackage", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def it_can_construct_from_a_filesystem_package(\n self, path_, root_uri_, uri_, uri_2_, blob_, blob_2_, PhysPkg_,\n PkgItem_, pkg_item_, pkg_item_2_, Package_):\n # exercise ---------------------\n pkg = Package.read(path_)\n # expected values --------------\n expected_PkgItem_calls = [\n call(root_uri_, uri_, blob_),\n call(root_uri_, uri_2_, blob_2_)\n ]\n expected_items = {uri_: pkg_item_,\n uri_2_: pkg_item_2_}\n # verify -----------------------\n PhysPkg_.read.assert_called_once_with(path_)\n assert PkgItem_.call_count == 2\n PkgItem_.assert_has_calls(expected_PkgItem_calls, any_order=True)\n Package_.assert_called_once_with(expected_items)\n assert isinstance(pkg, Package)", "metadata": "root.DescribePackage.it_can_construct_from_a_filesystem_package", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": " def it_can_find_one_of_its_items_by_uri_tail(self, pkg_item_):\n # fixture ----------------------\n pkg_items_ = {'head/tail': pkg_item_}\n package = Package(pkg_items_)\n # exercise ---------------------\n pkg_item = package.find_item_by_uri_tail('tail')\n # verify -----------------------\n assert pkg_item == pkg_item_\n with pytest.raises(KeyError):\n package.find_item_by_uri_tail('head')", "metadata": "root.DescribePackage.it_can_find_one_of_its_items_by_uri_tail", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def it_can_pretty_format_its_xml_pkg_items(self, prettify_fixture):\n package, pkg_item_, pkg_item_2_ = prettify_fixture\n package.prettify_xml()\n pkg_item_.prettify_xml.assert_called_once_with()\n pkg_item_2_.prettify_xml.assert_called_once_with()", "metadata": "root.DescribePackage.it_can_pretty_format_its_xml_pkg_items", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def it_can_provide_a_list_of_rels_items_in_the_package(\n self, pkg_item_, pkg_item_2_, pkg_item_3_):\n # fixture ----------------------\n pkg_items = {\n 'foo/bar.rels': pkg_item_, # should be sorted second\n 'joe/bob.xml': pkg_item_2_, # should be skipped\n 'bar/foo.rels': pkg_item_3_, # should be sorted first\n }\n package = Package(pkg_items)\n # exercise ---------------------\n rels_items = package.rels_items\n # verify -----------------------\n assert rels_items == [pkg_item_3_, pkg_item_]", "metadata": "root.DescribePackage.it_can_provide_a_list_of_rels_items_in_the_package", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def it_can_provide_a_list_of_xml_parts_in_the_package(\n self, pkg_item_, pkg_item_2_, pkg_item_3_):\n # fixture ----------------------\n pkg_items = {\n 'foobar': pkg_item_, # should be sorted second\n 'joebob': pkg_item_2_, # should be skipped\n 'barfoo': pkg_item_3_, # should be sorted first\n }\n package = Package(pkg_items)\n # exercise ---------------------\n xml_parts = package.xml_parts\n # verify -----------------------\n assert xml_parts == [pkg_item_3_, pkg_item_]", "metadata": "root.DescribePackage.it_can_provide_a_list_of_xml_parts_in_the_package", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " def it_can_save_itself_to_a_zip(\n self, pkg_item_dict_, PhysPkg_, blob_collection_):\n # fixture ----------------------\n package = Package(pkg_item_dict_)\n # exercise ---------------------\n package.save(PACKAGE_PATH)\n # verify -----------------------\n PhysPkg_.write_to_zip.assert_called_once_with(\n blob_collection_, PACKAGE_PATH)", "metadata": "root.DescribePackage.it_can_save_itself_to_a_zip", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def it_can_save_an_expanded_version_of_itself_to_a_directory(\n self, pkg_item_dict_, PhysPkg_, blob_collection_):\n # fixture ----------------------\n package = Package(pkg_item_dict_)\n # exercise ---------------------\n package.save_to_dir(DIRPATH)\n # verify -----------------------\n PhysPkg_.write_to_dir.assert_called_once_with(\n blob_collection_, DIRPATH)", "metadata": "root.DescribePackage.it_can_save_an_expanded_version_of_itself_to_a_directory", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def it_can_change_one_of_its_items_to_another(\n self, pkg_item_, pkg_item_2_):\n # fixture ----------------------\n pkg_items = {'uri': pkg_item_}\n package = Package(pkg_items)\n pkg_item_2_.uri = 'uri'\n pkg_item_2_.blob = 'new blob'\n # exercise ---------------------\n package.substitute_item(pkg_item_2_)\n # verify -----------------------\n assert pkg_item_.blob == 'new blob'", "metadata": "root.DescribePackage.it_can_change_one_of_its_items_to_another", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " @pytest.fixture\n def blob_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.blob_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " @pytest.fixture\n def blob_2_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.blob_2_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 130 }, { "content": " @pytest.fixture\n def blob_collection_(self, request, uri_, uri_2_, blob_, blob_2_):\n return {uri_: blob_, uri_2_: blob_2_}", "metadata": "root.DescribePackage.blob_collection_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 134 }, { "content": " @pytest.fixture\n def Package_(self, request):\n Package_ = class_mock('opcdiag.model.Package', request)\n return Package_", "metadata": "root.DescribePackage.Package_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 138 }, { "content": " @pytest.fixture\n def path_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.path_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 143 }, { "content": " @pytest.fixture\n def PhysPkg_(self, request, phys_pkg_):\n PhysPkg_ = class_mock('opcdiag.model.PhysPkg', request)\n PhysPkg_.read.return_value = phys_pkg_\n return PhysPkg_", "metadata": "root.DescribePackage.PhysPkg_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 147 }, { "content": " @pytest.fixture\n def phys_pkg_(self, request, root_uri_, uri_, uri_2_, blob_, blob_2_):\n phys_pkg = instance_mock(PhysPkg, request)\n phys_pkg.root_uri = root_uri_\n phys_pkg.__iter__.return_value = iter(((uri_, blob_),\n (uri_2_, blob_2_)))\n return phys_pkg", "metadata": "root.DescribePackage.phys_pkg_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": " @pytest.fixture\n def PkgItem_(self, request, pkg_item_, pkg_item_2_):\n PkgItem_ = class_mock('opcdiag.model.PkgItem', request)\n PkgItem_.side_effect = [pkg_item_, pkg_item_2_]\n return PkgItem_", "metadata": "root.DescribePackage.PkgItem_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 161 }, { "content": " @pytest.fixture\n def pkg_item_(self, request, blob_):\n pkg_item_ = instance_mock(PkgItem, request)\n pkg_item_.blob = blob_\n pkg_item_.is_rels_item = True\n pkg_item_.is_xml_part = True\n return pkg_item_", "metadata": "root.DescribePackage.pkg_item_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 167 }, { "content": " @pytest.fixture\n def pkg_item_2_(self, request, blob_2_):\n pkg_item_2_ = instance_mock(PkgItem, request)\n pkg_item_2_.blob = blob_2_\n pkg_item_2_.is_rels_item = False\n pkg_item_2_.is_xml_part = False\n return pkg_item_2_", "metadata": "root.DescribePackage.pkg_item_2_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " @pytest.fixture\n def pkg_item_3_(self, request):\n pkg_item_3_ = instance_mock(PkgItem, request)\n pkg_item_3_.is_rels_item = True\n pkg_item_3_.is_xml_part = True\n return pkg_item_3_", "metadata": "root.DescribePackage.pkg_item_3_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " @pytest.fixture\n def pkg_item_dict_(self, request, uri_, uri_2_, pkg_item_, pkg_item_2_):\n return {uri_: pkg_item_, uri_2_: pkg_item_2_}", "metadata": "root.DescribePackage.pkg_item_dict_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 190 }, { "content": " @pytest.fixture\n def prettify_fixture(self, pkg_item_, pkg_item_2_):\n pkg_items = {1: pkg_item_, 2: pkg_item_2_}\n package = Package(pkg_items)\n return package, pkg_item_, pkg_item_2_", "metadata": "root.DescribePackage.prettify_fixture", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 194 }, { "content": " @pytest.fixture\n def root_uri_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.root_uri_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " @pytest.fixture\n def uri_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.uri_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": " @pytest.fixture\n def uri_2_(self, request):\n return instance_mock(str, request)", "metadata": "root.DescribePackage.uri_2_", "header": "['class', 'DescribePackage', '(', 'object', ')', ':', '___EOS___']", "index": 208 }, { "content": "class DescribePkgItem(object):\n\n\n\n", "metadata": "root.DescribePkgItem", "header": "['module', '___EOS___']", "index": 213 }, { "content": " @pytest.mark.parametrize(('uri', 'is_ct', 'is_rels', 'is_xml_part'), [\n ('[Content_Types].xml', True, False, False),\n ('foo/bar.xml.rels', False, True, False),\n ('foo/bar.xml', False, False, True),\n ('media/foobar.jpg', False, False, False),\n ])\n def it_knows_what_kind_of_item_it_is(\n self, uri, is_ct, is_rels, is_xml_part):\n pkg_item = PkgItem(None, uri, None)\n assert pkg_item.is_content_types is is_ct\n assert pkg_item.is_rels_item is is_rels\n assert pkg_item.is_xml_part is is_xml_part", "metadata": "root.DescribePkgItem.it_knows_what_kind_of_item_it_is", "header": "['class', 'DescribePkgItem', '(', 'object', ')', ':', '___EOS___']", "index": 215 }, { "content": " def it_can_produce_an_etree_element_from_its_blob(self):\n blob = '<root><child>foobar</child></root>'\n pkg_item = PkgItem(None, None, blob)\n assert isinstance(pkg_item.element, etree._Element)", "metadata": "root.DescribePkgItem.it_can_produce_an_etree_element_from_its_blob", "header": "['class', 'DescribePkgItem', '(', 'object', ')', ':', '___EOS___']", "index": 228 }, { "content": " def it_can_calculate_its_effective_path(self):\n pkg_item = PkgItem('root_uri', 'uri', None)\n expected_path = ('root_uri\\\\uri' if sys.platform.startswith('win')\n else 'root_uri/uri')\n assert pkg_item.path == expected_path", "metadata": "root.DescribePkgItem.it_can_calculate_its_effective_path", "header": "['class', 'DescribePkgItem', '(', 'object', ')', ':', '___EOS___']", "index": 233 }, { "content": " def it_can_prettify_its_xml(self):\n blob = '<foo><bar/></foo>'\n pkg_item = PkgItem(None, 'foo.xml', blob)\n pkg_item.prettify_xml()\n assert pkg_item.blob == (\n '<?xml version=\\'1.0\\' encoding=\\'UTF-8\\' standalone=\\'yes\\'?>\\n'\n '<foo>\\n'\n ' <bar/>\\n'\n '</foo>\\n'\n )", "metadata": "root.DescribePkgItem.it_can_prettify_its_xml", "header": "['class', 'DescribePkgItem', '(', 'object', ')', ':', '___EOS___']", "index": 239 } ]
[]
[]
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_", "\"\"\"", "\\", "10", ";", "Unit", " ", "tests", " ", "for", " ", "model", " ", "module", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "opc", "diag_", "._", "model_", "import_", "Package_", ",_", "Pk", "g", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opc", "diag_", "._", "phys", "\\u", "pkg_", "import_", "Phys", "Pk", "g_", "\\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_", "from_", "mock_", "import_", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "unit", "util_", "import_", "class", "\\u", "mock_", ",_", "instance", "\\u", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIR", "PATH_", "=_", "'", "dir", "path", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PACKAG", "E", "\\u", "PATH_", "=_", "'", "package", "\\u", "path", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Describe", "Package_", "(_", "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_", "#", " ", "fixture", "s", " ", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "it", "\\u", "can", "\\u", "construct", "\\u", "from", "\\u", "a", "\\u", "filesystem", "\\u", "package_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "path", "\\u_", ",_", "root", "\\u", "uri", "\\u_", ",_", "uri", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ",_", "blob", "\\u_", ",_", "blob", "\\u", "2", "\\u_", ",_", "Phys", "Pk", "g", "\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pk", "g", "Item", "\\u_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ",_", "Packa", "ge", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg_", "=_", "Package_", "._", "read_", "(_", "path", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "expected", " ", "values", " ", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "Pk", "g", "Item", "\\u", "calls_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "call_", "(_", "root", "\\u", "uri", "\\u_", ",_", "uri", "\\u_", ",_", "blob", "\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "call_", "(_", "root", "\\u", "uri", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ",_", "blob", "\\u", "2", "\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "items_", "=_", "{_", "uri", "\\u_", ":_", "pkg", "\\u", "item", "\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uri", "\\u", "2", "\\u_", ":_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "Phys", "Pk", "g", "\\u_", "._", "read_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "path", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Pk", "g", "Item", "\\u_", "._", "call", "\\u", "count_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pk", "g", "Item", "\\u_", "._", "assert", "\\u", "has", "\\u", "calls_", "(_", "expected", "\\u", "Pk", "g", "Item", "\\u", "calls_", ",_", "any", "\\u", "order_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Packa", "ge", "\\u_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "expected", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "pkg_", ",_", "Package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "find", "\\u", "one", "\\u", "of", "\\u", "its", "\\u", "items", "\\u", "by", "\\u", "uri", "\\u", "tail_", "(_", "self_", ",_", "pkg", "\\u", "item", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "items", "\\u_", "=_", "{_", "'", "head", "/", "tail", "'_", ":_", "pkg", "\\u", "item", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "Package_", "(_", "pkg", "\\u", "items", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "pkg", "\\u", "item_", "=_", "package_", "._", "find", "\\u", "item", "\\u", "by", "\\u", "uri", "\\u", "tail_", "(_", "'", "tail", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "==_", "pkg", "\\u", "item", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "._", "find", "\\u", "item", "\\u", "by", "\\u", "uri", "\\u", "tail_", "(_", "'", "head", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "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_", "it", "\\u", "can", "\\u", "pretty", "\\u", "format\\u", "its", "\\u", "xml", "\\u", "pkg", "\\u", "items_", "(_", "self_", ",_", "pret", "tify", "\\u", "fixture_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "=_", "pret", "tify", "\\u", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "._", "pret", "tify", "\\u", "xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u_", "._", "pret", "tify", "\\u", "xml_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "pret", "tify", "\\u", "xml_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "provide", "\\u", "a", "\\u", "list", "\\u", "of", "\\u", "rel", "s", "\\u", "items", "\\u", "in", "\\u", "the", "\\u", "package_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "items_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "/", "bar", ".", "rel", "s", "'_", ":_", "pkg", "\\u", "item", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "sorte", "d", " ", "second_", "\\u\\u\\uNL\\u\\u\\u_", "'", "jo", "e", "/", "bob", ".", "xml", "'_", ":_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "skipped_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", "/", "foo", ".", "rel", "s", "'_", ":_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "sorte", "d", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "Package_", "(_", "pkg", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "rel", "s", "\\u", "items_", "=_", "package_", "._", "rel", "s", "\\u", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "rel", "s", "\\u", "items_", "==_", "[_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ",_", "pkg", "\\u", "item", "\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "provide", "\\u", "a", "\\u", "list", "\\u", "of", "\\u", "xml", "\\u", "part", "s", "\\u", "in", "\\u", "the", "\\u", "package_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "items_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fooba", "r", "'_", ":_", "pkg", "\\u", "item", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "sorte", "d", " ", "second_", "\\u\\u\\uNL\\u\\u\\u_", "'", "jo", "ebo", "b", "'_", ":_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "skipped_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", "foo", "'_", ":_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ",_", "#", " ", "shou", "ld", " ", "be", " ", "sorte", "d", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "Package_", "(_", "pkg", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "parts_", "=_", "package_", "._", "xml", "\\u", "parts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "xml", "\\u", "parts_", "==_", "[_", "pkg", "\\u", "item", "\\u", "3", "\\u_", ",_", "pkg", "\\u", "item", "\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "save", "\\u", "its", "elf", "\\u", "to", "\\u", "a", "\\u", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "pkg", "\\u", "item", "\\u", "dict\\u_", ",_", "Phys", "Pk", "g", "\\u_", ",_", "blob", "\\u", "collection", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "=_", "Package_", "(_", "pkg", "\\u", "item", "\\u", "dict\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "._", "save_", "(_", "PACKAG", "E", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "Phys", "Pk", "g", "\\u_", "._", "write", "\\u", "to", "\\u", "zip_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "blob", "\\u", "collection", "\\u_", ",_", "PACKAG", "E", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "save", "\\u", "an", "\\u", "expand", "ed", "\\u", "version", "\\u", "of", "\\u", "its", "elf", "\\u", "to", "\\u", "a", "\\u", "directory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "pkg", "\\u", "item", "\\u", "dict\\u_", ",_", "Phys", "Pk", "g", "\\u_", ",_", "blob", "\\u", "collection", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "=_", "Package_", "(_", "pkg", "\\u", "item", "\\u", "dict\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "._", "save", "\\u", "to", "\\u", "dir_", "(_", "DIR", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "Phys", "Pk", "g", "\\u_", "._", "write", "\\u", "to", "\\u", "dir_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "blob", "\\u", "collection", "\\u_", ",_", "DIR", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "change", "\\u", "one", "\\u", "of", "\\u", "its", "\\u", "items", "\\u", "to", "\\u", "anot", "her_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fixture", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "items_", "=_", "{_", "'", "uri", "'_", ":_", "pkg", "\\u", "item", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "Package_", "(_", "pkg", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "uri_", "=_", "'", "uri", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "blob_", "=_", "'", "new", " ", "blob", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "._", "substitute", "\\u", "item_", "(_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "pkg", "\\u", "item", "\\u_", "._", "blob_", "==_", "'", "new", " ", "blob", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "blob", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "blob", "\\u", "2", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "blob", "\\u", "collection", "\\u_", "(_", "self_", ",_", "request_", ",_", "uri", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ",_", "blob", "\\u_", ",_", "blob", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "uri", "\\u_", ":_", "blob", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ":_", "blob", "\\u", "2", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Packa", "ge", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Packa", "ge", "\\u_", "=_", "class", "\\u", "mock_", "(_", "'", "opc", "diag", ".", "model", ".", "Packa", "ge", "'_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Packa", "ge", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "path", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Phys", "Pk", "g", "\\u_", "(_", "self_", ",_", "request_", ",_", "phys", "\\u", "pkg", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Phys", "Pk", "g", "\\u_", "=_", "class", "\\u", "mock_", "(_", "'", "opc", "diag", ".", "model", ".", "Phys", "Pk", "g", "'_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Phys", "Pk", "g", "\\u_", "._", "read_", "._", "return", "\\u", "value_", "=_", "phys", "\\u", "pkg", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Phys", "Pk", "g", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "phys", "\\u", "pkg", "\\u_", "(_", "self_", ",_", "request_", ",_", "root", "\\u", "uri", "\\u_", ",_", "uri", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ",_", "blob", "\\u_", ",_", "blob", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phys", "\\u", "pkg_", "=_", "instance", "\\u", "mock_", "(_", "Phys", "Pk", "g_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phys", "\\u", "pkg_", "._", "root", "\\u", "uri_", "=_", "root", "\\u", "uri", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phys", "\\u", "pkg_", "._", "\\u\\u", "iter\\u\\u_", "._", "return", "\\u", "value_", "=_", "iter_", "(_", "(_", "(_", "uri", "\\u_", ",_", "blob", "\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "uri", "\\u", "2", "\\u_", ",_", "blob", "\\u", "2", "\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "phys", "\\u", "pkg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Pk", "g", "Item", "\\u_", "(_", "self_", ",_", "request_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pk", "g", "Item", "\\u_", "=_", "class", "\\u", "mock_", "(_", "'", "opc", "diag", ".", "model", ".", "Pk", "g", "Item", "'_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pk", "g", "Item", "\\u_", "._", "side", "\\u", "effect_", "=_", "[_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Pk", "g", "Item", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pkg", "\\u", "item", "\\u_", "(_", "self_", ",_", "request_", ",_", "blob", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "item", "\\u_", "=_", "instance", "\\u", "mock_", "(_", "Pk", "g", "Item_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u_", "._", "blob_", "=_", "blob", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u_", "._", "is", "\\u", "rel", "s", "\\u", "item_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u_", "._", "is", "\\u", "xml", "\\u", "part_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pkg", "\\u", "item", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "(_", "self_", ",_", "request_", ",_", "blob", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "item", "\\u", "2", "\\u_", "=_", "instance", "\\u", "mock_", "(_", "Pk", "g", "Item_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "blob_", "=_", "blob", "\\u", "2", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "is", "\\u", "rel", "s", "\\u", "item_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "._", "is", "\\u", "xml", "\\u", "part_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pkg", "\\u", "item", "\\u", "3", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "item", "\\u", "3", "\\u_", "=_", "instance", "\\u", "mock_", "(_", "Pk", "g", "Item_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "3", "\\u_", "._", "is", "\\u", "rel", "s", "\\u", "item_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item", "\\u", "3", "\\u_", "._", "is", "\\u", "xml", "\\u", "part_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pkg", "\\u", "item", "\\u", "3", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pkg", "\\u", "item", "\\u", "dict\\u_", "(_", "self_", ",_", "request_", ",_", "uri", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "uri", "\\u_", ":_", "pkg", "\\u", "item", "\\u_", ",_", "uri", "\\u", "2", "\\u_", ":_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pret", "tify", "\\u", "fixture_", "(_", "self_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "items_", "=_", "{_", "1_", ":_", "pkg", "\\u", "item", "\\u_", ",_", "2_", ":_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "Package_", "(_", "pkg", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "package_", ",_", "pkg", "\\u", "item", "\\u_", ",_", "pkg", "\\u", "item", "\\u", "2", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "root", "\\u", "uri", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "uri", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Package_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "uri", "\\u", "2", "\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "instance", "\\u", "mock_", "(_", "str_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Describe", "Pk", "g", "Item_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Pk", "g", "Item_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "(_", "'", "uri", "'_", ",_", "'", "is", "\\u", "ct", "'_", ",_", "'", "is", "\\u", "rel", "s", "'_", ",_", "'", "is", "\\u", "xml", "\\u", "part", "'_", ")_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'[", "Conten", "t", "\\u", "Type", "s", "].", "xml", "'_", ",_", "True_", ",_", "False_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "/", "bar", ".", "xml", ".", "rel", "s", "'_", ",_", "False_", ",_", "True_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "foo", "/", "bar", ".", "xml", "'_", ",_", "False_", ",_", "False_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "media", "/", "fooba", "r", ".", "jp", "g", "'_", ",_", "False_", ",_", "False_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "it", "\\u", "knows", "\\u", "what", "\\u", "kind", "\\u", "of", "\\u", "item", "\\u", "it", "\\u", "is_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "uri_", ",_", "is", "\\u", "ct_", ",_", "is", "\\u", "rels_", ",_", "is", "\\u", "xml", "\\u", "part_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "item_", "=_", "Pk", "g", "Item_", "(_", "None_", ",_", "uri_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "._", "is", "\\u", "content", "\\u", "types_", "is_", "is", "\\u", "ct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "._", "is", "\\u", "rel", "s", "\\u", "item_", "is_", "is", "\\u", "rels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "._", "is", "\\u", "xml", "\\u", "part_", "is_", "is", "\\u", "xml", "\\u", "part_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Pk", "g", "Item_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "produce", "\\u", "an", "\\u", "etree", "\\u", "element", "\\u", "from", "\\u", "its", "\\u", "blob_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blob_", "=_", "'<", "root", "><", "child", ">", "fooba", "r", "</", "child", "><", "/", "root", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item_", "=_", "Pk", "g", "Item_", "(_", "None_", ",_", "None_", ",_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "pkg", "\\u", "item_", "._", "element_", ",_", "etree_", "._", "\\u", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Pk", "g", "Item_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "calcul", "ate", "\\u", "its", "\\u", "effective", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "item_", "=_", "Pk", "g", "Item_", "(_", "'", "root", "\\u", "uri", "'_", ",_", "'", "uri", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "path_", "=_", "(_", "'", "root", "\\u", "uri", "\\\\\\\\", "uri", "'_", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "'", "root", "\\u", "uri", "/", "uri", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "._", "path_", "==_", "expected", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Describe", "Pk", "g", "Item_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "can", "\\u", "pret", "tify", "\\u", "its", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blob_", "=_", "'<", "foo", "><", "bar", "/>", "</", "foo", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item_", "=_", "Pk", "g", "Item_", "(_", "None_", ",_", "'", "foo", ".", "xml", "'_", ",_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "item_", "._", "pret", "tify", "\\u", "xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pkg", "\\u", "item_", "._", "blob_", "==_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "?", "xml", " ", "version", "=\\\\", "'", "1.0", "\\\\'", " ", "encoding", "=\\\\", "'", "UT", "F", "-", "8", "\\\\'", " ", "standalone", "=\\\\", "'", "ye", "s", "\\\\'", "?>", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "foo", ">\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "<", "bar", "/>", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "foo", ">\\\\", "n", "'_", "\\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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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 ]
Except block handles 'BaseException'
charles-vdulac/django-roa/django_roa/remoteauth/models.py
[ { "content": "import re\nfrom django.utils import timezone\nfrom django.core import validators\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.auth.models import Permission as DjangoPermission, \\\n User as DjangoUser, Group as DjangoGroup, \\\n UserManager as DjangoUserManager\ntry:\n from django.contrib.auth.models import Message as DjangoMessage\nexcept ImportError:\n DjangoMessage = None\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.db import models\n\nfrom django_roa import Model, Manager\n\n\n\n\n\n\n\n\n\n\nMessage = None\n\nif DjangoMessage:\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_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Permission_", "as_", "Dj", "ang", "o", "Permission_", ",_", "User_", "as_", "Dj", "ang", "o", "User_", ",_", "Group_", "as_", "Dj", "ang", "o", "Group_", ",_", "User", "Manager_", "as_", "Dj", "ang", "o", "User", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Message_", "as_", "Dj", "ang", "o", "Message_", "\\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 ", " _", "Dj", "ang", "o", "Message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "\\u", "roa", "_", "import_", "Model_", ",_", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "Dj", "ang", "o", "Message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ]
Unused import
mozilla/pontoon/pontoon/sync/utils.py
[ { "content": "import os\n\nfrom pontoon.base.models import Resource\nfrom pontoon.base.utils import extension_in, first\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def is_in_hidden_directory(path):\n \"\"\"\n Return true if path contains hidden directory.\n \"\"\"\n for p in path.split(os.sep):\n if p.startswith('.'):\n return True\n return False", "metadata": "root.is_in_hidden_directory", "header": "['module', '___EOS___']", "index": 6 }, { "content": "def is_resource(filename):\n \"\"\"\n Return True if the filename's extension is a supported Resource\n format.\n \"\"\"\n return extension_in(filename, Resource.ALLOWED_EXTENSIONS)", "metadata": "root.is_resource", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def is_source_resource(filename):\n \"\"\"\n Return True if the filename's extension is a source-only Resource\n format.\n \"\"\"\n return extension_in(filename, Resource.SOURCE_EXTENSIONS)", "metadata": "root.is_source_resource", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def directory_contains_resources(directory_path, source_only=False):\n \"\"\"\n Return True if the given directory contains at least one\n supported resource file (checked via file extension), or False\n otherwise.\n\n :param source_only:\n If True, only check for source-only formats.\n \"\"\"\n resource_check = is_source_resource if source_only else is_resource\n for root, dirnames, filenames in os.walk(directory_path):\n # first() avoids checking past the first matching resource.\n if first(filenames, resource_check) is not None:\n return True\n return False", "metadata": "root.directory_contains_resources", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def locale_directory_path(checkout_path, locale_code):\n \"\"\"\n Path to the directory where strings for the given locale are\n stored.\n \"\"\"\n possible_paths = []\n for root, dirnames, filenames in os.walk(checkout_path):\n if locale_code in dirnames:\n possible_paths.append(os.path.join(root, locale_code))\n\n locale_variant = locale_code.replace('-', '_')\n if locale_variant in dirnames:\n possible_paths.append(os.path.join(root, locale_variant))\n\n for possible_path in possible_paths:\n if directory_contains_resources(possible_path):\n return possible_path\n\n if possible_paths:\n return possible_paths[0]\n\n raise IOError('Directory for locale `{0}` not found'.format(\n locale_code or 'source'))", "metadata": "root.locale_directory_path", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def relative_source_path(path):\n \"\"\"\n Return relative source resource path for the given relative locale\n resource path. Source files for .po files are actually .pot.\n \"\"\"\n if path.endswith('po'):\n path += 't'\n return path", "metadata": "root.relative_source_path", "header": "['module', '___EOS___']", "index": 74 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "base_", "._", "models_", "import_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pont", "oon", "_", "._", "base_", "._", "utils_", "import_", "extensi", "on", "\\u", "in_", ",_", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "in", "\\u", "hidden", "\\u", "directory_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "true", " ", "if", " ", "path", " ", "contain", "s", " ", "hidden", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "path_", "._", "split_", "(_", "os_", "._", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "._", "startswith_", "(_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "resource_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "filename", "'", "s", " ", "extensi", "on", " ", "is", " ", "a", " ", "support", "ed", " ", "Reso", "urc", "e", "\\", "10", ";", " ", " ", " ", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "extensi", "on", "\\u", "in_", "(_", "filename_", ",_", "Resource_", "._", "ALLOWED", "\\u", "EXTENSIONS_", ")_", "\\u\\u\\uNEWLINE\\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", "source", "\\u", "resource_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "filename", "'", "s", " ", "extensi", "on", " ", "is", " ", "a", " ", "source", "-", "only", " ", "Reso", "urc", "e", "\\", "10", ";", " ", " ", " ", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "extensi", "on", "\\u", "in_", "(_", "filename_", ",_", "Resource_", "._", "SOU", "RC", "E", "\\u", "EXTENSIONS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "director", "y", "\\u", "contain", "s", "\\u", "resources_", "(_", "director", "y", "\\u", "path_", ",_", "source", "\\u", "only_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "give", "n", " ", "director", "y", " ", "contain", "s", " ", "at", " ", "leas", "t", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "support", "ed", " ", "resource", " ", "file", " ", "(", "checke", "d", " ", "via", " ", "file", " ", "extensi", "on", "),", " ", "or", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "source", "\\u", "only", ":", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "only", " ", "check", " ", "for", " ", "source", "-", "only", " ", "formats", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "check_", "=_", "is", "\\u", "source", "\\u", "resource_", "if_", "source", "\\u", "only_", "else_", "is", "\\u", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root_", ",_", "dirnames_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "director", "y", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", "()", " ", "avoid", "s", " ", "checking", " ", "past", " ", "the", " ", "first", " ", "matchi", "ng", " ", "resource", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "first_", "(_", "filenames_", ",_", "resource", "\\u", "check_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "locale", "\\u", "director", "y", "\\u", "path_", "(_", "check", "out", "\\u", "path_", ",_", "locale", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Path", " ", "to", " ", "the", " ", "director", "y", " ", "where", " ", "string", "s", " ", "for", " ", "the", " ", "give", "n", " ", "locale", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "store", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "\\u", "paths_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root_", ",_", "dirnames_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "check", "out", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "locale", "\\u", "code_", "in_", "dirnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possib", "le", "\\u", "paths_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "locale", "\\u", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "locale", "\\u", "variant_", "=_", "locale", "\\u", "code_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "locale", "\\u", "variant_", "in_", "dirnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possib", "le", "\\u", "paths_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "locale", "\\u", "variant_", ")_", ")_", "\\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_", "possib", "le", "\\u", "path_", "in_", "possib", "le", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "director", "y", "\\u", "contain", "s", "\\u", "resources_", "(_", "possib", "le", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "possib", "le", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "possib", "le", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "possib", "le", "\\u", "paths_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "'", "Director", "y", " ", "for", " ", "locale", " ", "`", "{", "0", "}`", " ", "not", " ", "found", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "locale", "\\u", "code_", "or_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\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", "\\u", "source", "\\u", "path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "relative", " ", "source", " ", "resource", " ", "path", " ", "for", " ", "the", " ", "give", "n", " ", "relative", " ", "locale", "\\", "10", ";", " ", " ", " ", " ", "resource", " ", "path", ".", " ", "Sou", "rce", " ", "files", " ", "for", " ", ".", "po", " ", "files", " ", "are", " ", "actual", "ly", " ", ".", "pot", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "._", "endswith_", "(_", "'", "po", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "+=_", "'", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rackerlabs/python-cloudservers/com/rackspace/cloud/servers/api/client/sharedipgroupmanager.py
[ { "content": " def wait (self, sharedIpGroup, timeout=None):\n \"\"\"\n \ttimeout is in milliseconds\n \"\"\"\n self._entityCopies[sharedIpGroup.id] = copy.copy(sharedIpGroup)\n if timeout is None:\n self._wait(sharedIpGroup)\n else:\n result = self._timeout(self._wait, (sharedIpGroup,), timeout_duration=timeout/1000.0)", "metadata": "root.SharedIpGroupManager.wait", "header": "['class', 'SharedIpGroupManager', '(', 'EntityManager', ')', ':', '___EOS___']", "index": 107 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Share", "d", "Ip", "Group", "Manager_", "(_", "Entit", "y", "Manager_", ")_", ":_", "\\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_", "wait_", "(_", "self_", ",_", "shared", "Ip", "Group_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "\t", "timeo", "ut", " ", "is", " ", "in", " ", "milliseconds", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "entity", "Copie", "s_", "[_", "shared", "Ip", "Group_", "._", "id_", "]_", "=_", "copy_", "._", "copy_", "(_", "shared", "Ip", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "wait_", "(_", "shared", "Ip", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "timeout_", "(_", "self_", "._", "\\u", "wait_", ",_", "(_", "shared", "Ip", "Group_", ",_", ")_", ",_", "timeo", "ut", "\\u", "duration_", "=_", "timeout_", "/_", "1000.0_", ")_", "\\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 ]
First parameter of a method is not named 'self'
skyostil/tracy/src/generator/Cheetah/Utils/optik/option_parser.py
[ { "content": " def _get_args (self, args):\n if args is None:\n return sys.argv[1:]\n else:\n return args[:] # don't modify caller's list", "metadata": "root.OptionParser._get_args", "header": "['class', 'OptionParser', ':', '___EOS___']", "index": 327 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Optio", "n", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "args_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "args_", "[_", ":_", "]_", "#", " ", "don", "'", "t", " ", "modif", "y", " ", "caller", "'", "s", " ", "list_", "\\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 ]
Variable defined multiple times
BastiPaeltz/codedict/source/lib/prettytable.py
[ { "content": " def _stringify_header(self, options):\n\n bits = []\n lpad, rpad = self._get_padding_widths(options)\n if options[\"border\"]:\n if options[\"hrules\"] in (ALL, FRAME):\n bits.append(self._hrule)\n bits.append(\"\\n\")\n if options[\"vrules\"] in (ALL, FRAME):\n bits.append(options[\"vertical_char\"])\n else:\n bits.append(\" \")\n # For tables with no data or field names\n if not self._field_names:\n if options[\"vrules\"] in (ALL, FRAME):\n bits.append(options[\"vertical_char\"])\n else:\n bits.append(\" \")\n for field, width, in zip(self._field_names, self._widths):\n if options[\"fields\"] and field not in options[\"fields\"]:\n continue\n if self._header_style == \"cap\":\n fieldname = field.capitalize()\n elif self._header_style == \"title\":\n fieldname = field.title()\n elif self._header_style == \"upper\":\n fieldname = field.upper()\n elif self._header_style == \"lower\":\n fieldname = field.lower()\n else:\n fieldname = field\n bits.append(\" \" * lpad + self._justify(fieldname, width, self._align[field]) + \" \" * rpad)\n if options[\"border\"]:\n if options[\"vrules\"] == ALL:\n bits.append(options[\"vertical_char\"])\n else:\n bits.append(\" \")\n # If vrules is FRAME, then we just appended a space at the end\n # of the last field, when we really want a vertical character\n if options[\"border\"] and options[\"vrules\"] == FRAME:\n bits.pop()\n bits.append(options[\"vertical_char\"])\n if options[\"border\"] and options[\"hrules\"] != NONE:\n bits.append(\"\\n\")\n bits.append(self._hrule)\n return \"\".join(bits)", "metadata": "root.PrettyTable._stringify_header", "header": "['class', 'PrettyTable', '(', 'object', ')', ':', '___EOS___']", "index": 1034 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Pret", "ty", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stringify", "\\u", "header_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lpa", "d_", ",_", "rpa", "d_", "=_", "self_", "._", "\\u", "get", "\\u", "padd", "ing", "\\u", "widths_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "[_", "\"", "border", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "[_", "\"", "hr", "ule", "s", "\"_", "]_", "in_", "(_", "ALL_", ",_", "FRAME", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "self_", "._", "\\u", "hr", "ule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "._", "append_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "[_", "\"", "vr", "ule", "s", "\"_", "]_", "in_", "(_", "ALL_", ",_", "FRAME", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "options_", "[_", "\"", "vertical", "\\u", "char", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "tables", " ", "with", " ", "no", " ", "data", " ", "or", " ", "field", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "field", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "[_", "\"", "vr", "ule", "s", "\"_", "]_", "in_", "(_", "ALL_", ",_", "FRAME", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "options_", "[_", "\"", "vertical", "\\u", "char", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "field_", ",_", "width_", ",_", "in_", "zip_", "(_", "self_", "._", "\\u", "field", "\\u", "names_", ",_", "self_", "._", "\\u", "widths_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "[_", "\"", "fields", "\"_", "]_", "and_", "field_", "not_", "in_", "options_", "[_", "\"", "fields", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "header", "\\u", "style_", "==_", "\"", "cap", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "field_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "header", "\\u", "style_", "==_", "\"", "title", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "field_", "._", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "header", "\\u", "style_", "==_", "\"", "upper", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "field_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "header", "\\u", "style_", "==_", "\"", "lower", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "field_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bits_", "._", "append_", "(_", "\"", " ", "\"_", "*_", "lpa", "d_", "+_", "self_", "._", "\\u", "justify_", "(_", "fieldname_", ",_", "width_", ",_", "self_", "._", "\\u", "align_", "[_", "field_", "]_", ")_", "+_", "\"", " ", "\"_", "*_", "rpa", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "[_", "\"", "border", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "[_", "\"", "vr", "ule", "s", "\"_", "]_", "==_", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bits_", "._", "append_", "(_", "options_", "[_", "\"", "vertical", "\\u", "char", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bits_", "._", "append_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "vr", "ule", "s", " ", "is", " ", "FRAME", ",", " ", "then", " ", "we", " ", "just", " ", "append", "ed", " ", "a", " ", "space", " ", "at", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "last", " ", "field", ",", " ", "whe", "n", " ", "we", " ", "reall", "y", " ", "want", " ", "a", " ", "vertical", " ", "character_", "\\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_", "options_", "[_", "\"", "border", "\"_", "]_", "and_", "options_", "[_", "\"", "vr", "ule", "s", "\"_", "]_", "==_", "FRAME", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "._", "append_", "(_", "options_", "[_", "\"", "vertical", "\\u", "char", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "[_", "\"", "border", "\"_", "]_", "and_", "options_", "[_", "\"", "hr", "ule", "s", "\"_", "]_", "!=_", "NONE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "._", "append_", "(_", "self_", "._", "\\u", "hr", "ule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "._", "join_", "(_", "bits_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/util/NumericHardUtil.py
[ { "content": "def findMode_Mult_faster(Nvec, Wmat):\n ''' Find modes to multinomial with given parameters\n vectorized to solve many problems simultaneously\n\n Args\n ------\n Nvec : 1D array, size P\n contains non-negative integers\n Wmat : 2D array, size P x K\n each row is valid probability vector of length K\n Wmat[p] has non-negative entries, sums to one\n\n Returns\n -------\n Nmat : 2D sparse array, size P x K\n Nmat[p,:] = argmax_{n} \\log p_{mult}( Nmat[p] | Nvec[p], Wmat[p] ) \n '''\n # Unpack and parse input\n Nvec = np.asarray(Nvec, dtype=np.int64)\n if Nvec.ndim < 1:\n Nvec = Nvec[np.newaxis]\n Wmat = np.asarray(Wmat, dtype=np.float64)\n if Wmat.ndim < 2:\n Wmat = Wmat[np.newaxis, :]\n\n # Allocate and create initial guess, \n # which is guaranteed to have rows that sum to less than Nvec\n Nmat = np.zeros(Wmat.shape, dtype=np.int64)\n np.floor(Nvec[:,np.newaxis] * Wmat, out=Nmat)\n\n # Run Alg. 1 from paper\n activeRows = np.flatnonzero(Nmat.sum(axis=1) < Nvec)\n\n if len(activeRows) > 0:\n f = Nvec[:,np.newaxis] * Wmat - Nmat\n q = (1 - f)/ Wmat\n q = np.take(q, activeRows, axis=0)\n\n while len(activeRows) > 0:\n minIDs = np.argmin(q, axis=1)\n ids = np.ravel_multi_index([activeRows, minIDs], Nmat.shape)\n Nmat.ravel()[ids] += 1\n\n #stillActiveMask = Nmat[activeRows].sum(axis=1) < Nvec[activeRows]\n stillActiveMask = np.take(Nmat, activeRows, axis=0).sum(axis=1) \\\n < np.take(Nvec, activeRows)\n activeRows = activeRows[stillActiveMask] \n ids = ids[stillActiveMask]\n minIDs = minIDs[stillActiveMask]\n\n q = np.take(q, np.flatnonzero(stillActiveMask), axis=0)\n qids = np.ravel_multi_index([np.arange(len(minIDs)), minIDs], q.shape)\n q.ravel()[qids] += 1.0 / Wmat.ravel()[ids]\n # Double-check Nmat satisfies constraints \n assert np.all(np.abs(Nmat.sum(axis=1) - Nvec) < 0.0001)\n return Nmat", "metadata": "root.findMode_Mult_faster", "header": "['module', '___EOS___']", "index": 139 } ]
[]
[]
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_", "find", "Mode", "\\u", "Mult", "\\u", "faste", "r_", "(_", "Nv", "ec_", ",_", "Wm", "at_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Fin", "d", " ", "mode", "s", " ", "to", " ", "multin", "omial", " ", "with", " ", "give", "n", " ", "parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "vectorize", "d", " ", "to", " ", "solve", " ", "many", " ", "problem", "s", " ", "simultaneous", "ly", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", "------", "\\", "10", ";", " ", " ", "Nv", "ec", " ", ":", " ", "1", "D", " ", "array", ",", " ", "size", " ", "P", "\\", "10", ";", " ", " ", " ", " ", " ", "contain", "s", " ", "non", "-", "negati", "ve", " ", "integ", "ers", "\\", "10", ";", " ", " ", "Wm", "at", " ", ":", " ", "2", "D", " ", "array", ",", " ", "size", " ", "P", " ", "x", " ", "K", "\\", "10", ";", " ", " ", " ", " ", " ", "each", " ", "row", " ", "is", " ", "valid", " ", "probabilit", "y", " ", "vector", " ", "of", " ", "length", " ", "K", "\\", "10", ";", " ", " ", " ", " ", " ", "Wm", "at", "[", "p", "]", " ", "has", " ", "non", "-", "negati", "ve", " ", "entri", "es", ",", " ", "sums", " ", "to", " ", "one", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", "-------", "\\", "10", ";", " ", " ", "Nm", "at", " ", ":", " ", "2", "D", " ", "spars", "e", " ", "array", ",", " ", "size", " ", "P", " ", "x", " ", "K", "\\", "10", ";", " ", " ", "Nm", "at", "[", "p", ",:", "]", " ", "=", " ", "argm", "ax", "\\u{", "n", "}", " ", "\\\\", "log", " ", "p", "\\u{", "mult", "}(", " ", "Nm", "at", "[", "p", "]", " ", "|", " ", "Nv", "ec", "[", "p", "],", " ", "Wm", "at", "[", "p", "]", " ", ")", " ", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unpack", " ", "and", " ", "parse", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "Nv", "ec_", "=_", "np_", "._", "asarray_", "(_", "Nv", "ec_", ",_", "dtype_", "=_", "np_", "._", "int64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Nv", "ec_", "._", "ndim_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Nv", "ec_", "=_", "Nv", "ec_", "[_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Wm", "at_", "=_", "np_", "._", "asarray_", "(_", "Wm", "at_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Wm", "at_", "._", "ndim_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Wm", "at_", "=_", "Wm", "at_", "[_", "np_", "._", "newaxis_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Allocate", " ", "and", " ", "create", " ", "initial", " ", "guess", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "whi", "ch", " ", "is", " ", "guaran", "tee", "d", " ", "to", " ", "have", " ", "rows", " ", "tha", "t", " ", "sum", " ", "to", " ", "less", " ", "than", " ", "Nv", "ec_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Nm", "at_", "=_", "np_", "._", "zeros_", "(_", "Wm", "at_", "._", "shape_", ",_", "dtype_", "=_", "np_", "._", "int64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "floor_", "(_", "Nv", "ec_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "*_", "Wm", "at_", ",_", "out_", "=_", "Nm", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "Alg", ".", " ", "1", " ", "from", " ", "paper_", "\\u\\u\\uNL\\u\\u\\u_", "active", "Rows_", "=_", "np_", "._", "flat", "nonzero_", "(_", "Nm", "at_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", "<_", "Nv", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "active", "Rows_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "Nv", "ec_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "*_", "Wm", "at_", "-_", "Nm", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "(_", "1_", "-_", "f_", ")_", "/_", "Wm", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "np_", "._", "take_", "(_", "q_", ",_", "active", "Rows_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "len_", "(_", "active", "Rows_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "ID", "s_", "=_", "np_", "._", "argmin_", "(_", "q_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "np_", "._", "rave", "l\\u", "multi", "\\u", "index_", "(_", "[_", "active", "Rows_", ",_", "min", "ID", "s_", "]_", ",_", "Nm", "at_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Nm", "at_", "._", "ravel_", "(_", ")_", "[_", "ids_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "still", "Activ", "e", "Mask", " ", "=", " ", "Nm", "at", "[", "active", "Row", "s", "].", "sum", "(", "axis", "=", "1", ")", " ", "<", " ", "Nv", "ec", "[", "active", "Row", "s", "]_", "\\u\\u\\uNL\\u\\u\\u_", "still", "Activ", "e", "Mask_", "=_", "np_", "._", "take_", "(_", "Nm", "at_", ",_", "active", "Rows_", ",_", "axis_", "=_", "0_", ")_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", "<_", "np_", "._", "take_", "(_", "Nv", "ec_", ",_", "active", "Rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "Rows_", "=_", "active", "Rows_", "[_", "still", "Activ", "e", "Mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "ids_", "[_", "still", "Activ", "e", "Mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "ID", "s_", "=_", "min", "ID", "s_", "[_", "still", "Activ", "e", "Mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q_", "=_", "np_", "._", "take_", "(_", "q_", ",_", "np_", "._", "flat", "nonzero_", "(_", "still", "Activ", "e", "Mask_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qid", "s_", "=_", "np_", "._", "rave", "l\\u", "multi", "\\u", "index_", "(_", "[_", "np_", "._", "arange_", "(_", "len_", "(_", "min", "ID", "s_", ")_", ")_", ",_", "min", "ID", "s_", "]_", ",_", "q_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "._", "ravel_", "(_", ")_", "[_", "qid", "s_", "]_", "+=_", "1.0_", "/_", "Wm", "at_", "._", "ravel_", "(_", ")_", "[_", "ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Doub", "le", "-", "check", " ", "Nm", "at", " ", "satisf", "ies", " ", "constraint", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "np_", "._", "all_", "(_", "np_", "._", "abs_", "(_", "Nm", "at_", "._", "sum_", "(_", "axis_", "=_", "1_", ")_", "-_", "Nv", "ec_", ")_", "<_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Nm", "at_", "\\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,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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 ]
Except block handles 'BaseException'
worldcompany/djangoembed/oembed/tests/tests/base.py
[ { "content": "import os\nfrom urllib2 import urlparse\ntry: \n import Image\nexcept ImportError:\n from PIL import Image\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom django.conf import settings\nfrom django.core.files import storage\nfrom django.core.files.base import ContentFile\nfrom django.core.urlresolvers import reverse, NoReverseMatch\nfrom django.test import TestCase\nfrom django.utils import simplejson\n\nimport oembed\nfrom oembed.providers import BaseProvider\nfrom oembed.resources import OEmbedResource\n\nfrom oembed.tests.settings import MEDIA_ROOT, MEDIA_URL, DEFAULT_FILE_STORAGE\nfrom oembed.tests.storage import DummyMemoryStorage\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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Image_", "\\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_", "PIL_", "import_", "Image_", "\\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_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "import_", "storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "base_", "import_", "Conten", "t", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", ",_", "No", "Revers", "e", "Match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "oem", "bed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oem", "bed_", "._", "providers_", "import_", "Base", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oem", "bed_", "._", "resources_", "import_", "OE", "mbed", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oem", "bed_", "._", "tests_", "._", "settings_", "import_", "MEDIA", "\\u", "ROOT_", ",_", "MEDIA", "\\u", "URL_", ",_", "DEF", "AUL", "T", "\\u", "FILE", "\\u", "STORAGE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oem", "bed_", "._", "tests_", "._", "storage_", "import_", "Du", "mm", "y", "Memo", "ry", "Storage_", "\\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 ]
Unused import
AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/urlpatterns_reverse/tests.py
[ { "content": "\"\"\"\nUnit tests for reverse URL lookups.\n\"\"\"\nfrom __future__ import absolute_import, unicode_literals\n\nfrom django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist\nfrom django.core.urlresolvers import (reverse, resolve, get_callable,\n get_resolver, NoReverseMatch, Resolver404, ResolverMatch, RegexURLResolver,\n RegexURLPattern)\nfrom django.http import HttpResponseRedirect, HttpResponsePermanentRedirect\nfrom django.shortcuts import redirect\nfrom django.test import TestCase\nfrom django.utils import unittest, six\n\nfrom . import urlconf_outer, middleware, views\n\n\nresolve_test_data = (\n # These entries are in the format: (path, url_name, app_name, namespace, view_func, args, kwargs)\n # Simple case\n ('/normal/42/37/', 'normal-view', None, '', views.empty_view, tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/view_class/42/37/', 'view-class', None, '', views.view_class_instance, tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/included/normal/42/37/', 'inc-normal-view', None, '', views.empty_view, tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/included/view_class/42/37/', 'inc-view-class', None, '', views.view_class_instance, tuple(), {'arg1': '42', 'arg2': '37'}),\n\n # Unnamed args are dropped if you have *any* kwargs in a pattern\n ('/mixed_args/42/37/', 'mixed-args', None, '', views.empty_view, tuple(), {'arg2': '37'}),\n ('/included/mixed_args/42/37/', 'inc-mixed-args', None, '', views.empty_view, tuple(), {'arg2': '37'}),\n\n # Unnamed views will be resolved to the function/class name\n ('/unnamed/normal/42/37/', 'regressiontests.urlpatterns_reverse.views.empty_view', None, '', views.empty_view, tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/unnamed/view_class/42/37/', 'regressiontests.urlpatterns_reverse.views.ViewClass', None, '', views.view_class_instance, tuple(), {'arg1': '42', 'arg2': '37'}),\n\n # If you have no kwargs, you get an args list.\n ('/no_kwargs/42/37/', 'no-kwargs', None, '', views.empty_view, ('42','37'), {}),\n ('/included/no_kwargs/42/37/', 'inc-no-kwargs', None, '', views.empty_view, ('42','37'), {}),\n\n # Namespaces\n ('/test1/inner/42/37/', 'urlobject-view', 'testapp', 'test-ns1', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/included/test3/inner/42/37/', 'urlobject-view', 'testapp', 'test-ns3', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/ns-included1/normal/42/37/', 'inc-normal-view', None, 'inc-ns1', views.empty_view, tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/included/test3/inner/42/37/', 'urlobject-view', 'testapp', 'test-ns3', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/default/inner/42/37/', 'urlobject-view', 'testapp', 'testapp', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/other2/inner/42/37/', 'urlobject-view', 'nodefault', 'other-ns2', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/other1/inner/42/37/', 'urlobject-view', 'nodefault', 'other-ns1', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n\n # Nested namespaces\n ('/ns-included1/test3/inner/42/37/', 'urlobject-view', 'testapp', 'inc-ns1:test-ns3', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n ('/ns-included1/ns-included4/ns-included2/test3/inner/42/37/', 'urlobject-view', 'testapp', 'inc-ns1:inc-ns4:inc-ns2:test-ns3', 'empty_view', tuple(), {'arg1': '42', 'arg2': '37'}),\n\n # Namespaces capturing variables\n ('/inc70/', 'inner-nothing', None, 'inc-ns5', views.empty_view, tuple(), {'outer': '70'}),\n ('/inc78/extra/foobar/', 'inner-extra', None, 'inc-ns5', views.empty_view, tuple(), {'outer':'78', 'extra':'foobar'}),\n)\n\ntest_data = (\n ('places', '/places/3/', [3], {}),\n ('places', '/places/3/', ['3'], {}),\n ('places', NoReverseMatch, ['a'], {}),\n ('places', NoReverseMatch, [], {}),\n ('places?', '/place/', [], {}),\n ('places+', '/places/', [], {}),\n ('places*', '/place/', [], {}),\n ('places2?', '/', [], {}),\n ('places2+', '/places/', [], {}),\n ('places2*', '/', [], {}),\n ('places3', '/places/4/', [4], {}),\n ('places3', '/places/harlem/', ['harlem'], {}),\n ('places3', NoReverseMatch, ['harlem64'], {}),\n ('places4', '/places/3/', [], {'id': 3}),\n ('people', NoReverseMatch, [], {}),\n ('people', '/people/adrian/', ['adrian'], {}),\n ('people', '/people/adrian/', [], {'name': 'adrian'}),\n ('people', NoReverseMatch, ['name with spaces'], {}),\n ('people', NoReverseMatch, [], {'name': 'name with spaces'}),\n ('people2', '/people/name/', [], {}),\n ('people2a', '/people/name/fred/', ['fred'], {}),\n ('people_backref', '/people/nate-nate/', ['nate'], {}),\n ('people_backref', '/people/nate-nate/', [], {'name': 'nate'}),\n ('optional', '/optional/fred/', [], {'name': 'fred'}),\n ('optional', '/optional/fred/', ['fred'], {}),\n ('hardcoded', '/hardcoded/', [], {}),\n ('hardcoded2', '/hardcoded/doc.pdf', [], {}),\n ('people3', '/people/il/adrian/', [], {'state': 'il', 'name': 'adrian'}),\n ('people3', NoReverseMatch, [], {'state': 'il'}),\n ('people3', NoReverseMatch, [], {'name': 'adrian'}),\n ('people4', NoReverseMatch, [], {'state': 'il', 'name': 'adrian'}),\n ('people6', '/people/il/test/adrian/', ['il/test', 'adrian'], {}),\n ('people6', '/people//adrian/', ['adrian'], {}),\n ('range', '/character_set/a/', [], {}),\n ('range2', '/character_set/x/', [], {}),\n ('price', '/price/$10/', ['10'], {}),\n ('price2', '/price/$10/', ['10'], {}),\n ('price3', '/price/$10/', ['10'], {}),\n ('product', '/product/chocolate+($2.00)/', [], {'price': '2.00', 'product': 'chocolate'}),\n ('headlines', '/headlines/2007.5.21/', [], dict(year=2007, month=5, day=21)),\n ('windows', r'/windows_path/C:%5CDocuments%20and%20Settings%5Cspam/', [], dict(drive_name='C', path=r'Documents and Settings\\spam')),\n ('special', r'/special_chars/+%5C$*/', [r'+\\$*'], {}),\n ('special', NoReverseMatch, [''], {}),\n ('mixed', '/john/0/', [], {'name': 'john'}),\n ('repeats', '/repeats/a/', [], {}),\n ('repeats2', '/repeats/aa/', [], {}),\n ('repeats3', '/repeats/aa/', [], {}),\n ('insensitive', '/CaseInsensitive/fred', ['fred'], {}),\n ('test', '/test/1', [], {}),\n ('test2', '/test/2', [], {}),\n ('inner-nothing', '/outer/42/', [], {'outer': '42'}),\n ('inner-nothing', '/outer/42/', ['42'], {}),\n ('inner-nothing', NoReverseMatch, ['foo'], {}),\n ('inner-extra', '/outer/42/extra/inner/', [], {'extra': 'inner', 'outer': '42'}),\n ('inner-extra', '/outer/42/extra/inner/', ['42', 'inner'], {}),\n ('inner-extra', NoReverseMatch, ['fred', 'inner'], {}),\n ('disjunction', NoReverseMatch, ['foo'], {}),\n ('inner-disjunction', NoReverseMatch, ['10', '11'], {}),\n ('extra-places', '/e-places/10/', ['10'], {}),\n ('extra-people', '/e-people/fred/', ['fred'], {}),\n ('extra-people', '/e-people/fred/', [], {'name': 'fred'}),\n ('part', '/part/one/', [], {'value': 'one'}),\n ('part', '/prefix/xx/part/one/', [], {'value': 'one', 'prefix': 'xx'}),\n ('part2', '/part2/one/', [], {'value': 'one'}),\n ('part2', '/part2/', [], {}),\n ('part2', '/prefix/xx/part2/one/', [], {'value': 'one', 'prefix': 'xx'}),\n ('part2', '/prefix/xx/part2/', [], {'prefix': 'xx'}),\n\n # Regression for #9038\n # These views are resolved by method name. Each method is deployed twice -\n # once with an explicit argument, and once using the default value on\n # the method. This is potentially ambiguous, as you have to pick the\n # correct view for the arguments provided.\n ('kwargs_view', '/arg_view/', [], {}),\n ('kwargs_view', '/arg_view/10/', [], {'arg1':10}),\n ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/', [], {}),\n ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/10/', [], {'arg1':10}),\n ('non_path_include', '/includes/non_path_include/', [], {}),\n\n # Tests for #13154\n ('defaults', '/defaults_view1/3/', [], {'arg1': 3, 'arg2': 1}),\n ('defaults', '/defaults_view2/3/', [], {'arg1': 3, 'arg2': 2}),\n ('defaults', NoReverseMatch, [], {'arg1': 3, 'arg2': 3}),\n ('defaults', NoReverseMatch, [], {'arg2': 1}),\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 NoURLPatternsTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.no_urls'\n", "metadata": "root.NoURLPatternsTests", "header": "['module', '___EOS___']", "index": 144 }, { "content": " def test_no_urls_exception(self):\n \"\"\"\n RegexURLResolver should raise an exception when no urlpatterns exist.\n \"\"\"\n resolver = RegexURLResolver(r'^$', self.urls)\n\n self.assertRaisesMessage(ImproperlyConfigured,\n \"The included urlconf regressiontests.urlpatterns_reverse.no_urls \"\\\n \"doesn't have any patterns in it\", getattr, resolver, 'url_patterns')", "metadata": "root.NoURLPatternsTests.test_no_urls_exception", "header": "['class', 'NoURLPatternsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": "class URLPatternReverse(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.urls'\n\n\n\n\n", "metadata": "root.URLPatternReverse", "header": "['module', '___EOS___']", "index": 157 }, { "content": " def test_urlpattern_reverse(self):\n for name, expected, args, kwargs in test_data:\n try:\n got = reverse(name, args=args, kwargs=kwargs)\n except NoReverseMatch:\n self.assertEqual(expected, NoReverseMatch)\n else:\n self.assertEqual(got, expected)", "metadata": "root.URLPatternReverse.test_urlpattern_reverse", "header": "['class', 'URLPatternReverse', '(', 'TestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_reverse_none(self):\n # Reversing None should raise an error, not return the last un-named view.\n self.assertRaises(NoReverseMatch, reverse, None)", "metadata": "root.URLPatternReverse.test_reverse_none", "header": "['class', 'URLPatternReverse', '(', 'TestCase', ')', ':', '___EOS___']", "index": 169 }, { "content": " def test_prefix_braces(self):\n self.assertEqual('/%7B%7Binvalid%7D%7D/includes/non_path_include/',\n reverse('non_path_include', prefix='/{{invalid}}/'))", "metadata": "root.URLPatternReverse.test_prefix_braces", "header": "['class', 'URLPatternReverse', '(', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_prefix_parenthesis(self):\n self.assertEqual('/bogus%29/includes/non_path_include/',\n reverse('non_path_include', prefix='/bogus)/'))", "metadata": "root.URLPatternReverse.test_prefix_parenthesis", "header": "['class', 'URLPatternReverse', '(', 'TestCase', ')', ':', '___EOS___']", "index": 177 }, { "content": " def test_prefix_format_char(self):\n self.assertEqual('/bump%2520map/includes/non_path_include/',\n reverse('non_path_include', prefix='/bump%20map/'))", "metadata": "root.URLPatternReverse.test_prefix_format_char", "header": "['class', 'URLPatternReverse', '(', 'TestCase', ')', ':', '___EOS___']", "index": 181 }, { "content": "class ResolverTests(unittest.TestCase):\n\n", "metadata": "root.ResolverTests", "header": "['module', '___EOS___']", "index": 185 }, { "content": " def test_resolver_repr(self):\n \"\"\"\n Test repr of RegexURLResolver, especially when urlconf_name is a list\n (#17892).\n \"\"\"\n # Pick a resolver from a namespaced urlconf\n resolver = get_resolver('regressiontests.urlpatterns_reverse.namespace_urls')\n sub_resolver = resolver.namespace_dict['test-ns1'][1]\n self.assertIn('<RegexURLPattern list>', repr(sub_resolver))", "metadata": "root.ResolverTests.test_resolver_repr", "header": "['class', 'ResolverTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 186 }, { "content": " def test_non_regex(self):\n \"\"\"\n Verifies that we raise a Resolver404 if what we are resolving doesn't\n meet the basic requirements of a path to match - i.e., at the very\n least, it matches the root pattern '^/'. We must never return None\n from resolve, or we will get a TypeError further down the line.\n\n Regression for #10834.\n \"\"\"\n self.assertRaises(Resolver404, resolve, '')\n self.assertRaises(Resolver404, resolve, 'a')\n self.assertRaises(Resolver404, resolve, '\\\\')\n self.assertRaises(Resolver404, resolve, '.')", "metadata": "root.ResolverTests.test_non_regex", "header": "['class', 'ResolverTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 196 }, { "content": " def test_404_tried_urls_have_names(self):\n \"\"\"\n Verifies that the list of URLs that come back from a Resolver404\n exception contains a list in the right format for printing out in\n the DEBUG 404 page with both the patterns and URL names, if available.\n \"\"\"\n urls = 'regressiontests.urlpatterns_reverse.named_urls'\n # this list matches the expected URL types and names returned when\n # you try to resolve a non-existent URL in the first level of included\n # URLs in named_urls.py (e.g., '/included/non-existent-url')\n url_types_names = [\n [{'type': RegexURLPattern, 'name': 'named-url1'}],\n [{'type': RegexURLPattern, 'name': 'named-url2'}],\n [{'type': RegexURLPattern, 'name': None}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': 'named-url3'}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': 'named-url4'}],\n [{'type': RegexURLResolver}, {'type': RegexURLPattern, 'name': None}],\n [{'type': RegexURLResolver}, {'type': RegexURLResolver}],\n ]\n try:\n resolve('/included/non-existent-url', urlconf=urls)\n self.fail('resolve did not raise a 404')\n except Resolver404 as e:\n # make sure we at least matched the root ('/') url resolver:\n self.assertTrue('tried' in e.args[0])\n tried = e.args[0]['tried']\n self.assertEqual(len(e.args[0]['tried']), len(url_types_names), 'Wrong number of tried URLs returned. Expected %s, got %s.' % (len(url_types_names), len(e.args[0]['tried'])))\n for tried, expected in zip(e.args[0]['tried'], url_types_names):\n for t, e in zip(tried, expected):\n self.assertTrue(isinstance(t, e['type']), str('%s is not an instance of %s') % (t, e['type']))\n if 'name' in e:\n if not e['name']:\n self.assertTrue(t.name is None, 'Expected no URL name but found %s.' % t.name)\n else:\n self.assertEqual(t.name, e['name'], 'Wrong URL name. Expected \"%s\", got \"%s\".' % (e['name'], t.name))", "metadata": "root.ResolverTests.test_404_tried_urls_have_names", "header": "['class', 'ResolverTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": "class ReverseLazyTest(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.reverse_lazy_urls'\n\n", "metadata": "root.ReverseLazyTest", "header": "['module', '___EOS___']", "index": 246 }, { "content": " def test_redirect_with_lazy_reverse(self):\n response = self.client.get('/redirect/')\n self.assertRedirects(response, \"/redirected_to/\", status_code=301)", "metadata": "root.ReverseLazyTest.test_redirect_with_lazy_reverse", "header": "['class', 'ReverseLazyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def test_user_permission_with_lazy_reverse(self):\n user = User.objects.create_user('alfred', '[email protected]', password='testpw')\n response = self.client.get('/login_required_view/')\n self.assertRedirects(response, \"/login/?next=/login_required_view/\", status_code=302)\n self.client.login(username='alfred', password='testpw')\n response = self.client.get('/login_required_view/')\n self.assertEqual(response.status_code, 200)", "metadata": "root.ReverseLazyTest.test_user_permission_with_lazy_reverse", "header": "['class', 'ReverseLazyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 253 }, { "content": "class ReverseShortcutTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.urls'\n\n\n\n", "metadata": "root.ReverseShortcutTests", "header": "['module', '___EOS___']", "index": 261 }, { "content": " def test_redirect_to_object(self):\n # We don't really need a model; just something with a get_absolute_url\n class FakeObj(object):\n def get_absolute_url(self):\n return \"/hi-there/\"\n\n res = redirect(FakeObj())\n self.assertTrue(isinstance(res, HttpResponseRedirect))\n self.assertEqual(res['Location'], '/hi-there/')\n\n res = redirect(FakeObj(), permanent=True)\n self.assertTrue(isinstance(res, HttpResponsePermanentRedirect))\n self.assertEqual(res['Location'], '/hi-there/')", "metadata": "root.ReverseShortcutTests.test_redirect_to_object", "header": "['class', 'ReverseShortcutTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 264 }, { "content": " def test_redirect_to_view_name(self):\n res = redirect('hardcoded2')\n self.assertEqual(res['Location'], '/hardcoded/doc.pdf')\n res = redirect('places', 1)\n self.assertEqual(res['Location'], '/places/1/')\n res = redirect('headlines', year='2008', month='02', day='17')\n self.assertEqual(res['Location'], '/headlines/2008.02.17/')\n self.assertRaises(NoReverseMatch, redirect, 'not-a-view')", "metadata": "root.ReverseShortcutTests.test_redirect_to_view_name", "header": "['class', 'ReverseShortcutTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 278 }, { "content": " def test_redirect_to_url(self):\n res = redirect('/foo/')\n self.assertEqual(res['Location'], '/foo/')\n res = redirect('http://example.com/')\n self.assertEqual(res['Location'], 'http://example.com/')", "metadata": "root.ReverseShortcutTests.test_redirect_to_url", "header": "['class', 'ReverseShortcutTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 287 }, { "content": " def test_redirect_view_object(self):\n from .views import absolute_kwargs_view\n res = redirect(absolute_kwargs_view)\n self.assertEqual(res['Location'], '/absolute_arg_view/')\n self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None)", "metadata": "root.ReverseShortcutTests.test_redirect_view_object", "header": "['class', 'ReverseShortcutTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 293 }, { "content": "class NamespaceTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.namespace_urls'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.NamespaceTests", "header": "['module', '___EOS___']", "index": 300 }, { "content": " def test_ambiguous_object(self):\n \"Names deployed via dynamic URL objects that require namespaces can't be resolved\"\n self.assertRaises(NoReverseMatch, reverse, 'urlobject-view')\n self.assertRaises(NoReverseMatch, reverse, 'urlobject-view', args=[37,42])\n self.assertRaises(NoReverseMatch, reverse, 'urlobject-view', kwargs={'arg1':42, 'arg2':37})", "metadata": "root.NamespaceTests.test_ambiguous_object", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 303 }, { "content": " def test_ambiguous_urlpattern(self):\n \"Names deployed via dynamic URL objects that require namespaces can't be resolved\"\n self.assertRaises(NoReverseMatch, reverse, 'inner-nothing')\n self.assertRaises(NoReverseMatch, reverse, 'inner-nothing', args=[37,42])\n self.assertRaises(NoReverseMatch, reverse, 'inner-nothing', kwargs={'arg1':42, 'arg2':37})", "metadata": "root.NamespaceTests.test_ambiguous_urlpattern", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 309 }, { "content": " def test_non_existent_namespace(self):\n \"Non-existent namespaces raise errors\"\n self.assertRaises(NoReverseMatch, reverse, 'blahblah:urlobject-view')\n self.assertRaises(NoReverseMatch, reverse, 'test-ns1:blahblah:urlobject-view')", "metadata": "root.NamespaceTests.test_non_existent_namespace", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 315 }, { "content": " def test_normal_name(self):\n \"Normal lookups work as expected\"\n self.assertEqual('/normal/', reverse('normal-view'))\n self.assertEqual('/normal/37/42/', reverse('normal-view', args=[37,42]))\n self.assertEqual('/normal/42/37/', reverse('normal-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/+%5C$*/', reverse('special-view'))", "metadata": "root.NamespaceTests.test_normal_name", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 320 }, { "content": " def test_simple_included_name(self):\n \"Normal lookups work on names included from other patterns\"\n self.assertEqual('/included/normal/', reverse('inc-normal-view'))\n self.assertEqual('/included/normal/37/42/', reverse('inc-normal-view', args=[37,42]))\n self.assertEqual('/included/normal/42/37/', reverse('inc-normal-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/included/+%5C$*/', reverse('inc-special-view'))", "metadata": "root.NamespaceTests.test_simple_included_name", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 327 }, { "content": " def test_namespace_object(self):\n \"Dynamic URL objects can be found using a namespace\"\n self.assertEqual('/test1/inner/', reverse('test-ns1:urlobject-view'))\n self.assertEqual('/test1/inner/37/42/', reverse('test-ns1:urlobject-view', args=[37,42]))\n self.assertEqual('/test1/inner/42/37/', reverse('test-ns1:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/test1/inner/+%5C$*/', reverse('test-ns1:urlobject-special-view'))", "metadata": "root.NamespaceTests.test_namespace_object", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 334 }, { "content": " def test_embedded_namespace_object(self):\n \"Namespaces can be installed anywhere in the URL pattern tree\"\n self.assertEqual('/included/test3/inner/', reverse('test-ns3:urlobject-view'))\n self.assertEqual('/included/test3/inner/37/42/', reverse('test-ns3:urlobject-view', args=[37,42]))\n self.assertEqual('/included/test3/inner/42/37/', reverse('test-ns3:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/included/test3/inner/+%5C$*/', reverse('test-ns3:urlobject-special-view'))", "metadata": "root.NamespaceTests.test_embedded_namespace_object", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 341 }, { "content": " def test_namespace_pattern(self):\n \"Namespaces can be applied to include()'d urlpatterns\"\n self.assertEqual('/ns-included1/normal/', reverse('inc-ns1:inc-normal-view'))\n self.assertEqual('/ns-included1/normal/37/42/', reverse('inc-ns1:inc-normal-view', args=[37,42]))\n self.assertEqual('/ns-included1/normal/42/37/', reverse('inc-ns1:inc-normal-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/ns-included1/+%5C$*/', reverse('inc-ns1:inc-special-view'))", "metadata": "root.NamespaceTests.test_namespace_pattern", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 348 }, { "content": " def test_namespace_pattern_with_variable_prefix(self):\n \"When using a include with namespaces when there is a regex variable in front of it\"\n self.assertEqual('/ns-outer/42/normal/', reverse('inc-outer:inc-normal-view', kwargs={'outer':42}))\n self.assertEqual('/ns-outer/42/normal/', reverse('inc-outer:inc-normal-view', args=[42]))\n self.assertEqual('/ns-outer/42/normal/37/4/', reverse('inc-outer:inc-normal-view', kwargs={'outer':42, 'arg1': 37, 'arg2': 4}))\n self.assertEqual('/ns-outer/42/normal/37/4/', reverse('inc-outer:inc-normal-view', args=[42, 37, 4]))\n self.assertEqual('/ns-outer/42/+%5C$*/', reverse('inc-outer:inc-special-view', kwargs={'outer':42}))\n self.assertEqual('/ns-outer/42/+%5C$*/', reverse('inc-outer:inc-special-view', args=[42]))", "metadata": "root.NamespaceTests.test_namespace_pattern_with_variable_prefix", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 355 }, { "content": " def test_multiple_namespace_pattern(self):\n \"Namespaces can be embedded\"\n self.assertEqual('/ns-included1/test3/inner/', reverse('inc-ns1:test-ns3:urlobject-view'))\n self.assertEqual('/ns-included1/test3/inner/37/42/', reverse('inc-ns1:test-ns3:urlobject-view', args=[37,42]))\n self.assertEqual('/ns-included1/test3/inner/42/37/', reverse('inc-ns1:test-ns3:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/ns-included1/test3/inner/+%5C$*/', reverse('inc-ns1:test-ns3:urlobject-special-view'))", "metadata": "root.NamespaceTests.test_multiple_namespace_pattern", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 364 }, { "content": " def test_nested_namespace_pattern(self):\n \"Namespaces can be nested\"\n self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-view'))\n self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/37/42/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-view', args=[37,42]))\n self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/42/37/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/+%5C$*/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-special-view'))", "metadata": "root.NamespaceTests.test_nested_namespace_pattern", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 371 }, { "content": " def test_app_lookup_object(self):\n \"A default application namespace can be used for lookup\"\n self.assertEqual('/default/inner/', reverse('testapp:urlobject-view'))\n self.assertEqual('/default/inner/37/42/', reverse('testapp:urlobject-view', args=[37,42]))\n self.assertEqual('/default/inner/42/37/', reverse('testapp:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/default/inner/+%5C$*/', reverse('testapp:urlobject-special-view'))", "metadata": "root.NamespaceTests.test_app_lookup_object", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 378 }, { "content": " def test_app_lookup_object_with_default(self):\n \"A default application namespace is sensitive to the 'current' app can be used for lookup\"\n self.assertEqual('/included/test3/inner/', reverse('testapp:urlobject-view', current_app='test-ns3'))\n self.assertEqual('/included/test3/inner/37/42/', reverse('testapp:urlobject-view', args=[37,42], current_app='test-ns3'))\n self.assertEqual('/included/test3/inner/42/37/', reverse('testapp:urlobject-view', kwargs={'arg1':42, 'arg2':37}, current_app='test-ns3'))\n self.assertEqual('/included/test3/inner/+%5C$*/', reverse('testapp:urlobject-special-view', current_app='test-ns3'))", "metadata": "root.NamespaceTests.test_app_lookup_object_with_default", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 385 }, { "content": " def test_app_lookup_object_without_default(self):\n \"An application namespace without a default is sensitive to the 'current' app can be used for lookup\"\n self.assertEqual('/other2/inner/', reverse('nodefault:urlobject-view'))\n self.assertEqual('/other2/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42]))\n self.assertEqual('/other2/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/other2/inner/+%5C$*/', reverse('nodefault:urlobject-special-view'))\n\n self.assertEqual('/other1/inner/', reverse('nodefault:urlobject-view', current_app='other-ns1'))\n self.assertEqual('/other1/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42], current_app='other-ns1'))\n self.assertEqual('/other1/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37}, current_app='other-ns1'))\n self.assertEqual('/other1/inner/+%5C$*/', reverse('nodefault:urlobject-special-view', current_app='other-ns1'))", "metadata": "root.NamespaceTests.test_app_lookup_object_without_default", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 392 }, { "content": " def test_special_chars_namespace(self):\n self.assertEqual('/+%5C$*/included/normal/', reverse('special:inc-normal-view'))\n self.assertEqual('/+%5C$*/included/normal/37/42/', reverse('special:inc-normal-view', args=[37,42]))\n self.assertEqual('/+%5C$*/included/normal/42/37/', reverse('special:inc-normal-view', kwargs={'arg1':42, 'arg2':37}))\n self.assertEqual('/+%5C$*/included/+%5C$*/', reverse('special:inc-special-view'))", "metadata": "root.NamespaceTests.test_special_chars_namespace", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 404 }, { "content": " def test_namespaces_with_variables(self):\n \"Namespace prefixes can capture variables: see #15900\"\n self.assertEqual('/inc70/', reverse('inc-ns5:inner-nothing', kwargs={'outer': '70'}))\n self.assertEqual('/inc78/extra/foobar/', reverse('inc-ns5:inner-extra', kwargs={'outer':'78', 'extra':'foobar'}))\n self.assertEqual('/inc70/', reverse('inc-ns5:inner-nothing', args=['70']))\n self.assertEqual('/inc78/extra/foobar/', reverse('inc-ns5:inner-extra', args=['78','foobar']))", "metadata": "root.NamespaceTests.test_namespaces_with_variables", "header": "['class', 'NamespaceTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 410 }, { "content": "class RequestURLconfTests(TestCase):\n\n\n\n", "metadata": "root.RequestURLconfTests", "header": "['module', '___EOS___']", "index": 417 }, { "content": " def setUp(self):\n self.root_urlconf = settings.ROOT_URLCONF\n self.middleware_classes = settings.MIDDLEWARE_CLASSES\n settings.ROOT_URLCONF = urlconf_outer.__name__", "metadata": "root.RequestURLconfTests.setUp", "header": "['class', 'RequestURLconfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 418 }, { "content": " def tearDown(self):\n settings.ROOT_URLCONF = self.root_urlconf\n settings.MIDDLEWARE_CLASSES = self.middleware_classes", "metadata": "root.RequestURLconfTests.tearDown", "header": "['class', 'RequestURLconfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 423 }, { "content": " def test_urlconf(self):\n response = self.client.get('/test/me/')\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.content, b'outer:/test/me/,'\n b'inner:/inner_urlconf/second_test/')\n response = self.client.get('/inner_urlconf/second_test/')\n self.assertEqual(response.status_code, 200)\n response = self.client.get('/second_test/')\n self.assertEqual(response.status_code, 404)", "metadata": "root.RequestURLconfTests.test_urlconf", "header": "['class', 'RequestURLconfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 427 }, { "content": " def test_urlconf_overridden(self):\n settings.MIDDLEWARE_CLASSES += (\n '%s.ChangeURLconfMiddleware' % middleware.__name__,\n )\n response = self.client.get('/test/me/')\n self.assertEqual(response.status_code, 404)\n response = self.client.get('/inner_urlconf/second_test/')\n self.assertEqual(response.status_code, 404)\n response = self.client.get('/second_test/')\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.content, b'outer:,inner:/second_test/')", "metadata": "root.RequestURLconfTests.test_urlconf_overridden", "header": "['class', 'RequestURLconfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 437 }, { "content": " def test_urlconf_overridden_with_null(self):\n settings.MIDDLEWARE_CLASSES += (\n '%s.NullChangeURLconfMiddleware' % middleware.__name__,\n )\n self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')", "metadata": "root.RequestURLconfTests.test_urlconf_overridden_with_null", "header": "['class', 'RequestURLconfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 449 }, { "content": "class ErrorHandlerResolutionTests(TestCase):\n \"\"\"Tests for handler404 and handler500\"\"\"\n\n\n", "metadata": "root.ErrorHandlerResolutionTests", "header": "['module', '___EOS___']", "index": 455 }, { "content": " def setUp(self):\n from django.core.urlresolvers import RegexURLResolver\n urlconf = 'regressiontests.urlpatterns_reverse.urls_error_handlers'\n urlconf_callables = 'regressiontests.urlpatterns_reverse.urls_error_handlers_callables'\n self.resolver = RegexURLResolver(r'^$', urlconf)\n self.callable_resolver = RegexURLResolver(r'^$', urlconf_callables)", "metadata": "root.ErrorHandlerResolutionTests.setUp", "header": "['class', 'ErrorHandlerResolutionTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 458 }, { "content": " def test_named_handlers(self):\n from .views import empty_view\n handler = (empty_view, {})\n self.assertEqual(self.resolver.resolve404(), handler)\n self.assertEqual(self.resolver.resolve500(), handler)", "metadata": "root.ErrorHandlerResolutionTests.test_named_handlers", "header": "['class', 'ErrorHandlerResolutionTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 465 }, { "content": " def test_callable_handers(self):\n from .views import empty_view\n handler = (empty_view, {})\n self.assertEqual(self.callable_resolver.resolve404(), handler)\n self.assertEqual(self.callable_resolver.resolve500(), handler)", "metadata": "root.ErrorHandlerResolutionTests.test_callable_handers", "header": "['class', 'ErrorHandlerResolutionTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 471 }, { "content": "class DefaultErrorHandlerTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.urls_without_full_import'\n", "metadata": "root.DefaultErrorHandlerTests", "header": "['module', '___EOS___']", "index": 477 }, { "content": " def test_default_handler(self):\n \"If the urls.py doesn't specify handlers, the defaults are used\"\n try:\n response = self.client.get('/test/')\n self.assertEqual(response.status_code, 404)\n except AttributeError:\n self.fail(\"Shouldn't get an AttributeError due to undefined 404 handler\")\n\n try:\n self.assertRaises(ValueError, self.client.get, '/bad_view/')\n except AttributeError:\n self.fail(\"Shouldn't get an AttributeError due to undefined 500 handler\")", "metadata": "root.DefaultErrorHandlerTests.test_default_handler", "header": "['class', 'DefaultErrorHandlerTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 480 }, { "content": "class NoRootUrlConfTests(TestCase):\n \"\"\"Tests for handler404 and handler500 if urlconf is None\"\"\"\n urls = None\n", "metadata": "root.NoRootUrlConfTests", "header": "['module', '___EOS___']", "index": 493 }, { "content": " def test_no_handler_exception(self):\n self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')", "metadata": "root.NoRootUrlConfTests.test_no_handler_exception", "header": "['class', 'NoRootUrlConfTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 497 }, { "content": "class ResolverMatchTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.namespace_urls'\n\n", "metadata": "root.ResolverMatchTests", "header": "['module', '___EOS___']", "index": 500 }, { "content": " def test_urlpattern_resolve(self):\n for path, name, app_name, namespace, func, args, kwargs in resolve_test_data:\n # Test legacy support for extracting \"function, args, kwargs\"\n match_func, match_args, match_kwargs = resolve(path)\n self.assertEqual(match_func, func)\n self.assertEqual(match_args, args)\n self.assertEqual(match_kwargs, kwargs)\n\n # Test ResolverMatch capabilities.\n match = resolve(path)\n self.assertEqual(match.__class__, ResolverMatch)\n self.assertEqual(match.url_name, name)\n self.assertEqual(match.args, args)\n self.assertEqual(match.kwargs, kwargs)\n self.assertEqual(match.app_name, app_name)\n self.assertEqual(match.namespace, namespace)\n self.assertEqual(match.func, func)\n\n # ... and for legacy purposes:\n self.assertEqual(match[0], func)\n self.assertEqual(match[1], args)\n self.assertEqual(match[2], kwargs)", "metadata": "root.ResolverMatchTests.test_urlpattern_resolve", "header": "['class', 'ResolverMatchTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 503 }, { "content": " def test_resolver_match_on_request(self):\n response = self.client.get('/resolver_match/')\n resolver_match = response.resolver_match\n self.assertEqual(resolver_match.url_name, 'test-resolver-match')", "metadata": "root.ResolverMatchTests.test_resolver_match_on_request", "header": "['class', 'ResolverMatchTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 526 }, { "content": "class ErroneousViewTests(TestCase):\n urls = 'regressiontests.urlpatterns_reverse.erroneous_urls'\n\n", "metadata": "root.ErroneousViewTests", "header": "['module', '___EOS___']", "index": 531 }, { "content": " def test_erroneous_resolve(self):\n self.assertRaises(ImportError, self.client.get, '/erroneous_inner/')\n self.assertRaises(ImportError, self.client.get, '/erroneous_outer/')\n self.assertRaises(ViewDoesNotExist, self.client.get, '/missing_inner/')\n self.assertRaises(ViewDoesNotExist, self.client.get, '/missing_outer/')\n self.assertRaises(ViewDoesNotExist, self.client.get, '/uncallable/')", "metadata": "root.ErroneousViewTests.test_erroneous_resolve", "header": "['class', 'ErroneousViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 534 }, { "content": " def test_erroneous_reverse(self):\n \"\"\"\n Ensure that a useful exception is raised when a regex is invalid in the\n URLConf.\n Refs #6170.\n \"\"\"\n # The regex error will be hit before NoReverseMatch can be raised\n self.assertRaises(ImproperlyConfigured, reverse, 'whatever blah blah')", "metadata": "root.ErroneousViewTests.test_erroneous_reverse", "header": "['class', 'ErroneousViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 541 }, { "content": "class ViewLoadingTests(TestCase):", "metadata": "root.ViewLoadingTests", "header": "['module', '___EOS___']", "index": 550 }, { "content": " def test_view_loading(self):\n # A missing view (identified by an AttributeError) should raise\n # ViewDoesNotExist, ...\n six.assertRaisesRegex(self, ViewDoesNotExist, \".*View does not exist in.*\",\n get_callable,\n 'regressiontests.urlpatterns_reverse.views.i_should_not_exist')\n # ... but if the AttributeError is caused by something else don't\n # swallow it.\n self.assertRaises(AttributeError, get_callable,\n 'regressiontests.urlpatterns_reverse.views_broken.i_am_broken')", "metadata": "root.ViewLoadingTests.test_view_loading", "header": "['class', 'ViewLoadingTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 551 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Unit", " ", "tests", " ", "for", " ", "reverse", " ", "URL", " ", "lookups", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", ",_", "View", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "(_", "reverse_", ",_", "resolve_", ",_", "get", "\\u", "callable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "resolver_", ",_", "No", "Revers", "e", "Match_", ",_", "Resolv", "er", "404_", ",_", "Resolv", "er", "Match_", ",_", "Rege", "x", "URL", "Resolver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rege", "x", "URL", "Pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Respons", "e", "Permanent", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "unittest_", ",_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "url", "conf", "\\u", "outer_", ",_", "middleware_", ",_", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resolve", "\\u", "test\\u", "data_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "entri", "es", " ", "are", " ", "in", " ", "the", " ", "format", ":", " ", "(", "path", ",", " ", "url", "\\u", "name", ",", " ", "app", "\\u", "name", ",", " ", "namespace", ",", " ", "view", "\\u", "func", ",", " ", "args", ",", " ", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "normal", "-", "view", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "view", "\\u", "class", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "view", "-", "class", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "view", "\\u", "class", "\\u", "instance_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "inc", "-", "normal", "-", "view", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "view", "\\u", "class", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "inc", "-", "view", "-", "class", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "view", "\\u", "class", "\\u", "instance_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "named", " ", "args", " ", "are", " ", "dropped", " ", "if", " ", "you", " ", "have", " ", "*", "any", "*", " ", "kwarg", "s", " ", "in", " ", "a", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "mixed", "\\u", "args", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "mixed", "-", "args", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "mixed", "\\u", "args", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "inc", "-", "mixed", "-", "args", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "named", " ", "views", " ", "will", " ", "be", " ", "resolve", "d", " ", "to", " ", "the", " ", "function", "/", "class", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "unn", "ame", "d", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "views", ".", "empty", "\\u", "view", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "unn", "ame", "d", "/", "view", "\\u", "class", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "views", ".", "View", "Class", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "view", "\\u", "class", "\\u", "instance_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "have", " ", "no", " ", "kwarg", "s", ",", " ", "you", " ", "get", " ", "an", " ", "args", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "no", "\\u", "kwarg", "s", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "no", "-", "kwarg", "s", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "(_", "'", "4", "2", "'_", ",_", "'", "3", "7", "'_", ")_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "no", "\\u", "kwarg", "s", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "inc", "-", "no", "-", "kwarg", "s", "'_", ",_", "None_", ",_", "''_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "(_", "'", "4", "2", "'_", ",_", "'", "3", "7", "'_", ")_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Names", "paces", "_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "test", "1", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "test", "-", "ns", "1", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "test", "-", "ns", "3", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "ns", "-", "include", "d1", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "inc", "-", "normal", "-", "view", "'_", ",_", "None_", ",_", "'", "inc", "-", "ns", "1", "'_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "test", "-", "ns", "3", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "default", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "other", "2", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "node", "fault", "'_", ",_", "'", "other", "-", "ns", "2", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "other", "1", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "node", "fault", "'_", ",_", "'", "other", "-", "ns", "1", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nest", "ed", " ", "namespaces_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "ns", "-", "include", "d1", "/", "ns", "-", "include", "d4", "/", "ns", "-", "include", "d2", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "'", "testa", "pp", "'_", ",_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "ns", "4", ":", "inc", "-", "ns", "2", ":", "test", "-", "ns", "3", "'_", ",_", "'", "empty", "\\u", "view", "'_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "4", "2", "'_", ",_", "'", "arg", "2", "'_", ":_", "'", "3", "7", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Names", "paces", " ", "captur", "ing", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "inc", "7", "0", "/'_", ",_", "'", "inner", "-", "not", "hing", "'_", ",_", "None_", ",_", "'", "inc", "-", "ns", "5", "'_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "outer", "'_", ":_", "'", "7", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "inc", "7", "8", "/", "extra", "/", "fooba", "r", "/'_", ",_", "'", "inner", "-", "extra", "'_", ",_", "None_", ",_", "'", "inc", "-", "ns", "5", "'_", ",_", "views_", "._", "empty", "\\u", "view_", ",_", "tuple_", "(_", ")_", ",_", "{_", "'", "outer", "'_", ":_", "'", "7", "8", "'_", ",_", "'", "extra", "'_", ":_", "'", "fooba", "r", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "'_", ",_", "'/", "place", "s", "/", "3", "/'_", ",_", "[_", "3_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "'_", ",_", "'/", "place", "s", "/", "3", "/'_", ",_", "[_", "'", "3", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "a", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "?'_", ",_", "'/", "place", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "+'_", ",_", "'/", "place", "s", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "*'_", ",_", "'/", "place", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s2", "?'_", ",_", "'/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s2", "+'_", ",_", "'/", "place", "s", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s2", "*'_", ",_", "'/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s3", "'_", ",_", "'/", "place", "s", "/", "4", "/'_", ",_", "[_", "4_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s3", "'_", ",_", "'/", "place", "s", "/", "har", "lem", "/'_", ",_", "[_", "'", "har", "lem", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s3", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "har", "lem", "64", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "place", "s", "4", "'_", ",_", "'/", "place", "s", "/", "3", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "id", "'_", ":_", "3_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "'_", ",_", "'/", "people", "/", "adr", "ian", "/'_", ",_", "[_", "'", "adr", "ian", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "'_", ",_", "'/", "people", "/", "adr", "ian", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "adr", "ian", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "name", " ", "with", " ", "space", "s", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "name", " ", "with", " ", "space", "s", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "2", "'_", ",_", "'/", "people", "/", "name", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "2a", "'_", ",_", "'/", "people", "/", "name", "/", "fre", "d", "/'_", ",_", "[_", "'", "fre", "d", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "\\u", "back", "ref", "'_", ",_", "'/", "people", "/", "nat", "e-", "nat", "e", "/'_", ",_", "[_", "'", "nat", "e", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "\\u", "back", "ref", "'_", ",_", "'/", "people", "/", "nat", "e-", "nat", "e", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "nat", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "option", "al", "'_", ",_", "'/", "option", "al", "/", "fre", "d", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "fre", "d", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "option", "al", "'_", ",_", "'/", "option", "al", "/", "fre", "d", "/'_", ",_", "[_", "'", "fre", "d", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "hard", "code", "d", "'_", ",_", "'/", "hard", "code", "d", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "hard", "code", "d2", "'_", ",_", "'/", "hard", "code", "d", "/", "doc", ".", "pdf", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "3", "'_", ",_", "'/", "people", "/", "il", "/", "adr", "ian", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "state", "'_", ":_", "'", "il", "'_", ",_", "'", "name", "'_", ":_", "'", "adr", "ian", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "3", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "state", "'_", ":_", "'", "il", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "3", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "adr", "ian", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "4", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "state", "'_", ":_", "'", "il", "'_", ",_", "'", "name", "'_", ":_", "'", "adr", "ian", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "6", "'_", ",_", "'/", "people", "/", "il", "/", "test", "/", "adr", "ian", "/'_", ",_", "[_", "'", "il", "/", "test", "'_", ",_", "'", "adr", "ian", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "people", "6", "'_", ",_", "'/", "people", "//", "adr", "ian", "/'_", ",_", "[_", "'", "adr", "ian", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "range", "'_", ",_", "'/", "character", "\\u", "set", "/", "a", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "range", "2", "'_", ",_", "'/", "character", "\\u", "set", "/", "x", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "price", "'_", ",_", "'/", "price", "/$", "10", "/'_", ",_", "[_", "'", "10", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "price", "2", "'_", ",_", "'/", "price", "/$", "10", "/'_", ",_", "[_", "'", "10", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "price", "3", "'_", ",_", "'/", "price", "/$", "10", "/'_", ",_", "[_", "'", "10", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "product", "'_", ",_", "'/", "product", "/", "cho", "colat", "e", "+(", "$", "2.0", "0", ")/", "'_", ",_", "[_", "]_", ",_", "{_", "'", "price", "'_", ":_", "'", "2.0", "0", "'_", ",_", "'", "product", "'_", ":_", "'", "cho", "colat", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "headline", "s", "'_", ",_", "'/", "headline", "s", "/", "2007", ".5", ".2", "1", "/'_", ",_", "[_", "]_", ",_", "dict_", "(_", "year_", "=_", "2007_", ",_", "month_", "=_", "5_", ",_", "day_", "=_", "21_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "windows", "'_", ",_", "r", "'/", "windows", "\\u", "path", "/", "C", ":", "%", "5", "CD", "ocu", "ment", "s", "%", "20", "and", "%", "20", "Sett", "ings", "%", "5", "Cs", "pam", "/'_", ",_", "[_", "]_", ",_", "dict_", "(_", "drive", "\\u", "name_", "=_", "'", "C", "'_", ",_", "path_", "=_", "r", "'", "Document", "s", " ", "and", " ", "Sett", "ings", "\\\\", "spam", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "special", "'_", ",_", "r", "'/", "special", "\\u", "char", "s", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "[_", "r", "'+", "\\\\$", "*'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "special", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "''_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mixed", "'_", ",_", "'/", "john", "/", "0", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "john", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "repeat", "s", "'_", ",_", "'/", "repeat", "s", "/", "a", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "repeat", "s2", "'_", ",_", "'/", "repeat", "s", "/", "aa", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "repeat", "s3", "'_", ",_", "'/", "repeat", "s", "/", "aa", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inse", "nsitive", "'_", ",_", "'/", "Case", "Inse", "nsitive", "/", "fre", "d", "'_", ",_", "[_", "'", "fre", "d", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "test", "'_", ",_", "'/", "test", "/", "1", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "test", "2", "'_", ",_", "'/", "test", "/", "2", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "not", "hing", "'_", ",_", "'/", "outer", "/", "4", "2", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "outer", "'_", ":_", "'", "4", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "not", "hing", "'_", ",_", "'/", "outer", "/", "4", "2", "/'_", ",_", "[_", "'", "4", "2", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "not", "hing", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "foo", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "extra", "'_", ",_", "'/", "outer", "/", "4", "2", "/", "extra", "/", "inner", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "extra", "'_", ":_", "'", "inner", "'_", ",_", "'", "outer", "'_", ":_", "'", "4", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "extra", "'_", ",_", "'/", "outer", "/", "4", "2", "/", "extra", "/", "inner", "/'_", ",_", "[_", "'", "4", "2", "'_", ",_", "'", "inner", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "extra", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "fre", "d", "'_", ",_", "'", "inner", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "disj", "uncti", "on", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "foo", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "inner", "-", "disj", "uncti", "on", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "'", "10", "'_", ",_", "'", "11", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "extra", "-", "place", "s", "'_", ",_", "'/", "e-", "place", "s", "/", "10", "/'_", ",_", "[_", "'", "10", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "extra", "-", "people", "'_", ",_", "'/", "e-", "people", "/", "fre", "d", "/'_", ",_", "[_", "'", "fre", "d", "'_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "extra", "-", "people", "'_", ",_", "'/", "e-", "people", "/", "fre", "d", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "name", "'_", ":_", "'", "fre", "d", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part", "'_", ",_", "'/", "part", "/", "one", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "value", "'_", ":_", "'", "one", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part", "'_", ",_", "'/", "prefix", "/", "xx", "/", "part", "/", "one", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "value", "'_", ":_", "'", "one", "'_", ",_", "'", "prefix", "'_", ":_", "'", "xx", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part2", "'_", ",_", "'/", "part2", "/", "one", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "value", "'_", ":_", "'", "one", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part2", "'_", ",_", "'/", "part2", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part2", "'_", ",_", "'/", "prefix", "/", "xx", "/", "part2", "/", "one", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "value", "'_", ":_", "'", "one", "'_", ",_", "'", "prefix", "'_", ":_", "'", "xx", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part2", "'_", ",_", "'/", "prefix", "/", "xx", "/", "part2", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "prefix", "'_", ":_", "'", "xx", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Regr", "ession", " ", "for", " ", "#", "903", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "views", " ", "are", " ", "resolve", "d", " ", "by", " ", "method", " ", "name", ".", " ", "Ea", "ch", " ", "method", " ", "is", " ", "deploye", "d", " ", "twi", "ce", " ", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "onc", "e", " ", "with", " ", "an", " ", "explicit", " ", "argu", "ment", ",", " ", "and", " ", "onc", "e", " ", "usi", "ng", " ", "the", " ", "default", " ", "value", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "method", ".", " ", "Thi", "s", " ", "is", " ", "potenti", "ally", " ", "ambiguous", ",", " ", "as", " ", "you", " ", "have", " ", "to", " ", "pick", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", " ", "view", " ", "for", " ", "the", " ", "argu", "ment", "s", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "kwarg", "s", "\\u", "view", "'_", ",_", "'/", "arg", "\\u", "view", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "kwarg", "s", "\\u", "view", "'_", ",_", "'/", "arg", "\\u", "view", "/", "10", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "1", "'_", ":_", "10_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "views", ".", "abs", "olute", "\\u", "kwarg", "s", "\\u", "view", "'_", ",_", "'/", "abs", "olute", "\\u", "arg", "\\u", "view", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "views", ".", "abs", "olute", "\\u", "kwarg", "s", "\\u", "view", "'_", ",_", "'/", "abs", "olute", "\\u", "arg", "\\u", "view", "/", "10", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "1", "'_", ":_", "10_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "non", "\\u", "path", "\\u", "include", "'_", ",_", "'/", "include", "s", "/", "non", "\\u", "path", "\\u", "include", "/'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "for", " ", "#", "131", "54_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "default", "s", "'_", ",_", "'/", "default", "s", "\\u", "view", "1", "/", "3", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "1", "'_", ":_", "3_", ",_", "'", "arg", "2", "'_", ":_", "1_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "default", "s", "'_", ",_", "'/", "default", "s", "\\u", "view", "2", "/", "3", "/'_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "1", "'_", ":_", "3_", ",_", "'", "arg", "2", "'_", ":_", "2_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "default", "s", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "1", "'_", ":_", "3_", ",_", "'", "arg", "2", "'_", ":_", "3_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "default", "s", "'_", ",_", "No", "Revers", "e", "Match_", ",_", "[_", "]_", ",_", "{_", "'", "arg", "2", "'_", ":_", "1_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "No", "URL", "Patterns", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "no", "\\u", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "URL", "Patterns", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "urls", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rege", "x", "URL", "Resolv", "er", " ", "shou", "ld", " ", "raise", " ", "an", " ", "exception", " ", "whe", "n", " ", "no", " ", "urlpa", "tter", "ns", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolver_", "=_", "Rege", "x", "URL", "Resolver_", "(_", "r", "'", "^", "$'_", ",_", "self_", "._", "urls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Message_", "(_", "Impro", "perl", "y", "Configured_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "include", "d", " ", "url", "conf", " ", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "no", "\\u", "urls", " ", "\"_", "\"", "doe", "sn", "'", "t", " ", "have", " ", "any", " ", "pattern", "s", " ", "in", " ", "it", "\"_", ",_", "getattr_", ",_", "resolver_", ",_", "'", "url", "\\u", "pattern", "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_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "urlpa", "tter", "n", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "expected_", ",_", "args_", ",_", "kwargs_", "in_", "test\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "got_", "=_", "reverse_", "(_", "name_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "No", "Revers", "e", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "got_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "reverse", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Revers", "ing", " ", "Non", "e", " ", "shou", "ld", " ", "raise", " ", "an", " ", "error", ",", " ", "not", " ", "return", " ", "the", " ", "last", " ", "un", "-", "named", " ", "view", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "prefix", "\\u", "braces", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "'/", "%", "7", "B", "%", "7", "Bin", "valid", "%", "7", "D", "%", "7", "D", "/", "include", "s", "/", "non", "\\u", "path", "\\u", "include", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "non", "\\u", "path", "\\u", "include", "'_", ",_", "prefix_", "=_", "'/{", "{", "invalid", "}}", "/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "prefix", "\\u", "parenthes", "is_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "'/", "bog", "us", "%", "2", "9", "/", "include", "s", "/", "non", "\\u", "path", "\\u", "include", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "non", "\\u", "path", "\\u", "include", "'_", ",_", "prefix_", "=_", "'/", "bog", "us", ")/", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Pat", "tern", "Revers", "e_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "prefix", "\\u", "format\\u", "char_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "'/", "bump", "%", "252", "0", "map", "/", "include", "s", "/", "non", "\\u", "path", "\\u", "include", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "non", "\\u", "path", "\\u", "include", "'_", ",_", "prefix_", "=_", "'/", "bump", "%", "20", "map", "/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Resolv", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Resolv", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "resolver", "\\u", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "repr", " ", "of", " ", "Rege", "x", "URL", "Resolv", "er", ",", " ", "especial", "ly", " ", "whe", "n", " ", "url", "conf", "\\u", "name", " ", "is", " ", "a", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "(", "#", "178", "9", "2", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pick", " ", "a", " ", "resolver", " ", "from", " ", "a", " ", "namespace", "d", " ", "url", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "resolver_", "=_", "get", "\\u", "resolver_", "(_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "namespace", "\\u", "urls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "resolver_", "=_", "resolver_", "._", "namespace", "\\u", "dict_", "[_", "'", "test", "-", "ns", "1", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'<", "Rege", "x", "URL", "Pat", "tern", " ", "list", ">'_", ",_", "repr_", "(_", "sub\\u", "resolver_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resolv", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "non", "\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verifie", "s", " ", "tha", "t", " ", "we", " ", "raise", " ", "a", " ", "Resolv", "er", "404", " ", "if", " ", "what", " ", "we", " ", "are", " ", "resolv", "ing", " ", "doe", "sn", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "meet", " ", "the", " ", "basic", " ", "require", "ment", "s", " ", "of", " ", "a", " ", "path", " ", "to", " ", "match", " ", "-", " ", "i", ".", "e", ".,", " ", "at", " ", "the", " ", "very", "\\", "10", ";", " ", " ", " ", " ", "leas", "t", ",", " ", "it", " ", "matche", "s", " ", "the", " ", "root", " ", "pattern", " ", "'", "^", "/'", ".", " ", "We", " ", "must", " ", "neve", "r", " ", "return", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "resolve", ",", " ", "or", " ", "we", " ", "will", " ", "get", " ", "a", " ", "Type", "Error", " ", "fur", "ther", " ", "down", " ", "the", " ", "line", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Regr", "ession", " ", "for", " ", "#", "108", "34.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Resolv", "er", "404_", ",_", "resolve_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Resolv", "er", "404_", ",_", "resolve_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Resolv", "er", "404_", ",_", "resolve_", ",_", "'\\\\\\\\'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Resolv", "er", "404_", ",_", "resolve_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resolv", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "404", "\\u", "trie", "d\\u", "urls", "\\u", "have", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verifie", "s", " ", "tha", "t", " ", "the", " ", "list", " ", "of", " ", "URL", "s", " ", "tha", "t", " ", "come", " ", "back", " ", "from", " ", "a", " ", "Resolv", "er", "404", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "contain", "s", " ", "a", " ", "list", " ", "in", " ", "the", " ", "right", " ", "format", " ", "for", " ", "printin", "g", " ", "out", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "DEBU", "G", " ", "404", " ", "page", " ", "with", " ", "bot", "h", " ", "the", " ", "pattern", "s", " ", "and", " ", "URL", " ", "names", ",", " ", "if", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "named", "\\u", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "matche", "s", " ", "the", " ", "expected", " ", "URL", " ", "types", " ", "and", " ", "names", " ", "return", "ed", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "try", " ", "to", " ", "resolve", " ", "a", " ", "non", "-", "existen", "t", " ", "URL", " ", "in", " ", "the", " ", "first", " ", "level", " ", "of", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", "s", " ", "in", " ", "named", "\\u", "urls", ".", "py", " ", "(", "e", ".", "g", ".,", " ", "'/", "include", "d", "/", "non", "-", "existen", "t", "-", "url", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "types", "\\u", "names_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "1", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url2", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "None_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "3", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "'", "named", "-", "url", "4", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Pattern_", ",_", "'", "name", "'_", ":_", "None_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", ",_", "{_", "'", "type", "'_", ":_", "Rege", "x", "URL", "Resolver_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolve_", "(_", "'/", "include", "d", "/", "non", "-", "existen", "t", "-", "url", "'_", ",_", "url", "conf_", "=_", "urls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "'", "resolve", " ", "did", " ", "not", " ", "raise", " ", "a", " ", "404", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Resolv", "er", "404_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "at", " ", "leas", "t", " ", "matche", "d", " ", "the", " ", "root", " ", "('", "/'", ")", " ", "url", " ", "resolver", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'", "trie", "d", "'_", "in_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trie", "d_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ")_", ",_", "len_", "(_", "url", "\\u", "types", "\\u", "names_", ")_", ",_", "'", "Wro", "ng", " ", "number", " ", "of", " ", "trie", "d", " ", "URL", "s", " ", "return", "ed", ".", " ", " ", "Expect", "ed", " ", "%", "s", ",", " ", "got", " ", "%", "s", ".'_", "%_", "(_", "len_", "(_", "url", "\\u", "types", "\\u", "names_", ")_", ",_", "len_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "trie", "d_", ",_", "expected_", "in_", "zip_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "[_", "'", "trie", "d", "'_", "]_", ",_", "url", "\\u", "types", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", ",_", "e_", "in_", "zip_", "(_", "trie", "d_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", ",_", "e_", "[_", "'", "type", "'_", "]_", ")_", ",_", "str_", "(_", "'%", "s", " ", "is", " ", "not", " ", "an", " ", "instance", " ", "of", " ", "%", "s", "'_", ")_", "%_", "(_", "t_", ",_", "e_", "[_", "'", "type", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "e_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assert", "True_", "(_", "t_", "._", "name_", "is_", "None_", ",_", "'", "Expect", "ed", " ", "no", " ", "URL", " ", "name", " ", "but", " ", "found", " ", "%", "s", ".'_", "%_", "t_", "._", "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 ", " ", " _", "self_", "._", "assert", "Equal_", "(_", "t_", "._", "name_", ",_", "e_", "[_", "'", "name", "'_", "]_", ",_", "'", "Wro", "ng", " ", "URL", " ", "name", ".", " ", " ", "Expect", "ed", " ", "\"%", "s", "\",", " ", "got", " ", "\"%", "s", "\".'_", "%_", "(_", "e_", "[_", "'", "name", "'_", "]_", ",_", "t_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Revers", "e", "La", "zy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "reverse", "\\u", "lazy", "\\u", "urls", "'_", "\\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_", "Revers", "e", "La", "zy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "redirec", "t", "\\u", "with", "\\u", "lazy", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "redirec", "t", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "response_", ",_", "\"/", "redirected", "\\u", "to", "/\"_", ",_", "status", "\\u", "code_", "=_", "301_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "La", "zy", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user", "\\u", "permissi", "on", "\\u", "with", "\\u", "lazy", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "'", "alf", "red", "'_", ",_", "'", "alf", "red", "@", "example", ".", "com", "'_", ",_", "password_", "=_", "'", "testp", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "login", "\\u", "require", "d\\u", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "response_", ",_", "\"/", "login", "/?", "next", "=", "/", "login", "\\u", "require", "d\\u", "view", "/\"_", ",_", "status", "\\u", "code_", "=_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "alf", "red", "'_", ",_", "password_", "=_", "'", "testp", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "login", "\\u", "require", "d\\u", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Revers", "e", "Short", "cut", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Revers", "e", "Short", "cut", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "redirec", "t", "\\u", "to", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "reall", "y", " ", "need", " ", "a", " ", "model", ";", " ", "just", " ", "somet", "hing", " ", "with", " ", "a", " ", "get", "\\u", "abs", "olute", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Fake", "Obj_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"/", "hi", "-", "there", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "Fake", "Obj_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "res_", ",_", "Http", "Respons", "e", "Redirect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "hi", "-", "there", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "Fake", "Obj_", "(_", ")_", ",_", "permanent", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "res_", ",_", "Http", "Respons", "e", "Permanent", "Redirect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "hi", "-", "there", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "Short", "cut", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "redirec", "t", "\\u", "to", "\\u", "view", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "redirect_", "(_", "'", "hard", "code", "d2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "hard", "code", "d", "/", "doc", ".", "pdf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "'", "place", "s", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "place", "s", "/", "1", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "'", "headline", "s", "'_", ",_", "year_", "=_", "'", "2008", "'_", ",_", "month_", "=_", "'", "02", "'_", ",_", "day_", "=_", "'", "1", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "headline", "s", "/", "2008", ".02", ".1", "7", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "redirect_", ",_", "'", "not", "-", "a", "-", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "Short", "cut", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "redirec", "t", "\\u", "to", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "redirect_", "(_", "'/", "foo", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "foo", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "'", "http", "://", "example", ".", "com", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'", "http", "://", "example", ".", "com", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "Short", "cut", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "redirec", "t", "\\u", "view", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "views_", "import_", "abs", "olute", "\\u", "kwarg", "s", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "redirect_", "(_", "abs", "olute", "\\u", "kwarg", "s", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "abs", "olute", "\\u", "arg", "\\u", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "redirect_", ",_", "abs", "olute", "\\u", "kwarg", "s", "\\u", "view_", ",_", "wrong", "\\u", "argument_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "namespace", "\\u", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "ambiguous", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", " ", "deploye", "d", " ", "via", " ", "dynami", "c", " ", "URL", " ", "object", "s", " ", "tha", "t", " ", "require", " ", "namespace", "s", " ", "can", "'", "t", " ", "be", " ", "resolve", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "urlo", "bject", "-", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ambiguous", "\\u", "urlpa", "tter", "n_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", " ", "deploye", "d", " ", "via", " ", "dynami", "c", " ", "URL", " ", "object", "s", " ", "tha", "t", " ", "require", " ", "namespace", "s", " ", "can", "'", "t", " ", "be", " ", "resolve", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "inner", "-", "not", "hing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "inner", "-", "not", "hing", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "inner", "-", "not", "hing", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "non", "\\u", "existen", "t", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Non", "-", "existen", "t", " ", "namespace", "s", " ", "raise", " ", "error", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "bla", "hb", "lah", ":", "urlo", "bject", "-", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "No", "Revers", "e", "Match_", ",_", "reverse_", ",_", "'", "test", "-", "ns", "1", ":", "bla", "hb", "lah", ":", "urlo", "bject", "-", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Normal", " ", "lookups", " ", "work", " ", "as", " ", "expected", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "normal", "/'_", ",_", "reverse_", "(_", "'", "normal", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "normal", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "include", "d\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Normal", " ", "lookups", " ", "work", " ", "on", " ", "names", " ", "include", "d", " ", "from", " ", "other", " ", "pattern", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "normal", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "normal", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "normal", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "namespace", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Dynamic", " ", "URL", " ", "object", "s", " ", "can", " ", "be", " ", "found", " ", "usi", "ng", " ", "a", " ", "namespace", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "test", "1", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "1", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "test", "1", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "1", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "test", "1", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "1", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "test", "1", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "1", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "embedde", "d\\u", "namespace", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", "paces", " ", "can", " ", "be", " ", "install", "ed", " ", "any", "where", " ", "in", " ", "the", " ", "URL", " ", "pattern", " ", "tree", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "namespace", "\\u", "pattern_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", "paces", " ", "can", " ", "be", " ", "applied", " ", "to", " ", "include", "()'", "d", " ", "urlpa", "tter", "ns", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "normal", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "normal", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "normal", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "namespace", "\\u", "pattern", "\\u", "with", "\\u", "variab", "le", "\\u", "prefix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Whe", "n", " ", "usi", "ng", " ", "a", " ", "include", " ", "with", " ", "namespace", "s", " ", "whe", "n", " ", "there", " ", "is", " ", "a", " ", "regex", " ", "variab", "le", " ", "in", " ", "front", " ", "of", " ", "it", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "normal", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "outer", "'_", ":_", "42_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "normal", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "normal", "/", "3", "7", "/", "4", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "outer", "'_", ":_", "42_", ",_", "'", "arg", "1", "'_", ":_", "37_", ",_", "'", "arg", "2", "'_", ":_", "4_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "normal", "/", "3", "7", "/", "4", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "42_", ",_", "37_", ",_", "4_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "special", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "outer", "'_", ":_", "42_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "outer", "/", "4", "2", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "outer", ":", "inc", "-", "special", "-", "view", "'_", ",_", "args_", "=_", "[_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "namespace", "\\u", "pattern_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", "paces", " ", "can", " ", "be", " ", "embedde", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "namespace", "\\u", "pattern_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", "paces", " ", "can", " ", "be", " ", "nest", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "ns", "-", "include", "d4", "/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "ns", "4", ":", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "ns", "-", "include", "d4", "/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "ns", "4", ":", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "ns", "-", "include", "d4", "/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "ns", "4", ":", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "ns", "-", "include", "d1", "/", "ns", "-", "include", "d4", "/", "ns", "-", "include", "d1", "/", "test", "3", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "1", ":", "inc", "-", "ns", "4", ":", "inc", "-", "ns", "1", ":", "test", "-", "ns", "3", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "app", "\\u", "look", "up", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "A", " ", "default", " ", "applica", "tion", " ", "namespace", " ", "can", " ", "be", " ", "used", " ", "for", " ", "look", "up", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "default", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "default", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "default", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "default", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "app", "\\u", "look", "up", "\\u", "object\\u", "with", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "A", " ", "default", " ", "applica", "tion", " ", "namespace", " ", "is", " ", "sensi", "tiv", "e", " ", "to", " ", "the", " ", "'", "current", "'", " ", "app", " ", "can", " ", "be", " ", "used", " ", "for", " ", "look", "up", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ",_", "current", "\\u", "app_", "=_", "'", "test", "-", "ns", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ",_", "current", "\\u", "app_", "=_", "'", "test", "-", "ns", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ",_", "current", "\\u", "app_", "=_", "'", "test", "-", "ns", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "include", "d", "/", "test", "3", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "testa", "pp", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ",_", "current", "\\u", "app_", "=_", "'", "test", "-", "ns", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "app", "\\u", "look", "up", "\\u", "object\\u", "with", "out", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "An", " ", "applica", "tion", " ", "namespace", " ", "with", "out", " ", "a", " ", "default", " ", "is", " ", "sensi", "tiv", "e", " ", "to", " ", "the", " ", "'", "current", "'", " ", "app", " ", "can", " ", "be", " ", "used", " ", "for", " ", "look", "up", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "2", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "2", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "2", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "2", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "1", "/", "inner", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ",_", "current", "\\u", "app_", "=_", "'", "other", "-", "ns", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "1", "/", "inner", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ",_", "current", "\\u", "app_", "=_", "'", "other", "-", "ns", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "1", "/", "inner", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ",_", "current", "\\u", "app_", "=_", "'", "other", "-", "ns", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "other", "1", "/", "inner", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "node", "fault", ":", "urlo", "bject", "-", "special", "-", "view", "'_", ",_", "current", "\\u", "app_", "=_", "'", "other", "-", "ns", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "special", "\\u", "char", "s", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "'/", "+", "%", "5", "C", "$", "*/", "include", "d", "/", "normal", "/'_", ",_", "reverse_", "(_", "'", "special", ":", "inc", "-", "normal", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "+", "%", "5", "C", "$", "*/", "include", "d", "/", "normal", "/", "3", "7", "/", "4", "2", "/'_", ",_", "reverse_", "(_", "'", "special", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "args_", "=_", "[_", "37_", ",_", "42_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "+", "%", "5", "C", "$", "*/", "include", "d", "/", "normal", "/", "4", "2", "/", "3", "7", "/'_", ",_", "reverse_", "(_", "'", "special", ":", "inc", "-", "normal", "-", "view", "'_", ",_", "kwargs_", "=_", "{_", "'", "arg", "1", "'_", ":_", "42_", ",_", "'", "arg", "2", "'_", ":_", "37_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "+", "%", "5", "C", "$", "*/", "include", "d", "/", "+", "%", "5", "C", "$", "*/", "'_", ",_", "reverse_", "(_", "'", "special", ":", "inc", "-", "special", "-", "view", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Names", "pace", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "namespace", "s", "\\u", "with", "\\u", "variables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Names", "pace", " ", "prefix", "es", " ", "can", " ", "captur", "e", " ", "variab", "les", ":", " ", "see", " ", "#", "159", "00", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "inc", "7", "0", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "5", ":", "inner", "-", "not", "hing", "'_", ",_", "kwargs_", "=_", "{_", "'", "outer", "'_", ":_", "'", "7", "0", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "inc", "7", "8", "/", "extra", "/", "fooba", "r", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "5", ":", "inner", "-", "extra", "'_", ",_", "kwargs_", "=_", "{_", "'", "outer", "'_", ":_", "'", "7", "8", "'_", ",_", "'", "extra", "'_", ":_", "'", "fooba", "r", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "inc", "7", "0", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "5", ":", "inner", "-", "not", "hing", "'_", ",_", "args_", "=_", "[_", "'", "7", "0", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'/", "inc", "7", "8", "/", "extra", "/", "fooba", "r", "/'_", ",_", "reverse_", "(_", "'", "inc", "-", "ns", "5", ":", "inner", "-", "extra", "'_", ",_", "args_", "=_", "[_", "'", "7", "8", "'_", ",_", "'", "fooba", "r", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Request", "URL", "conf", "Tests_", "(_", "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_", "Request", "URL", "conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root", "\\u", "url", "conf_", "=_", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "middle", "ware", "\\u", "classes_", "=_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "=_", "url", "conf", "\\u", "outer_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "URL", "conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "=_", "self_", "._", "root", "\\u", "url", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "self_", "._", "middle", "ware", "\\u", "classes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "URL", "conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "url", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "test", "/", "me", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "'", "outer", ":/", "test", "/", "me", "/", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "inner", ":/", "inner", "\\u", "url", "conf", "/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "inner", "\\u", "url", "conf", "/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "URL", "conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "url", "conf", "\\u", "overrid", "den_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "+=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "Change", "URL", "conf", "Mid", "dle", "ware", "'_", "%_", "middleware_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "test", "/", "me", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "inner", "\\u", "url", "conf", "/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "content_", ",_", "b", "'", "outer", ":,", "inner", ":/", "second", "\\u", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "URL", "conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "url", "conf", "\\u", "overrid", "den", "\\u", "with", "\\u", "null_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "+=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "Null", "Change", "URL", "conf", "Mid", "dle", "ware", "'_", "%_", "middleware_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Impro", "perl", "y", "Configured_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "test", "/", "me", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Error", "Handle", "r", "Reso", "luti", "on", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "for", " ", "handler", "404", " ", "and", " ", "handler", "500", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Error", "Handle", "r", "Reso", "luti", "on", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "Rege", "x", "URL", "Resolver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "conf_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "urls", "\\u", "error", "\\u", "handler", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "conf", "\\u", "calla", "bles_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "urls", "\\u", "error", "\\u", "handler", "s", "\\u", "calla", "bles", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolver_", "=_", "Rege", "x", "URL", "Resolver_", "(_", "r", "'", "^", "$'_", ",_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callable\\u", "resolver_", "=_", "Rege", "x", "URL", "Resolver_", "(_", "r", "'", "^", "$'_", ",_", "url", "conf", "\\u", "calla", "bles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Handle", "r", "Reso", "luti", "on", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "named", "\\u", "handlers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "views_", "import_", "empty", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "(_", "empty", "\\u", "view_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "resolver_", "._", "resolve", "404_", "(_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "resolver_", "._", "resolve", "500_", "(_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Handle", "r", "Reso", "luti", "on", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "callable\\u", "hande", "rs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "views_", "import_", "empty", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "(_", "empty", "\\u", "view_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "callable\\u", "resolver_", "._", "resolve", "404_", "(_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "callable\\u", "resolver_", "._", "resolve", "500_", "(_", ")_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Default", "Error", "Handle", "r", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "urls", "\\u", "with", "out", "\\u", "full", "\\u", "import", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Default", "Error", "Handle", "r", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "handler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "If", " ", "the", " ", "urls", ".", "py", " ", "doe", "sn", "'", "t", " ", "speci", "fy", " ", "handler", "s", ",", " ", "the", " ", "default", "s", " ", "are", " ", "used", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "404_", ")_", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "Sho", "ul", "dn", "'", "t", " ", "get", " ", "an", " ", "Attribute", "Error", " ", "due", " ", "to", " ", "undefined", " ", "404", " ", "handler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "bad", "\\u", "view", "/'_", ")_", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "Sho", "ul", "dn", "'", "t", " ", "get", " ", "an", " ", "Attribute", "Error", " ", "due", " ", "to", " ", "undefined", " ", "500", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "No", "Roo", "t", "Ur", "l", "Conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "for", " ", "handler", "404", " ", "and", " ", "handler", "500", " ", "if", " ", "url", "conf", " ", "is", " ", "Non", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Roo", "t", "Ur", "l", "Conf", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "handler", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Impro", "perl", "y", "Configured_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "test", "/", "me", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Resolv", "er", "Match", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "namespace", "\\u", "urls", "'_", "\\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_", "Resolv", "er", "Match", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "urlpa", "tter", "n", "\\u", "resolve_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", ",_", "name_", ",_", "app", "\\u", "name_", ",_", "namespace_", ",_", "func_", ",_", "args_", ",_", "kwargs_", "in_", "resolve", "\\u", "test\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "lega", "cy", " ", "support", " ", "for", " ", "extracti", "ng", " ", "\"", "function", ",", " ", "args", ",", " ", "kwarg", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match", "\\u", "func_", ",_", "match", "\\u", "args_", ",_", "match", "\\u", "kwargs_", "=_", "resolve_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match", "\\u", "func_", ",_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match", "\\u", "args_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match", "\\u", "kwargs_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "Resolv", "er", "Match", " ", "capab", "ilities", "._", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "resolve_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "\\u\\u", "class\\u\\u_", ",_", "Resolv", "er", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "url", "\\u", "name_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "args_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "kwargs_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "app", "\\u", "name_", ",_", "app", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "namespace_", ",_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "._", "func_", ",_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "and", " ", "for", " ", "lega", "cy", " ", "purpose", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "[_", "0_", "]_", ",_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "[_", "1_", "]_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "match_", "[_", "2_", "]_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resolv", "er", "Match", "Tests_", "(_", "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", "resolver", "\\u", "match", "\\u", "on", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "resolver", "\\u", "match", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolver", "\\u", "match_", "=_", "response_", "._", "resolver", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resolver", "\\u", "match_", "._", "url", "\\u", "name_", ",_", "'", "test", "-", "resolver", "-", "match", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Err", "one", "ous", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "erro", "neous", "\\u", "urls", "'_", "\\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_", "Err", "one", "ous", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "erro", "neous", "\\u", "resolve_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Import", "Error_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "erro", "neous", "\\u", "inner", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Import", "Error_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "erro", "neous", "\\u", "outer", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "View", "Do", "es", "Not", "Exist_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "missi", "ng", "\\u", "inner", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "View", "Do", "es", "Not", "Exist_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "missi", "ng", "\\u", "outer", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "View", "Do", "es", "Not", "Exist_", ",_", "self_", "._", "client_", "._", "get_", ",_", "'/", "unca", "lla", "ble", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Err", "one", "ous", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "erro", "neous", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "tha", "t", " ", "a", " ", "usef", "ul", " ", "exception", " ", "is", " ", "raise", "d", " ", "whe", "n", " ", "a", " ", "regex", " ", "is", " ", "invalid", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "URL", "Conf", ".", "\\", "10", ";", " ", " ", " ", " ", "Refs", " ", "#", "617", "0.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "regex", " ", "error", " ", "will", " ", "be", " ", "hit", " ", "bef", "ore", " ", "No", "Revers", "e", "Match", " ", "can", " ", "be", " ", "raised_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Impro", "perl", "y", "Configured_", ",_", "reverse_", ",_", "'", "what", "ever", " ", "bla", "h", " ", "bla", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "View", "Load", "ing", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "Load", "ing", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "view", "\\u", "loading_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "missi", "ng", " ", "view", " ", "(", "identifi", "ed", " ", "by", " ", "an", " ", "Attribute", "Error", ")", " ", "shou", "ld", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "View", "Do", "es", "Not", "Exist", ",", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "six_", "._", "assert", "Rai", "ses", "Regex_", "(_", "self_", ",_", "View", "Do", "es", "Not", "Exist_", ",_", "\".*", "View", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", ".*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "callable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "regress", "ion", "tests", ".", "urlpa", "tter", "ns", "\\u", "reverse", ".", "views", ".", "i", "\\u", "shou", "ld", "\\u", "not", "\\u", "exist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "...", " ", "but", " ", "if", " ", "the", " ", "Attribute", "Error", " ", "is", " ", "caus", "ed", " ", "by", " ", "somet", "hing", " ", "else", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "swa", "llow", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Attribute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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 ]
Unused local variable
cloudmatrix/esky/esky/bootstrap.py
[ { "content": "def _split_version_components(s):\n \"\"\"Split version string into individual tokens.\n\n pkg_resources does this using a regexp: (\\d+ | [a-z]+ | \\.| -)\n Unfortunately the 're' module isn't in the bootstrap, so we have to do\n an equivalent parse by hand. Forunately, that's pretty easy.\n \"\"\"\n comps = []\n start = 0\n while start < len(s):\n end = start+1\n if s[start].isdigit():\n while end < len(s) and s[end].isdigit():\n end += 1\n elif s[start].isalpha():\n while end < len(s) and s[end].isalpha():\n end += 1\n elif s[start] in (\".\",\"-\"):\n pass\n else:\n while end < len(s) and not (s[end].isdigit() or s[end].isalpha() or s[end] in (\".\",\"-\")):\n end += 1\n comps.append(s[start:end])\n start = end\n return comps", "metadata": "root._split_version_components", "header": "['module', '___EOS___']", "index": 593 } ]
[]
[]
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_", "\\u", "split", "\\u", "version", "\\u", "components_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Split", " ", "version", " ", "string", " ", "int", "o", " ", "individual", " ", "token", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pkg", "\\u", "resource", "s", " ", "doe", "s", " ", "this", " ", "usi", "ng", " ", "a", " ", "regexp", ":", " ", "(\\\\", "d", "+", " ", "|", " ", "[", "a", "-", "z", "]+", " ", "|", " ", "\\\\.", "|", " ", "-)", "\\", "10", ";", " ", " ", " ", " ", "Unf", "ort", "unat", "el", "y", " ", "the", " ", "'", "re", "'", " ", "module", " ", "isn", "'", "t", " ", "in", " ", "the", " ", "boots", "trap", ",", " ", "so", " ", "we", " ", "have", " ", "to", " ", "do", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "equivalent", " ", "parse", " ", "by", " ", "hand", ".", " ", " ", "For", "unat", "el", "y", ",", " ", "tha", "t", "'", "s", " ", "pretty", " ", "easy", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "start_", "<_", "len_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "[_", "start_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "end_", "<_", "len_", "(_", "s_", ")_", "and_", "s_", "[_", "end_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "[_", "start_", "]_", "._", "isalpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "end_", "<_", "len_", "(_", "s_", ")_", "and_", "s_", "[_", "end_", "]_", "._", "isalpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "[_", "start_", "]_", "in_", "(_", "\".\"_", ",_", "\"-\"_", ")_", ":_", "\\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 ", " _", "while_", "end_", "<_", "len_", "(_", "s_", ")_", "and_", "not_", "(_", "s_", "[_", "end_", "]_", "._", "isdigit_", "(_", ")_", "or_", "s_", "[_", "end_", "]_", "._", "isalpha_", "(_", ")_", "or_", "s_", "[_", "end_", "]_", "in_", "(_", "\".\"_", ",_", "\"-\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comps_", "._", "append_", "(_", "s_", "[_", "start_", ":_", "end_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "comps_", "\\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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\n start = next(gen)\n second = next(gen)\n duration = second - start\n now = datetime.datetime.utcnow()\n diff_from_now = now - start\n number_of_iterations = number_of_iterations_in_time(\n duration,\n diff_from_now)\n next_run = apply_delta_to_datetime(\n duration,\n start,\n number_of_iterations + 1)\n return next_run, duration", "metadata": "root.next_run_and_duration_from_8601", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "next", "\\u", "run", "\\u", "and", "\\u", "duration", "\\u", "from", "\\u", "860", "1_", "(_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gen_", "=_", "ani", "so", "860", "1_", "._", "parse", "\\u", "repeatin", "g", "\\u", "interval_", "(_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "next_", "(_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second_", "=_", "next_", "(_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "second_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "from", "\\u", "now_", "=_", "now_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "\\u", "of", "\\u", "iterations_", "=_", "number", "\\u", "of", "\\u", "iterati", "ons", "\\u", "in", "\\u", "time_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "from", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "run_", "=_", "appl", "y", "\\u", "delta", "\\u", "to", "\\u", "datetime_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "\\u", "of", "\\u", "iterations_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "next", "\\u", "run_", ",_", "duration_", "\\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 ]
Unguarded next in generator
bblanchon/SublimeText-HighlightBuildErrors/HighlightBuildErrors.py
[ { "content": "def get_selected_error(view):\n file_name = get_file_name_from_view(view)\n return next((e for e in g_errors if e.file_name == file_name and e.get_region(view).contains(view.sel()[0])), None)", "metadata": "root.get_selected_error", "header": "['module', '___EOS___']", "index": 88 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "guard", "ed_", "next_", "in_", "generator_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "selecte", "d\\u", "error_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "name_", "=_", "get", "\\u", "file", "\\u", "name", "\\u", "from", "\\u", "view_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "next_", "(_", "(_", "e_", "for_", "e_", "in_", "g", "\\u", "errors_", "if_", "e_", "._", "file", "\\u", "name_", "==_", "file", "\\u", "name_", "and_", "e_", "._", "get", "\\u", "region_", "(_", "view_", ")_", "._", "contains_", "(_", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", ",_", "None_", ")_", "\\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 ]
First parameter of a method is not named 'self'
nii-cloud/dodai-compute/nova/api/ec2/admin.py
[ { "content": " def block_external_addresses(self, context, cidr):\n \"\"\"Add provider-level firewall rules to block incoming traffic.\"\"\"\n LOG.audit(_('Blocking traffic to all projects incoming from %s'),\n cidr, context=context)\n cidr = urllib.unquote(cidr).decode()\n # raise if invalid\n netaddr.IPNetwork(cidr)\n rule = {'cidr': cidr}\n tcp_rule = rule.copy()\n tcp_rule.update({'protocol': 'tcp', 'from_port': 1, 'to_port': 65535})\n udp_rule = rule.copy()\n udp_rule.update({'protocol': 'udp', 'from_port': 1, 'to_port': 65535})\n icmp_rule = rule.copy()\n icmp_rule.update({'protocol': 'icmp', 'from_port': -1,\n 'to_port': None})\n rules_added = 0\n if not self._provider_fw_rule_exists(context, tcp_rule):\n db.provider_fw_rule_create(context, tcp_rule)\n rules_added += 1\n if not self._provider_fw_rule_exists(context, udp_rule):\n db.provider_fw_rule_create(context, udp_rule)\n rules_added += 1\n if not self._provider_fw_rule_exists(context, icmp_rule):\n db.provider_fw_rule_create(context, icmp_rule)\n rules_added += 1\n if not rules_added:\n raise exception.ApiError(_('Duplicate rule'))\n self.compute_api.trigger_provider_fw_rules_refresh(context)\n return {'status': 'OK', 'message': 'Added %s rules' % rules_added}", "metadata": "root.AdminController.block_external_addresses", "header": "['class', 'AdminController', '(', 'object', ')', ':', '___EOS___']", "index": 343 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Admi", "n", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "block", "\\u", "external", "\\u", "addresses_", "(_", "self_", ",_", "context_", ",_", "cidr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "provide", "r", "-", "level", " ", "firew", "all", " ", "rule", "s", " ", "to", " ", "block", " ", "inco", "ming", " ", "traffic", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "Block", "ing", " ", "traffic", " ", "to", " ", "all", " ", "project", "s", " ", "inco", "ming", " ", "from", " ", "%", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cidr_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cidr_", "=_", "urllib_", "._", "unquote_", "(_", "cidr_", ")_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "raise", " ", "if", " ", "invalid_", "\\u\\u\\uNL\\u\\u\\u_", "netaddr_", "._", "IP", "Network_", "(_", "cidr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule_", "=_", "{_", "'", "cid", "r", "'_", ":_", "cidr_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "\\u", "rule_", "=_", "rule_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "\\u", "rule_", "._", "update_", "(_", "{_", "'", "protoc", "ol", "'_", ":_", "'", "tcp", "'_", ",_", "'", "from", "\\u", "port", "'_", ":_", "1_", ",_", "'", "to", "\\u", "port", "'_", ":_", "65535_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ud", "p", "\\u", "rule_", "=_", "rule_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ud", "p", "\\u", "rule_", "._", "update_", "(_", "{_", "'", "protoc", "ol", "'_", ":_", "'", "ud", "p", "'_", ",_", "'", "from", "\\u", "port", "'_", ":_", "1_", ",_", "'", "to", "\\u", "port", "'_", ":_", "65535_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icmp", "\\u", "rule_", "=_", "rule_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icmp", "\\u", "rule_", "._", "update_", "(_", "{_", "'", "protoc", "ol", "'_", ":_", "'", "icmp", "'_", ",_", "'", "from", "\\u", "port", "'_", ":_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "\\u", "port", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "s", "\\u", "added_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "exists_", "(_", "context_", ",_", "tcp", "\\u", "rule_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "create_", "(_", "context_", ",_", "tcp", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "s", "\\u", "added_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "exists_", "(_", "context_", ",_", "ud", "p", "\\u", "rule_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "create_", "(_", "context_", ",_", "ud", "p", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "s", "\\u", "added_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "exists_", "(_", "context_", ",_", "icmp", "\\u", "rule_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "provide", "r", "\\u", "fw", "\\u", "rule", "\\u", "create_", "(_", "context_", ",_", "icmp", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "s", "\\u", "added_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "rule", "s", "\\u", "added_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Ap", "i", "Error_", "(_", "\\u_", "(_", "'", "Duplicate", " ", "rule", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "compute", "\\u", "api_", "._", "trigger", "\\u", "provide", "r", "\\u", "fw", "\\u", "rule", "s", "\\u", "refresh_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "status", "'_", ":_", "'", "OK", "'_", ",_", "'", "message", "'_", ":_", "'", "Added", " ", "%", "s", " ", "rule", "s", "'_", "%_", "rule", "s", "\\u", "added_", "}_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
saltstack/salt/tests/unit/modules/win_groupadd_test.py
[ { "content": " def test_members(self):\n '''\n Test if it remove a user to a group\n '''\n comment = ['Failure accessing group dc=foo. C']\n ret = {'name': 'dc=foo', 'result': False, 'comment': comment,\n 'changes': {'Users Added': [], 'Users Removed': []}}\n\n with patch(win_groupadd.win32.client, 'flag', 2):\n self.assertDictEqual(win_groupadd.members\n ('dc=foo', 'dc=\\\\user1,dc=\\\\user2,dc=\\\\user3'),\n ret)\n\n with patch(win_groupadd.win32.client, 'flag', 1):\n comment = ['Failed to add dc=\\\\user2 to dc=foo. C',\n 'Failed to remove dc=\\\\user1 from dc=foo. C']\n ret.update({'comment': comment, 'result': False})\n self.assertDictEqual(win_groupadd.members('dc=foo', 'dc=\\\\user2'), ret)\n\n with patch(win_groupadd.win32.client, 'flag', None):\n comment = ['dc=foo membership is correct']\n ret.update({'comment': comment, 'result': None})\n self.assertDictEqual(win_groupadd.members('dc=foo', 'dc=\\\\user1'), ret)", "metadata": "root.WinGroupTestCase.test_members", "header": "['class', 'WinGroupTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 125 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Win", "Group", "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", "members_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "if", " ", "it", " ", "remove", " ", "a", " ", "user", " ", "to", " ", "a", " ", "group", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "[_", "'", "Fail", "ure", " ", "accessi", "ng", " ", "group", " ", "dc", "=", "foo", ".", " ", " ", "C", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "'", "name", "'_", ":_", "'", "dc", "=", "foo", "'_", ",_", "'", "result", "'_", ":_", "False_", ",_", "'", "comment", "'_", ":_", "comment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", "'_", ":_", "{_", "'", "User", "s", " ", "Added", "'_", ":_", "[_", "]_", ",_", "'", "User", "s", " ", "Remove", "d", "'_", ":_", "[_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "win", "\\u", "group", "add_", "._", "win32", "_", "._", "client_", ",_", "'", "flag", "'_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Dict", "Equal_", "(_", "win", "\\u", "group", "add_", "._", "members_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dc", "=", "foo", "'_", ",_", "'", "dc", "=\\\\", "\\\\", "user", "1", ",", "dc", "=\\\\", "\\\\", "user", "2", ",", "dc", "=\\\\", "\\\\", "user3", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "patch_", "(_", "win", "\\u", "group", "add_", "._", "win32", "_", "._", "client_", ",_", "'", "flag", "'_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "[_", "'", "Fail", "ed", " ", "to", " ", "add", " ", "dc", "=\\\\", "\\\\", "user", "2", " ", "to", " ", "dc", "=", "foo", ".", " ", " ", "C", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "remove", " ", "dc", "=\\\\", "\\\\", "user", "1", " ", "from", " ", "dc", "=", "foo", ".", " ", " ", "C", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "._", "update_", "(_", "{_", "'", "comment", "'_", ":_", "comment_", ",_", "'", "result", "'_", ":_", "False_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Dict", "Equal_", "(_", "win", "\\u", "group", "add_", "._", "members_", "(_", "'", "dc", "=", "foo", "'_", ",_", "'", "dc", "=\\\\", "\\\\", "user", "2", "'_", ")_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "patch_", "(_", "win", "\\u", "group", "add_", "._", "win32", "_", "._", "client_", ",_", "'", "flag", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "[_", "'", "dc", "=", "foo", " ", "member", "ship", " ", "is", " ", "correct", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "._", "update_", "(_", "{_", "'", "comment", "'_", ":_", "comment_", ",_", "'", "result", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Dict", "Equal_", "(_", "win", "\\u", "group", "add_", "._", "members_", "(_", "'", "dc", "=", "foo", "'_", ",_", "'", "dc", "=\\\\", "\\\\", "user", "1", "'_", ")_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
openstack/cloudbase-init/cloudbaseinit/plugins/common/setuserpassword.py
[ { "content": " def execute(self, service, shared_data):\n # TODO(alexpilotti): The username selection logic must be set in the\n # CreateUserPlugin instead if using CONF.username\n user_name = shared_data.get(constants.SHARED_DATA_USERNAME,\n CONF.username)\n\n osutils = osutils_factory.get_os_utils()\n if osutils.user_exists(user_name):\n password = self._set_password(service, osutils,\n user_name, shared_data)\n if password:\n LOG.info('Password succesfully updated for user %s' %\n user_name)\n # TODO(alexpilotti): encrypt with DPAPI\n shared_data[constants.SHARED_DATA_PASSWORD] = password\n\n if not service.can_post_password:\n LOG.info('Cannot set the password in the metadata as it '\n 'is not supported by this service')\n else:\n self._set_metadata_password(password, service)\n\n if service.can_update_password:\n # If the metadata provider can update the password, the plugin\n # must run at every boot in order to update the password if\n # it was changed.\n return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False\n else:\n return base.PLUGIN_EXECUTION_DONE, False", "metadata": "root.SetUserPasswordPlugin.execute", "header": "['class', 'SetUserPasswordPlugin', '(', 'base', '.', 'BasePlugin', ')', ':', '___EOS___']", "index": 142 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Set", "User", "Passw", "ord", "Plugin_", "(_", "base_", "._", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "service_", ",_", "shared", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "alex", "pilot", "ti", "):", " ", "The", " ", "user", "name", " ", "selection", " ", "logic", " ", "must", " ", "be", " ", "set", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", "User", "Plug", "in", " ", "inst", "ead", " ", "if", " ", "usi", "ng", " ", "CONF", ".", "username_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "name_", "=_", "shared", "\\u", "data_", "._", "get_", "(_", "constants_", "._", "SHARED", "\\u", "DATA", "\\u", "USERNAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "osu", "tils_", "=_", "osu", "til", "s", "\\u", "factory_", "._", "get", "\\u", "os", "\\u", "utils_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "osu", "tils_", "._", "user", "\\u", "exists_", "(_", "user", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "self_", "._", "\\u", "set\\u", "password_", "(_", "service_", ",_", "osu", "tils_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "name_", ",_", "shared", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "'", "Passw", "ord", " ", "succe", "sfu", "ll", "y", " ", "update", "d", " ", "for", " ", "user", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "alex", "pilot", "ti", "):", " ", "encrypt", " ", "with", " ", "DP", "API_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "\\u", "data_", "[_", "constants_", "._", "SHARED", "\\u", "DATA", "\\u", "PASSWORD_", "]_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "service_", "._", "can", "\\u", "post", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOG_", "._", "info_", "(_", "'", "Cann", "ot", " ", "set", " ", "the", " ", "password", " ", "in", " ", "the", " ", "metadata", " ", "as", " ", "it", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", " ", "not", " ", "support", "ed", " ", "by", " ", "this", " ", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "set\\u", "metadata", "\\u", "password_", "(_", "password_", ",_", "service_", ")_", "\\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_", "service_", "._", "can", "\\u", "update", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "metadata", " ", "provide", "r", " ", "can", " ", "update", " ", "the", " ", "password", ",", " ", "the", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "must", " ", "run", " ", "at", " ", "every", " ", "boot", " ", "in", " ", "order", " ", "to", " ", "update", " ", "the", " ", "password", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "was", " ", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base_", "._", "PLUGIN", "\\u", "EXECUTE", "\\u", "ON", "\\u", "NEXT", "\\u", "BOOT", "_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base_", "._", "PLUGIN", "\\u", "EXECUT", "ION", "\\u", "DONE_", ",_", "False_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
google/grr/grr/lib/aff4_objects/user_managers_test.py
[ { "content": "class FullAccessControlManagerIntegrationTest(test_lib.GRRBaseTest):\n \"\"\"Integration tests for FullAccessControlManager.\n\n This test differs from FullAccessControlManagerTest, as it doesn't call\n FullAccessControlManager's methods directly, but checks it through\n calls to GRR's functionality that has to check access via access control\n manager.\n \"\"\"\n\n install_mock_acl = False\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.FullAccessControlManagerIntegrationTest", "header": "['module', '___EOS___']", "index": 401 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Full", "Access", "Control", "Manager", "Integrati", "on", "Test_", "(_", "test\\u", "lib_", "._", "GR", "RB", "ase", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Integrati", "on", " ", "tests", " ", "for", " ", "Full", "Access", "Control", "Manager", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "test", " ", "differs", " ", "from", " ", "Full", "Access", "Control", "Manager", "Test", ",", " ", "as", " ", "it", " ", "doe", "sn", "'", "t", " ", "call", "\\", "10", ";", " ", " ", "Full", "Access", "Control", "Manager", "'", "s", " ", "method", "s", " ", "direct", "ly", ",", " ", "but", " ", "checks", " ", "it", " ", "through", "\\", "10", ";", " ", " ", "calls", " ", "to", " ", "GR", "R", "'", "s", " ", "functional", "it", "y", " ", "tha", "t", " ", "has", " ", "to", " ", "check", " ", "access", " ", "via", " ", "access", " ", "control", "\\", "10", ";", " ", " ", "manage", "r", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "mock", "\\u", "acl_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
CMB/cligh/cligh/utils.py
[ { "content": "def get_named_user(client, username):\n\ttry:\n\t\tuser = client.get_user(username)\n\texcept GithubException as e:\n\t\tdie('''Failed to retrieve the record for user %s:\nEncountered the following exception:\n%s\n''' % (username, str(e)))\n\treturn user", "metadata": "root.get_named_user", "header": "['module', '___EOS___']", "index": 91 } ]
[]
[]
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", "\\u", "named", "\\u", "user_", "(_", "client_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "user_", "=_", "client_", "._", "get", "\\u", "user_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "hub", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "die_", "(_", "'''", "Fail", "ed", " ", "to", " ", "retrieve", " ", "the", " ", "record", " ", "for", " ", "user", " ", "%", "s", ":", "\\", "10", ";", "Enco", "unter", "ed", " ", "the", " ", "follow", "ing", " ", "exception", ":", "\\", "10", ";", "%", "s", "\\", "10", ";'", "''_", "%_", "(_", "username_", ",_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "user_", "\\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 ]
Conflicting attributes in base classes
kuri65536/python-for-android/python-modules/twisted/twisted/test/test_pb.py
[ { "content": "class NewStyleCopy(pb.Copyable, pb.RemoteCopy, object):", "metadata": "root.NewStyleCopy", "header": "['module', '___EOS___']", "index": 312 } ]
[]
[]
0
false
[ "[CLS]_", "Confl", "ict", "ing_", "attributes_", "in_", "base_", "classes_", "[SEP]_", "module_", "\\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_", "New", "Style", "Copy_", "(_", "pb_", "._", "Copy", "able_", ",_", "pb_", "._", "Remo", "te", "Copy_", ",_", "object_", ")_", ":_", "\\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 ]
Unnecessary pass
deanhiller/databus/webapp/play1.3.x/python/Lib/decimal.py
[ { "content": " def handle(self, context, *args):\n pass", "metadata": "root.DecimalException.handle", "header": "['class', 'DecimalException', '(', 'ArithmeticError', ')', ':', '___EOS___']", "index": 175 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Deci", "mal", "Exception_", "(_", "Arithm", "etic", "Error_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "context_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
callowayproject/django-objectpermissions/objectpermissions/__init__.py
[ { "content": "__version_info__ = {\n 'major': 0,\n 'minor': 3,\n 'micro': 3,\n 'releaselevel': 'final',\n 'serial': 0\n}\n\n\n__version__ = get_version()\n\ntry:\n from registration import register, AlreadyRegistered\n from models import UnknownPermission\n\n __all__ = ('register', 'AlreadyRegistered', 'UnknownPermission')\nexcept ImportError:\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_version():\n vers = [\"%(major)i.%(minor)i\" % __version_info__, ]\n\n if __version_info__['micro']:\n vers.append(\".%(micro)i\" % __version_info__)\n if __version_info__['releaselevel'] != 'final':\n vers.append('%(releaselevel)s%(serial)i' % __version_info__)\n return ''.join(vers)", "metadata": "root.get_version", "header": "['module', '___EOS___']", "index": 8 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "major", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mino", "r", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "micro", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "level", "'_", ":_", "'", "final", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "serial", "'_", ":_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\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", "version\\u\\u_", "=_", "get", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "registration_", "import_", "register_", ",_", "Al", "read", "y", "Register", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "models_", "import_", "Un", "know", "n", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "'", "register", "'_", ",_", "'", "Al", "read", "y", "Register", "ed", "'_", ",_", "'", "Un", "know", "n", "Permi", "ssion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "version_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vers_", "=_", "[_", "\"%", "(", "major", ")", "i", ".", "%", "(", "mino", "r", ")", "i", "\"_", "%_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", "[_", "'", "micro", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vers_", "._", "append_", "(_", "\".", "%", "(", "micro", ")", "i", "\"_", "%_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", "[_", "'", "release", "level", "'_", "]_", "!=_", "'", "final", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vers_", "._", "append_", "(_", "'%", "(", "release", "level", ")", "s", "%", "(", "serial", ")", "i", "'_", "%_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "vers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
enthought/envisage/envisage/ui/single_project/api.py
[ { "content": "#-----------------------------------------------------------------------------\n#\n# Copyright (c) 2006 by Enthought, Inc.\n# All rights reserved.\n#\n# Author: Dave Peterson <[email protected]>\n#\n#-----------------------------------------------------------------------------\n\n# IDs of services provided by this plugin\nfrom .services import IPROJECT_MODEL, IPROJECT_UI\n\n# Commonly referred to classes within this plugin\nfrom .factory_definition import FactoryDefinition\nfrom .model_service import ModelService\nfrom .project import Project\nfrom .project_action import ProjectAction\nfrom .project_factory import ProjectFactory\nfrom .view.project_view import ProjectView\n# FIXME: Add back this import when it actually works :)\n#from .editor.project_editor import ProjectEditor\n\n#### EOF #####################################################################\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
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", ")", " ", "2006", " ", "by", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Author", ":", " ", "Dav", "e", " ", "Peter", "son", " ", "<", "dp", "eter", "son", "@", "enth", "ou", "ght", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ID", "s", " ", "of", " ", "service", "s", " ", "provided", " ", "by", " ", "this", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "services_", "import_", "IP", "RO", "JE", "CT", "\\u", "MODEL_", ",_", "IP", "RO", "JE", "CT", "\\u", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Common", "ly", " ", "referred", " ", "to", " ", "classe", "s", " ", "within", " ", "this", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "factor", "y", "\\u", "definition_", "import_", "Factor", "y", "Definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "model", "\\u", "service_", "import_", "Model", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "project_", "import_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "project", "\\u", "action_", "import_", "Project", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "project", "\\u", "factory_", "import_", "Project", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "view_", "._", "project", "\\u", "view_", "import_", "Project", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Add", " ", "back", " ", "this", " ", "import", " ", "whe", "n", " ", "it", " ", "actual", "ly", " ", "works", " ", ":)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", ".", "editor", ".", "project", "\\u", "editor", " ", "import", " ", "Project", "Editor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "EO", "F", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\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 ]
Comparison of constants
mne-tools/mne-python/mne/source_estimate.py
[ { "content": "def morph_data_precomputed(subject_from, subject_to, stc_from, vertices_to,\n morph_mat):\n \"\"\"Morph source estimate between subjects using a precomputed matrix\n\n Parameters\n ----------\n subject_from : string\n Name of the original subject as named in the SUBJECTS_DIR.\n subject_to : string\n Name of the subject on which to morph as named in the SUBJECTS_DIR.\n stc_from : SourceEstimate\n Source estimates for subject \"from\" to morph.\n vertices_to : list of array of int\n The vertices on the destination subject's brain.\n morph_mat : sparse matrix\n The morphing matrix, typically from compute_morph_matrix.\n\n Returns\n -------\n stc_to : SourceEstimate\n Source estimate for the destination subject.\n \"\"\"\n if not sparse.issparse(morph_mat):\n raise ValueError('morph_mat must be a sparse matrix')\n\n if not isinstance(vertices_to, list) or not len(vertices_to) == 2:\n raise ValueError('vertices_to must be a list of length 2')\n\n if not sum(len(v) for v in vertices_to) == morph_mat.shape[0]:\n raise ValueError('number of vertices in vertices_to must match '\n 'morph_mat.shape[0]')\n if not stc_from.data.shape[0] == morph_mat.shape[1]:\n raise ValueError('stc_from.data.shape[0] must be the same as '\n 'morph_mat.shape[0]')\n\n if stc_from.subject is not None and stc_from.subject != subject_from:\n raise ValueError('stc_from.subject and subject_from must match')\n data = morph_mat * stc_from.data\n stc_to = SourceEstimate(data, vertices_to, stc_from.tmin, stc_from.tstep,\n verbose=stc_from.verbose, subject=subject_to)\n return stc_to", "metadata": "root.morph_data_precomputed", "header": "['module', '___EOS___']", "index": 2284 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "morph", "\\u", "data\\u", "precompute", "d_", "(_", "subject", "\\u", "from_", ",_", "subject", "\\u", "to_", ",_", "stc", "\\u", "from_", ",_", "vertice", "s", "\\u", "to_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "morph", "\\u", "mat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Morph", " ", "source", " ", "estimate", " ", "bet", "ween", " ", "subject", "s", " ", "usi", "ng", " ", "a", " ", "precompute", "d", " ", "matrix", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "subject", "\\u", "from", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "original", " ", "subject", " ", "as", " ", "named", " ", "in", " ", "the", " ", "SUBJECT", "S", "\\u", "DIR", ".", "\\", "10", ";", " ", " ", " ", " ", "subject", "\\u", "to", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "subject", " ", "on", " ", "whi", "ch", " ", "to", " ", "morph", " ", "as", " ", "named", " ", "in", " ", "the", " ", "SUBJECT", "S", "\\u", "DIR", ".", "\\", "10", ";", " ", " ", " ", " ", "stc", "\\u", "from", " ", ":", " ", "Sou", "rce", "Estimat", "e", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "estimate", "s", " ", "for", " ", "subject", " ", "\"", "from", "\"", " ", "to", " ", "morph", ".", "\\", "10", ";", " ", " ", " ", " ", "vertice", "s", "\\u", "to", " ", ":", " ", "list", " ", "of", " ", "array", " ", "of", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "vertice", "s", " ", "on", " ", "the", " ", "destinat", "ion", " ", "subject", "'", "s", " ", "brain", ".", "\\", "10", ";", " ", " ", " ", " ", "morph", "\\u", "mat", " ", ":", " ", "spars", "e", " ", "matrix", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "morphi", "ng", " ", "matrix", ",", " ", "typical", "ly", " ", "from", " ", "compute", "\\u", "morph", "\\u", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "stc", "\\u", "to", " ", ":", " ", "Sou", "rce", "Estimat", "e", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "estimate", " ", "for", " ", "the", " ", "destinat", "ion", " ", "subject", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sparse_", "._", "iss", "parse_", "(_", "morph", "\\u", "mat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "morph", "\\u", "mat", " ", "must", " ", "be", " ", "a", " ", "spars", "e", " ", "matrix", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "vertice", "s", "\\u", "to_", ",_", "list_", ")_", "or_", "not_", "len_", "(_", "vertice", "s", "\\u", "to_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "vertice", "s", "\\u", "to", " ", "must", " ", "be", " ", "a", " ", "list", " ", "of", " ", "length", " ", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "sum_", "(_", "len_", "(_", "v_", ")_", "for_", "v_", "in_", "vertice", "s", "\\u", "to_", ")_", "==_", "morph", "\\u", "mat_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "number", " ", "of", " ", "vertice", "s", " ", "in", " ", "vertice", "s", "\\u", "to", " ", "must", " ", "match", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "morph", "\\u", "mat", ".", "shape", "[", "0", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "stc", "\\u", "from_", "._", "data_", "._", "shape_", "[_", "0_", "]_", "==_", "morph", "\\u", "mat_", "._", "shape_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "stc", "\\u", "from", ".", "data", ".", "shape", "[", "0", "]", " ", "must", " ", "be", " ", "the", " ", "same", " ", "as", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "morph", "\\u", "mat", ".", "shape", "[", "0", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stc", "\\u", "from_", "._", "subject_", "is_", "not_", "None_", "and_", "stc", "\\u", "from_", "._", "subject_", "!=_", "subject", "\\u", "from_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "stc", "\\u", "from", ".", "subject", " ", "and", " ", "subject", "\\u", "from", " ", "must", " ", "match", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "morph", "\\u", "mat_", "*_", "stc", "\\u", "from_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stc", "\\u", "to_", "=_", "Sou", "rce", "Estimat", "e_", "(_", "data_", ",_", "vertice", "s", "\\u", "to_", ",_", "stc", "\\u", "from_", "._", "tmin_", ",_", "stc", "\\u", "from_", "._", "tst", "ep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ver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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gkno/gkno_launcher/src/networkx/algorithms/bipartite/projection.py
[ { "content": "def projected_graph(B, nodes, multigraph=False):\n r\"\"\"Returns the projection of B onto one of its node sets.\n\n Returns the graph G that is the projection of the bipartite graph B \n onto the specified nodes. They retain their attributes and are connected\n in G if they have a common neighbor in B.\n\n Parameters\n ----------\n B : NetworkX graph \n The input graph should be bipartite. \n\n nodes : list or iterable\n Nodes to project onto (the \"bottom\" nodes).\n\n multigraph: bool (default=False)\n If True return a multigraph where the multiple edges represent multiple\n shared neighbors. They edge key in the multigraph is assigned to the\n label of the neighbor.\n\n Returns\n -------\n Graph : NetworkX graph or multigraph\n A graph that is the projection onto the given nodes.\n\n Examples\n --------\n >>> from networkx.algorithms import bipartite\n >>> B = nx.path_graph(4)\n >>> G = bipartite.projected_graph(B, [1,3]) \n >>> print(G.nodes())\n [1, 3]\n >>> print(G.edges())\n [(1, 3)]\n \n If nodes `a`, and `b` are connected through both nodes 1 and 2 then\n building a multigraph results in two edges in the projection onto \n [`a`,`b`]:\n\n >>> B = nx.Graph()\n >>> B.add_edges_from([('a', 1), ('b', 1), ('a', 2), ('b', 2)])\n >>> G = bipartite.projected_graph(B, ['a', 'b'], multigraph=True)\n >>> print([sorted((u,v)) for u,v in G.edges()])\n [['a', 'b'], ['a', 'b']]\n\n Notes\n ------\n No attempt is made to verify that the input graph B is bipartite.\n Returns a simple graph that is the projection of the bipartite graph B\n onto the set of nodes given in list nodes. If multigraph=True then\n a multigraph is returned with an edge for every shared neighbor.\n\n Directed graphs are allowed as input. The output will also then\n be a directed graph with edges if there is a directed path between\n the nodes.\n\n The graph and node properties are (shallow) copied to the projected graph.\n\n See Also\n --------\n is_bipartite, \n is_bipartite_node_set, \n sets, \n weighted_projected_graph,\n collaboration_weighted_projected_graph,\n overlap_weighted_projected_graph,\n generic_weighted_projected_graph\n \"\"\"\n if B.is_multigraph():\n raise nx.NetworkXError(\"not defined for multigraphs\")\n if B.is_directed():\n directed=True\n if multigraph:\n G=nx.MultiDiGraph()\n else:\n G=nx.DiGraph()\n else:\n directed=False\n if multigraph:\n G=nx.MultiGraph()\n else:\n G=nx.Graph()\n G.graph.update(B.graph)\n G.add_nodes_from((n,B.node[n]) for n in nodes)\n for u in nodes:\n nbrs2=set((v for nbr in B[u] for v in B[nbr])) -set([u])\n if multigraph:\n for n in nbrs2:\n if directed:\n links=set(B[u]) & set(B.pred[n])\n else:\n links=set(B[u]) & set(B[n])\n for l in links:\n if not G.has_edge(u,n,l):\n G.add_edge(u,n,key=l)\n else:\n G.add_edges_from((u,n) for n in nbrs2)\n return G", "metadata": "root.projected_graph", "header": "['module', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "projected", "\\u", "graph_", "(_", "B_", ",_", "nodes_", ",_", "multi", "graph_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", "s", " ", "the", " ", "projecti", "on", " ", "of", " ", "B", " ", "onto", " ", "one", " ", "of", " ", "its", " ", "node", " ", "sets", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "graph", " ", "G", " ", "tha", "t", " ", "is", " ", "the", " ", "projecti", "on", " ", "of", " ", "the", " ", "bip", "arti", "te", " ", "graph", " ", "B", " ", "\\", "10", ";", " ", " ", " ", " ", "onto", " ", "the", " ", "specified", " ", "nodes", ".", " ", "The", "y", " ", "retain", " ", "thei", "r", " ", "attribute", "s", " ", "and", " ", "are", " ", "connect", "ed", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "G", " ", "if", " ", "the", "y", " ", "have", " ", "a", " ", "common", " ", "neighbor", " ", "in", " ", "B", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "B", " ", ":", " ", "Network", "X", " ", "graph", " ", "\\", "10", ";", " ", " ", "The", " ", "input", " ", "graph", " ", "shou", "ld", " ", "be", " ", "bip", "arti", "te", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nodes", " ", ":", " ", "list", " ", "or", " ", "iterable", "\\", "10", ";", " ", " ", "Node", "s", " ", "to", " ", "project", " ", "onto", " ", "(", "the", " ", "\"", "bottom", "\"", " ", "nodes", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "multi", "graph", ":", " ", "bool", " ", "(", "default", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", "If", " ", "Tru", "e", " ", "return", " ", "a", " ", "multi", "graph", " ", "where", " ", "the", " ", "multiple", " ", "edge", "s", " ", "represent", " ", "multiple", "\\", "10", ";", " ", " ", " ", "shared", " ", "neighbor", "s", ".", " ", " ", "The", "y", " ", "edge", " ", "key", " ", "in", " ", "the", " ", "multi", "graph", " ", "is", " ", "assign", "ed", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", "label", " ", "of", " ", "the", " ", "neighbor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "Graph", " ", ":", " ", "Network", "X", " ", "graph", " ", "or", " ", "multi", "graph", "\\", "10", ";", " ", " ", " ", "A", " ", "graph", " ", "tha", "t", " ", "is", " ", "the", " ", "projecti", "on", " ", "onto", " ", "the", " ", "give", "n", " ", "nodes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "networkx", ".", "algo", "rit", "hms", " ", "import", " ", "bip", "arti", "te", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "B", " ", "=", " ", "nx", ".", "path", "\\u", "graph", "(", "4", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "bip", "arti", "te", ".", "projected", "\\u", "graph", "(", "B", ",", " ", "[", "1", ",", "3", "])", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "G", ".", "nodes", "())", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "3", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "G", ".", "edge", "s", "())", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "3", ")]", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "nodes", " ", "`", "a", "`", ",", " ", "and", " ", "`", "b", "`", " ", "are", " ", "connect", "ed", " ", "through", " ", "bot", "h", " ", "nodes", " ", "1", " ", "and", " ", "2", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "buildi", "ng", " ", "a", " ", "multi", "graph", " ", "results", " ", "in", " ", "two", " ", "edge", "s", " ", "in", " ", "the", " ", "projecti", "on", " ", "onto", " ", "\\", "10", ";", " ", " ", " ", " ", "[", "`", "a", "`", ",", "`", "b", "`]", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "B", " ", "=", " ", "nx", ".", "Graph", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "B", ".", "add", "\\u", "edge", "s", "\\u", "from", "([(", "'", "a", "',", " ", "1", "),", " ", "('", "b", "',", " ", "1", "),", " ", "('", "a", "',", " ", "2", "),", " ", "('", "b", "',", " ", "2", ")])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "bip", "arti", "te", ".", "projected", "\\u", "graph", "(", "B", ",", " ", "['", "a", "',", " ", "'", "b", "']", ",", " ", "multi", "graph", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "([", "sorte", "d", "((", "u", ",", "v", "))", " ", "for", " ", "u", ",", "v", " ", "in", " ", "G", ".", "edge", "s", "()]", ")", "\\", "10", ";", " ", " ", " ", " ", "[[", "'", "a", "',", " ", "'", "b", "']", ",", " ", "['", "a", "',", " ", "'", "b", "']]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "------", "\\", "10", ";", " ", " ", " ", " ", "No", " ", "atte", "mpt", " ", "is", " ", "made", " ", "to", " ", "verify", " ", "tha", "t", " ", "the", " ", "input", " ", "graph", " ", "B", " ", "is", " ", "bip", "arti", "te", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "simple", " ", "graph", " ", "tha", "t", " ", "is", " ", "the", " ", "projecti", "on", " ", "of", " ", "the", " ", "bip", "arti", "te", " ", "graph", " ", "B", "\\", "10", ";", " ", " ", " ", " ", "onto", " ", "the", " ", "set", " ", "of", " ", "nodes", " ", "give", "n", " ", "in", " ", "list", " ", "nodes", ".", " ", " ", "If", " ", "multi", "graph", "=", "Tru", "e", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "multi", "graph", " ", "is", " ", "return", "ed", " ", "with", " ", "an", " ", "edge", " ", "for", " ", "every", " ", "shared", " ", "neighbor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Direct", "ed", " ", "graph", "s", " ", "are", " ", "allow", "ed", " ", "as", " ", "input", ".", " ", " ", "The", " ", "output", " ", "will", " ", "als", "o", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "a", " ", "direct", "ed", " ", "graph", " ", "with", " ", "edge", "s", " ", "if", " ", "there", " ", "is", " ", "a", " ", "direct", "ed", " ", "path", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "nodes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "graph", " ", "and", " ", "node", " ", "proper", "ties", " ", "are", " ", "(", "shallow", ")", " ", "copie", "d", " ", "to", " ", "the", " ", "projected", " ", "graph", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "is", "\\u", "bip", "arti", "te", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "is", "\\u", "bip", "arti", "te", "\\u", "node", "\\u", "set", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "sets", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "weight", "ed", "\\u", "projected", "\\u", "graph", ",", "\\", "10", ";", " ", " ", " ", " ", "collaborat", "ion", "\\u", "weight", "ed", "\\u", "projected", "\\u", "graph", ",", "\\", "10", ";", " ", " ", " ", " ", "overl", "ap", "\\u", "weight", "ed", "\\u", "projected", "\\u", "graph", ",", "\\", "10", ";", " ", " ", " ", " ", "gener", "ic", "\\u", "weight", "ed", "\\u", "projected", "\\u", "graph", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "B_", "._", "is", "\\u", "multi", "graph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "\"", "not", " ", "defin", "ed", " ", "for", " ", "multi", "graph", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "B_", "._", "is", "\\u", "directed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "directed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multi", "graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Multi", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Di", "Graph_", "(_", ")_", "\\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 ", " _", "directed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multi", "graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Multi", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "._", "graph_", "._", "update_", "(_", "B_", "._", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "nodes", "\\u", "from_", "(_", "(_", "n_", ",_", "B_", "._", "node_", "[_", "n_", "]_", ")_", "for_", "n_", "in_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "u_", "in_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbr", "s2_", "=_", "set_", "(_", "(_", "v_", "for_", "nbr_", "in_", "B_", "[_", "u_", "]_", "for_", "v_", "in_", "B_", "[_", "nbr_", "]_", ")_", ")_", "-_", "set_", "(_", "[_", "u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multi", "graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "nbr", "s2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "directed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "links_", "=_", "set_", "(_", "B_", "[_", "u_", "]_", ")_", "&_", "set_", "(_", "B_", "._", "pred_", "[_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "links_", "=_", "set_", "(_", "B_", "[_", "u_", "]_", ")_", "&_", "set_", "(_", "B_", "[_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "G_", "._", "has", "\\u", "edge_", "(_", "u_", ",_", "n_", ",_", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "G_", "._", "add", "\\u", "edge_", "(_", "u_", ",_", "n_", ",_", "key_", "=_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "._", "add", "\\u", "edge", "s", "\\u", "from_", "(_", "(_", "u_", ",_", "n_", ")_", "for_", "n_", "in_", "nbr", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "G_", "\\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, 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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 ]
NotImplemented is not an Exception
agiliq/merchant/billing/gateways/eway_gateway/eway_gateway.py
[ { "content": " def credit(self, money, identification, options=None):\n raise NotImplementedError", "metadata": "root.EwayGateway.credit", "header": "['class', 'EwayGateway', '(', 'Gateway', ')', ':', '___EOS___']", "index": 198 } ]
[]
[]
0
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "class_", "Ew", "ay", "Gateway_", "(_", "Gateway_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "credit_", "(_", "self_", ",_", "money_", ",_", "identifica", "tion_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unreachable code
mollyproject/mollyproject/molly/apps/places/providers/postcodes.py
[ { "content": " def _get_source(self):\n try:\n source = Source.objects.get(module_name=self.MODULE_NAME)\n except Source.DoesNotExist:\n source = Source(module_name=self.MODULE_NAME)\n\n source.name = \"Postcodes\"\n source.save()\n\n return source", "metadata": "root.PostcodesMapsProvider._get_source", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 138 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "source_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Source_", "._", "objects_", "._", "get_", "(_", "module", "\\u", "name_", "=_", "self_", "._", "MODUL", "E", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Source_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Source_", "(_", "module", "\\u", "name_", "=_", "self_", "._", "MODUL", "E", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "._", "name_", "=_", "\"", "Post", "codes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "source_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
datastax/python-driver/cassandra/cqlengine/statements.py
[ { "content": " def __init__(self,\n table,\n assignments=None,\n where=None,\n ttl=None,\n timestamp=None,\n conditionals=None,\n if_exists=False):\n super(UpdateStatement, self). __init__(table,\n assignments=assignments,\n where=where,\n ttl=ttl,\n timestamp=timestamp,\n conditionals=conditionals)\n\n self.if_exists = if_exists", "metadata": "root.UpdateStatement.__init__", "header": "['class', 'UpdateStatement', '(', 'AssignmentStatement', ')', ':', '___EOS___']", "index": 741 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Update", "Statement_", "(_", "Assign", "ment", "Statement_", ")_", ":_", "\\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_", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignments_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "where_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ttl_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conditional", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "if", "\\u", "exists_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Update", "Statement_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignments_", "=_", "assignments_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "where_", "=_", "where_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ttl_", "=_", "ttl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conditional", "s_", "=_", "conditional", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "if", "\\u", "exists_", "=_", "if", "\\u", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
numba/numba/numba/tests/test_object_mode.py
[ { "content": "\"\"\"\nTesting object mode specifics.\n\n\"\"\"\nfrom __future__ import print_function\n\nimport numpy\n\nimport numba.unittest_support as unittest\nfrom numba.compiler import compile_isolated, Flags\nfrom numba import utils, jit\nfrom .support import TestCase\n\n\n\n\n\nforceobj = Flags()\nforceobj.set(\"force_pyobject\")\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def complex_constant(n):\n tmp = n + 4\n return tmp + 3j", "metadata": "root.complex_constant", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def long_constant(n):\n return n + 100000000000000000000000000000000000000000000000", "metadata": "root.long_constant", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def loop_nest_3(x, y):\n n = 0\n for i in range(x):\n for j in range(y):\n for k in range(x+y):\n n += i * j\n\n return n", "metadata": "root.loop_nest_3", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def array_of_object(x):\n return x", "metadata": "root.array_of_object", "header": "['module', '___EOS___']", "index": 36 }, { "content": "class TestObjectMode(TestCase):\n\n\n\n\n", "metadata": "root.TestObjectMode", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def test_complex_constant(self):\n pyfunc = complex_constant\n cres = compile_isolated(pyfunc, (), flags=forceobj)\n cfunc = cres.entry_point\n self.assertPreciseEqual(pyfunc(12), cfunc(12))", "metadata": "root.TestObjectMode.test_complex_constant", "header": "['class', 'TestObjectMode', '(', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_long_constant(self):\n pyfunc = long_constant\n cres = compile_isolated(pyfunc, (), flags=forceobj)\n cfunc = cres.entry_point\n self.assertPreciseEqual(pyfunc(12), cfunc(12))", "metadata": "root.TestObjectMode.test_long_constant", "header": "['class', 'TestObjectMode', '(', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_loop_nest(self):\n \"\"\"\n Test bug that decref the iterator early.\n If the bug occurs, a segfault should occur\n \"\"\"\n pyfunc = loop_nest_3\n cres = compile_isolated(pyfunc, (), flags=forceobj)\n cfunc = cres.entry_point\n self.assertEqual(pyfunc(5, 5), cfunc(5, 5))\n\n def bm_pyfunc():\n pyfunc(5, 5)\n\n def bm_cfunc():\n cfunc(5, 5)\n\n print(utils.benchmark(bm_pyfunc))\n print(utils.benchmark(bm_cfunc))", "metadata": "root.TestObjectMode.test_loop_nest", "header": "['class', 'TestObjectMode', '(', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_array_of_object(self):\n cfunc = jit(array_of_object)\n objarr = numpy.array([object()] * 10)\n self.assertIs(cfunc(objarr), objarr)", "metadata": "root.TestObjectMode.test_array_of_object", "header": "['class', 'TestObjectMode', '(', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_sequence_contains(self):\n \"\"\"\n Test handling of the `in` comparison\n \"\"\"\n @jit(forceobj=True)\n def foo(x, y):\n return x in y\n\n self.assertTrue(foo(1, [0, 1]))\n self.assertTrue(foo(0, [0, 1]))\n self.assertFalse(foo(2, [0, 1]))\n\n with self.assertRaises(TypeError) as raises:\n foo(None, None)\n\n self.assertIn(\"is not iterable\", str(raises.exception))", "metadata": "root.TestObjectMode.test_sequence_contains", "header": "['class', 'TestObjectMode', '(', 'TestCase', ')', ':', '___EOS___']", "index": 78 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", "ing", " ", "object", " ", "mode", " ", "specific", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\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_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numba_", "._", "unittest", "\\u", "support_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "compiler_", "import_", "compile", "\\u", "isolated", "_", ",_", "Flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "import_", "utils_", ",_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "support_", "import_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "force", "obj_", "=_", "Flags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "force", "obj_", "._", "set_", "(_", "\"", "force", "\\u", "pyobj", "ect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "def_", "complex", "\\u", "constant_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "n_", "+_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmp_", "+_", "3", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "long", "\\u", "constant_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "n_", "+_", "100000000000", "0000000000000", "0000000000000", "000000000", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "loop", "\\u", "nest", "\\u", "3_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "range_", "(_", "x_", "+_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "i_", "*_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "array", "\\u", "of", "\\u", "object_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "complex", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyfu", "nc_", "=_", "complex", "\\u", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cres", "_", "=_", "compile", "\\u", "isolated", "_", "(_", "pyfu", "nc_", ",_", "(_", ")_", ",_", "flags_", "=_", "force", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfunc_", "=_", "cres", "_", "._", "entry", "\\u", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "pyfu", "nc_", "(_", "12_", ")_", ",_", "cfunc_", "(_", "12_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "long", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyfu", "nc_", "=_", "long", "\\u", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cres", "_", "=_", "compile", "\\u", "isolated", "_", "(_", "pyfu", "nc_", ",_", "(_", ")_", ",_", "flags_", "=_", "force", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfunc_", "=_", "cres", "_", "._", "entry", "\\u", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "pyfu", "nc_", "(_", "12_", ")_", ",_", "cfunc_", "(_", "12_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop", "\\u", "nest_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "bug", " ", "tha", "t", " ", "decre", "f", " ", "the", " ", "iter", "ator", " ", "ear", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "bug", " ", "occur", "s", ",", " ", "a", " ", "seg", "fault", " ", "shou", "ld", " ", "occur", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyfu", "nc_", "=_", "loop", "\\u", "nest", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cres", "_", "=_", "compile", "\\u", "isolated", "_", "(_", "pyfu", "nc_", ",_", "(_", ")_", ",_", "flags_", "=_", "force", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfunc_", "=_", "cres", "_", "._", "entry", "\\u", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pyfu", "nc_", "(_", "5_", ",_", "5_", ")_", ",_", "cfunc_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bm", "\\u", "pyfu", "nc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyfu", "nc_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bm", "\\u", "cfunc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfunc_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "utils_", "._", "benchmark_", "(_", "bm", "\\u", "pyfu", "nc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "utils_", "._", "benchmark_", "(_", "bm", "\\u", "cfunc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "array", "\\u", "of", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfunc_", "=_", "jit_", "(_", "array", "\\u", "of", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "arr_", "=_", "numpy_", "._", "array_", "(_", "[_", "object_", "(_", ")_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "cfunc_", "(_", "obj", "arr_", ")_", ",_", "obj", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Object", "Mode_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sequence", "\\u", "contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "handling", " ", "of", " ", "the", " ", "`", "in", "`", " ", "compa", "ris", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "jit_", "(_", "force", "obj_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "in_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "foo_", "(_", "1_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "foo_", "(_", "0_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "foo_", "(_", "2_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "is", " ", "not", " ", "iterable", "\"_", ",_", "str_", "(_", "raises_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 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, 4, 2, 2, 2, 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 ]
Unused local variable
mihaip/streamspigot/app/datasources/thumbnails.py
[ { "content": "def get_thumbnail_info(url, size):\n def get_thumb_url_for_short_photo_id(short_photo_id):\n return 'http://flic.kr/p/img/%s_%s.jpg' % (\n short_photo_id, size == SMALL_THUMBNAIL and 't' or 'm')\n\n def get_youtube_thumb_url(video_id):\n # See http://stackoverflow.com/questions/2068344\n return 'http://img.youtube.com/vi/%s/%s.jpg' % (\n video_id, need_small and 'default' or 'hqdefault')\n\n thumb_url = None\n thumb_width = None\n thumb_height = None\n need_small = size == SMALL_THUMBNAIL\n\n parsed_url = urlparse.urlparse(url)\n hostname = parsed_url.netloc\n path = parsed_url.path\n query = dict(parse_qsl(parsed_url.query))\n\n if hostname == 'yfrog.com':\n # See http://yfrog.com/page/api\n match = _YFROG_PATH_RE.match(path)\n if match:\n thumb_url = 'http://yfrog.com/%s' % match.group(1)\n if need_small:\n thumb_url += ':small'\n else:\n thumb_url += ':iphone'\n elif hostname in ('instagr.am', 'instagram.com', 'www.instagram.com'):\n # See http://instagram.com/developer/embedding/#media\n match = _INSTAGRAM_PATH_RE.match(path)\n if match:\n thumb_url = 'http://instagr.am/p/%s/media/' % match.group(1)\n if need_small:\n thumb_url += '?size=t'\n thumb_width = 150\n thumb_height = 150\n else:\n thumb_width = 306\n thumb_height = 306\n elif hostname == 'flic.kr':\n # See http://www.flickr.com/services/api/misc.urls.html (\"Short URLs\"\n # section) and http://www.flickr.com/groups/api/discuss/72157616713786392/#comment72157623145381402\n match = _FLICKR_SHORT_PATH_RE.match(path)\n if match:\n thumb_url = get_thumb_url_for_short_photo_id(match.group(1))\n elif _FLICKR_LONG_HOSTNAME_RE.match(hostname):\n # See http://www.flickr.com/services/api/misc.urls.html (\"Photo Source\n # URLs\" section).\n match = _FLICKR_LONG_PATH_RE.match(path)\n if match:\n path_prefix = match.group(1)\n size_suffix = match.group(2)\n extension = match.group(3)\n\n if size_suffix == '_o':\n # Original photos have their own secret, so so we can't generate\n # a thumbnail URL from them without doing an API call.\n thumb_url = url\n else:\n thumb_url = '%s://%s%s' % (parsed_url.scheme, hostname, path_prefix)\n if need_small:\n thumb_url += '_t'\n thumb_url += extension\n elif hostname == 'www.flickr.com':\n # See http://www.flickr.com/services/api/misc.urls.html (\"Web Page\n # URLs\" section).\n match = _FLICKR_PHOTO_PAGE_PATH_RE.match(path)\n if match:\n photo_id = int(match.group(1))\n # Given a photo ID (but not its secret), all we can do is generate\n # a short URL-style thumbnail for it.\n short_photo_id = _get_short_flickr_photo_id(photo_id)\n thumb_url = get_thumb_url_for_short_photo_id(short_photo_id)\n elif hostname.startswith('i.') and hostname.endswith('.imgur.com'):\n # See http://webapps.stackexchange.com/questions/16103. We don't use\n # a strict hostname comparison so that we can handle \"Pro\" imgur\n # instances too (e.g. i.stack.imgur.com).\n match = _IMGUR_PATH_RE.match(path)\n if match:\n thumb_url = '%s://%s/%s%s%s' % (\n parsed_url.scheme, hostname, match.group(1),\n (need_small and 's' or 'l'), match.group(2))\n elif hostname == 'imgur.com':\n # See http://imgur.com/faq#gallery\n match = _IMGUR_GALLERY_PATH_RE.match(path)\n if match:\n thumb_url = 'http://i.imgur.com/%s%s.jpg' % (\n match.group(2), (need_small and 's' or 'l'))\n elif hostname == 'twitpic.com':\n # See http://dev.twitpic.com/docs/thumbnails/ (the 'large' size isn't\n # documented there, but it is what twitter.com seems to use).\n match = _TWITPIC_PATH_RE.match(path)\n if match:\n thumb_url = 'http://twitpic.com/show/%s/%s' % (\n need_small and 'thumb' or 'large',\n match.group(1))\n if need_small:\n thumb_width = 150\n thumb_height = 150\n elif hostname == 'lockerz.com':\n # See http://support.lockerz.com/entries/350297-image-from-url\n match = _LOCKERZ_PATH_RE.match(path)\n if match:\n thumb_url = 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=%s&size=%s' % (\n urllib.quote(url),\n need_small and 'small' or 'medium')\n if need_small:\n thumb_width = 150\n thumb_height = 150\n elif hostname == 'cl.ly':\n # See http://developer.getcloudapp.com/view-item\n thumb_url = 'http://thumbs.cl.ly%s' % path\n elif hostname == 'youtube.com' or hostname == 'www.youtube.com':\n if path == '/watch' and 'v' in query:\n thumb_url = get_youtube_thumb_url(query['v'])\n elif hostname == 'youtu.be':\n thumb_url = get_youtube_thumb_url(path[1:])\n elif hostname == 'img.ly':\n # See http://web.archive.org/web/20100606214502/http://img.ly/api/docs\n # (current API docs have removed references to thumbnails)\n match = _IMGLY_FULL_PATH_RE.match(path)\n if match:\n thumb_url = 'http://s3.amazonaws.com/imgly_production/%s/%s.jpg' % (\n match.group(1),\n need_small and 'thumb' or 'large')\n else:\n match = _IMGLY_SHORT_PATH_RE.match(path)\n if match:\n thumb_url = 'http://img.ly/show/%s/%s' % (\n need_small and 'thumb' or 'large',\n match.group(1))\n if need_small:\n thumb_width = 150\n thumb_height = 150\n elif hostname == 'ow.ly':\n # No online docs, but these paths are shown in the embed codes that\n # appear in the sidebar of any image (e.g. see http://ow.ly/i/oKuW).\n match = _OWLY_PATH_RE.match(path)\n if match:\n thumb_url = 'http://static.ow.ly/photos/%s/%s.jpg' % (\n need_small and 'thumb' or 'normal',\n match.group(1))\n if need_small:\n thumb_width = 100\n thumb_height = 100\n\n return thumb_url, thumb_width, thumb_height", "metadata": "root.get_thumbnail_info", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def get(self):\n url = self.request.get('url')\n\n self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'\n def add_field(label, value):\n self.response.out.write('<p><b>%s</b>: %s</p>' % (label, value))\n\n iframe_url, iframe_width, iframe_height = get_iframe_info(url)\n if iframe_url:\n add_field('iframe_url', iframe_url)\n add_field('iframe_width', iframe_width)\n add_field('iframe_height', iframe_height)\n iframe_attributes = ''\n if iframe_width and iframe_height:\n iframe_attributes = ' width=\"%d\" height=\"%d\"' % (\n iframe_width, iframe_height)\n add_field('HTML',\n '<iframe src=\"%s\" frameborder=\"0\"%s></iframe>'\n % (xml.sax.saxutils.escape(iframe_url), iframe_attributes))\n\n def add_thumbnail(size):\n thumb_url, thumb_width, thumb_height = get_thumbnail_info(url, size)\n if thumb_url:\n add_field('thumb_url (%s)' % size, thumb_url)\n add_field('thumb_width (%s)' % size, thumb_width)\n add_field('thumb_height (%s)' % size, thumb_height)\n img_attributes = ''\n if thumb_width and thumb_height:\n img_attributes = ' width=\"%d\" height=\"%d\"' % (\n thumb_width, thumb_height)\n add_field('HTML (%s)',\n '<img src=\"%s\" alt=\"\" style=\"padding:2px\"%s/>'\n % (xml.sax.saxutils.escape(thumb_url), img_attributes))\n\n add_thumbnail(LARGE_THUMBNAIL)\n add_thumbnail(SMALL_THUMBNAIL)", "metadata": "root.TestHandler.get", "header": "['class', 'TestHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 225 } ]
[]
[]
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_", "get", "\\u", "thumbnail", "\\u", "info_", "(_", "url_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "thumb", "\\u", "url", "\\u", "for", "\\u", "short", "\\u", "photo", "\\u", "id_", "(_", "short", "\\u", "photo", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "http", "://", "fli", "c", ".", "kr", "/", "p", "/", "img", "/", "%", "s", "\\u", "%", "s", ".", "jp", "g", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "short", "\\u", "photo", "\\u", "id_", ",_", "size_", "==_", "SMALL", "\\u", "THUMB", "NA", "IL", "_", "and_", "'", "t", "'_", "or_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "youtu", "be", "\\u", "thumb", "\\u", "url_", "(_", "video", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "206", "834", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "http", "://", "img", ".", "youtu", "be", ".", "com", "/", "vi", "/", "%", "s", "/", "%", "s", ".", "jp", "g", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "video", "\\u", "id_", ",_", "need", "\\u", "small_", "and_", "'", "default", "'_", "or_", "'", "hq", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thumb", "\\u", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "width_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "small_", "=_", "size_", "==_", "SMALL", "\\u", "THUMB", "NA", "IL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parsed", "\\u", "url_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "parsed", "\\u", "url_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "parsed", "\\u", "url_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "dict_", "(_", "parse", "\\u", "qs", "l_", "(_", "parsed", "\\u", "url_", "._", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hostname_", "==_", "'", "yf", "rog", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "yf", "rog", ".", "com", "/", "page", "/", "api_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "YF", "RO", "G", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "yf", "rog", ".", "com", "/", "%", "s", "'_", "%_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "+=_", "':", "small", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "+=_", "':", "iph", "one", "'_", "\\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_", "hostname_", "in_", "(_", "'", "insta", "gr", ".", "am", "'_", ",_", "'", "insta", "gram", ".", "com", "'_", ",_", "'", "www", ".", "insta", "gram", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "insta", "gram", ".", "com", "/", "developer", "/", "embed", "ding", "/", "#", "media_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "INSTA", "GRAM", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "insta", "gr", ".", "am", "/", "p", "/", "%", "s", "/", "media", "/'_", "%_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "+=_", "'?", "size", "=", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "width_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "width_", "=_", "306", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "306", "_", "\\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_", "hostname_", "==_", "'", "fli", "c", ".", "kr", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "www", ".", "flickr", ".", "com", "/", "service", "s", "/", "api", "/", "misc", ".", "urls", ".", "html", " ", "(\"", "Short", " ", "URL", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "section", ")", " ", "and", " ", "http", "://", "www", ".", "flickr", ".", "com", "/", "group", "s", "/", "api", "/", "discuss", "/", "721", "576", "167", "137", "863", "9", "2", "/", "#", "comment", "721", "576", "231", "453", "814", "02_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "FLI", "CK", "R", "\\u", "SHORT", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "get", "\\u", "thumb", "\\u", "url", "\\u", "for", "\\u", "short", "\\u", "photo", "\\u", "id_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "FLI", "CK", "R", "\\u", "LONG", "\\u", "HOSTNAME", "\\u", "RE_", "._", "match_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "www", ".", "flickr", ".", "com", "/", "service", "s", "/", "api", "/", "misc", ".", "urls", ".", "html", " ", "(\"", "Photo", " ", "Source_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", "s", "\"", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "FLI", "CK", "R", "\\u", "LONG", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "prefix_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "suffix_", "=_", "match_", "._", "group_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extension_", "=_", "match_", "._", "group_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "size", "\\u", "suffix_", "==_", "'\\u", "o", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Origina", "l", " ", "photo", "s", " ", "have", " ", "thei", "r", " ", "own", " ", "secret", ",", " ", "so", " ", "so", " ", "we", " ", "can", "'", "t", " ", "generate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "thumbnail", " ", "URL", " ", "from", " ", "them", " ", "with", "out", " ", "doi", "ng", " ", "an", " ", "API", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'%", "s", "://", "%", "s", "%", "s", "'_", "%_", "(_", "parsed", "\\u", "url_", "._", "scheme_", ",_", "hostname_", ",_", "path", "\\u", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "thumb", "\\u", "url_", "+=_", "'\\u", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thumb", "\\u", "url_", "+=_", "extension_", "\\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_", "hostname_", "==_", "'", "www", ".", "flickr", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "www", ".", "flickr", ".", "com", "/", "service", "s", "/", "api", "/", "misc", ".", "urls", ".", "html", " ", "(\"", "Web", " ", "Page_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", "s", "\"", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "FLI", "CK", "R", "\\u", "PHOTO", "\\u", "PAGE", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "photo", "\\u", "id_", "=_", "int_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Give", "n", " ", "a", " ", "photo", " ", "ID", " ", "(", "but", " ", "not", " ", "its", " ", "secret", "),", " ", "all", " ", "we", " ", "can", " ", "do", " ", "is", " ", "generate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "short", " ", "URL", "-", "style", " ", "thumbnail", " ", "for", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "short", "\\u", "photo", "\\u", "id_", "=_", "\\u", "get", "\\u", "short", "\\u", "flickr", "\\u", "photo", "\\u", "id_", "(_", "photo", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "url_", "=_", "get", "\\u", "thumb", "\\u", "url", "\\u", "for", "\\u", "short", "\\u", "photo", "\\u", "id_", "(_", "short", "\\u", "photo", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "._", "startswith_", "(_", "'", "i", ".'_", ")_", "and_", "hostname_", "._", "endswith_", "(_", "'.", "img", "ur", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "weba", "pps", ".", "stack", "exchange", ".", "com", "/", "question", "s", "/", "161", "03", ".", " ", "We", " ", "don", "'", "t", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "strict", " ", "host", "name", " ", "compa", "ris", "on", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "handle", " ", "\"", "Pro", "\"", " ", "img", "ur_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", "s", " ", "too", " ", "(", "e", ".", "g", ".", " ", "i", ".", "stack", ".", "img", "ur", ".", "com", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "IMG", "UR", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'%", "s", "://", "%", "s", "/", "%", "s", "%", "s", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parsed", "\\u", "url_", "._", "scheme_", ",_", "hostname_", ",_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "need", "\\u", "small_", "and_", "'", "s", "'_", "or_", "'", "l", "'_", ")_", ",_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "img", "ur", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "img", "ur", ".", "com", "/", "faq", "#", "gallery", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "IMG", "UR", "\\u", "GAL", "LER", "Y", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "i", ".", "img", "ur", ".", "com", "/", "%", "s", "%", "s", ".", "jp", "g", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "._", "group_", "(_", "2_", ")_", ",_", "(_", "need", "\\u", "small_", "and_", "'", "s", "'_", "or_", "'", "l", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "twit", "pic", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "dev", ".", "twit", "pic", ".", "com", "/", "docs", "/", "thumbnail", "s", "/", " ", "(", "the", " ", "'", "large", "'", " ", "size", " ", "isn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documente", "d", " ", "there", ",", " ", "but", " ", "it", " ", "is", " ", "what", " ", "twit", "ter", ".", "com", " ", "see", "ms", " ", "to", " ", "use", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "TW", "IT", "PIC", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "twit", "pic", ".", "com", "/", "show", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "small_", "and_", "'", "thumb", "'_", "or_", "'", "large", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "width_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "150_", "\\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_", "hostname_", "==_", "'", "lock", "er", "z", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "support", ".", "lock", "er", "z", ".", "com", "/", "entri", "es", "/", "350", "297", "-", "image", "-", "from", "-", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "LOCK", "ER", "Z", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "api", ".", "pli", "xi", ".", "com", "/", "api", "/", "tpa", "pi", ".", "svc", "/", "imagef", "rom", "url", "?", "url", "=", "%", "s", "&", "size", "=", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "quote_", "(_", "url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "small_", "and_", "'", "small", "'_", "or_", "'", "medium", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "width_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "150_", "\\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_", "hostname_", "==_", "'", "cl", ".", "ly", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "developer", ".", "getc", "loud", "app", ".", "com", "/", "view", "-", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "thumbs", ".", "cl", ".", "ly", "%", "s", "'_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "youtu", "be", ".", "com", "'_", "or_", "hostname_", "==_", "'", "www", ".", "youtu", "be", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "==_", "'/", "watch", "'_", "and_", "'", "v", "'_", "in_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "get", "\\u", "youtu", "be", "\\u", "thumb", "\\u", "url_", "(_", "query_", "[_", "'", "v", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "youtu", ".", "be", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "get", "\\u", "youtu", "be", "\\u", "thumb", "\\u", "url_", "(_", "path_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "img", ".", "ly", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "web", ".", "archive", ".", "org", "/", "web", "/", "20100", "606", "214", "502", "/", "http", "://", "img", ".", "ly", "/", "api", "/", "docs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "current", " ", "API", " ", "docs", " ", "have", " ", "remove", "d", " ", "reference", "s", " ", "to", " ", "thumbnail", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "IMG", "LY", "\\u", "FULL", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "s3", ".", "amaz", "ona", "ws", ".", "com", "/", "img", "ly", "\\u", "producti", "on", "/", "%", "s", "/", "%", "s", ".", "jp", "g", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "small_", "and_", "'", "thumb", "'_", "or_", "'", "large", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "IMG", "LY", "\\u", "SHORT", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "img", ".", "ly", "/", "show", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "small_", "and_", "'", "thumb", "'_", "or_", "'", "large", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "thumb", "\\u", "width_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hostname_", "==_", "'", "ow", ".", "ly", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "onli", "ne", " ", "docs", ",", " ", "but", " ", "these", " ", "path", "s", " ", "are", " ", "shown", " ", "in", " ", "the", " ", "embed", " ", "codes", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appear", " ", "in", " ", "the", " ", "sidebar", " ", "of", " ", "any", " ", "image", " ", "(", "e", ".", "g", ".", " ", "see", " ", "http", "://", "ow", ".", "ly", "/", "i", "/", "o", "Ku", "W", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "\\u", "OWL", "Y", "\\u", "PATH", "\\u", "RE_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", "=_", "'", "http", "://", "static", ".", "ow", ".", "ly", "/", "photo", "s", "/", "%", "s", "/", "%", "s", ".", "jp", "g", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "small_", "and_", "'", "thumb", "'_", "or_", "'", "normal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "small_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "width_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "height_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "thumb", "\\u", "url_", ",_", "thumb", "\\u", "width_", ",_", "thumb", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "html", ";", " ", "charset", "=", "UT", "F", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "field_", "(_", "label_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'<", "p", "><", "b", ">", "%", "s", "</", "b", ">:", " ", "%", "s", "</", "p", ">'_", "%_", "(_", "label_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iframe", "\\u", "url_", ",_", "iframe", "\\u", "width_", ",_", "iframe", "\\u", "height_", "=_", "get", "\\u", "iframe", "\\u", "info_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "iframe", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "field_", "(_", "'", "iframe", "\\u", "url", "'_", ",_", "iframe", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "iframe", "\\u", "widt", "h", "'_", ",_", "iframe", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "iframe", "\\u", "height", "'_", ",_", "iframe", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iframe", "\\u", "attributes_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "iframe", "\\u", "width_", "and_", "iframe", "\\u", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iframe", "\\u", "attributes_", "=_", "'", " ", "widt", "h", "=\"", "%", "d", "\"", " ", "height", "=\"", "%", "d", "\"'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "iframe", "\\u", "width_", ",_", "iframe", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "HTM", "L", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "iframe", " ", "src", "=\"", "%", "s", "\"", " ", "frame", "border", "=\"", "0", "\"%", "s", "><", "/", "iframe", ">'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "xml_", "._", "sax_", "._", "sax", "utils_", "._", "escape_", "(_", "iframe", "\\u", "url_", ")_", ",_", "iframe", "\\u", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "thumbnail_", "(_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "url_", ",_", "thumb", "\\u", "width_", ",_", "thumb", "\\u", "height_", "=_", "get", "\\u", "thumbnail", "\\u", "info_", "(_", "url_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "field_", "(_", "'", "thumb", "\\u", "url", " ", "(%", "s", ")'_", "%_", "size_", ",_", "thumb", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "thumb", "\\u", "widt", "h", " ", "(%", "s", ")'_", "%_", "size_", ",_", "thumb", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "thumb", "\\u", "height", " ", "(%", "s", ")'_", "%_", "size_", ",_", "thumb", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "attributes_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumb", "\\u", "width_", "and_", "thumb", "\\u", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "\\u", "attributes_", "=_", "'", " ", "widt", "h", "=\"", "%", "d", "\"", " ", "height", "=\"", "%", "d", "\"'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "thumb", "\\u", "width_", ",_", "thumb", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "\\u", "field_", "(_", "'", "HTM", "L", " ", "(%", "s", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "img", " ", "src", "=\"", "%", "s", "\"", " ", "alt", "=\"\"", " ", "style", "=\"", "padd", "ing", ":", "2p", "x", "\"%", "s", "/>'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "xml_", "._", "sax_", "._", "sax", "utils_", "._", "escape_", "(_", "thumb", "\\u", "url_", ")_", ",_", "img", "\\u", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "\\u", "thumbnail_", "(_", "LARGE", "\\u", "THUMB", "NA", "IL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "thumbnail_", "(_", "SMALL", "\\u", "THUMB", "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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 ]
Unused local variable
treeio/treeio/treeio/core/api/doc.py
[ { "content": "def _convert(template, params=None):\n \"\"\"URI template converter\"\"\"\n if params is None:\n params = []\n paths = template % dict([p, \"{%s}\" % p] for p in params)\n return u'/api%s%s' % (get_script_prefix(), paths)", "metadata": "root._convert", "header": "['module', '___EOS___']", "index": 146 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert_", "(_", "template_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "URI", " ", "template", " ", "converter", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "paths_", "=_", "template_", "%_", "dict_", "(_", "[_", "p_", ",_", "\"{", "%", "s", "}\"_", "%_", "p_", "]_", "for_", "p_", "in_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "u", "'/", "api", "%", "s", "%", "s", "'_", "%_", "(_", "get", "\\u", "script", "\\u", "prefix_", "(_", ")_", ",_", "paths_", ")_", "\\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 ]
Unused import
kivy/kivy/kivy/utils.py
[ { "content": "# pylint: disable=W0611\n'''\nUtils\n=====\n\nThe Utils module provides a selection of general utility functions and classes\nthat may be useful for various applications. These include maths, color,\nalgebraic and platform functions.\n\n.. versionchanged:: 1.6.0\n The OrderedDict class has been removed. Use collections.OrderedDict\n instead.\n\n'''\n\n__all__ = ('intersection', 'difference', 'strtotuple',\n 'get_color_from_hex', 'get_hex_from_color', 'get_random_color',\n 'is_color_transparent', 'hex_colormap', 'colormap', 'boundary',\n 'deprecated', 'SafeList',\n 'interpolate', 'QueryDict',\n 'platform', 'escape_markup', 'reify', 'rgba')\n\nfrom os import environ\nfrom sys import platform as _sys_platform\nfrom re import match, split\nfrom kivy.compat import string_types\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nhex_colormap = {\n 'aliceblue': '#f0f8ff',\n 'antiquewhite': '#faebd7',\n 'aqua': '#00ffff',\n 'aquamarine': '#7fffd4',\n 'azure': '#f0ffff',\n 'beige': '#f5f5dc',\n 'bisque': '#ffe4c4',\n 'black': '#000000',\n 'blanchedalmond': '#ffebcd',\n 'blue': '#0000ff',\n 'blueviolet': '#8a2be2',\n 'brown': '#a52a2a',\n 'burlywood': '#deb887',\n 'cadetblue': '#5f9ea0',\n 'chartreuse': '#7fff00',\n 'chocolate': '#d2691e',\n 'coral': '#ff7f50',\n 'cornflowerblue': '#6495ed',\n 'cornsilk': '#fff8dc',\n 'crimson': '#dc143c',\n 'cyan': '#00ffff',\n 'darkblue': '#00008b',\n 'darkcyan': '#008b8b',\n 'darkgoldenrod': '#b8860b',\n 'darkgray': '#a9a9a9',\n 'darkgrey': '#a9a9a9',\n 'darkgreen': '#006400',\n 'darkkhaki': '#bdb76b',\n 'darkmagenta': '#8b008b',\n 'darkolivegreen': '#556b2f',\n 'darkorange': '#ff8c00',\n 'darkorchid': '#9932cc',\n 'darkred': '#8b0000',\n 'darksalmon': '#e9967a',\n 'darkseagreen': '#8fbc8f',\n 'darkslateblue': '#483d8b',\n 'darkslategray': '#2f4f4f',\n 'darkslategrey': '#2f4f4f',\n 'darkturquoise': '#00ced1',\n 'darkviolet': '#9400d3',\n 'deeppink': '#ff1493',\n 'deepskyblue': '#00bfff',\n 'dimgray': '#696969',\n 'dimgrey': '#696969',\n 'dodgerblue': '#1e90ff',\n 'firebrick': '#b22222',\n 'floralwhite': '#fffaf0',\n 'forestgreen': '#228b22',\n 'fuchsia': '#ff00ff',\n 'gainsboro': '#dcdcdc',\n 'ghostwhite': '#f8f8ff',\n 'gold': '#ffd700',\n 'goldenrod': '#daa520',\n 'gray': '#808080',\n 'grey': '#808080',\n 'green': '#008000',\n 'greenyellow': '#adff2f',\n 'honeydew': '#f0fff0',\n 'hotpink': '#ff69b4',\n 'indianred': '#cd5c5c',\n 'indigo': '#4b0082',\n 'ivory': '#fffff0',\n 'khaki': '#f0e68c',\n 'lavender': '#e6e6fa',\n 'lavenderblush': '#fff0f5',\n 'lawngreen': '#7cfc00',\n 'lemonchiffon': '#fffacd',\n 'lightblue': '#add8e6',\n 'lightcoral': '#f08080',\n 'lightcyan': '#e0ffff',\n 'lightgoldenrodyellow': '#fafad2',\n 'lightgreen': '#90ee90',\n 'lightgray': '#d3d3d3',\n 'lightgrey': '#d3d3d3',\n 'lightpink': '#ffb6c1',\n 'lightsalmon': '#ffa07a',\n 'lightseagreen': '#20b2aa',\n 'lightskyblue': '#87cefa',\n 'lightslategray': '#778899',\n 'lightslategrey': '#778899',\n 'lightsteelblue': '#b0c4de',\n 'lightyellow': '#ffffe0',\n 'lime': '#00ff00',\n 'limegreen': '#32cd32',\n 'linen': '#faf0e6',\n 'magenta': '#ff00ff',\n 'maroon': '#800000',\n 'mediumaquamarine': '#66cdaa',\n 'mediumblue': '#0000cd',\n 'mediumorchid': '#ba55d3',\n 'mediumpurple': '#9370db',\n 'mediumseagreen': '#3cb371',\n 'mediumslateblue': '#7b68ee',\n 'mediumspringgreen': '#00fa9a',\n 'mediumturquoise': '#48d1cc',\n 'mediumvioletred': '#c71585',\n 'midnightblue': '#191970',\n 'mintcream': '#f5fffa',\n 'mistyrose': '#ffe4e1',\n 'moccasin': '#ffe4b5',\n 'navajowhite': '#ffdead',\n 'navy': '#000080',\n 'oldlace': '#fdf5e6',\n 'olive': '#808000',\n 'olivedrab': '#6b8e23',\n 'orange': '#ffa500',\n 'orangered': '#ff4500',\n 'orchid': '#da70d6',\n 'palegoldenrod': '#eee8aa',\n 'palegreen': '#98fb98',\n 'paleturquoise': '#afeeee',\n 'palevioletred': '#db7093',\n 'papayawhip': '#ffefd5',\n 'peachpuff': '#ffdab9',\n 'peru': '#cd853f',\n 'pink': '#ffc0cb',\n 'plum': '#dda0dd',\n 'powderblue': '#b0e0e6',\n 'purple': '#800080',\n 'red': '#ff0000',\n 'rosybrown': '#bc8f8f',\n 'royalblue': '#4169e1',\n 'saddlebrown': '#8b4513',\n 'salmon': '#fa8072',\n 'sandybrown': '#f4a460',\n 'seagreen': '#2e8b57',\n 'seashell': '#fff5ee',\n 'sienna': '#a0522d',\n 'silver': '#c0c0c0',\n 'skyblue': '#87ceeb',\n 'slateblue': '#6a5acd',\n 'slategray': '#708090',\n 'slategrey': '#708090',\n 'snow': '#fffafa',\n 'springgreen': '#00ff7f',\n 'steelblue': '#4682b4',\n 'tan': '#d2b48c',\n 'teal': '#008080',\n 'thistle': '#d8bfd8',\n 'tomato': '#ff6347',\n 'turquoise': '#40e0d0',\n 'violet': '#ee82ee',\n 'wheat': '#f5deb3',\n 'white': '#ffffff',\n 'whitesmoke': '#f5f5f5',\n 'yellow': '#ffff00',\n 'yellowgreen': '#9acd32',\n}\n\ncolormap = {k: get_color_from_hex(v) for k, v in hex_colormap.items()}\n\nDEPRECATED_CALLERS = []\n\n\n\n\n\n\n\n\n\n\n\n\nplatform = Platform()\n'''\nplatform is a string describing the current Operating System. It is one\nof: *win*, *linux*, *android*, *macosx*, *ios* or *unknown*.\nYou can use it as follows::\n\n from kivy import platform\n if platform == 'linux':\n do_linux_things()\n if platform() == 'linux': # triggers deprecation warning\n do_more_linux_things()\n\n.. versionadded:: 1.3.0\n\n.. versionchanged:: 1.8.0\n\n platform is now a variable instead of a function.\n\n'''\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def boundary(value, minvalue, maxvalue):\n '''Limit a value between a minvalue and maxvalue.'''\n return min(max(value, minvalue), maxvalue)", "metadata": "root.boundary", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def intersection(set1, set2):\n '''Return the intersection of 2 lists.'''\n return [s for s in set1 if s in set2]", "metadata": "root.intersection", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def difference(set1, set2):\n '''Return the difference between 2 lists.'''\n return [s for s in set1 if s not in set2]", "metadata": "root.difference", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def interpolate(value_from, value_to, step=10):\n '''Interpolate between two values. This can be useful for smoothing some\n transitions. For example::\n\n # instead of setting directly\n self.pos = pos\n\n # use interpolate, and you'll have a nicer transition\n self.pos = interpolate(self.pos, new_pos)\n\n .. warning::\n These interpolations work only on lists/tuples/doubles with the same\n dimensions. No test is done to check the dimensions are the same.\n '''\n if type(value_from) in (list, tuple):\n out = []\n for x, y in zip(value_from, value_to):\n out.append(interpolate(x, y, step))\n return out\n else:\n return value_from + (value_to - value_from) / float(step)", "metadata": "root.interpolate", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def strtotuple(s):\n '''Convert a tuple string into a tuple\n with some security checks. Designed to be used\n with the eval() function::\n\n a = (12, 54, 68)\n b = str(a) # return '(12, 54, 68)'\n c = strtotuple(b) # return (12, 54, 68)\n\n '''\n # security\n if not match('^[,.0-9 ()\\[\\]]*$', s):\n raise Exception('Invalid characters in string for tuple conversion')\n # fast syntax check\n if s.count('(') != s.count(')'):\n raise Exception('Invalid count of ( and )')\n if s.count('[') != s.count(']'):\n raise Exception('Invalid count of [ and ]')\n r = eval(s)\n if type(r) not in (list, tuple):\n raise Exception('Conversion failed')\n return r", "metadata": "root.strtotuple", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def rgba(s, *args):\n '''Return a kivy color (4 value from 0-1 range) from either a hex string or\n a list of 0-255 values\n\n .. versionadded:: 1.9.2\n '''\n if isinstance(s, string_types):\n return get_color_from_hex(s)\n elif isinstance(s, (list, tuple)):\n s = map(lambda x: x / 255., s)\n if len(s) == 3:\n return list(s) + [1]\n return s\n elif isinstance(s, (int, float)):\n s = map(lambda x: x / 255., [s] + list(args))\n if len(s) == 3:\n return list(s) + [1]\n return s\n raise Exception('Invalid value (not a string / list / tuple)')", "metadata": "root.rgba", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def get_color_from_hex(s):\n '''Transform a hex string color to a kivy\n :class:`~kivy.graphics.Color`.\n '''\n if s.startswith('#'):\n return get_color_from_hex(s[1:])\n\n value = [int(x, 16) / 255.\n for x in split('([0-9a-f]{2})', s.lower()) if x != '']\n if len(value) == 3:\n value.append(1)\n return value", "metadata": "root.get_color_from_hex", "header": "['module', '___EOS___']", "index": 111 }, { "content": "def get_hex_from_color(color):\n '''Transform a kivy :class:`~kivy.graphics.Color` to a hex value::\n\n >>> get_hex_from_color((0, 1, 0))\n '#00ff00'\n >>> get_hex_from_color((.25, .77, .90, .5))\n '#3fc4e57f'\n\n .. versionadded:: 1.5.0\n '''\n return '#' + ''.join(['{0:02x}'.format(int(x * 255)) for x in color])", "metadata": "root.get_hex_from_color", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def get_random_color(alpha=1.0):\n '''Returns a random color (4 tuple).\n\n :Parameters:\n `alpha` : float, defaults to 1.0\n If alpha == 'random', a random alpha value is generated.\n '''\n from random import random\n if alpha == 'random':\n return [random(), random(), random(), random()]\n else:\n return [random(), random(), random(), alpha]", "metadata": "root.get_random_color", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def is_color_transparent(c):\n '''Return True if the alpha channel is 0.'''\n if len(c) < 4:\n return False\n if float(c[3]) == 0.:\n return True\n return False", "metadata": "root.is_color_transparent", "header": "['module', '___EOS___']", "index": 152 }, { "content": "def deprecated(func):\n '''This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted the first time\n the function is used.'''\n\n import inspect\n import functools\n\n @functools.wraps(func)\n def new_func(*args, **kwargs):\n file, line, caller = inspect.stack()[1][1:4]\n caller_id = \"%s:%s:%s\" % (file, line, caller)\n # We want to print deprecated warnings only once:\n if caller_id not in DEPRECATED_CALLERS:\n DEPRECATED_CALLERS.append(caller_id)\n warning = (\n 'Call to deprecated function %s in %s line %d.'\n 'Called from %s line %d'\n ' by %s().' % (\n func.__name__,\n func.__code__.co_filename,\n func.__code__.co_firstlineno + 1,\n file, line, caller))\n from kivy.logger import Logger\n Logger.warn(warning)\n if func.__doc__:\n Logger.warn(func.__doc__)\n return func(*args, **kwargs)\n return new_func", "metadata": "root.deprecated", "header": "['module', '___EOS___']", "index": 315 }, { "content": "class SafeList(list):\n '''List with a clear() method.\n\n .. warning::\n Usage of the iterate() function will decrease your performance.\n '''\n\n", "metadata": "root.SafeList", "header": "['module', '___EOS___']", "index": 346 }, { "content": " def clear(self):\n del self[:]", "metadata": "root.SafeList.clear", "header": "['class', 'SafeList', '(', 'list', ')', ':', '___EOS___']", "index": 353 }, { "content": " @deprecated\n def iterate(self, reverse=False):\n if reverse:\n return iter(reversed(self))\n return iter(self)", "metadata": "root.SafeList.iterate", "header": "['class', 'SafeList', '(', 'list', ')', ':', '___EOS___']", "index": 356 }, { "content": "class QueryDict(dict):\n '''QueryDict is a dict() that can be queried with dot.\n\n .. versionadded:: 1.0.4\n\n ::\n\n d = QueryDict()\n # create a key named toto, with the value 1\n d.toto = 1\n # it's the same as\n d['toto'] = 1\n '''\n\n", "metadata": "root.QueryDict", "header": "['module', '___EOS___']", "index": 363 }, { "content": " def __getattr__(self, attr):\n try:\n return self.__getitem__(attr)\n except KeyError:\n return super(QueryDict, self).__getattr__(attr)", "metadata": "root.QueryDict.__getattr__", "header": "['class', 'QueryDict', '(', 'dict', ')', ':', '___EOS___']", "index": 377 }, { "content": " def __setattr__(self, attr, value):\n self.__setitem__(attr, value)", "metadata": "root.QueryDict.__setattr__", "header": "['class', 'QueryDict', '(', 'dict', ')', ':', '___EOS___']", "index": 383 }, { "content": "def format_bytes_to_human(size, precision=2):\n '''Format a byte value to a human readable representation (B, KB, MB...).\n\n .. versionadded:: 1.0.8\n\n :Parameters:\n `size`: int\n Number that represents the bytes value\n `precision`: int, defaults to 2\n Precision after the comma\n\n Examples::\n\n >>> format_bytes_to_human(6463)\n '6.31 KB'\n >>> format_bytes_to_human(646368746541)\n '601.98 GB'\n\n '''\n size = int(size)\n fmt = '%%1.%df %%s' % precision\n for unit in ['B', 'KB', 'MB', 'GB', 'TB']:\n if size < 1024.0:\n return fmt % (size, unit)\n size /= 1024.0", "metadata": "root.format_bytes_to_human", "header": "['module', '___EOS___']", "index": 387 }, { "content": "class Platform(object):\n # refactored to class to allow module function to be replaced\n # with module variable\n\n\n\n\n\n\n\n", "metadata": "root.Platform", "header": "['module', '___EOS___']", "index": 414 }, { "content": " def __init__(self):\n self._platform_ios = None\n self._platform_android = None", "metadata": "root.Platform.__init__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 418 }, { "content": " @deprecated\n def __call__(self):\n return self._get_platform()", "metadata": "root.Platform.__call__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 422 }, { "content": " def __eq__(self, other):\n return other == self._get_platform()", "metadata": "root.Platform.__eq__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 426 }, { "content": " def __ne__(self, other):\n return other != self._get_platform()", "metadata": "root.Platform.__ne__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 429 }, { "content": " def __str__(self):\n return self._get_platform()", "metadata": "root.Platform.__str__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 432 }, { "content": " def __repr__(self):\n return 'platform name: \\'{platform}\\' from: \\n{instance}'.format(\n platform=self._get_platform(),\n instance=super(Platform, self).__repr__()\n )", "metadata": "root.Platform.__repr__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 435 }, { "content": " def __hash__(self):\n return self._get_platform().__hash__()", "metadata": "root.Platform.__hash__", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 441 }, { "content": " def _get_platform(self):\n if self._platform_android is None:\n # ANDROID_ARGUMENT and ANDROID_PRIVATE are 2 environment variables\n # from python-for-android project\n self._platform_android = 'ANDROID_ARGUMENT' in environ\n\n if self._platform_ios is None:\n self._platform_ios = (environ.get('KIVY_BUILD', '') == 'ios')\n\n # On android, _sys_platform return 'linux2', so prefer to check the\n # import of Android module than trying to rely on _sys_platform.\n if self._platform_android is True:\n return 'android'\n elif self._platform_ios is True:\n return 'ios'\n elif _sys_platform in ('win32', 'cygwin'):\n return 'win'\n elif _sys_platform == 'darwin':\n return 'macosx'\n elif _sys_platform[:5] == 'linux':\n return 'linux'\n elif _sys_platform.startswith('freebsd'):\n return 'linux'\n return 'unknown'", "metadata": "root.Platform._get_platform", "header": "['class', 'Platform', '(', 'object', ')', ':', '___NEWLINE___', '# refactored to class to allow module function to be replaced', '___NL___', '# with module variable', '___NL___', '___EOS___']", "index": 444 }, { "content": "def escape_markup(text):\n '''\n Escape markup characters found in the text. Intended to be used when markup\n text is activated on the Label::\n\n untrusted_text = escape_markup('Look at the example [1]')\n text = '[color=ff0000]' + untrusted_text + '[/color]'\n w = Label(text=text, markup=True)\n\n .. versionadded:: 1.3.0\n '''\n return text.replace('&', '&amp;').replace('[', '&bl;').replace(']', '&br;')", "metadata": "root.escape_markup", "header": "['module', '___EOS___']", "index": 491 }, { "content": "class reify(object):\n '''\n Put the result of a method which uses this (non-data) descriptor decorator\n in the instance dict after the first call, effectively replacing the\n decorator with an instance variable.\n\n It acts like @property, except that the function is only ever called once;\n after that, the value is cached as a regular attribute. This gives you lazy\n attribute creation on objects that are meant to be immutable.\n\n Taken from the `Pyramid project <https://pypi.python.org/pypi/pyramid/>`_.\n\n To use this as a decorator::\n\n @reify\n def lazy(self):\n ...\n return hard_to_compute_int\n first_time = self.lazy # lazy is reify obj, reify.__get__() runs\n second_time = self.lazy # lazy is hard_to_compute_int\n '''\n\n", "metadata": "root.reify", "header": "['module', '___EOS___']", "index": 505 }, { "content": " def __init__(self, func):\n self.func = func\n self.__doc__ = func.__doc__", "metadata": "root.reify.__init__", "header": "['class', 'reify', '(', 'object', ')', ':', '___EOS___']", "index": 527 }, { "content": " def __get__(self, inst, cls):\n if inst is None:\n return self\n retval = self.func(inst)\n setattr(inst, self.func.__name__, retval)\n return retval", "metadata": "root.reify.__get__", "header": "['class', 'reify', '(', 'object', ')', ':', '___EOS___']", "index": 531 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "061", "1_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Ut", "il", "s", "\\", "10", ";", "=====", "\\", "10", ";", "\\", "10", ";", "The", " ", "Ut", "il", "s", " ", "module", " ", "provide", "s", " ", "a", " ", "selection", " ", "of", " ", "genera", "l", " ", "utility", " ", "function", "s", " ", "and", " ", "classe", "s", "\\", "10", ";", "tha", "t", " ", "may", " ", "be", " ", "usef", "ul", " ", "for", " ", "vari", "ous", " ", "applica", "tion", "s", ".", " ", "The", "se", " ", "include", " ", "maths", ",", " ", "color", ",", "\\", "10", ";", "algebra", "ic", " ", "and", " ", "platform", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "change", "d", "::", " ", "1.6", ".0", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Order", "ed", "Dict", " ", "class", " ", "has", " ", "bee", "n", " ", "remove", "d", ".", " ", "Us", "e", " ", "collection", "s", ".", "Order", "ed", "Dict", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "'", "intersect", "ion", "'_", ",_", "'", "difference", "'_", ",_", "'", "strt", "otu", "ple", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "\\u", "color", "\\u", "from", "\\u", "hex", "'_", ",_", "'", "get", "\\u", "hex", "\\u", "from", "\\u", "color", "'_", ",_", "'", "get", "\\u", "random", "\\u", "color", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "color", "\\u", "transp", "arent", "'_", ",_", "'", "hex", "\\u", "colormap", "'_", ",_", "'", "colormap", "'_", ",_", "'", "bound", "ary", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depre", "cated", "'_", ",_", "'", "Safe", "List", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interpolat", "e", "'_", ",_", "'", "Query", "Dict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "platform", "'_", ",_", "'", "escape", "\\u", "markup", "'_", ",_", "'", "rei", "fy", "'_", ",_", "'", "rgb", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "import_", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "platform_", "as_", "\\u", "sys", "\\u", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "re_", "import_", "match_", ",_", "split_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kivy_", "._", "compat_", "import_", "string", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "hex", "\\u", "colormap_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alic", "eb", "lue", "'_", ":_", "'#", "f0", "f8", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "anti", "que", "white", "'_", ":_", "'#", "fa", "eb", "d7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aqu", "a", "'_", ":_", "'#", "00", "fff", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aqu", "amar", "ine", "'_", ":_", "'#", "7f", "ffd", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "azu", "re", "'_", ":_", "'#", "f0", "fff", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bei", "ge", "'_", ":_", "'#", "f5", "f5", "dc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bis", "que", "'_", ":_", "'#", "ffe", "4c", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "black", "'_", ":_", "'#", "000000", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bla", "nche", "dal", "mond", "'_", ":_", "'#", "ffe", "bcd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blue", "'_", ":_", "'#", "0000", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blue", "violet", "'_", ":_", "'#", "8a", "2b", "e2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "brow", "n", "'_", ":_", "'#", "a5", "2a", "2a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bur", "ly", "wood", "'_", ":_", "'#", "deb", "887", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cade", "tbl", "ue", "'_", ":_", "'#", "5f", "9e", "a0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "chart", "reus", "e", "'_", ":_", "'#", "7f", "ff", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cho", "colat", "e", "'_", ":_", "'#", "d2", "691", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cora", "l", "'_", ":_", "'#", "ff", "7f", "50", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "corn", "flower", "blue", "'_", ":_", "'#", "649", "5e", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "corn", "sil", "k", "'_", ":_", "'#", "fff", "8d", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cri", "mso", "n", "'_", ":_", "'#", "dc", "143", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cya", "n", "'_", ":_", "'#", "00", "fff", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "blue", "'_", ":_", "'#", "0000", "8b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "cya", "n", "'_", ":_", "'#", "008", "b8", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "golden", "rod", "'_", ":_", "'#", "b8", "860", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "gray", "'_", ":_", "'#", "a9", "a9", "a9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "grey", "'_", ":_", "'#", "a9", "a9", "a9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "green", "'_", ":_", "'#", "006", "400", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "kha", "ki", "'_", ":_", "'#", "bdb", "7", "6b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "mage", "nta", "'_", ":_", "'#", "8b", "008", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "oli", "veg", "reen", "'_", ":_", "'#", "556", "b2", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "orange", "'_", ":_", "'#", "ff", "8c", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "orch", "id", "'_", ":_", "'#", "993", "2c", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "red", "'_", ":_", "'#", "8b", "0000", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "sal", "mon", "'_", ":_", "'#", "e9", "967", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "sea", "green", "'_", ":_", "'#", "8f", "bc", "8f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "slate", "blue", "'_", ":_", "'#", "483", "d8", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "slate", "gray", "'_", ":_", "'#", "2f", "4f", "4f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "slate", "grey", "'_", ":_", "'#", "2f", "4f", "4f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "tur", "quo", "ise", "'_", ":_", "'#", "00", "ced", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dark", "violet", "'_", ":_", "'#", "940", "0d", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deep", "pin", "k", "'_", ":_", "'#", "ff", "149", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deep", "sky", "blue", "'_", ":_", "'#", "00", "bf", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dim", "gray", "'_", ":_", "'#", "696", "969", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dim", "grey", "'_", ":_", "'#", "696", "969", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dod", "ger", "blue", "'_", ":_", "'#", "1e", "90", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fire", "brick", "'_", ":_", "'#", "b2", "2222", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flo", "ral", "white", "'_", ":_", "'#", "fff", "af", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forest", "green", "'_", ":_", "'#", "228", "b2", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fu", "chs", "ia", "'_", ":_", "'#", "ff", "00", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gains", "bor", "o", "'_", ":_", "'#", "dcd", "cdc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ghost", "white", "'_", ":_", "'#", "f8", "f8", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gold", "'_", ":_", "'#", "ffd", "700", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "golden", "rod", "'_", ":_", "'#", "da", "a5", "20", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gray", "'_", ":_", "'#", "808", "080", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grey", "'_", ":_", "'#", "808", "080", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "green", "'_", ":_", "'#", "0080", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "green", "yell", "ow", "'_", ":_", "'#", "adf", "f2", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "honey", "dew", "'_", ":_", "'#", "f0", "fff", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hot", "pin", "k", "'_", ":_", "'#", "ff", "6", "9", "b4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "india", "nre", "d", "'_", ":_", "'#", "cd", "5c", "5c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "indig", "o", "'_", ":_", "'#", "4b", "008", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ivo", "ry", "'_", ":_", "'#", "fffff", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kha", "ki", "'_", ":_", "'#", "f0", "e", "6", "8c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lav", "ender", "'_", ":_", "'#", "e", "6e", "6f", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lav", "ender", "blu", "sh", "'_", ":_", "'#", "fff", "0f", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "law", "ngr", "een", "'_", ":_", "'#", "7c", "fc", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lem", "onc", "hi", "ffo", "n", "'_", ":_", "'#", "fff", "acd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "light", "blue", "'_", ":_", "'#", "add", "8e", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "light", "cora", "l", "'_", ":_", "'#", "f0", "808", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "light", "cya", "n", "'_", ":_", "'#", "e0", "fff", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lightg", "old", "enr", "ody", "ello", "w", "'_", ":_", "'#", "fa", "fad", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lightg", "reen", "'_", ":_", "'#", "90", "ee", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lightg", "ray", "'_", ":_", "'#", "d3", "d3", "d3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lightg", "rey", "'_", ":_", "'#", "d3", "d3", "d3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "light", "pin", "k", "'_", ":_", "'#", "ff", "b6", "c1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "alm", "on", "'_", ":_", "'#", "ffa", "0", "7a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "ea", "green", "'_", ":_", "'#", "20", "b2", "aa", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "ky", "blue", "'_", ":_", "'#", "87", "cef", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "late", "gray", "'_", ":_", "'#", "778", "899", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "late", "grey", "'_", ":_", "'#", "778", "899", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lights", "tee", "lbl", "ue", "'_", ":_", "'#", "b0", "c4", "de", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "light", "yell", "ow", "'_", ":_", "'#", "fff", "fe", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lim", "e", "'_", ":_", "'#", "00", "ff", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lim", "egr", "een", "'_", ":_", "'#", "32", "cd", "32", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "linen", "'_", ":_", "'#", "fa", "f0", "e", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mage", "nta", "'_", ":_", "'#", "ff", "00", "ff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mar", "oon", "'_", ":_", "'#", "80000", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "aqu", "amar", "ine", "'_", ":_", "'#", "6", "6c", "da", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "blue", "'_", ":_", "'#", "0000", "cd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "orch", "id", "'_", ":_", "'#", "ba", "5", "5d", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "pur", "ple", "'_", ":_", "'#", "937", "0d", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "sea", "green", "'_", ":_", "'#", "3c", "b3", "7", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "slate", "blue", "'_", ":_", "'#", "7b", "6", "8e", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "spring", "green", "'_", ":_", "'#", "00", "fa", "9", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "tur", "quo", "ise", "'_", ":_", "'#", "4", "8d", "1c", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "violet", "red", "'_", ":_", "'#", "c7", "158", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "night", "blue", "'_", ":_", "'#", "191", "970", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mint", "crea", "m", "'_", ":_", "'#", "f5", "fff", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mist", "yro", "se", "'_", ":_", "'#", "ffe", "4e", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "moc", "casi", "n", "'_", ":_", "'#", "ffe", "4b", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nav", "ajo", "white", "'_", ":_", "'#", "ffd", "ead", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nav", "y", "'_", ":_", "'#", "0000", "80", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "lace", "'_", ":_", "'#", "fdf", "5e", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oli", "ve", "'_", ":_", "'#", "808", "000", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oli", "ved", "rab", "'_", ":_", "'#", "6b", "8e", "23", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orange", "'_", ":_", "'#", "ffa", "500", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orange", "red", "'_", ":_", "'#", "ff", "4500", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orch", "id", "'_", ":_", "'#", "da", "7", "0d", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pale", "golden", "rod", "'_", ":_", "'#", "eee", "8a", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pale", "green", "'_", ":_", "'#", "98", "fb", "98", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pale", "tur", "quo", "ise", "'_", ":_", "'#", "afe", "eee", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pale", "violet", "red", "'_", ":_", "'#", "db", "709", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pap", "aya", "whi", "p", "'_", ":_", "'#", "ffe", "fd", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peac", "hp", "uff", "'_", ":_", "'#", "ffd", "ab", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "per", "u", "'_", ":_", "'#", "cd", "853", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pin", "k", "'_", ":_", "'#", "ffc", "0c", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plum", "'_", ":_", "'#", "dda", "0d", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pow", "der", "blue", "'_", ":_", "'#", "b0", "e0", "e", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pur", "ple", "'_", ":_", "'#", "800", "080", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "red", "'_", ":_", "'#", "ff", "0000", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ros", "yb", "rown", "'_", ":_", "'#", "bc", "8f", "8f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "roy", "alb", "lue", "'_", ":_", "'#", "416", "9e", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sadd", "le", "brow", "n", "'_", ":_", "'#", "8b", "451", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sal", "mon", "'_", ":_", "'#", "fa", "807", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sand", "yb", "rown", "'_", ":_", "'#", "f4", "a4", "60", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sea", "green", "'_", ":_", "'#", "2e", "8b", "5", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sea", "shell", "'_", ":_", "'#", "fff", "5e", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sie", "nna", "'_", ":_", "'#", "a0", "522", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "silv", "er", "'_", ":_", "'#", "c0", "c0", "c0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sky", "blue", "'_", ":_", "'#", "87", "cee", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slate", "blue", "'_", ":_", "'#", "6a", "5a", "cd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slate", "gray", "'_", ":_", "'#", "708", "090", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slate", "grey", "'_", ":_", "'#", "708", "090", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "snow", "'_", ":_", "'#", "fff", "afa", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spring", "green", "'_", ":_", "'#", "00", "ff", "7f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "steel", "blue", "'_", ":_", "'#", "468", "2b", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tan", "'_", ":_", "'#", "d2", "b4", "8c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tea", "l", "'_", ":_", "'#", "0080", "80", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "this", "tle", "'_", ":_", "'#", "d8", "bf", "d8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "toma", "to", "'_", ":_", "'#", "ff", "634", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tur", "quo", "ise", "'_", ":_", "'#", "40", "e0", "d0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "violet", "'_", ":_", "'#", "ee", "8", "2e", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "whe", "at", "'_", ":_", "'#", "f5", "deb", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "white", "'_", ":_", "'#", "ffffff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "white", "smoke", "'_", ":_", "'#", "f5", "f5", "f5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yell", "ow", "'_", ":_", "'#", "fff", "f0", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yell", "ow", "green", "'_", ":_", "'#", "9", "acd", "32", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "colormap_", "=_", "{_", "k_", ":_", "get", "\\u", "color", "\\u", "from", "\\u", "hex_", "(_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "hex", "\\u", "colormap_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEP", "RECA", "TED", "\\u", "CALL", "ERS_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "platform_", "=_", "Platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", "platform", " ", "is", " ", "a", " ", "string", " ", "descri", "bing", " ", "the", " ", "current", " ", "Opera", "ting", " ", "System", ".", " ", "It", " ", "is", " ", "one", "\\", "10", ";", "of", ":", " ", "*", "win", "*", ",", " ", "*", "linux", "*", ",", " ", "*", "android", "*", ",", " ", "*", "macos", "x", "*", ",", " ", "*", "ios", "*", " ", "or", " ", "*", "unknown", "*.", "\\", "10", ";", "You", " ", "can", " ", "use", " ", "it", " ", "as", " ", "follow", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "ki", "vy", " ", "import", " ", "platform", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "platform", " ", "==", " ", "'", "linux", "':", "\\", "10", ";", " ", " ", " ", " ", "do", "\\u", "linux", "\\u", "thing", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "platform", "()", " ", "==", " ", "'", "linux", "':", " ", "#", " ", "trigger", "s", " ", "deprecation", " ", "warn", "ing", "\\", "10", ";", " ", " ", " ", " ", "do", "\\u", "more", "\\u", "linux", "\\u", "thing", "s", "()", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "adde", "d", "::", " ", "1.3", ".0", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "change", "d", "::", " ", "1.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "platform", " ", "is", " ", "now", " ", "a", " ", "variab", "le", " ", "inst", "ead", " ", "of", " ", "a", " ", " ", "function", ".", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "boundary_", "(_", "value_", ",_", "minv", "alue_", ",_", "maxva", "lue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Limit", " ", "a", " ", "value", " ", "bet", "ween", " ", "a", " ", "minv", "alu", "e", " ", "and", " ", "maxva", "lue", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "min_", "(_", "max_", "(_", "value_", ",_", "minv", "alue_", ")_", ",_", "maxva", "lue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "intersection_", "(_", "set1", "_", ",_", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "intersect", "ion", " ", "of", " ", "2", " ", "lists", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "s_", "for_", "s_", "in_", "set1", "_", "if_", "s_", "in_", "set", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "difference_", "(_", "set1", "_", ",_", "set", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "difference", " ", "bet", "ween", " ", "2", " ", "lists", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "s_", "for_", "s_", "in_", "set1", "_", "if_", "s_", "not_", "in_", "set", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interpolate_", "(_", "value", "\\u", "from_", ",_", "value", "\\u", "to_", ",_", "step_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Interpolate", " ", "bet", "ween", " ", "two", " ", "values", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "usef", "ul", " ", "for", " ", "smoothing", " ", "some", "\\", "10", ";", " ", " ", " ", " ", "transiti", "ons", ".", " ", "For", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "inst", "ead", " ", "of", " ", "setti", "ng", " ", "direct", "ly", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "pos", " ", "=", " ", "pos", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "use", " ", "interpolat", "e", ",", " ", "and", " ", "you", "'", "ll", " ", "have", " ", "a", " ", "nice", "r", " ", "transiti", "on", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "pos", " ", "=", " ", "interpolat", "e", "(", "self", ".", "pos", ",", " ", "new", "\\u", "pos", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "interpolati", "ons", " ", "work", " ", "only", " ", "on", " ", "lists", "/", "tuple", "s", "/", "double", "s", " ", "with", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "dimension", "s", ".", " ", "No", " ", "test", " ", "is", " ", "don", "e", " ", "to", " ", "check", " ", "the", " ", "dimension", "s", " ", "are", " ", "the", " ", "same", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "value", "\\u", "from_", ")_", "in_", "(_", "list_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "y_", "in_", "zip_", "(_", "value", "\\u", "from_", ",_", "value", "\\u", "to_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "interpolate_", "(_", "x_", ",_", "y_", ",_", "step_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\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_", "value", "\\u", "from_", "+_", "(_", "value", "\\u", "to_", "-_", "value", "\\u", "from_", ")_", "/_", "float_", "(_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strt", "otu", "ple_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Convert", " ", "a", " ", "tuple", " ", "string", " ", "int", "o", " ", "a", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "some", " ", "security", " ", "checks", ".", " ", "Designe", "d", " ", "to", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "eval", "()", " ", "function", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "=", " ", "(", "1", "2", ",", " ", "5", "4", ",", " ", "6", "8", ")", "\\", "10", ";", " ", " ", " ", " ", "b", " ", "=", " ", "str", "(", "a", ")", " ", " ", " ", " ", " ", "#", " ", "return", " ", "'(", "1", "2", ",", " ", "5", "4", ",", " ", "6", "8", ")'", "\\", "10", ";", " ", " ", " ", " ", "c", " ", "=", " ", "strt", "otu", "ple", "(", "b", ")", " ", " ", "#", " ", "return", " ", "(", "1", "2", ",", " ", "5", "4", ",", " ", "6", "8", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "security_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "match_", "(_", "'", "^", "[", ",.", "0", "-", "9", " ", "()", "\\\\[", "\\\\]", "]*", "$'_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "character", "s", " ", "in", " ", "string", " ", "for", " ", "tuple", " ", "conve", "rsi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fast", " ", "synta", "x", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "count_", "(_", "'('_", ")_", "!=_", "s_", "._", "count_", "(_", "')'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "count", " ", "of", " ", "(", " ", "and", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "count_", "(_", "'['_", ")_", "!=_", "s_", "._", "count_", "(_", "']'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "count", " ", "of", " ", "[", " ", "and", " ", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "eval_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "r_", ")_", "not_", "in_", "(_", "list_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Conversion", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgba_", "(_", "s_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "a", " ", "ki", "vy", " ", "color", " ", "(", "4", " ", "value", " ", "from", " ", "0", "-1", " ", "range", ")", " ", "from", " ", "eit", "her", " ", "a", " ", "hex", " ", "string", " ", "or", "\\", "10", ";", " ", " ", " ", "a", " ", "list", " ", "of", " ", "0", "-", "255", " ", "values", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "1.9", ".2", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "s_", ",_", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "color", "\\u", "from", "\\u", "hex_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "s_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "/_", "255.", "_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "s_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "s_", ")_", "+_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "s_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "/_", "255.", "_", ",_", "[_", "s_", "]_", "+_", "list_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "s_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "s_", ")_", "+_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "value", " ", "(", "not", " ", "a", " ", "string", " ", "/", " ", "list", " ", "/", " ", "tuple", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "color", "\\u", "from", "\\u", "hex_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Transform", " ", "a", " ", "hex", " ", "string", " ", "color", " ", "to", " ", "a", " ", "ki", "vy", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "~", "ki", "vy", ".", "graphic", "s", ".", "Color", "`.", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "color", "\\u", "from", "\\u", "hex_", "(_", "s_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "[_", "int_", "(_", "x_", ",_", "16_", ")_", "/_", "255.", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "split_", "(_", "'(", "[", "0", "-", "9", "a", "-", "f", "]{", "2", "})'_", ",_", "s_", "._", "lower_", "(_", ")_", ")_", "if_", "x_", "!=_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "hex", "\\u", "from", "\\u", "color_", "(_", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Transform", " ", "a", " ", "ki", "vy", " ", ":", "class", ":`", "~", "ki", "vy", ".", "graphic", "s", ".", "Color", "`", " ", "to", " ", "a", " ", "hex", " ", "value", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "get", "\\u", "hex", "\\u", "from", "\\u", "color", "((", "0", ",", " ", "1", ",", " ", "0", "))\\", "10", ";", " ", " ", " ", " ", "'#", "00", "ff", "00", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "get", "\\u", "hex", "\\u", "from", "\\u", "color", "((", ".2", "5", ",", " ", ".7", "7", ",", " ", ".90", ",", " ", ".5", "))\\", "10", ";", " ", " ", " ", " ", "'#", "3f", "c4", "e5", "7f", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "1.5", ".0", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'#'_", "+_", "''_", "._", "join_", "(_", "[_", "'{", "0", ":", "02", "x", "}'_", "._", "format_", "(_", "int_", "(_", "x_", "*_", "255_", ")_", ")_", "for_", "x_", "in_", "color_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "random", "\\u", "color_", "(_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", "s", " ", "a", " ", "random", " ", "color", " ", "(", "4", " ", "tuple", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "alpha", "`", " ", ":", " ", "float", ",", " ", "default", "s", " ", "to", " ", "1.0", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "alpha", " ", "==", " ", "'", "random", "',", " ", "a", " ", "random", " ", "alpha", " ", "value", " ", "is", " ", "generat", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alpha_", "==_", "'", "random", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "random_", "(_", ")_", ",_", "random_", "(_", ")_", ",_", "random_", "(_", ")_", ",_", "random_", "(_", ")_", "]_", "\\u\\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_", "[_", "random_", "(_", ")_", ",_", "random_", "(_", ")_", ",_", "random_", "(_", ")_", ",_", "alpha_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "color", "\\u", "transparent_", "(_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "alpha", " ", "channel", " ", "is", " ", "0.", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "c_", ")_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "float_", "(_", "c_", "[_", "3_", "]_", ")_", "==_", "0._", ":_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "deprecated_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "is", " ", "a", " ", "decorat", "or", " ", "whi", "ch", " ", "can", " ", "be", " ", "used", " ", "to", " ", "mark", " ", "function", "s", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "depre", "cated", ".", " ", "It", " ", "will", " ", "result", " ", "in", " ", "a", " ", "warn", "ing", " ", "bei", "ng", " ", "emitte", "d", " ", "the", " ", "first", " ", "time", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "function", " ", "is", " ", "used", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "functools_", "._", "wraps_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", ",_", "line_", ",_", "caller_", "=_", "inspect_", "._", "stack_", "(_", ")_", "[_", "1_", "]_", "[_", "1_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "caller", "\\u", "id_", "=_", "\"%", "s", ":", "%", "s", ":", "%", "s", "\"_", "%_", "(_", "file_", ",_", "line_", ",_", "caller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "to", " ", "print", " ", "depre", "cated", " ", "warn", "ings", " ", "only", " ", "onc", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "caller", "\\u", "id_", "not_", "in_", "DEP", "RECA", "TED", "\\u", "CALL", "ERS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DEP", "RECA", "TED", "\\u", "CALL", "ERS_", "._", "append_", "(_", "caller", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warning_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Call", " ", "to", " ", "depre", "cated", " ", "function", " ", "%", "s", " ", "in", " ", "%", "s", " ", "line", " ", "%", "d", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Call", "ed", " ", "from", " ", "%", "s", " ", "line", " ", "%", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "by", " ", "%", "s", "()", ".'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "func_", "._", "\\u\\u", "code", "\\u\\u_", "._", "co", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "func_", "._", "\\u\\u", "code", "\\u\\u_", "._", "co", "\\u", "firstl", "inen", "o_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file_", ",_", "line_", ",_", "caller_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kivy_", "._", "logger_", "import_", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Logger_", "._", "warn_", "(_", "warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", "._", "\\u\\u", "doc\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Logger_", "._", "warn_", "(_", "func_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "func_", "\\u\\u\\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_", "Safe", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "List", " ", "with", " ", "a", " ", "clear", "()", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", " ", "of", " ", "the", " ", "iterate", "()", " ", "function", " ", "will", " ", "decrease", " ", "your", " ", "perform", "anc", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Safe", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Safe", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "deprecated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "iterate_", "(_", "self_", ",_", "reverse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "reversed_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "iter_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Query", "Dict", " ", "is", " ", "a", " ", "dict", "()", " ", "tha", "t", " ", "can", " ", "be", " ", "queried", " ", "with", " ", "dot", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "1.0", ".4", "\\", "10", ";", "\\", "10", ";", " ", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "d", " ", "=", " ", "Query", "Dict", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "create", " ", "a", " ", "key", " ", "named", " ", "tot", "o", ",", " ", "with", " ", "the", " ", "value", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "tot", "o", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "it", "'", "s", " ", "the", " ", "same", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "d", "['", "tot", "o", "']", " ", "=", " ", "1", "\\", "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_", "Query", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "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 ", " _", "return_", "self_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Query", "Dict_", ",_", "self_", ")_", "._", "\\u\\u", "getattr\\u\\u_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\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_", "(_", "self_", ",_", "attr_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "setitem\\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_", "def_", "format\\u", "bytes", "\\u", "to", "\\u", "human_", "(_", "size_", ",_", "precision_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Format", " ", "a", " ", "byte", " ", "value", " ", "to", " ", "a", " ", "human", " ", "reada", "ble", " ", "represent", "ation", " ", "(", "B", ",", " ", "KB", ",", " ", "MB", "...)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "1.0", ".8", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "size", "`", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Number", " ", "tha", "t", " ", "represent", "s", " ", "the", " ", "bytes", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "`", "preci", "sion", "`", ":", " ", "int", ",", " ", "default", "s", " ", "to", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "Precis", "ion", " ", "after", " ", "the", " ", "comma", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "format\\u", "bytes", "\\u", "to", "\\u", "human", "(", "646", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "6.3", "1", " ", "KB", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "format\\u", "bytes", "\\u", "to", "\\u", "human", "(", "646", "368", "746", "541", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "601", ".9", "8", " ", "GB", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "int_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "'%%", "1", ".", "%", "df", " ", "%%", "s", "'_", "%_", "precision_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "unit_", "in_", "[_", "'", "B", "'_", ",_", "'", "KB", "'_", ",_", "'", "MB", "'_", ",_", "'", "GB", "'_", ",_", "'", "TB", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "size_", "<_", "1024.", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fmt_", "%_", "(_", "size_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "size_", "/=_", "1024.", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "platform", "\\u", "ios_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "platform", "\\u", "android", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "deprecated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "==_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "!=_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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_", "'", "platform", " ", "name", ":", " ", "\\\\'{", "platform", "}\\\\'", " ", "from", ":", " ", "\\\\", "n", "{", "instance", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "=_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "super_", "(_", "Platform_", ",_", "self_", ")_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "platform_", "(_", ")_", "._", "\\u\\u", "hash\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Platform_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refactor", "ed", " ", "to", " ", "class", " ", "to", " ", "allow", " ", "module", " ", "function", " ", "to", " ", "be", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "module", " ", "variable_", "\\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", "get", "\\u", "platform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "platform", "\\u", "android", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ANDROID", "\\u", "ARGUMENT", " ", "and", " ", "ANDROID", "\\u", "PRIVATE", " ", "are", " ", "2", " ", "environ", "ment", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "python", "-", "for", "-", "android", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "platform", "\\u", "android", "_", "=_", "'", "ANDROID", "\\u", "ARGUMENT", "'_", "in_", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "platform", "\\u", "ios_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "platform", "\\u", "ios_", "=_", "(_", "environ_", "._", "get_", "(_", "'", "KI", "VY", "\\u", "BUILD", "'_", ",_", "''_", ")_", "==_", "'", "ios", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "android", ",", " ", "\\u", "sys", "\\u", "platform", " ", "return", " ", "'", "linux", "2", "',", " ", "so", " ", "prefer", " ", "to", " ", "check", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "of", " ", "And", "roid", " ", "module", " ", "than", " ", "try", "ing", " ", "to", " ", "rely", " ", "on", " ", "\\u", "sys", "\\u", "platform", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "platform", "\\u", "android", "_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "android", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "platform", "\\u", "ios_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "ios", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "sys", "\\u", "platform_", "in_", "(_", "'", "win32", "'_", ",_", "'", "cyg", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "win", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "sys", "\\u", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "macos", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "sys", "\\u", "platform_", "[_", ":_", "5_", "]_", "==_", "'", "linux", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "linux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "sys", "\\u", "platform_", "._", "startswith_", "(_", "'", "freeb", "sd", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "linux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "escape", "\\u", "markup_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Esc", "ape", " ", "markup", " ", "character", "s", " ", "found", " ", "in", " ", "the", " ", "text", ".", " ", "Inten", "ded", " ", "to", " ", "be", " ", "used", " ", "whe", "n", " ", "markup", "\\", "10", ";", " ", " ", " ", " ", "text", " ", "is", " ", "activat", "ed", " ", "on", " ", "the", " ", "Label", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "untr", "uste", "d\\u", "text", " ", "=", " ", "escape", "\\u", "markup", "('", "Look", " ", "at", " ", "the", " ", "example", " ", "[", "1", "]'", ")", "\\", "10", ";", " ", " ", " ", " ", "text", " ", "=", " ", "'[", "color", "=", "ff", "0000", "]'", " ", "+", " ", "untr", "uste", "d\\u", "text", " ", "+", " ", "'[", "/", "color", "]'", "\\", "10", ";", " ", " ", " ", " ", "w", " ", "=", " ", "Label", "(", "text", "=", "text", ",", " ", "markup", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "1.3", ".0", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "._", "replace_", "(_", "'&'_", ",_", "'&", "amp", ";'_", ")_", "._", "replace_", "(_", "'['_", ",_", "'&", "bl", ";'_", ")_", "._", "replace_", "(_", "']'_", ",_", "'&", "br", ";'_", ")_", "\\u\\u\\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_", "rei", "fy_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Put", " ", "the", " ", "result", " ", "of", " ", "a", " ", "method", " ", "whi", "ch", " ", "use", "s", " ", "this", " ", "(", "non", "-", "data", ")", " ", "descrip", "tor", " ", "decorat", "or", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "instance", " ", "dict", " ", "after", " ", "the", " ", "first", " ", "call", ",", " ", "effective", "ly", " ", "repla", "cing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "decorat", "or", " ", "with", " ", "an", " ", "instance", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "acts", " ", "like", " ", "@", "property", ",", " ", "except", " ", "tha", "t", " ", "the", " ", "function", " ", "is", " ", "only", " ", "ever", " ", "call", "ed", " ", "onc", "e", ";", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "tha", "t", ",", " ", "the", " ", "value", " ", "is", " ", "cache", "d", " ", "as", " ", "a", " ", "regular", " ", "attribute", ".", " ", "Thi", "s", " ", "give", "s", " ", "you", " ", "lazy", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "creati", "on", " ", "on", " ", "object", "s", " ", "tha", "t", " ", "are", " ", "mean", "t", " ", "to", " ", "be", " ", "immutable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Taken", " ", "from", " ", "the", " ", "`", "Pyr", "amid", " ", "project", " ", "<", "https", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "pyram", "id", "/>", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "use", " ", "this", " ", "as", " ", "a", " ", "decorat", "or", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "@", "rei", "fy", "\\", "10", ";", " ", " ", " ", " ", " ", "def", " ", "lazy", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "return", " ", "hard", "\\u", "to", "\\u", "compute", "\\u", "int", "\\", "10", ";", " ", " ", " ", " ", " ", "first", "\\u", "time", " ", "=", " ", "self", ".", "lazy", " ", " ", " ", "#", " ", "lazy", " ", "is", " ", "rei", "fy", " ", "obj", ",", " ", "rei", "fy", ".\\u", "\\u", "get", "\\u\\u()", " ", "runs", "\\", "10", ";", " ", " ", " ", " ", " ", "second", "\\u", "time", " ", "=", " ", "self", ".", "lazy", " ", " ", "#", " ", "lazy", " ", "is", " ", "hard", "\\u", "to", "\\u", "compute", "\\u", "int", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "rei", "fy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "doc\\u\\u_", "=_", "func_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "rei", "fy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get\\u\\u_", "(_", "self_", ",_", "inst_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inst_", "is_", "None_", ":_", "\\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_", "retval_", "=_", "self_", "._", "func_", "(_", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "inst_", ",_", "self_", "._", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "retval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "retval_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
scalyr/scalyr-agent-2/scalyr_agent/third_party/pymysql/converters.py
[ { "content": "def convert_mysql_timestamp(timestamp):\n \"\"\"Convert a MySQL TIMESTAMP to a Timestamp object.\n\n MySQL >= 4.1 returns TIMESTAMP in the same format as DATETIME:\n\n >>> mysql_timestamp_converter('2007-02-25 22:32:17')\n datetime.datetime(2007, 2, 25, 22, 32, 17)\n\n MySQL < 4.1 uses a big string of numbers:\n\n >>> mysql_timestamp_converter('20070225223217')\n datetime.datetime(2007, 2, 25, 22, 32, 17)\n\n Illegal values are returned as None:\n\n >>> mysql_timestamp_converter('2007-02-31 22:32:17') is None\n True\n >>> mysql_timestamp_converter('00000000000000') is None\n True\n\n \"\"\"\n if timestamp[4] == '-':\n return convert_datetime(timestamp)\n timestamp += \"0\"*(14-len(timestamp)) # padding\n year, month, day, hour, minute, second = \\\n int(timestamp[:4]), int(timestamp[4:6]), int(timestamp[6:8]), \\\n int(timestamp[8:10]), int(timestamp[10:12]), int(timestamp[12:14])\n try:\n return datetime.datetime(year, month, day, hour, minute, second)\n except ValueError:\n return None", "metadata": "root.convert_mysql_timestamp", "header": "['module', '___EOS___']", "index": 219 } ]
[]
[]
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_", "convert", "\\u", "mysql", "\\u", "timestamp_", "(_", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "My", "SQL", " ", "TIMES", "TAM", "P", " ", "to", " ", "a", " ", "Timest", "amp", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "My", "SQL", " ", ">=", " ", "4.1", " ", "return", "s", " ", "TIMES", "TAM", "P", " ", "in", " ", "the", " ", "same", " ", "format", " ", "as", " ", "DATETIME", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "mysql", "\\u", "timestamp", "\\u", "converter", "('", "2007", "-0", "2", "-", "25", " ", "2", "2", ":", "32", ":", "1", "7", "')", "\\", "10", ";", " ", " ", "datetime", ".", "datetime", "(", "2007", ",", " ", "2", ",", " ", "25", ",", " ", "2", "2", ",", " ", "32", ",", " ", "1", "7", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "My", "SQL", " ", "<", " ", "4.1", " ", "use", "s", " ", "a", " ", "big", " ", "string", " ", "of", " ", "numbers", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "mysql", "\\u", "timestamp", "\\u", "converter", "('", "2007", "022", "522", "321", "7", "')", "\\", "10", ";", " ", " ", "datetime", ".", "datetime", "(", "2007", ",", " ", "2", ",", " ", "25", ",", " ", "2", "2", ",", " ", "32", ",", " ", "1", "7", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Il", "lega", "l", " ", "values", " ", "are", " ", "return", "ed", " ", "as", " ", "Non", "e", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "mysql", "\\u", "timestamp", "\\u", "converter", "('", "2007", "-0", "2", "-", "3", "1", " ", "2", "2", ":", "32", ":", "1", "7", "')", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", ">>>", " ", "mysql", "\\u", "timestamp", "\\u", "converter", "('", "0000000000000", "0", "')", " ", "is", " ", "Non", "e", "\\", "10", ";", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timestamp_", "[_", "4_", "]_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "convert", "\\u", "datetime_", "(_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamp_", "+=_", "\"", "0", "\"_", "*_", "(_", "14_", "-_", "len_", "(_", "timestamp_", ")_", ")_", "#", " ", "padding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year_", ",_", "month_", ",_", "day_", ",_", "hour_", ",_", "minute_", ",_", "second_", "=_", "int_", "(_", "timestamp_", "[_", ":_", "4_", "]_", ")_", ",_", "int_", "(_", "timestamp_", "[_", "4_", ":_", "6_", "]_", ")_", ",_", "int_", "(_", "timestamp_", "[_", "6_", ":_", "8_", "]_", ")_", ",_", "int_", "(_", "timestamp_", "[_", "8_", ":_", "10_", "]_", ")_", ",_", "int_", "(_", "timestamp_", "[_", "10_", ":_", "12_", "]_", ")_", ",_", "int_", "(_", "timestamp_", "[_", "12_", ":_", "14_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "(_", "year_", ",_", "month_", ",_", "day_", ",_", "hour_", ",_", "minute_", ",_", "second_", ")_", "\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
CiscoSystems/avos/openstack_dashboard/dashboards/project/database_backups/tables.py
[ { "content": "# Copyright 2013 Rackspace Hosting\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\nfrom django.core.urlresolvers import reverse\nfrom django.template import defaultfilters as d_filters\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.utils.translation import ungettext_lazy\n\nfrom horizon import tables\nfrom horizon.utils import filters\n\nfrom openstack_dashboard import api\n\n\nSTATUS_CHOICES = (\n (\"BUILDING\", None),\n (\"COMPLETED\", True),\n (\"DELETE_FAILED\", False),\n (\"FAILED\", False),\n (\"NEW\", None),\n (\"SAVING\", None),\n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LaunchLink(tables.LinkAction):\n name = \"create\"\n verbose_name = _(\"Create Backup\")\n url = \"horizon:project:database_backups:create\"\n classes = (\"ajax-modal\", \"btn-create\")\n icon = \"camera\"", "metadata": "root.LaunchLink", "header": "['module', '___EOS___']", "index": 35 }, { "content": "class RestoreLink(tables.LinkAction):\n name = \"restore\"\n verbose_name = _(\"Restore Backup\")\n url = \"horizon:project:databases:launch\"\n classes = (\"ajax-modal\",)\n icon = \"cloud-upload\"\n\n", "metadata": "root.RestoreLink", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def allowed(self, request, backup=None):\n return backup.status == 'COMPLETED'", "metadata": "root.RestoreLink.allowed", "header": "['class', 'RestoreLink', '(', 'tables', '.', 'LinkAction', ')', ':', '___EOS___']", "index": 50 }, { "content": " def get_link_url(self, datum):\n url = reverse(self.url)\n return url + '?backup=%s' % datum.id", "metadata": "root.RestoreLink.get_link_url", "header": "['class', 'RestoreLink', '(', 'tables', '.', 'LinkAction', ')', ':', '___EOS___']", "index": 53 }, { "content": "class DownloadBackup(tables.LinkAction):\n name = \"download\"\n verbose_name = _(\"Download Backup\")\n url = 'horizon:project:containers:object_download'\n classes = (\"btn-download\",)\n\n", "metadata": "root.DownloadBackup", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def get_link_url(self, datum):\n ref = datum.locationRef.split('/')\n container_name = ref[5]\n object_path = '/'.join(ref[6:])\n return reverse(self.url,\n kwargs={'container_name': container_name,\n 'object_path': object_path})", "metadata": "root.DownloadBackup.get_link_url", "header": "['class', 'DownloadBackup', '(', 'tables', '.', 'LinkAction', ')', ':', '___EOS___']", "index": 64 }, { "content": " def allowed(self, request, datum):\n return datum.status == 'COMPLETED'", "metadata": "root.DownloadBackup.allowed", "header": "['class', 'DownloadBackup', '(', 'tables', '.', 'LinkAction', ')', ':', '___EOS___']", "index": 72 }, { "content": "class DeleteBackup(tables.DeleteAction):\n\n", "metadata": "root.DeleteBackup", "header": "['module', '___EOS___']", "index": 76 }, { "content": " @staticmethod\n def action_present(count):\n return ungettext_lazy(\n u\"Delete Backup\",\n u\"Delete Backups\",\n count\n )", "metadata": "root.DeleteBackup.action_present", "header": "['class', 'DeleteBackup', '(', 'tables', '.', 'DeleteAction', ')', ':', '___EOS___']", "index": 77 }, { "content": " @staticmethod\n def action_past(count):\n return ungettext_lazy(\n u\"Deleted Backup\",\n u\"Deleted Backups\",\n count\n )", "metadata": "root.DeleteBackup.action_past", "header": "['class', 'DeleteBackup', '(', 'tables', '.', 'DeleteAction', ')', ':', '___EOS___']", "index": 85 }, { "content": " def delete(self, request, obj_id):\n api.trove.backup_delete(request, obj_id)", "metadata": "root.DeleteBackup.delete", "header": "['class', 'DeleteBackup', '(', 'tables', '.', 'DeleteAction', ')', ':', '___EOS___']", "index": 93 }, { "content": "class UpdateRow(tables.Row):\n ajax = True\n", "metadata": "root.UpdateRow", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def get_data(self, request, backup_id):\n backup = api.trove.backup_get(request, backup_id)\n try:\n backup.instance = api.trove.instance_get(request,\n backup.instance_id)\n except Exception:\n pass\n return backup", "metadata": "root.UpdateRow.get_data", "header": "['class', 'UpdateRow', '(', 'tables', '.', 'Row', ')', ':', '___EOS___']", "index": 100 }, { "content": "def db_link(obj):\n if not hasattr(obj, 'instance'):\n return\n if hasattr(obj.instance, 'name'):\n return reverse(\n 'horizon:project:databases:detail',\n kwargs={'instance_id': obj.instance_id})", "metadata": "root.db_link", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def db_name(obj):\n if not hasattr(obj, 'instance') or not hasattr(obj.instance, 'name'):\n return obj.instance_id\n return obj.instance.name", "metadata": "root.db_name", "header": "['module', '___EOS___']", "index": 119 }, { "content": "def get_datastore(obj):\n if hasattr(obj, \"datastore\"):\n return obj.datastore[\"type\"]\n return _(\"Not available\")", "metadata": "root.get_datastore", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def get_datastore_version(obj):\n if hasattr(obj, \"datastore\"):\n return obj.datastore[\"version\"]\n return _(\"Not available\")", "metadata": "root.get_datastore_version", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def is_incremental(obj):\n return hasattr(obj, 'parent_id') and obj.parent_id is not None", "metadata": "root.is_incremental", "header": "['module', '___EOS___']", "index": 137 }, { "content": "class BackupsTable(tables.DataTable):\n name = tables.Column(\"name\",\n link=\"horizon:project:database_backups:detail\",\n verbose_name=_(\"Name\"))\n datastore = tables.Column(get_datastore,\n verbose_name=_(\"Datastore\"))\n datastore_version = tables.Column(get_datastore_version,\n verbose_name=_(\"Datastore Version\"))\n created = tables.Column(\"created\", verbose_name=_(\"Created\"),\n filters=[filters.parse_isotime])\n instance = tables.Column(db_name, link=db_link,\n verbose_name=_(\"Database\"))\n incremental = tables.Column(is_incremental,\n verbose_name=_(\"Incremental\"),\n filters=(d_filters.yesno,\n d_filters.capfirst))\n status = tables.Column(\"status\",\n filters=(d_filters.title,\n filters.replace_underscores),\n verbose_name=_(\"Status\"),\n status=True,\n status_choices=STATUS_CHOICES)\n\n class Meta:\n name = \"backups\"\n verbose_name = _(\"Backups\")\n status_columns = [\"status\"]\n row_class = UpdateRow\n table_actions = (LaunchLink, DeleteBackup)\n row_actions = (RestoreLink, DownloadBackup, DeleteBackup)", "metadata": "root.BackupsTable", "header": "['module', '___EOS___']", "index": 141 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Rack", "space", " ", "Host", "ing_", "\\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_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "default", "filters_", "as_", "d\\u", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "unge", "ttext", "\\u", "lazy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "horizon_", "import_", "tables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "horizon_", "._", "utils_", "import_", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STATUS", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "BUILD", "ING", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "COMPLETED", "\"_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "DELET", "E", "\\u", "FAIL", "ED", "\"_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "FAIL", "ED", "\"_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "NEW", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "SA", "VING", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Launch", "Link_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "create", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Creat", "e", " ", "Back", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"", "horizon", ":", "project", ":", "databa", "se", "\\u", "backup", "s", ":", "create", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "\"", "aja", "x", "-", "modal", "\"_", ",_", "\"", "btn", "-", "create", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon_", "=_", "\"", "came", "ra", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Restor", "e", "Link_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "restore", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Restor", "e", " ", "Back", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"", "horizon", ":", "project", ":", "databa", "ses", ":", "launch", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "\"", "aja", "x", "-", "modal", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon_", "=_", "\"", "cloud", "-", "upload", "\"_", "\\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_", "Restor", "e", "Link_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "allowed_", "(_", "self_", ",_", "request_", ",_", "backup_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "backup_", "._", "status_", "==_", "'", "COMPLETED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Restor", "e", "Link_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "link", "\\u", "url_", "(_", "self_", ",_", "datum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "self_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "url_", "+_", "'?", "backup", "=", "%", "s", "'_", "%_", "datum_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Down", "load", "Backup_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "download", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Down", "load", " ", "Back", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'", "horizon", ":", "project", ":", "container", "s", ":", "object\\u", "download", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "\"", "btn", "-", "download", "\"_", ",_", ")_", "\\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_", "Down", "load", "Backup_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "link", "\\u", "url_", "(_", "self_", ",_", "datum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref_", "=_", "datum_", "._", "location", "Ref_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container", "\\u", "name_", "=_", "ref_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "path_", "=_", "'/'_", "._", "join_", "(_", "ref_", "[_", "6_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reverse_", "(_", "self_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "container", "\\u", "name", "'_", ":_", "container", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "path", "'_", ":_", "object\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Down", "load", "Backup_", "(_", "tables_", "._", "Link", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "allowed_", "(_", "self_", ",_", "request_", ",_", "datum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datum_", "._", "status_", "==_", "'", "COMPLETED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Delete", "Backup_", "(_", "tables_", "._", "Delete", "Action_", ")_", ":_", "\\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_", "Delete", "Backup_", "(_", "tables_", "._", "Delete", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "action", "\\u", "present_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Delete", " ", "Back", "up", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Delete", " ", "Back", "ups", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Delete", "Backup_", "(_", "tables_", "._", "Delete", "Action_", ")_", ":_", "\\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_", "action", "\\u", "past_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Delete", "d", " ", "Back", "up", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Delete", "d", " ", "Back", "ups", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Delete", "Backup_", "(_", "tables_", "._", "Delete", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "request_", ",_", "obj", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api_", "._", "trove_", "._", "backup", "\\u", "delete_", "(_", "request_", ",_", "obj", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Update", "Row_", "(_", "tables_", "._", "Row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ajax_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Update", "Row_", "(_", "tables_", "._", "Row_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "data_", "(_", "self_", ",_", "request_", ",_", "backup", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backup_", "=_", "api_", "._", "trove_", "._", "backup", "\\u", "get_", "(_", "request_", ",_", "backup", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backup_", "._", "instance_", "=_", "api_", "._", "trove_", "._", "instance", "\\u", "get_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backup_", "._", "instance", "\\u", "id_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "backup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "db", "\\u", "link_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "obj_", ",_", "'", "instance", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", "._", "instance_", ",_", "'", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "horizon", ":", "project", ":", "databa", "ses", ":", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "obj_", "._", "instance", "\\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_", "db", "\\u", "name_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "obj_", ",_", "'", "instance", "'_", ")_", "or_", "not_", "hasattr_", "(_", "obj_", "._", "instance_", ",_", "'", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "instance", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "._", "instance_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "datastore_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "obj_", ",_", "\"", "datast", "ore", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "datastore_", "[_", "\"", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u_", "(_", "\"", "Not", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "datast", "ore", "\\u", "version_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "obj_", ",_", "\"", "datast", "ore", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "datastore_", "[_", "\"", "version", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u_", "(_", "\"", "Not", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\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", "incremental", "_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hasattr_", "(_", "obj_", ",_", "'", "parent", "\\u", "id", "'_", ")_", "and_", "obj_", "._", "parent", "\\u", "id_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Back", "ups", "Table_", "(_", "tables_", "._", "Data", "Table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "tables_", "._", "Column_", "(_", "\"", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "\"", "horizon", ":", "project", ":", "databa", "se", "\\u", "backup", "s", ":", "deta", "il", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Name", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datastore_", "=_", "tables_", "._", "Column_", "(_", "get", "\\u", "datastore_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Datas", "tore", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datast", "ore", "\\u", "version_", "=_", "tables_", "._", "Column_", "(_", "get", "\\u", "datast", "ore", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Datas", "tore", " ", "Version", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "tables_", "._", "Column_", "(_", "\"", "created", "\"_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Creat", "ed", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "[_", "filters_", "._", "parse", "\\u", "isot", "ime_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "tables_", "._", "Column_", "(_", "db", "\\u", "name_", ",_", "link_", "=_", "db", "\\u", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Databa", "se", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incremental", "_", "=_", "tables_", "._", "Column_", "(_", "is", "\\u", "incremental", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Increment", "al", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "(_", "d\\u", "filters_", "._", "yesno", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d\\u", "filters_", "._", "cap", "first_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "tables_", "._", "Column_", "(_", "\"", "status", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "(_", "d\\u", "filters_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "._", "replace", "\\u", "underscore", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "choices_", "=_", "STATUS", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "backup", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Back", "ups", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "columns_", "=_", "[_", "\"", "status", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "class_", "=_", "Update", "Row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "actions_", "=_", "(_", "Launch", "Link_", ",_", "Delete", "Backup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "actions_", "=_", "(_", "Restor", "e", "Link_", ",_", "Down", "load", "Backup_", ",_", "Delete", "Backup_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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aio/txaio/_common.py
[ { "content": " def _notify_bucket(self, real_time):\n \"\"\"\n Internal helper. This 'does' the callbacks in a particular bucket.\n\n :param real_time: the bucket to do callbacks on\n \"\"\"\n (delayed_call, calls) = self._buckets[real_time]\n del self._buckets[real_time]\n errors = []\n\n def notify_one_chunk(calls, chunk_size, chunk_delay_ms):\n for call in calls[:chunk_size]:\n try:\n call()\n except Exception as e:\n errors.append(e)\n calls = calls[chunk_size:]\n if calls:\n self._create_delayed_call(\n chunk_delay_ms / 1000.0,\n notify_one_chunk, calls, chunk_size, chunk_delay_ms,\n )\n else:\n # done all calls; make sure there were no errors\n if len(errors):\n msg = u\"Error(s) processing call_later bucket:\\n\"\n for e in errors:\n msg += u\"{}\\n\".format(e)\n raise RuntimeError(msg)\n # ceil()ing because we want the number of chunks, and a\n # partial chunk is still a chunk\n delay_ms = self._bucket_milliseconds / math.ceil(float(len(calls)) / self._chunk_size)\n notify_one_chunk(calls, self._chunk_size, delay_ms)", "metadata": "root._BatchedTimer._notify_bucket", "header": "['class', '_BatchedTimer', '(', 'IBatchedTimer', ')', ':', '___EOS___']", "index": 66 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "\\u", "Bat", "ched", "Timer_", "(_", "IB", "atch", "ed", "Timer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "notif", "y", "\\u", "bucket_", "(_", "self_", ",_", "real", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Intern", "al", " ", "help", "er", ".", " ", "Thi", "s", " ", "'", "doe", "s", "'", " ", "the", " ", "callback", "s", " ", "in", " ", "a", " ", "partic", "ular", " ", "bucket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "real", "\\u", "time", ":", " ", "the", " ", "bucket", " ", "to", " ", "do", " ", "callback", "s", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "delayed", "\\u", "call_", ",_", "calls_", ")_", "=_", "self_", "._", "\\u", "buckets_", "[_", "real", "\\u", "time_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "buckets_", "[_", "real", "\\u", "time_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "notif", "y", "\\u", "one", "\\u", "chunk_", "(_", "calls_", ",_", "chunk", "\\u", "size_", ",_", "chunk", "\\u", "dela", "y", "\\u", "ms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "call_", "in_", "calls_", "[_", ":_", "chunk", "\\u", "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 ", " ", "_", "call_", "(_", ")_", "\\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 ", " ", "_", "errors_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "calls_", "=_", "calls_", "[_", "chunk", "\\u", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "calls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "delayed", "\\u", "call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "chunk", "\\u", "dela", "y", "\\u", "ms_", "/_", "1000.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notif", "y", "\\u", "one", "\\u", "chunk_", ",_", "calls_", ",_", "chunk", "\\u", "size_", ",_", "chunk", "\\u", "dela", "y", "\\u", "ms_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "e", " ", "all", " ", "calls", ";", " ", "make", " ", "sure", " ", "there", " ", "wer", "e", " ", "no", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "u", "\"", "Error", "(", "s", ")", " ", "process", "ing", " ", "call", "\\u", "late", "r", " ", "bucket", ":\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "+=_", "u", "\"{}\\\\", "n", "\"_", "._", "format_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ceil", "()", "ing", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "the", " ", "number", " ", "of", " ", "chunks", ",", " ", "and", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "partial", " ", "chunk", " ", "is", " ", "still", " ", "a", " ", "chunk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dela", "y", "\\u", "ms_", "=_", "self_", "._", "\\u", "bucket", "\\u", "milliseconds", "_", "/_", "math_", "._", "ceil_", "(_", "float_", "(_", "len_", "(_", "calls_", ")_", ")_", "/_", "self_", "._", "\\u", "chunk", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notif", "y", "\\u", "one", "\\u", "chunk_", "(_", "calls_", ",_", "self_", "._", "\\u", "chunk", "\\u", "size_", ",_", "dela", "y", "\\u", "ms_", ")_", "\\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 ]
Unreachable code
OpenBazaar/OpenBazaar-Server/api/restapi.py
[ { "content": " @GET('^/api/v1/get_image')\n @authenticated\n def get_image(self, request):\n @defer.inlineCallbacks\n def _showImage(resp=None):\n @defer.inlineCallbacks\n def _setContentDispositionAndSend(file_path, extension, content_type):\n request.setHeader('content-disposition', 'filename=\"%s.%s\"' % (file_path, extension))\n request.setHeader('content-type', content_type)\n request.setHeader('cache-control', 'max-age=604800')\n\n f = open(file_path, \"rb\")\n yield FileSender().beginFileTransfer(f, request)\n f.close()\n defer.returnValue(0)\n\n if os.path.exists(image_path):\n yield _setContentDispositionAndSend(image_path, \"jpg\", \"image/jpeg\")\n else:\n request.setResponseCode(http.NOT_FOUND)\n request.write(\"No such image '%s'\" % request.path)\n request.finish()\n\n if \"hash\" in request.args and len(request.args[\"hash\"][0]) == 40:\n if self.db.filemap.get_file(request.args[\"hash\"][0]) is not None:\n image_path = self.db.filemap.get_file(request.args[\"hash\"][0])\n else:\n image_path = os.path.join(DATA_FOLDER, \"cache\", request.args[\"hash\"][0])\n if not os.path.exists(image_path) and \"guid\" in request.args:\n node = None\n for connection in self.protocol.values():\n if connection.handler.node is not None and \\\n connection.handler.node.id == unhexlify(request.args[\"guid\"][0]):\n node = connection.handler.node\n self.mserver.get_image(node, unhexlify(request.args[\"hash\"][0])).addCallback(_showImage)\n if node is None:\n _showImage()\n else:\n _showImage()\n else:\n request.write(NoResource().render(request))\n request.finish()\n\n return server.NOT_DONE_YET", "metadata": "root.OpenBazaarAPI.get_image", "header": "['class', 'OpenBazaarAPI', '(', 'APIResource', ')', ':', '___EOS___']", "index": 103 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Open", "Baz", "aar", "API_", "(_", "API", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "GET_", "(_", "'", "^", "/", "api", "/", "v1", "/", "get", "\\u", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "image_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "show", "Image_", "(_", "resp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "set", "Conten", "t", "Dispo", "sition", "And", "Send_", "(_", "file", "\\u", "path_", ",_", "extension_", ",_", "content", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "set", "Header_", "(_", "'", "content", "-", "disposition", "'_", ",_", "'", "filename", "=\"", "%", "s", ".", "%", "s", "\"'_", "%_", "(_", "file", "\\u", "path_", ",_", "extension_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "set", "Header_", "(_", "'", "content", "-", "type", "'_", ",_", "content", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "set", "Header_", "(_", "'", "cache", "-", "control", "'_", ",_", "'", "max", "-", "age", "=", "604", "800", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "file", "\\u", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "File", "Sender_", "(_", ")_", "._", "begin", "File", "Transfer", "_", "(_", "f_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defer_", "._", "return", "Value_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "image", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u", "set", "Conten", "t", "Dispo", "sition", "And", "Send_", "(_", "image", "\\u", "path_", ",_", "\"", "jp", "g", "\"_", ",_", "\"", "image", "/", "jpeg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "set", "Respons", "e", "Code_", "(_", "http_", "._", "NOT", "\\u", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "write_", "(_", "\"", "No", " ", "suc", "h", " ", "image", " ", "'%", "s", "'\"_", "%_", "request_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "hash", "\"_", "in_", "request_", "._", "args_", "and_", "len_", "(_", "request_", "._", "args_", "[_", "\"", "hash", "\"_", "]_", "[_", "0_", "]_", ")_", "==_", "40_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "db_", "._", "filem", "ap_", "._", "get", "\\u", "file_", "(_", "request_", "._", "args_", "[_", "\"", "hash", "\"_", "]_", "[_", "0_", "]_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "path_", "=_", "self_", "._", "db_", "._", "filem", "ap_", "._", "get", "\\u", "file_", "(_", "request_", "._", "args_", "[_", "\"", "hash", "\"_", "]_", "[_", "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 ", " _", "image", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "DATA", "\\u", "FOLDER_", ",_", "\"", "cache", "\"_", ",_", "request_", "._", "args_", "[_", "\"", "hash", "\"_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "image", "\\u", "path_", ")_", "and_", "\"", "guid", "\"_", "in_", "request_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "connection_", "in_", "self_", "._", "protocol_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "connection_", "._", "handler_", "._", "node_", "is_", "not_", "None_", "and_", "connection_", "._", "handler_", "._", "node_", "._", "id_", "==_", "unhexlify_", "(_", "request_", "._", "args_", "[_", "\"", "guid", "\"_", "]_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "node_", "=_", "connection_", "._", "handler_", "._", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mse", "rver_", "._", "get", "\\u", "image_", "(_", "node_", ",_", "unhexlify_", "(_", "request_", "._", "args_", "[_", "\"", "hash", "\"_", "]_", "[_", "0_", "]_", ")_", ")_", "._", "add", "Callback_", "(_", "\\u", "show", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "show", "Image_", "(_", ")_", "\\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 ", " _", "\\u", "show", "Image_", "(_", ")_", "\\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 ", " _", "request_", "._", "write_", "(_", "No", "Resource_", "(_", ")_", "._", "render_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "server_", "._", "NOT", "\\u", "DON", "E", "\\u", "YE", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Suspicious unused loop iteration variable
wehriam/awspider/awspider/aws/sdb.py
[ { "content": " def _copyDomainCallback4(self, data, source_domain, destination_domain,\n next_token=None, total_box_usage=0):\n for row in data:\n if row[0] == False:\n raise row[1]\n if next_token is not None:\n return self._copyDomainCallback2(\n source_domain=source_domain,\n destination_domain=destination_domain,\n next_token=next_token,\n total_box_usage=total_box_usage)\n LOGGER.debug(\"\"\"CopyDomain:\\n%s -> %s\\nBox usage: %s\"\"\" % (\n source_domain,\n destination_domain,\n total_box_usage))\n return True", "metadata": "root.AmazonSDB._copyDomainCallback4", "header": "['class', 'AmazonSDB', ':', '___EOS___']", "index": 221 } ]
[]
[]
0
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "class_", "Ama", "zon", "SD", "B_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "copy", "Doma", "in", "Call", "back", "4_", "(_", "self_", ",_", "data_", ",_", "source", "\\u", "domain_", ",_", "destinat", "ion", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "token_", "=_", "None_", ",_", "total", "\\u", "box", "\\u", "usage_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "0_", "]_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "row_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "next", "\\u", "token_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "copy", "Doma", "in", "Call", "back", "2_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "domain_", "=_", "source", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destinat", "ion", "\\u", "domain_", "=_", "destinat", "ion", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "token_", "=_", "next", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "box", "\\u", "usage_", "=_", "total", "\\u", "box", "\\u", "usage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "\"\"\"", "Copy", "Doma", "in", ":\\\\", "n", "%", "s", " ", "->", " ", "%", "s", "\\\\", "n", "Box", " ", "usage", ":", " ", "%", "s", "\"\"\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destinat", "ion", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "box", "\\u", "usage_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bartdag/recodoc2/recodoc2/apps/channel/admin.py
[ { "content": "class MessageInline(admin.StackedInline):\n model = Message\n extra = 0\n ordering = ('index',)", "metadata": "root.MessageInline", "header": "['module', '___EOS___']", "index": 36 } ]
[]
[]
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_", "Messag", "e", "Inline_", "(_", "admin_", "._", "Stack", "ed", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "(_", "'", "index", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openstack/neutron/neutron/tests/functional/agent/l2/extensions/test_ovs_agent_qos_extension.py
[ { "content": " def test_port_creation_with_different_bandwidth_limits(self):\n \"\"\"Make sure different types of policies end on the right ports.\"\"\"\n\n port_dicts = self.create_test_ports(amount=3)\n\n port_dicts[0]['qos_policy_id'] = TEST_POLICY_ID1\n port_dicts[1]['qos_policy_id'] = TEST_POLICY_ID2\n\n self.setup_agent_and_ports(port_dicts)\n self.wait_until_ports_state(self.ports, up=True)\n\n self._assert_bandwidth_limit_rule_is_set(self.ports[0],\n TEST_BW_LIMIT_RULE_1)\n\n self._assert_bandwidth_limit_rule_is_set(self.ports[1],\n TEST_BW_LIMIT_RULE_2)\n\n self._assert_bandwidth_limit_rule_not_set(self.ports[2])", "metadata": "root.TestOVSAgentQosExtension.test_port_creation_with_different_bandwidth_limits", "header": "['class', 'TestOVSAgentQosExtension', '(', 'OVSAgentQoSExtensionTestFramework', ')', ':', '___EOS___']", "index": 170 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "OVS", "Agent", "Qo", "s", "Extension_", "(_", "OVS", "Agent", "Qo", "SE", "xte", "nsion", "Test", "Framework_", ")_", ":_", "\\u\\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", "port", "\\u", "creati", "on", "\\u", "with", "\\u", "different", "\\u", "bandwi", "dth", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "sure", " ", "different", " ", "types", " ", "of", " ", "poli", "cies", " ", "end", " ", "on", " ", "the", " ", "right", " ", "port", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "dicts_", "=_", "self_", "._", "create", "\\u", "test\\u", "ports_", "(_", "amount_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "dicts_", "[_", "0_", "]_", "[_", "'", "qo", "s", "\\u", "policy", "\\u", "id", "'_", "]_", "=_", "TEST", "\\u", "POLICY", "\\u", "ID", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "dicts_", "[_", "1_", "]_", "[_", "'", "qo", "s", "\\u", "policy", "\\u", "id", "'_", "]_", "=_", "TEST", "\\u", "POLICY", "\\u", "ID", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "agent", "\\u", "and", "\\u", "ports_", "(_", "port", "\\u", "dicts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "unti", "l\\u", "port", "s", "\\u", "state_", "(_", "self_", "._", "ports_", ",_", "up_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "bandwi", "dth", "\\u", "limit", "\\u", "rule", "\\u", "is", "\\u", "set_", "(_", "self_", "._", "ports_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "BW", "\\u", "LIMIT", "\\u", "RULE", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "bandwi", "dth", "\\u", "limit", "\\u", "rule", "\\u", "is", "\\u", "set_", "(_", "self_", "._", "ports_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "BW", "\\u", "LIMIT", "\\u", "RULE", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "bandwi", "dth", "\\u", "limit", "\\u", "rule", "\\u", "not", "\\u", "set_", "(_", "self_", "._", "ports_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pinax/pinax-comments/pinax/comments/tests/tests.py
[ { "content": "from django.core.urlresolvers import reverse\nfrom django.template import Template, Context\n\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom pinax.comments.forms import CommentForm\nfrom pinax.comments.models import Comment\n\nfrom .models import Demo\nfrom .test import TestCase\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCaseMixin(TestCase):\n\n\n\n\n", "metadata": "root.TestCaseMixin", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def get(self, url_name, *args, **kwargs):\n data = kwargs.pop(\"data\", {})\n return self.get(reverse(url_name, args=args, kwargs=kwargs), data)", "metadata": "root.TestCaseMixin.get", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def getajax(self, url_name, *args, **kwargs):\n data = kwargs.pop(\"data\", {})\n return self.get(reverse(url_name, args=args, kwargs=kwargs), data,\n HTTP_X_REQUESTED_WITH=\"XMLHttpRequest\")", "metadata": "root.TestCaseMixin.getajax", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def post_comment_2(self, url_name, *args, **kwargs):\n url_name = \"pinax_comments:\" + url_name\n return self.post(url_name, args=args, kwargs=kwargs)", "metadata": "root.TestCaseMixin.post_comment_2", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def postajax(self, url_name, *args, **kwargs):\n data = kwargs.pop(\"data\", {})\n return self.post(reverse(url_name, args=args, kwargs=kwargs), data,\n HTTP_X_REQUESTED_WITH=\"XMLHttpRequest\")", "metadata": "root.TestCaseMixin.postajax", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def reload(self, obj):\n return obj.__class__._default_manager.get(pk=obj.pk)", "metadata": "root.TestCaseMixin.reload", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def assert_renders(self, tmpl, context, value):\n tmpl = Template(tmpl)\n self.assertEqual(tmpl.render(context), value)", "metadata": "root.TestCaseMixin.assert_renders", "header": "['class', 'TestCaseMixin', '(', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": "class CommentTests(TestCaseMixin):\n\n\n\n\n", "metadata": "root.CommentTests", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def setUp(self):\n super(CommentTests, self).setUp()\n self.gimli = self.make_user(username=\"gimli\")\n self.aragorn = self.make_user(username=\"aragorn\")", "metadata": "root.CommentTests.setUp", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 40 }, { "content": " def assert_renders(self, tmpl, context, value):\n tmpl = Template(tmpl)\n self.assertEqual(tmpl.render(context), value)", "metadata": "root.CommentTests.assert_renders", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 45 }, { "content": " def post_comment(self, obj, data):\n return self.post(\n \"pinax_comments:post_comment\",\n content_type_id=ContentType.objects.get_for_model(obj).pk,\n object_id=obj.pk,\n data=data\n )", "metadata": "root.CommentTests.post_comment", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_post_comment(self):\n d = Demo.objects.create(name=\"Wizard\")\n\n response = self.post_comment(d, data={\n \"name\": \"Frodo Baggins\",\n \"comment\": \"Where'd you go?\",\n })\n self.response_302(response)\n\n self.assertEqual(Comment.objects.count(), 1)\n c = Comment.objects.get()\n self.assertEqual(c.author, None)\n self.assertEqual(c.name, \"Frodo Baggins\")\n\n response = self.post_comment(d, data={\n \"comment\": \"Where is everyone?\"\n })\n self.assertEqual(Comment.objects.count(), 1)\n\n with self.login(self.gimli):\n response = self.post_comment(d, data={\n \"comment\": \"I thought you were watching the hobbits?\"\n })\n self.response_302(response)\n self.assertEqual(Comment.objects.count(), 2)\n\n c = Comment.objects.order_by(\"id\")[1]\n self.assertEqual(c.comment, \"I thought you were watching the hobbits?\")\n self.assertEqual(c.author, self.gimli)", "metadata": "root.CommentTests.test_post_comment", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_delete_comment(self):\n d = Demo.objects.create(name=\"Wizard\")\n with self.login(self.gimli):\n response = self.post_comment(d, data={\n \"comment\": \"Wow, you're a jerk.\",\n })\n comment = Comment.objects.get()\n response = self.post(\"pinax_comments:delete_comment\", pk=comment.pk)\n self.response_404(response)\n self.assertEqual(Comment.objects.count(), 1)\n\n with self.login(self.aragorn):\n response = self.post(\"pinax_comments:delete_comment\", pk=comment.pk)\n self.assertEqual(response.status_code, 302)\n self.assertEqual(Comment.objects.count(), 1)\n\n with self.login(self.gimli):\n response = self.post(\"pinax_comments:delete_comment\", pk=comment.pk)\n self.assertEqual(response.status_code, 302)\n self.assertEqual(Comment.objects.count(), 0)", "metadata": "root.CommentTests.test_delete_comment", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 87 }, { "content": " def test_ttag_comment_count(self):\n d = Demo.objects.create(name=\"Wizard\")\n self.post_comment(d, data={\n \"name\": \"Gandalf\",\n \"comment\": \"You can't win\",\n })\n self.post_comment(d, data={\n \"name\": \"Gollum\",\n \"comment\": \"We wants our precious\",\n })\n\n self.assert_renders(\n \"{% load pinax_comments_tags %}{% comment_count o %}\",\n Context({\"o\": d}),\n \"2\"\n )", "metadata": "root.CommentTests.test_ttag_comment_count", "header": "['class', 'CommentTests', '(', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 108 }, { "content": "def test_ttag_comments(self):\n d = Demo.objects.create(name=\"Wizard\")\n self.post_comment(d, data={\n \"name\": \"Gandalf\",\n \"comment\": \"You can't win\",\n })\n self.post_comment(d, data={\n \"name\": \"Gollum\",\n \"comment\": \"We wants our precious\",\n })\n\n c = Context({\"o\": d})\n self.assert_renders(\n \"{% load pinax_comments_tags %}{% comments o as cs %}\",\n c,\n \"\"\n )\n self.assertEqual(list(c[\"cs\"]), list(Comment.objects.all()))", "metadata": "root.test_ttag_comments", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def test_ttag_comment_form(self):\n d = Demo.objects.create(name=\"Wizard\")\n c = Context({\"o\": d})\n self.assert_renders(\n \"{% load pinax_comments_tags %}{% comment_form o as comment_form %}\",\n c,\n \"\"\n )\n self.assertTrue(isinstance(c[\"comment_form\"], CommentForm))\n\n with self.login(self.gimli):\n c = Context({\"o\": d, \"user\": self.user})\n self.assert_renders(\n \"{% load pinax_comments_tags %}{% comment_form o as comment_form %}\",\n c,\n \"\"\n )\n self.assertTrue(isinstance(c[\"comment_form\"], CommentForm))", "metadata": "root.test_ttag_comment_form", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def test_ttag_comment_target(self):\n d = Demo.objects.create(name=\"Wizard\")\n self.assert_renders(\n \"{% load pinax_comments_tags %}{% comment_target o %}\",\n Context({\"o\": d}),\n \"/comment/%d/%d/\" % (ContentType.objects.get_for_model(d).pk, d.pk)\n )", "metadata": "root.test_ttag_comment_target", "header": "['module', '___EOS___']", "index": 166 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Template_", ",_", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pin", "ax_", "._", "comments_", "._", "forms_", "import_", "Comme", "nt", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pin", "ax_", "._", "comments_", "._", "models_", "import_", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "models_", "import_", "Demo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "test_", "import_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "url", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "reverse_", "(_", "url", "\\u", "name_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "kwargs_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "geta", "jax_", "(_", "self_", ",_", "url", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "reverse_", "(_", "url", "\\u", "name_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "kwargs_", ")_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "\"", "XML", "Http", "Request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "comment", "\\u", "2_", "(_", "self_", ",_", "url", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "name_", "=_", "\"", "pin", "ax", "\\u", "comment", "s", ":\"_", "+_", "url", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "post_", "(_", "url", "\\u", "name_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "posta", "jax_", "(_", "self_", ",_", "url", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "post_", "(_", "reverse_", "(_", "url", "\\u", "name_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "kwargs_", ")_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "\"", "XML", "Http", "Request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reload_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u", "default", "\\u", "manager_", "._", "get_", "(_", "pk_", "=_", "obj_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case", "Mixin_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "render", "s_", "(_", "self_", ",_", "tmpl_", ",_", "context_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpl_", "=_", "Template_", "(_", "tmpl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tmpl_", "._", "render_", "(_", "context_", ")_", ",_", "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_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\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_", "(_", "Comme", "nt", "Tests_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gi", "mli", "_", "=_", "self_", "._", "make", "\\u", "user_", "(_", "username_", "=_", "\"", "gi", "mli", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ara", "gor", "n_", "=_", "self_", "._", "make", "\\u", "user_", "(_", "username_", "=_", "\"", "ara", "gor", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "render", "s_", "(_", "self_", ",_", "tmpl_", ",_", "context_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpl_", "=_", "Template_", "(_", "tmpl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tmpl_", "._", "render_", "(_", "context_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "comment_", "(_", "self_", ",_", "obj_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pin", "ax", "\\u", "comment", "s", ":", "post", "\\u", "comment", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "obj_", ")_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "id_", "=_", "obj_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "comment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Fro", "do", " ", "Bag", "gin", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "Whe", "re", "'", "d", " ", "you", " ", "go", "?\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "302_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Comment_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "author_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "name_", ",_", "\"", "Fro", "do", " ", "Bag", "gin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "Whe", "re", " ", "is", " ", "everyone", "?\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "login_", "(_", "self_", "._", "gi", "mli", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "I", " ", "thought", " ", "you", " ", "wer", "e", " ", "watch", "ing", " ", "the", " ", "hob", "bits", "?\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "302_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Comment_", "._", "objects_", "._", "order", "\\u", "by_", "(_", "\"", "id", "\"_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "comment_", ",_", "\"", "I", " ", "thought", " ", "you", " ", "wer", "e", " ", "watch", "ing", " ", "the", " ", "hob", "bits", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "author_", ",_", "self_", "._", "gi", "mli", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "comment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "login_", "(_", "self_", "._", "gi", "mli", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "Wo", "w", ",", " ", "you", "'", "re", " ", "a", " ", "jer", "k", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "Comment_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "post_", "(_", "\"", "pin", "ax", "\\u", "comment", "s", ":", "delete", "\\u", "comment", "\"_", ",_", "pk_", "=_", "comment_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "404_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "login_", "(_", "self_", "._", "ara", "gor", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "post_", "(_", "\"", "pin", "ax", "\\u", "comment", "s", ":", "delete", "\\u", "comment", "\"_", ",_", "pk_", "=_", "comment_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "login_", "(_", "self_", "._", "gi", "mli", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "post_", "(_", "\"", "pin", "ax", "\\u", "comment", "s", ":", "delete", "\\u", "comment", "\"_", ",_", "pk_", "=_", "comment_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Comment_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comme", "nt", "Tests_", "(_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tta", "g", "\\u", "comment", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Gan", "dal", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "You", " ", "can", "'", "t", " ", "win", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Gol", "lum", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "We", " ", "want", "s", " ", "our", " ", "precio", "us", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "\\u", "render", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "pin", "ax", "\\u", "comment", "s", "\\u", "tags", " ", "%}", "{%", " ", "comment", "\\u", "count", " ", "o", " ", "%}", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Context_", "(_", "{_", "\"", "o", "\"_", ":_", "d_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tta", "g", "\\u", "comments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Gan", "dal", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "You", " ", "can", "'", "t", " ", "win", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "comment_", "(_", "d_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Gol", "lum", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "We", " ", "want", "s", " ", "our", " ", "precio", "us", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Context_", "(_", "{_", "\"", "o", "\"_", ":_", "d_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "render", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "pin", "ax", "\\u", "comment", "s", "\\u", "tags", " ", "%}", "{%", " ", "comment", "s", " ", "o", " ", "as", " ", "cs", " ", "%}", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "c_", "[_", "\"", "cs", "\"_", "]_", ")_", ",_", "list_", "(_", "Comment_", "._", "objects_", "._", "all_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tta", "g", "\\u", "comment", "\\u", "form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Context_", "(_", "{_", "\"", "o", "\"_", ":_", "d_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "render", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "pin", "ax", "\\u", "comment", "s", "\\u", "tags", " ", "%}", "{%", " ", "comment", "\\u", "form", " ", "o", " ", "as", " ", "comment", "\\u", "form", " ", "%}", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "c_", "[_", "\"", "comment", "\\u", "form", "\"_", "]_", ",_", "Comme", "nt", "Form_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "login_", "(_", "self_", "._", "gi", "mli", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Context_", "(_", "{_", "\"", "o", "\"_", ":_", "d_", ",_", "\"", "user", "\"_", ":_", "self_", "._", "user_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "render", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "pin", "ax", "\\u", "comment", "s", "\\u", "tags", " ", "%}", "{%", " ", "comment", "\\u", "form", " ", "o", " ", "as", " ", "comment", "\\u", "form", " ", "%}", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "c_", "[_", "\"", "comment", "\\u", "form", "\"_", "]_", ",_", "Comme", "nt", "Form_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "tta", "g", "\\u", "comment", "\\u", "target_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Demo", "_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Wiz", "ard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "render", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "%", " ", "load", " ", "pin", "ax", "\\u", "comment", "s", "\\u", "tags", " ", "%}", "{%", " ", "comment", "\\u", "target", " ", "o", " ", "%}", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Context_", "(_", "{_", "\"", "o", "\"_", ":_", "d_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "comment", "/", "%", "d", "/", "%", "d", "/\"_", "%_", "(_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "d_", ")_", "._", "pk_", ",_", "d_", "._", "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 ]
First parameter of a method is not named 'self'
Lukasa/hyper/test/test_http11.py
[ { "content": " def test_request_with_file_body_in_text_mode(self):\n # Testing this is tricksy: in practice, we do this by passing a fake\n # file and monkeypatching out 'os.fstat'. This makes it look like a\n # real file.\n FstatRval = namedtuple('FstatRval', ['st_size'])\n\n def fake_fstat(*args):\n return FstatRval(16)\n\n old_fstat = hyper.http11.connection.os.fstat\n\n try:\n hyper.http11.connection.os.fstat = fake_fstat\n c = HTTP11Connection('httpbin.org')\n c._sock = DummySocket()\n\n f = DummyFile(b'')\n f.buffer = StringIO(u'some binary data')\n\n with pytest.raises(ValueError):\n c.request('POST', '/post', body=f)\n finally:\n # Put back the monkeypatch.\n hyper.http11.connection.os.fstat = old_fstat", "metadata": "root.TestHTTP11Connection.test_request_with_file_body_in_text_mode", "header": "['class', 'TestHTTP11Connection', '(', 'object', ')', ':', '___EOS___']", "index": 385 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "HTTP", "11", "Connection_", "(_", "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_", "test\\u", "request", "\\u", "with", "\\u", "file", "\\u", "body", "\\u", "in", "\\u", "text", "\\u", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "ing", " ", "this", " ", "is", " ", "trick", "sy", ":", " ", "in", " ", "practic", "e", ",", " ", "we", " ", "do", " ", "this", " ", "by", " ", "passi", "ng", " ", "a", " ", "fake_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "file", " ", "and", " ", "monkey", "patch", "ing", " ", "out", " ", "'", "os", ".", "fsta", "t", "'.", " ", "Thi", "s", " ", "make", "s", " ", "it", " ", "look", " ", "like", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "real", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Fs", "tat", "Rv", "al_", "=_", "namedtuple_", "(_", "'", "Fs", "tat", "Rv", "al", "'_", ",_", "[_", "'", "st", "\\u", "size", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fake", "\\u", "fsta", "t_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fs", "tat", "Rv", "al_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "fsta", "t_", "=_", "hyper", "_", "._", "http", "11_", "._", "connection_", "._", "os_", "._", "fsta", "t_", "\\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 ", " _", "hyper", "_", "._", "http", "11_", "._", "connection_", "._", "os_", "._", "fsta", "t_", "=_", "fake", "\\u", "fsta", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "HTTP", "11", "Connection_", "(_", "'", "http", "bin", ".", "org", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "\\u", "sock_", "=_", "Du", "mm", "y", "Socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "Du", "mm", "y", "File_", "(_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "buffer_", "=_", "String", "IO_", "(_", "u", "'", "some", " ", "binar", "y", " ", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "request_", "(_", "'", "POST", "'_", ",_", "'/", "post", "'_", ",_", "body_", "=_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Put", " ", "back", " ", "the", " ", "monkey", "patch", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hyper", "_", "._", "http", "11_", "._", "connection_", "._", "os_", "._", "fsta", "t_", "=_", "old", "\\u", "fsta", "t_", "\\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, 2, 2, 2, 2, 2, 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
awesto/django-shop/example/myshop/migrations/polymorphic/0004_add_delivery.py
[ { "content": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-04-07 13:48\nfrom __future__ import unicode_literals\n\nfrom decimal import Decimal\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport django.db.models.fields\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('myshop', '0003_add_polymorphic'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='Delivery',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('shipping_id', models.CharField(blank=True, help_text=\"The transaction processor's reference\", max_length=255, null=True, verbose_name='Shipping ID')),\n ('fulfilled_at', models.DateTimeField(blank=True, null=True, verbose_name='Fulfilled at')),\n ('shipped_at', models.DateTimeField(blank=True, null=True, verbose_name='Shipped at')),\n ('shipping_method', models.CharField(help_text='The shipping backend used to deliver the items for this order', max_length=50, verbose_name='Shipping method')),\n ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='myshop.Order')),\n ],\n ),\n migrations.CreateModel(\n name='DeliveryItem',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('quantity', models.IntegerField(default=0, verbose_name='Delivered quantity')),\n ('delivery', models.ForeignKey(help_text='Refer to the shipping provider used to ship this item', on_delete=django.db.models.deletion.CASCADE, to='myshop.Delivery', verbose_name='Delivery')),\n ],\n ),\n migrations.AddField(\n model_name='orderitem',\n name='canceled',\n field=models.BooleanField(default=False, verbose_name='Item canceled '),\n ),\n migrations.AlterField(\n model_name='commodity',\n name='unit_price',\n field=django.db.models.fields.DecimalField(decimal_places=3, default=Decimal('0'), help_text='Net price for this product', max_digits=30),\n ),\n migrations.AlterField(\n model_name='orderpayment',\n name='amount',\n field=django.db.models.fields.DecimalField(decimal_places=2, default=Decimal('0'), help_text='How much was paid with this particular transfer.', max_digits=30),\n ),\n migrations.AlterField(\n model_name='smartcard',\n name='unit_price',\n field=django.db.models.fields.DecimalField(decimal_places=3, default=Decimal('0'), help_text='Net price for this product', max_digits=30),\n ),\n migrations.AlterField(\n model_name='smartphone',\n name='unit_price',\n field=django.db.models.fields.DecimalField(decimal_places=3, default=Decimal('0'), help_text='Net price for this product', max_digits=30),\n ),\n migrations.AddField(\n model_name='deliveryitem',\n name='item',\n field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='myshop.OrderItem', verbose_name='Ordered item'),\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 10 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", "d", " ", "by", " ", "Dj", "ang", "o", " ", "1.9", ".5", " ", "on", " ", "2016", "-0", "4", "-0", "7", " ", "13", ":", "48_", "\\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_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "migrations_", ",_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "django_", "._", "db_", "._", "models_", "._", "deletion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "django_", "._", "db_", "._", "models_", "._", "fields_", "\\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_", "(_", "'", "mys", "hop", "'_", ",_", "'", "0003", "\\u", "add", "\\u", "polymorphic", "'_", ")_", ",_", "\\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_", "._", "Creat", "e", "Model_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Deliver", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "auto", "\\u", "created_", "=_", "True_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "serialize_", "=_", "False_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "shipping", "\\u", "id", "'_", ",_", "models_", "._", "Char", "Field_", "(_", "blank_", "=_", "True_", ",_", "help", "\\u", "text_", "=_", "\"", "The", " ", "transaction", " ", "process", "or", "'", "s", " ", "reference", "\"_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "null_", "=_", "True_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Ship", "ping", " ", "ID", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fulfill", "ed", "\\u", "at", "'_", ",_", "models_", "._", "Date", "Time", "Field_", "(_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Fu", "lfil", "led", " ", "at", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "ship", "ped", "\\u", "at", "'_", ",_", "models_", "._", "Date", "Time", "Field_", "(_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Ship", "ped", " ", "at", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "shipping", "\\u", "method", "'_", ",_", "models_", "._", "Char", "Field_", "(_", "help", "\\u", "text_", "=_", "'", "The", " ", "shipping", " ", "back", "end", " ", "used", " ", "to", " ", "deliver", " ", "the", " ", "items", " ", "for", " ", "this", " ", "order", "'_", ",_", "max", "\\u", "length_", "=_", "50_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Ship", "ping", " ", "method", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "order", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "on", "\\u", "delete_", "=_", "django_", "._", "db_", "._", "models_", "._", "deletion_", "._", "CASCADE_", ",_", "to_", "=_", "'", "mys", "hop", ".", "Order", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Creat", "e", "Model_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Deliver", "y", "Item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "auto", "\\u", "created_", "=_", "True_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "serialize_", "=_", "False_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "quanti", "ty", "'_", ",_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Deliver", "ed", " ", "quanti", "ty", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "delivery", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "help", "\\u", "text_", "=_", "'", "Refer", " ", "to", " ", "the", " ", "shipping", " ", "provide", "r", " ", "used", " ", "to", " ", "ship", " ", "this", " ", "item", "'_", ",_", "on", "\\u", "delete_", "=_", "django_", "._", "db_", "._", "models_", "._", "deletion_", "._", "CASCADE_", ",_", "to_", "=_", "'", "mys", "hop", ".", "Deliver", "y", "'_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Deliver", "y", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "orderi", "tem", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "cancel", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Item", " ", "cancel", "ed", " ", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "commod", "it", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "unit", "\\u", "price", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "Deci", "mal", "Field_", "(_", "decima", "l\\u", "places_", "=_", "3_", ",_", "default_", "=_", "Decimal_", "(_", "'", "0", "'_", ")_", ",_", "help", "\\u", "text_", "=_", "'", "Net", " ", "price", " ", "for", " ", "this", " ", "product", "'_", ",_", "max", "\\u", "digits_", "=_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "order", "pay", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "amo", "unt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "Deci", "mal", "Field_", "(_", "decima", "l\\u", "places_", "=_", "2_", ",_", "default_", "=_", "Decimal_", "(_", "'", "0", "'_", ")_", ",_", "help", "\\u", "text_", "=_", "'", "Ho", "w", " ", "muc", "h", " ", "was", " ", "paid", " ", "with", " ", "this", " ", "partic", "ular", " ", "transfer", ".'_", ",_", "max", "\\u", "digits_", "=_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "smart", "card", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "unit", "\\u", "price", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "Deci", "mal", "Field_", "(_", "decima", "l\\u", "places_", "=_", "3_", ",_", "default_", "=_", "Decimal_", "(_", "'", "0", "'_", ")_", ",_", "help", "\\u", "text_", "=_", "'", "Net", " ", "price", " ", "for", " ", "this", " ", "product", "'_", ",_", "max", "\\u", "digits_", "=_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "smart", "phone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "unit", "\\u", "price", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "django_", "._", "db_", "._", "models_", "._", "fields_", "._", "Deci", "mal", "Field_", "(_", "decima", "l\\u", "places_", "=_", "3_", ",_", "default_", "=_", "Decimal_", "(_", "'", "0", "'_", ")_", ",_", "help", "\\u", "text_", "=_", "'", "Net", " ", "price", " ", "for", " ", "this", " ", "product", "'_", ",_", "max", "\\u", "digits_", "=_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "delivery", "item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "on", "\\u", "delete_", "=_", "django_", "._", "db_", "._", "models_", "._", "deletion_", "._", "CASCADE_", ",_", "to_", "=_", "'", "mys", "hop", ".", "Order", "Item", "'_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Order", "ed", " ", "item", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
openstack/rally/rally/plugins/openstack/context/sahara/sahara_image.py
[ { "content": " @logging.log_task_wrapper(LOG.info, _(\"Enter context: `Sahara Image`\"))\n def setup(self):\n utils.init_sahara_context(self)\n self.context[\"sahara\"][\"images\"] = {}\n\n # The user may want to use the existing image. In this case he should\n # make sure that the image is public and has all required metadata.\n image_uuid = self.config.get(\"image_uuid\")\n\n self.context[\"sahara\"][\"need_image_cleanup\"] = not image_uuid\n\n if image_uuid:\n # Using the first user to check the existing image.\n user = self.context[\"users\"][0]\n clients = osclients.Clients(user[\"credential\"])\n\n image = clients.glance().images.get(image_uuid)\n\n if not image.is_public:\n raise exceptions.BenchmarkSetupFailure(\n \"Image provided in the Sahara context should be public.\")\n image_id = image_uuid\n\n for user, tenant_id in rutils.iterate_per_tenants(\n self.context[\"users\"]):\n self.context[\"tenants\"][tenant_id][\"sahara\"][\"image\"] = (\n image_id)\n else:\n for user, tenant_id in rutils.iterate_per_tenants(\n self.context[\"users\"]):\n\n image_id = self._create_image(\n hadoop_version=self.config[\"hadoop_version\"],\n image_url=self.config[\"image_url\"],\n plugin_name=self.config[\"plugin_name\"],\n user=user,\n user_name=self.config[\"username\"])\n\n self.context[\"tenants\"][tenant_id][\"sahara\"][\"image\"] = (\n image_id)", "metadata": "root.SaharaImage.setup", "header": "['class', 'SaharaImage', '(', 'context', '.', 'Context', ')', ':', '___EOS___']", "index": 76 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Sa", "hara", "Image_", "(_", "context_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "logging_", "._", "log", "\\u", "task", "\\u", "wrapper_", "(_", "LOG_", "._", "info_", ",_", "\\u_", "(_", "\"", "Enter", " ", "context", ":", " ", "`", "Sa", "hara", " ", "Image", "`\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "init", "\\u", "sahara", "\\u", "context_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "[_", "\"", "sahara", "\"_", "]_", "[_", "\"", "images", "\"_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "user", " ", "may", " ", "want", " ", "to", " ", "use", " ", "the", " ", "exist", "ing", " ", "image", ".", " ", "In", " ", "this", " ", "case", " ", "he", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "image", " ", "is", " ", "public", " ", "and", " ", "has", " ", "all", " ", "require", "d", " ", "metadata", "._", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "uuid_", "=_", "self_", "._", "config_", "._", "get_", "(_", "\"", "image", "\\u", "uuid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "[_", "\"", "sahara", "\"_", "]_", "[_", "\"", "need", "\\u", "image", "\\u", "clean", "up", "\"_", "]_", "=_", "not_", "image", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "image", "\\u", "uuid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "ing", " ", "the", " ", "first", " ", "user", " ", "to", " ", "check", " ", "the", " ", "exist", "ing", " ", "image", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "self_", "._", "context_", "[_", "\"", "users", "\"_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clients_", "=_", "osc", "lien", "ts_", "._", "Client", "s_", "(_", "user_", "[_", "\"", "cred", "ential", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "=_", "clients_", "._", "glance_", "(_", ")_", "._", "images_", "._", "get_", "(_", "image", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "image_", "._", "is", "\\u", "public_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Benchmark", "Set", "up", "Failure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Image", " ", "provided", " ", "in", " ", "the", " ", "Sa", "hara", " ", "context", " ", "shou", "ld", " ", "be", " ", "public", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "\\u", "id_", "=_", "image", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", ",_", "tenan", "t", "\\u", "id_", "in_", "rut", "ils_", "._", "iterate", "\\u", "per", "\\u", "tenants_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "[_", "\"", "users", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "[_", "\"", "tenan", "ts", "\"_", "]_", "[_", "tenan", "t", "\\u", "id_", "]_", "[_", "\"", "sahara", "\"_", "]_", "[_", "\"", "image", "\"_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "user_", ",_", "tenan", "t", "\\u", "id_", "in_", "rut", "ils_", "._", "iterate", "\\u", "per", "\\u", "tenants_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "[_", "\"", "users", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "id_", "=_", "self_", "._", "\\u", "create", "\\u", "image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "self_", "._", "config_", "[_", "\"", "hadoop", "\\u", "version", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "url_", "=_", "self_", "._", "config_", "[_", "\"", "image", "\\u", "url", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "self_", "._", "config_", "[_", "\"", "plugin", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "name_", "=_", "self_", "._", "config_", "[_", "\"", "user", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "[_", "\"", "tenan", "ts", "\"_", "]_", "[_", "tenan", "t", "\\u", "id_", "]_", "[_", "\"", "sahara", "\"_", "]_", "[_", "\"", "image", "\"_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ioflo/ioflo/ioflo/aio/uxd/test/test_uxding.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nUnittests for uxding module\n\"\"\"\nimport sys\nif sys.version_info < (2, 7):\n import unittest2 as unittest\nelse:\n import unittest\n\nimport os\nimport tempfile\nimport shutil\n\nfrom ioflo.aid.sixing import *\nfrom ioflo.aid.consoling import getConsole\nfrom ioflo.aio import wiring\nfrom ioflo.aio.uxd import uxding\n\nconsole = getConsole()\n\n\n\n\n\n\n\n\nif __name__ == '__main__' and __package__ is None:\n\n #console.reinit(verbosity=console.Wordage.concise)\n\n #runAll() #run all unittests\n\n runSome()#only run some\n\n #runOne('testClientAutoReconnect')\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setUpModule():\n console.reinit(verbosity=console.Wordage.concise)", "metadata": "root.setUpModule", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def tearDownModule():\n console.reinit(verbosity=console.Wordage.concise)", "metadata": "root.tearDownModule", "header": "['module', '___EOS___']", "index": 24 }, { "content": "class BasicTestCase(unittest.TestCase):\n \"\"\"\n Test Case\n \"\"\"\n\n\n\n", "metadata": "root.BasicTestCase", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def setUp(self):\n \"\"\"\n\n \"\"\"\n pass", "metadata": "root.BasicTestCase.setUp", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def tearDown(self):\n \"\"\"\n\n \"\"\"\n pass", "metadata": "root.BasicTestCase.tearDown", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def testSocketUxdNb(self):\n \"\"\"\n Test Class SocketUxdNb\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testSocketUxdNb.__doc__))\n console.reinit(verbosity=console.Wordage.profuse)\n\n userDirpath = os.path.join('~', '.ioflo', 'test')\n userDirpath = os.path.abspath(os.path.expanduser(userDirpath))\n if not os.path.exists(userDirpath):\n os.makedirs(userDirpath)\n\n tempDirpath = tempfile.mkdtemp(prefix=\"test\", suffix=\"uxd\", dir=userDirpath)\n\n sockDirpath = os.path.join(tempDirpath, 'uxd')\n if not os.path.exists(sockDirpath):\n os.makedirs(sockDirpath)\n\n logDirpath = os.path.join(tempDirpath, 'log')\n if not os.path.exists(logDirpath):\n os.makedirs(logDirpath)\n\n wireLog = wiring.WireLog(path=logDirpath)\n result = wireLog.reopen(prefix='alpha', midfix='uxd')\n\n\n ha = os.path.join(sockDirpath, 'alpha.uxd')\n alpha = uxding.SocketUxdNb(ha=ha, umask=0x077, wlog=wireLog)\n self.assertIs(alpha.opened, False)\n result = alpha.reopen()\n self.assertIs(result, True)\n self.assertIs(alpha.opened, True)\n self.assertEqual(alpha.ha, ha)\n\n ha = os.path.join(sockDirpath, 'beta.uxd')\n beta = uxding.SocketUxdNb(ha=ha, umask=0x077)\n result = beta.reopen()\n self.assertIs(result, True)\n self.assertEqual(beta.ha, ha)\n\n ha = os.path.join(sockDirpath, 'gamma.uxd')\n gamma = uxding.SocketUxdNb(ha=ha, umask=0x077)\n result = gamma.reopen()\n self.assertIs(result, True)\n self.assertEqual(gamma.ha, ha)\n\n txMsg = b\"Alpha sends to Beta\"\n alpha.send(txMsg, beta.ha)\n rxMsg, sa = beta.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, alpha.ha)\n\n txMsg = b\"Alpha sends to Gamma\"\n alpha.send(txMsg, gamma.ha)\n rxMsg, sa = gamma.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, alpha.ha)\n\n txMsg = b\"Alpha sends to Alpha\"\n alpha.send(txMsg, alpha.ha)\n rxMsg, sa = alpha.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, alpha.ha)\n\n txMsg = b\"Beta sends to Alpha\"\n beta.send(txMsg, alpha.ha)\n rxMsg, sa = alpha.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, beta.ha)\n\n txMsg = b\"Beta sends to Gamma\"\n beta.send(txMsg, gamma.ha)\n rxMsg, sa = gamma.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, beta.ha)\n\n txMsg = b\"Beta sends to Beta\"\n beta.send(txMsg, beta.ha)\n rxMsg, sa = beta.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, beta.ha)\n\n txMsg = b\"Gamma sends to Alpha\"\n gamma.send(txMsg, alpha.ha)\n rxMsg, sa = alpha.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, gamma.ha)\n\n txMsg = b\"Gamma sends to Beta\"\n gamma.send(txMsg, beta.ha)\n rxMsg, sa = beta.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, gamma.ha)\n\n txMsg = b\"Gamma sends to Gamma\"\n gamma.send(txMsg, gamma.ha)\n rxMsg, sa = gamma.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, gamma.ha)\n\n\n pairs = [(alpha, beta), (alpha, gamma), (alpha, alpha),\n (beta, alpha), (beta, gamma), (beta, beta),\n (gamma, alpha), (gamma, beta), (gamma, gamma),]\n names = [('alpha', 'beta'), ('alpha', 'gamma'), ('alpha', 'alpha'),\n ('beta', 'alpha'), ('beta', 'gamma'), ('beta', 'beta'),\n ('gamma', 'alpha'), ('gamma', 'beta'), ('gamma', 'gamma'),]\n\n for i, pair in enumerate(pairs):\n txer, rxer = pair\n txName, rxName = names[i]\n txMsg = ns2b(\"{0} sends to {1} again\".format(txName.capitalize(), rxName.capitalize()))\n txer.send(txMsg, rxer.ha)\n rxMsg, sa = rxer.receive()\n self.assertEqual(txMsg, rxMsg)\n self.assertEqual(sa, txer.ha)\n\n\n rxMsg, sa = alpha.receive()\n self.assertIs(b'', rxMsg)\n self.assertIs(None, sa)\n\n rxMsg, sa = beta.receive()\n self.assertIs(b'', rxMsg)\n self.assertIs(None, sa)\n\n rxMsg, sa = gamma.receive()\n self.assertIs(b'', rxMsg)\n self.assertIs(None, sa)\n\n alpha.close()\n beta.close()\n gamma.close()\n\n self.assertIs(alpha.opened, False)\n\n wireLog.close()\n shutil.rmtree(tempDirpath)\n console.reinit(verbosity=console.Wordage.concise)", "metadata": "root.BasicTestCase.testSocketUxdNb", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": "def runOne(test):\n '''\n Unittest Runner\n '''\n test = BasicTestCase(test)\n suite = unittest.TestSuite([test])\n unittest.TextTestRunner(verbosity=2).run(suite)", "metadata": "root.runOne", "header": "['module', '___EOS___']", "index": 186 }, { "content": "def runSome():\n \"\"\" Unittest runner \"\"\"\n tests = []\n names = [\n 'testSocketUxdNb',\n ]\n tests.extend(map(BasicTestCase, names))\n suite = unittest.TestSuite(tests)\n unittest.TextTestRunner(verbosity=2).run(suite)", "metadata": "root.runSome", "header": "['module', '___EOS___']", "index": 194 }, { "content": "def runAll():\n \"\"\" Unittest runner \"\"\"\n suite = unittest.TestSuite()\n suite.addTest(unittest.TestLoader().loadTestsFromTestCase(BasicTestCase))\n unittest.TextTestRunner(verbosity=2).run(suite)", "metadata": "root.runAll", "header": "['module', '___EOS___']", "index": 204 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Unit", "tests", " ", "for", " ", "ux", "ding", " ", "module", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "io", "flo", "_", "._", "aid_", "._", "si", "xin", "g_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io", "flo", "_", "._", "aid_", "._", "conso", "ling_", "import_", "get", "Console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io", "flo", "_", "._", "aio", "_", "import_", "wir", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io", "flo", "_", "._", "aio", "_", "._", "ux", "d_", "import_", "ux", "ding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "=_", "get", "Console_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", "and_", "\\u\\u", "package", "\\u\\u_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "console", ".", "reini", "t", "(", "verbo", "sity", "=", "console", ".", "Word", "age", ".", "conc", "ise", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "run", "All", "()", " ", "#", "run", " ", "all", " ", "unittest", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "Some", "_", "(_", ")_", "#", "only", " ", "run", " ", "some", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "run", "One", "('", "test", "Client", "Auto", "Recon", "nect", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up", "Module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "console_", "._", "reini", "t_", "(_", "verbosity_", "=_", "console_", "._", "Word", "age_", "._", "conc", "ise_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down", "Module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "console_", "._", "reini", "t_", "(_", "verbosity_", "=_", "console_", "._", "Word", "age_", "._", "conc", "ise_", ")_", "\\u\\u\\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_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Case", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "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", "Sock", "et", "U", "xd", "Nb", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Class", " ", "Sock", "et", "U", "xd", "Nb", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Sock", "et", "U", "xd", "Nb", "_", "._", "\\u\\u", "doc\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "reini", "t_", "(_", "verbosity_", "=_", "console_", "._", "Word", "age_", "._", "prof", "use_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Dir", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'~'_", ",_", "'.", "io", "flo", "'_", ",_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Dir", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "user", "Dir", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "user", "Dir", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "user", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "Dir", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "prefix_", "=_", "\"", "test", "\"_", ",_", "suffix_", "=_", "\"", "ux", "d", "\"_", ",_", "dir_", "=_", "user", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sock", "Dir", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "temp", "Dir", "path_", ",_", "'", "ux", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "sock", "Dir", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "sock", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "Dir", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "temp", "Dir", "path_", ",_", "'", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "log", "Dir", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "log", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wire", "Log_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "path_", "=_", "log", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log_", "._", "reo", "pen_", "(_", "prefix_", "=_", "'", "alpha", "'_", ",_", "mid", "fix_", "=_", "'", "ux", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ha_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sock", "Dir", "path_", ",_", "'", "alpha", ".", "ux", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "ux", "ding_", "._", "Sock", "et", "U", "xd", "Nb", "_", "(_", "ha_", "=_", "ha_", ",_", "umask", "_", "=_", "0x0", "77_", ",_", "wl", "og_", "=_", "wire", "Log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "opened_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "result_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "opened_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ha_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sock", "Dir", "path_", ",_", "'", "beta", ".", "ux", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "=_", "ux", "ding_", "._", "Sock", "et", "U", "xd", "Nb", "_", "(_", "ha_", "=_", "ha_", ",_", "umask", "_", "=_", "0x0", "77_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "beta_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "result_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ha_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sock", "Dir", "path_", ",_", "'", "gamma", ".", "ux", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "=_", "ux", "ding_", "._", "Sock", "et", "U", "xd", "Nb", "_", "(_", "ha_", "=_", "ha_", ",_", "umask", "_", "=_", "0x0", "77_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "gamma_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "result_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "ha_", ",_", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Al", "pha", " ", "send", "s", " ", "to", " ", "Beta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "send_", "(_", "tx", "Msg_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "beta_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Al", "pha", " ", "send", "s", " ", "to", " ", "Gamma", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "send_", "(_", "tx", "Msg_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "gamma_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Al", "pha", " ", "send", "s", " ", "to", " ", "Al", "pha", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "send_", "(_", "tx", "Msg_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "alpha_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Beta", " ", "send", "s", " ", "to", " ", "Al", "pha", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "send_", "(_", "tx", "Msg_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "alpha_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Beta", " ", "send", "s", " ", "to", " ", "Gamma", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "send_", "(_", "tx", "Msg_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "gamma_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Beta", " ", "send", "s", " ", "to", " ", "Beta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "send_", "(_", "tx", "Msg_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "beta_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Gamma", " ", "send", "s", " ", "to", " ", "Al", "pha", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "send_", "(_", "tx", "Msg_", ",_", "alpha_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "alpha_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Gamma", " ", "send", "s", " ", "to", " ", "Beta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "send_", "(_", "tx", "Msg_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "beta_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "Msg_", "=_", "b", "\"", "Gamma", " ", "send", "s", " ", "to", " ", "Gamma", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "send_", "(_", "tx", "Msg_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "gamma_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "gamma_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pairs_", "=_", "[_", "(_", "alpha_", ",_", "beta_", ")_", ",_", "(_", "alpha_", ",_", "gamma_", ")_", ",_", "(_", "alpha_", ",_", "alpha_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "beta_", ",_", "alpha_", ")_", ",_", "(_", "beta_", ",_", "gamma_", ")_", ",_", "(_", "beta_", ",_", "beta_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "gamma_", ",_", "alpha_", ")_", ",_", "(_", "gamma_", ",_", "beta_", ")_", ",_", "(_", "gamma_", ",_", "gamma_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "(_", "'", "alpha", "'_", ",_", "'", "beta", "'_", ")_", ",_", "(_", "'", "alpha", "'_", ",_", "'", "gamma", "'_", ")_", ",_", "(_", "'", "alpha", "'_", ",_", "'", "alpha", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "beta", "'_", ",_", "'", "alpha", "'_", ")_", ",_", "(_", "'", "beta", "'_", ",_", "'", "gamma", "'_", ")_", ",_", "(_", "'", "beta", "'_", ",_", "'", "beta", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "gamma", "'_", ",_", "'", "alpha", "'_", ")_", ",_", "(_", "'", "gamma", "'_", ",_", "'", "beta", "'_", ")_", ",_", "(_", "'", "gamma", "'_", ",_", "'", "gamma", "'_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "pair_", "in_", "enumerate_", "(_", "pairs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "er_", ",_", "rx", "er_", "=_", "pair_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "Name_", ",_", "rx", "Name_", "=_", "names_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "Msg_", "=_", "ns", "2b", "_", "(_", "\"{", "0", "}", " ", "send", "s", " ", "to", " ", "{", "1", "}", " ", "again", "\"_", "._", "format_", "(_", "tx", "Name_", "._", "capitalize_", "(_", ")_", ",_", "rx", "Name_", "._", "capitalize_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "er_", "._", "send_", "(_", "tx", "Msg_", ",_", "rx", "er_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "rx", "er_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "Msg_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sa_", ",_", "tx", "er_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "alpha_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "b", "''_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "None_", ",_", "sa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "beta_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "b", "''_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "None_", ",_", "sa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "Msg_", ",_", "sa_", "=_", "gamma_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "b", "''_", ",_", "rx", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "None_", ",_", "sa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "opened_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "temp", "Dir", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "reini", "t_", "(_", "verbosity_", "=_", "console_", "._", "Word", "age_", "._", "conc", "ise_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "One_", "(_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Unit", "test", " ", "Run", "ner", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "Basic", "Test", "Case_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", "[_", "test_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Some", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Unit", "test", " ", "runn", "er", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "Sock", "et", "U", "xd", "Nb", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tests_", "._", "extend_", "(_", "map_", "(_", "Basic", "Test", "Case_", ",_", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "All_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Unit", "test", " ", "runn", "er", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "._", "load", "Test", "s", "Fro", "m", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bchew/dynamodump/dynamodump.py
[ { "content": "def change_prefix(source_table_name, source_wildcard, destination_wildcard, separator):\n source_prefix = source_wildcard.split(\"*\", 1)[0]\n destination_prefix = destination_wildcard.split(\"*\", 1)[0]\n if source_table_name.split(separator, 1)[0] == source_prefix:\n return destination_prefix + separator + source_table_name.split(separator, 1)[1]", "metadata": "root.change_prefix", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def do_empty(conn, table_name): \n logging.info(\"Starting Empty for \" + table_name + \"..\")\n\n # get table schema\n logging.info(\"Fetching table schema for \" + table_name)\n table_data = conn.describe_table(table_name)\n\n table_desc = table_data[\"Table\"]\n table_attribute_definitions = table_desc[\"AttributeDefinitions\"]\n table_key_schema = table_desc[\"KeySchema\"]\n original_read_capacity = table_desc[\"ProvisionedThroughput\"][\"ReadCapacityUnits\"]\n original_write_capacity = table_desc[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"]\n table_local_secondary_indexes = table_desc.get(\"LocalSecondaryIndexes\")\n table_global_secondary_indexes = table_desc.get(\"GlobalSecondaryIndexes\")\n\n table_provisioned_throughput = {\"ReadCapacityUnits\": int(original_read_capacity), \"WriteCapacityUnits\": int(original_write_capacity)}\n\n logging.info(\"Deleting Table \" + table_name)\n\n delete_table(conn, sleep_interval, table_name)\n\n logging.info(\"Creating Table \" + table_name)\n\n while True:\n try:\n conn.create_table(table_attribute_definitions, table_name, table_key_schema, table_provisioned_throughput, table_local_secondary_indexes, table_global_secondary_indexes)\n break\n except boto.exception.JSONResponseError, e:\n if e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#LimitExceededException\":\n logging.info(\"Limit exceeded, retrying creation of \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n elif e.body[\"__type\"] == \"com.amazon.coral.availability#ThrottlingException\":\n logging.info(\"Control plane limit exceeded, retrying creation of \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n else:\n logging.exception(e)\n sys.exit(1)\n\n # wait for table creation completion\n wait_for_active_table(conn, table_name, \"created\")\n\n\n\n logging.info(\"Recreation of \" + table_name + \" completed. Time taken: \" + str(datetime.datetime.now().replace(microsecond=0) - start_time))", "metadata": "root.do_empty", "header": "['module', '___EOS___']", "index": 164 } ]
[]
[]
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_", "change", "\\u", "prefix_", "(_", "source", "\\u", "table", "\\u", "name_", ",_", "source", "\\u", "wildcard_", ",_", "destinat", "ion", "\\u", "wildcard_", ",_", "separator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "prefix_", "=_", "source", "\\u", "wildcard_", "._", "split_", "(_", "\"*\"_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "\\u", "prefix_", "=_", "destinat", "ion", "\\u", "wildcard_", "._", "split_", "(_", "\"*\"_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "\\u", "table", "\\u", "name_", "._", "split_", "(_", "separator_", ",_", "1_", ")_", "[_", "0_", "]_", "==_", "source", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "destinat", "ion", "\\u", "prefix_", "+_", "separator_", "+_", "source", "\\u", "table", "\\u", "name_", "._", "split_", "(_", "separator_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "empty_", "(_", "conn_", ",_", "table", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Start", "ing", " ", "Emp", "ty", " ", "for", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "table", " ", "schema_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Fe", "tch", "ing", " ", "table", " ", "schema", " ", "for", " ", "\"_", "+_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "data_", "=_", "conn_", "._", "descri", "be", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "desc_", "=_", "table", "\\u", "data_", "[_", "\"", "Table", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "attribute", "\\u", "definitions_", "=_", "table", "\\u", "desc_", "[_", "\"", "Attribute", "Definit", "ion", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "key", "\\u", "schema_", "=_", "table", "\\u", "desc_", "[_", "\"", "Key", "Schema", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "read", "\\u", "capacity_", "=_", "table", "\\u", "desc_", "[_", "\"", "Provision", "ed", "Through", "put", "\"_", "]_", "[_", "\"", "Read", "Capacit", "y", "Unit", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "write", "\\u", "capacity_", "=_", "table", "\\u", "desc_", "[_", "\"", "Provision", "ed", "Through", "put", "\"_", "]_", "[_", "\"", "Write", "Capacit", "y", "Unit", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "local", "\\u", "second", "ary", "\\u", "indexes_", "=_", "table", "\\u", "desc_", "._", "get_", "(_", "\"", "Local", "Second", "ary", "Indexe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "global", "\\u", "second", "ary", "\\u", "indexes_", "=_", "table", "\\u", "desc_", "._", "get_", "(_", "\"", "Global", "Second", "ary", "Indexe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "provisioned", "\\u", "throughput", "_", "=_", "{_", "\"", "Read", "Capacit", "y", "Unit", "s", "\"_", ":_", "int_", "(_", "original", "\\u", "read", "\\u", "capacity_", ")_", ",_", "\"", "Write", "Capacit", "y", "Unit", "s", "\"_", ":_", "int_", "(_", "original", "\\u", "write", "\\u", "capacity_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Del", "eti", "ng", " ", "Table", " ", "\"_", "+_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "table_", "(_", "conn_", ",_", "sleep", "\\u", "interval_", ",_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "Table", " ", "\"_", "+_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\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 ", " _", "conn_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "attribute", "\\u", "definitions_", ",_", "table", "\\u", "name_", ",_", "table", "\\u", "key", "\\u", "schema_", ",_", "table", "\\u", "provisioned", "\\u", "throughput", "_", ",_", "table", "\\u", "local", "\\u", "second", "ary", "\\u", "indexes_", ",_", "table", "\\u", "global", "\\u", "second", "ary", "\\u", "indexes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "exception_", "._", "JSONR", "esp", "ons", "e", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "ona", "ws", ".", "dynamodb", ".", "v2", "0120", "810", "#", "Limit", "Exce", "eded", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Limit", " ", "exceed", "ed", ",", " ", "retrying", " ", "creati", "on", " ", "of", " ", "\"_", "+_", "destinat", "ion", "\\u", "table_", "+_", "\"..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "on", ".", "cora", "l", ".", "avail", "abilit", "y", "#", "Thr", "ott", "ling", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Control", " ", "plane", " ", "limit", " ", "exceed", "ed", ",", " ", "retrying", " ", "creati", "on", " ", "of", " ", "\"_", "+_", "destinat", "ion", "\\u", "table_", "+_", "\"..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", " ", "for", " ", "table", " ", "creati", "on", " ", "completion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wait", "\\u", "for", "\\u", "active", "\\u", "table_", "(_", "conn_", ",_", "table", "\\u", "name_", ",_", "\"", "created", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Rec", "rea", "tion", " ", "of", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"", " ", "complete", "d", ".", " ", "Time", " ", "take", "n", ":", " ", "\"_", "+_", "str_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "replace_", "(_", "microsecond_", "=_", "0_", ")_", "-_", "start", "\\u", "time_", ")_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
california-civic-data-coalition/django-calaccess-raw-data/calaccess_raw/models/lobbying.py
[ { "content": " def __str__(self):\n return str(self.filing_id)", "metadata": "root.LattCd.__str__", "header": "['class', 'LattCd', '(', 'CalAccessBaseModel', ')', ':', '___EOS___']", "index": 1891 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Lat", "t", "Cd", "_", "(_", "Cal", "Access", "Base", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "filing", "\\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 ]
Signature mismatch in overriding method
seoester/Git-Deployment-Handler/gitdh/database.py
[ { "content": "class DatabaseBackend(object):\n\n\n\n\n\n\n\n", "metadata": "root.DatabaseBackend", "header": "['module', '___EOS___']", "index": 4 }, { "content": "\t@staticmethod\n\tdef getDatabaseBackend(config):\n\t\tdbEngine = config['Database']['Engine']\n\t\tif dbEngine == 'mysql':\n\t\t\tdb = MySQL(config)\n\t\telif dbEngine == 'mongodb':\n\t\t\tdb = MongoDB(config)\n\t\telif dbEngine == 'sqlite':\n\t\t\tdb = SQLite(config)\n\t\telse:\n\t\t\traise Exception(\"Unknown Database Engine\")\n\t\treturn db", "metadata": "root.DatabaseBackend.getDatabaseBackend", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 5 }, { "content": "\tdef __init__(self, config):\n\t\tself.config = config", "metadata": "root.DatabaseBackend.__init__", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 18 }, { "content": "\tdef getQueuedCommits(self):\n\t\tpass", "metadata": "root.DatabaseBackend.getQueuedCommits", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": "\tdef getAllCommits(self):\n\t\tpass", "metadata": "root.DatabaseBackend.getAllCommits", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": "\tdef insertCommit(self, commit):\n\t\tpass", "metadata": "root.DatabaseBackend.insertCommit", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": "\tdef setStatusWorking(self, commit):\n\t\tself.setStatus(commit, commit.status[:commit.status.rfind('_')] + '_working')", "metadata": "root.DatabaseBackend.setStatusWorking", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": "\tdef setStatusSkipped(self, commit):\n\t\tself.setStatus(commit, commit.status[:commit.status.rfind('_')] + '_skipped')", "metadata": "root.DatabaseBackend.setStatusSkipped", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": "\tdef setStatusFinished(self, commit):\n\t\tself.setStatus(commit, commit.status[:commit.status.rfind('_')] + '_finished')", "metadata": "root.DatabaseBackend.setStatusFinished", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": "\tdef setStatus(self, commit, status):\n\t\tpass", "metadata": "root.DatabaseBackend.setStatus", "header": "['class', 'DatabaseBackend', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": "class MongoDB(DatabaseBackend):\n\n\n\n\n", "metadata": "root.MongoDB", "header": "['module', '___EOS___']", "index": 134 }, { "content": "\tdef __init__(self, config):\n\t\timport pymongo\n\t\tDatabaseBackend.__init__(self, config)\n\t\tconfSection = config['Database']\n\t\tself.client = pymongo.MongoClient(host=confSection['Host'], port=config.getint('Database', 'Port'))\n\t\tself.coll = self.client[confSection['Database']][confSection['Collection']]", "metadata": "root.MongoDB.__init__", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 135 }, { "content": "\tdef getQueuedCommits(self):\n\t\tjsonCommits = self.coll.find({'status': {'$regex': '_queued$'}}, ['_id', 'hash', 'author', 'date', 'message', 'branch', 'repository', 'status']).sort('date')\n\t\tcommits = []\n\t\tfor jsonCommit in jsonCommits:\n\t\t\tcommits.append(GitCommit(jsonCommit['hash'], jsonCommit['author'], jsonCommit['date'], jsonCommit['message'], jsonCommit['branch'], jsonCommit['repository'], id=jsonCommit['_id'], status=jsonCommit['status']))\n\t\treturn commits", "metadata": "root.MongoDB.getQueuedCommits", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 142 }, { "content": "\tdef getAllCommits(self):\n\t\tjsonCommits = self.coll.find({}, ['_id', 'hash', 'author', 'date', 'message', 'branch', 'repository', 'status']).sort('date')\n\t\tcommits = []\n\t\tfor jsonCommit in jsonCommits:\n\t\t\tcommits.append(GitCommit(jsonCommit['hash'], jsonCommit['author'], jsonCommit['date'], jsonCommit['message'], jsonCommit['branch'], jsonCommit['repository'], id=jsonCommit['_id'], status=jsonCommit['status']))\n\t\treturn commits", "metadata": "root.MongoDB.getAllCommits", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 149 }, { "content": "\tdef insertCommit(self, commit):\n\t\tkeys = {'hash', 'author', 'date', 'message', 'branch', 'repository', 'status'}\n\t\tcommitDict = {}\n\t\tfor key in keys:\n\t\t\tcommitDict[key] = getattr(commit, key)\n\t\tself.coll.insert(commitDict)\n\t\tcommit.id = commitDict['_id']", "metadata": "root.MongoDB.insertCommit", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 156 }, { "content": "\tdef setStatus(self, commit, status):\n\t\tcommit.status = status\n\t\tif hasattr(commit, 'id') and not commit.id is None:\n\t\t\tself.coll.update({'_id': commit.id}, {'$set': {'status': status}})", "metadata": "root.MongoDB.setStatus", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 164 }, { "content": "\tdef __del__(self):\n\t\tself.client.disconnect()", "metadata": "root.MongoDB.__del__", "header": "['class', 'MongoDB', '(', 'DatabaseBackend', ')', ':', '___EOS___']", "index": 169 } ]
[]
[]
0
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Databa", "se", "Backend_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "db", "Engine_", "=_", "config_", "[_", "'", "Databa", "se", "'_", "]_", "[_", "'", "Engine", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "db", "Engine_", "==_", "'", "mysql", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "db_", "=_", "My", "SQL_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "db", "Engine_", "==_", "'", "mongodb", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "db_", "=_", "Mon", "go", "DB_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "db", "Engine_", "==_", "'", "sql", "ite", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "db_", "=_", "SQL", "ite_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "Exception_", "(_", "\"", "Un", "know", "n", " ", "Databa", "se", " ", "Engine", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Queued", "Commi", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "All", "Commi", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Commit_", "(_", "self_", ",_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Status", "Work", "ing_", "(_", "self_", ",_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "set", "Status_", "(_", "commit_", ",_", "commit_", "._", "status_", "[_", ":_", "commit_", "._", "status_", "._", "rfind_", "(_", "'\\u'_", ")_", "]_", "+_", "'\\u", "working", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Status", "Skipped", "_", "(_", "self_", ",_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "set", "Status_", "(_", "commit_", ",_", "commit_", "._", "status_", "[_", ":_", "commit_", "._", "status_", "._", "rfind_", "(_", "'\\u'_", ")_", "]_", "+_", "'\\u", "skip", "ped", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Status", "Finished_", "(_", "self_", ",_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "set", "Status_", "(_", "commit_", ",_", "commit_", "._", "status_", "[_", ":_", "commit_", "._", "status_", "._", "rfind_", "(_", "'\\u'_", ")_", "]_", "+_", "'\\u", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Backend_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Status_", "(_", "self_", ",_", "commit_", ",_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "pymongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Databa", "se", "Backend_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "Section_", "=_", "config_", "[_", "'", "Databa", "se", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "pymongo_", "._", "Mon", "go", "Client_", "(_", "host_", "=_", "conf", "Section_", "[_", "'", "Host", "'_", "]_", ",_", "port_", "=_", "config_", "._", "getint_", "(_", "'", "Databa", "se", "'_", ",_", "'", "Port", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "coll_", "=_", "self_", "._", "client_", "[_", "conf", "Section_", "[_", "'", "Databa", "se", "'_", "]_", "]_", "[_", "conf", "Section_", "[_", "'", "Collecti", "on", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Queued", "Commi", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "json", "Commi", "ts_", "=_", "self_", "._", "coll_", "._", "find_", "(_", "{_", "'", "status", "'_", ":_", "{_", "'$", "regex", "'_", ":_", "'\\u", "queue", "d", "$'_", "}_", "}_", ",_", "[_", "'\\u", "id", "'_", ",_", "'", "hash", "'_", ",_", "'", "author", "'_", ",_", "'", "date", "'_", ",_", "'", "message", "'_", ",_", "'", "branch", "'_", ",_", "'", "repos", "itor", "y", "'_", ",_", "'", "status", "'_", "]_", ")_", "._", "sort_", "(_", "'", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "json", "Commit_", "in_", "json", "Commi", "ts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "commits_", "._", "append_", "(_", "Git", "Commit_", "(_", "json", "Commit_", "[_", "'", "hash", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "author", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "date", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "message", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "branch", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "repos", "itor", "y", "'_", "]_", ",_", "id_", "=_", "json", "Commit_", "[_", "'\\u", "id", "'_", "]_", ",_", "status_", "=_", "json", "Commit_", "[_", "'", "status", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "commits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "All", "Commi", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "json", "Commi", "ts_", "=_", "self_", "._", "coll_", "._", "find_", "(_", "{_", "}_", ",_", "[_", "'\\u", "id", "'_", ",_", "'", "hash", "'_", ",_", "'", "author", "'_", ",_", "'", "date", "'_", ",_", "'", "message", "'_", ",_", "'", "branch", "'_", ",_", "'", "repos", "itor", "y", "'_", ",_", "'", "status", "'_", "]_", ")_", "._", "sort_", "(_", "'", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "json", "Commit_", "in_", "json", "Commi", "ts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "commits_", "._", "append_", "(_", "Git", "Commit_", "(_", "json", "Commit_", "[_", "'", "hash", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "author", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "date", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "message", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "branch", "'_", "]_", ",_", "json", "Commit_", "[_", "'", "repos", "itor", "y", "'_", "]_", ",_", "id_", "=_", "json", "Commit_", "[_", "'\\u", "id", "'_", "]_", ",_", "status_", "=_", "json", "Commit_", "[_", "'", "status", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "commits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Commit_", "(_", "self_", ",_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "keys_", "=_", "{_", "'", "hash", "'_", ",_", "'", "author", "'_", ",_", "'", "date", "'_", ",_", "'", "message", "'_", ",_", "'", "branch", "'_", ",_", "'", "repos", "itor", "y", "'_", ",_", "'", "status", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "commit", "Dict_", "[_", "key_", "]_", "=_", "getattr_", "(_", "commit_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "coll_", "._", "insert_", "(_", "commit", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit_", "._", "id_", "=_", "commit", "Dict_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Status_", "(_", "self_", ",_", "commit_", ",_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "commit_", "._", "status_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "commit_", ",_", "'", "id", "'_", ")_", "and_", "not_", "commit_", "._", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "coll_", "._", "update_", "(_", "{_", "'\\u", "id", "'_", ":_", "commit_", "._", "id_", "}_", ",_", "{_", "'$", "set", "'_", ":_", "{_", "'", "status", "'_", ":_", "status_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "DB_", "(_", "Databa", "se", "Backend_", ")_", ":_", "\\u\\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", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "client_", "._", "disconnect_", "(_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
stamparm/maltrail/core/httpd.py
[ { "content": "def start_httpd(address=None, port=None, join=False, pem=None):\n \"\"\"\n Starts HTTP server\n \"\"\"\n\n class ThreadingServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):\n def server_bind(self):\n self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n BaseHTTPServer.HTTPServer.server_bind(self)\n\n def finish_request(self, *args, **kwargs):\n try:\n BaseHTTPServer.HTTPServer.finish_request(self, *args, **kwargs)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n class SSLThreadingServer(ThreadingServer):\n def __init__(self, server_address, pem, HandlerClass):\n import OpenSSL # python-openssl\n\n ThreadingServer.__init__(self, server_address, HandlerClass)\n ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD)\n ctx.use_privatekey_file(pem)\n ctx.use_certificate_file(pem)\n self.socket = OpenSSL.SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type))\n self.server_bind()\n self.server_activate()\n\n def shutdown_request(self, request):\n try:\n request.shutdown()\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n class ReqHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n def do_GET(self):\n path, query = self.path.split('?', 1) if '?' in self.path else (self.path, \"\")\n params = {}\n content = None\n skip = False\n\n if hasattr(self, \"data\"):\n params.update(urlparse.parse_qs(self.data))\n\n if query:\n params.update(urlparse.parse_qs(query))\n\n for key in params:\n if params[key]:\n params[key] = params[key][-1]\n\n if path == '/':\n path = \"index.html\"\n\n path = path.strip('/')\n extension = os.path.splitext(path)[-1].lower()\n\n if hasattr(self, \"_%s\" % path):\n content = getattr(self, \"_%s\" % path)(params)\n\n else:\n path = path.replace('/', os.path.sep)\n path = os.path.abspath(os.path.join(HTML_DIR, path)).strip()\n\n if not os.path.isfile(path) and os.path.isfile(\"%s.html\" % path):\n path = \"%s.html\" % path\n\n if \"..\" not in os.path.relpath(path, HTML_DIR) and os.path.isfile(path) and (extension not in DISABLED_CONTENT_EXTENSIONS or os.path.split(path)[-1] in CONTENT_EXTENSIONS_EXCLUSIONS):\n mtime = time.gmtime(os.path.getmtime(path))\n if_modified_since = self.headers.get(HTTP_HEADER.IF_MODIFIED_SINCE)\n\n if if_modified_since and extension not in (\".htm\", \".html\"):\n if_modified_since = [_ for _ in if_modified_since.split(';') if _.upper().endswith(\"GMT\")][0]\n if time.mktime(mtime) <= time.mktime(time.strptime(if_modified_since, HTTP_TIME_FORMAT)):\n self.send_response(httplib.NOT_MODIFIED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n skip = True\n\n if not skip:\n content = open(path, \"rb\").read()\n last_modified = time.strftime(HTTP_TIME_FORMAT, mtime)\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, mimetypes.guess_type(path)[0] or \"application/octet-stream\")\n self.send_header(HTTP_HEADER.LAST_MODIFIED, last_modified)\n if extension not in (\".htm\", \".html\"):\n self.send_header(HTTP_HEADER.EXPIRES, \"Sun, 17-Jan-2038 19:14:07 GMT\") # Reference: http://blog.httpwatch.com/2007/12/10/two-simple-rules-for-http-caching/\n self.send_header(HTTP_HEADER.CACHE_CONTROL, \"max-age=3600, must-revalidate\") # Reference: http://stackoverflow.com/a/5084555\n else:\n self.send_header(HTTP_HEADER.CACHE_CONTROL, \"no-cache\")\n\n else:\n self.send_response(httplib.NOT_FOUND)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n content = '<!DOCTYPE html><html lang=\"en\"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL %s was not found on this server.</p></body></html>' % self.path.split('?')[0]\n\n if content is not None:\n for match in re.finditer(r\"<\\!(\\w+)\\!>\", content):\n name = match.group(1)\n _ = getattr(self, \"_%s\" % name.lower(), None)\n if _:\n content = self._format(content, **{ name: _() })\n\n if \"gzip\" in self.headers.getheader(HTTP_HEADER.ACCEPT_ENCODING, \"\"):\n self.send_header(HTTP_HEADER.CONTENT_ENCODING, \"gzip\")\n _ = cStringIO.StringIO()\n compress = gzip.GzipFile(\"\", \"w+b\", 9, _)\n compress._stream = _\n compress.write(content)\n compress.flush()\n compress.close()\n content = compress._stream.getvalue()\n\n self.send_header(HTTP_HEADER.CONTENT_LENGTH, str(len(content)))\n\n self.end_headers()\n\n if content:\n self.wfile.write(content)\n\n self.wfile.flush()\n self.wfile.close()\n\n def do_POST(self):\n length = self.headers.getheader(HTTP_HEADER.CONTENT_LENGTH)\n data = self.rfile.read(int(length))\n data = urllib.unquote_plus(data)\n self.data = data\n self.do_GET()\n\n def get_session(self):\n retval = None\n cookie = self.headers.get(HTTP_HEADER.COOKIE)\n\n if cookie:\n match = re.search(r\"%s\\s*=\\s*([^;]+)\" % SESSION_COOKIE_NAME, cookie)\n if match:\n session = match.group(1)\n if session in SESSIONS:\n if SESSIONS[session].client_ip != self.client_address[0]:\n pass\n elif SESSIONS[session].expiration > time.time():\n retval = SESSIONS[session]\n else:\n del SESSIONS[session]\n\n return retval\n\n def delete_session(self):\n cookie = self.headers.get(HTTP_HEADER.COOKIE)\n\n if cookie:\n match = re.search(r\"%s=(.+)\" % SESSION_COOKIE_NAME, cookie)\n if match:\n session = match.group(1)\n if session in SESSIONS:\n del SESSIONS[session]\n\n def version_string(self):\n return SERVER_HEADER\n\n def end_headers(self):\n if not hasattr(self, \"_headers_ended\"):\n BaseHTTPServer.BaseHTTPRequestHandler.end_headers(self)\n self._headers_ended = True\n\n def log_message(self, format, *args):\n return\n\n def finish(self):\n try:\n BaseHTTPServer.BaseHTTPRequestHandler.finish(self)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n def _version(self):\n return VERSION\n\n def _format(self, content, **params):\n if content:\n for key, value in params.items():\n content = content.replace(\"<!%s!>\" % key, value)\n\n return content\n\n def _login(self, params):\n valid = False\n\n if params.get(\"username\") and params.get(\"hash\") and params.get(\"nonce\"):\n if params.get(\"nonce\") not in DISPOSED_NONCES:\n DISPOSED_NONCES.add(params.get(\"nonce\"))\n for entry in (config.USERS or []):\n entry = re.sub(r\"\\s\", \"\", entry)\n username, stored_hash, uid, netfilter = entry.split(':')\n if username == params.get(\"username\"):\n try:\n if params.get(\"hash\") == hashlib.sha256(stored_hash.strip() + params.get(\"nonce\")).hexdigest():\n valid = True\n break\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n if valid:\n session_id = os.urandom(SESSION_ID_LENGTH).encode(\"hex\")\n expiration = time.time() + 3600 * SESSION_EXPIRATION_HOURS\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.SET_COOKIE, \"%s=%s; expires=%s; path=/; HttpOnly\" % (SESSION_COOKIE_NAME, session_id, time.strftime(HTTP_TIME_FORMAT, time.gmtime(expiration))))\n\n if netfilter in (\"\", \"0.0.0.0/0\"):\n netfilters = None\n else:\n addresses = set()\n netmasks = set()\n\n for item in set(re.split(r\"[;,]\", netfilter)):\n item = item.strip()\n if '/' in item:\n _ = item.split('/')[-1]\n if _.isdigit() and int(_) >= 16:\n lower = addr_to_int(item.split('/')[0])\n mask = make_mask(int(_))\n upper = lower | (0xffffffff ^ mask)\n while lower <= upper:\n addresses.add(int_to_addr(lower))\n lower += 1\n else:\n netmasks.add(item)\n elif '-' in item:\n _ = item.split('-')\n lower, upper = addr_to_int(_[0]), addr_to_int(_[1])\n while lower <= upper:\n addresses.add(int_to_addr(lower))\n lower += 1\n elif re.search(r\"\\d+\\.\\d+\\.\\d+\\.\\d+\", item):\n addresses.add(item)\n\n netfilters = netmasks\n if addresses:\n netfilters.add(get_regex(addresses))\n\n SESSIONS[session_id] = AttribDict({\"username\": username, \"uid\": uid, \"netfilters\": netfilters, \"expiration\": expiration, \"client_ip\": self.client_address[0]})\n else:\n time.sleep(UNAUTHORIZED_SLEEP_TIME)\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n content = \"Login %s\" % (\"success\" if valid else \"failed\")\n\n if not subprocess.mswindows:\n try:\n subprocess.check_output(\"logger -p auth.info -t \\\"%s[%d]\\\" \\\"%s password for %s from %s port %s\\\"\" % (NAME.lower(), os.getpid(), \"Accepted\" if valid else \"Failed\", params.get(\"username\"), self.client_address[0], self.client_address[1]), stderr=subprocess.STDOUT, shell=True)\n except Exception:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n return content\n\n def _logout(self, params):\n self.delete_session()\n self.send_response(httplib.FOUND)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.LOCATION, \"/\")\n\n def _whoami(self, params):\n session = self.get_session()\n username = session.username if session else \"\"\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return username\n\n def _check_ip(self, params):\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n try:\n result_worst = worst_asns(params.get(\"address\"))\n if result_worst:\n result_ipcat = result_worst\n else:\n _ = (ipcat_lookup(params.get(\"address\")) or \"\").lower().split(' ')\n result_ipcat = _[1] if _[0] == 'the' else _[0]\n return (\"%s\" if not params.get(\"callback\") else \"%s(%%s)\" % params.get(\"callback\")) % json.dumps({\"ipcat\": result_ipcat, \"worst_asns\": str(result_worst is not None).lower()})\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n def _trails(self, params):\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return open(TRAILS_FILE, \"rb\").read()\n\n def _ping(self, params):\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return PING_RESPONSE\n\n def _events(self, params):\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n start, end, size, total = None, None, -1, None\n content = None\n event_log_path = os.path.join(config.LOG_DIR, \"%s.log\" % params.get(\"date\", \"\"))\n\n if os.path.exists(event_log_path):\n total = os.stat(event_log_path).st_size\n\n if self.headers.get(HTTP_HEADER.RANGE):\n match = re.search(r\"bytes=(\\d+)-(\\d+)\", self.headers[HTTP_HEADER.RANGE])\n if match:\n start, end = int(match.group(1)), int(match.group(2))\n max_size = end - start + 1\n end = min(total - 1, end)\n size = end - start + 1\n\n if start == 0 or not session.range_handle:\n session.range_handle = open(event_log_path, \"rb\")\n\n if session.netfilters is None:\n session.range_handle.seek(start)\n self.send_response(httplib.PARTIAL_CONTENT)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes %d-%d/%d\" % (start, end, total))\n content = session.range_handle.read(size)\n else:\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n buffer, addresses, netmasks, regex = cStringIO.StringIO(), set(), [], \"\"\n for netfilter in session.netfilters:\n if not netfilter:\n continue\n if '/' in netfilter:\n netmasks.append(netfilter)\n elif re.search(r\"\\A[\\d.]+\\Z\", netfilter):\n addresses.add(netfilter)\n elif '\\.' in netfilter:\n regex = r\"\\b(%s)\\b\" % netfilter\n else:\n print \"[!] invalid network filter '%s'\" % netfilter\n return\n\n for line in session.range_handle:\n display = False\n ip = None\n\n if regex:\n match = re.search(regex, line)\n if match:\n ip = match.group(1)\n display = True\n\n if not display and (addresses or netmasks):\n for match in re.finditer(r\"\\b(\\d+\\.\\d+\\.\\d+\\.\\d+)\\b\", line):\n if not display:\n ip = match.group(1)\n else:\n break\n\n if ip in addresses:\n display = True\n break\n elif netmasks:\n for _ in netmasks:\n prefix, mask = _.split('/')\n if addr_to_int(ip) & make_mask(int(mask)) == addr_to_int(prefix):\n addresses.add(ip)\n display = True\n break\n\n if display:\n if \",%s\" % ip in line or \"%s,\" % ip in line:\n line = re.sub(r\" ([\\d.,]+,)?%s(,[\\d.,]+)? \" % re.escape(ip), \" %s \" % ip, line)\n buffer.write(line)\n if buffer.tell() >= max_size:\n break\n\n content = buffer.getvalue()\n end = start + len(content) - 1\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes %d-%d/%d\" % (start, end, end + 1 + max_size * (len(content) >= max_size)))\n\n if len(content) < max_size:\n session.range_handle.close()\n session.range_handle = None\n\n if size == -1:\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n self.end_headers()\n\n with open(event_log_path, \"rb\") as f:\n while True:\n data = f.read(io.DEFAULT_BUFFER_SIZE)\n if not data:\n break\n else:\n self.wfile.write(data)\n\n else:\n self.send_response(httplib.OK) # instead of httplib.NO_CONTENT (compatibility reasons)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n if self.headers.get(HTTP_HEADER.RANGE):\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes 0-0/0\")\n\n return content\n\n def _counts(self, params):\n counts = {}\n\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"application/json\")\n\n match = re.search(r\"\\d+\\-\\d+\\-\\d+\", params.get(\"from\", \"\"))\n if match:\n min_ = datetime.datetime.strptime(match.group(0), DATE_FORMAT)\n else:\n min_ = datetime.datetime.fromtimestamp(0)\n\n match = re.search(r\"\\d+\\-\\d+\\-\\d+\", params.get(\"to\", \"\"))\n if match:\n max_ = datetime.datetime.strptime(match.group(0), DATE_FORMAT)\n else:\n max_ = datetime.datetime.now()\n\n min_ = min_.replace(hour=0, minute=0, second=0, microsecond=0)\n max_ = max_.replace(hour=23, minute=59, second=59, microsecond=999999)\n\n for filepath in sorted(glob.glob(os.path.join(config.LOG_DIR, \"*.log\"))):\n filename = os.path.basename(filepath)\n if not re.search(r\"\\A\\d{4}-\\d{2}-\\d{2}\\.log\\Z\", filename):\n continue\n try:\n current = datetime.datetime.strptime(os.path.splitext(filename)[0], DATE_FORMAT)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n else:\n if min_ <= current <= max_:\n timestamp = int(time.mktime(current.timetuple()))\n size = os.path.getsize(filepath)\n with open(filepath, \"rb\") as f:\n content = f.read(io.DEFAULT_BUFFER_SIZE)\n if size >= io.DEFAULT_BUFFER_SIZE:\n total = 1.0 * content.count('\\n') * size / io.DEFAULT_BUFFER_SIZE\n counts[timestamp] = int(round(total / 100) * 100)\n else:\n counts[timestamp] = content.count('\\n')\n\n return json.dumps(counts)\n\n class SSLReqHandler(ReqHandler):\n def setup(self):\n self.connection = self.request\n self.rfile = socket._fileobject(self.request, \"rb\", self.rbufsize)\n self.wfile = socket._fileobject(self.request, \"wb\", self.wbufsize)\n\n try:\n if pem:\n server = SSLThreadingServer((address or '', int(port) if str(port or \"\").isdigit() else 0), pem, SSLReqHandler)\n else:\n server = ThreadingServer((address or '', int(port) if str(port or \"\").isdigit() else 0), ReqHandler)\n except Exception as ex:\n if \"Address already in use\" in str(ex):\n exit(\"[!] another instance already running\")\n elif \"Name or service not known\" in str(ex):\n exit(\"[!] invalid configuration value for 'HTTP_ADDRESS' ('%s')\" % config.HTTP_ADDRESS)\n elif \"Cannot assign requested address\" in str(ex):\n exit(\"[!] can't use configuration value for 'HTTP_ADDRESS' ('%s')\" % config.HTTP_ADDRESS)\n else:\n raise\n\n print \"[i] starting HTTP%s server at 'http%s://%s:%d/'\" % ('S' if pem else \"\", 's' if pem else \"\", server.server_address[0], server.server_address[1])\n\n print \"[o] running...\"\n\n if join:\n server.serve_forever()\n else:\n thread = threading.Thread(target=server.serve_forever)\n thread.daemon = True\n thread.start()", "metadata": "root.start_httpd", "header": "['module', '___EOS___']", "index": 68 } ]
[]
[]
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_", "start", "\\u", "httpd_", "(_", "address_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "join_", "=_", "False_", ",_", "pem_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "s", " ", "HTTP", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Thread", "ing", "Server_", "(_", "Sock", "et", "Server_", "._", "Thread", "ing", "Mix", "In_", ",_", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "server", "\\u", "bind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", "._", "server", "\\u", "bind_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish", "\\u", "request_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\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 ", " _", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", "._", "finish", "\\u", "request_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SS", "LT", "hread", "ing", "Server_", "(_", "Thread", "ing", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server", "\\u", "address_", ",_", "pem_", ",_", "Handle", "r", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Open", "SSL_", "#", " ", "python", "-", "openss", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Thread", "ing", "Server_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server", "\\u", "address_", ",_", "Handle", "r", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "Open", "SSL_", "._", "SSL_", "._", "Context_", "(_", "Open", "SSL_", "._", "SSL_", "._", "TLS", "v1", "\\u", "METHOD_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "use", "\\u", "private", "key", "\\u", "file_", "(_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "use", "\\u", "certifica", "te", "\\u", "file_", "(_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "socket_", "=_", "Open", "SSL_", "._", "SSL_", "._", "Connection_", "(_", "ctx_", ",_", "socket_", "._", "socket_", "(_", "self_", "._", "address", "\\u", "family_", ",_", "self_", "._", "socket", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "bind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shut", "down", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Re", "q", "Handler_", "(_", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", ",_", "query_", "=_", "self_", "._", "path_", "._", "split_", "(_", "'?'_", ",_", "1_", ")_", "if_", "'?'_", "in_", "self_", "._", "path_", "else_", "(_", "self_", "._", "path_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "data", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "._", "update_", "(_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "self_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "._", "update_", "(_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "params_", "[_", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "params_", "[_", "key_", "]_", "=_", "params_", "[_", "key_", "]_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "path_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "\"", "index", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "path_", "._", "strip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extension_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "path_", ")_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "getattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "path_", ")_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "path_", "._", "replace_", "(_", "'/'_", ",_", "os_", "._", "path_", "._", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "HTM", "L", "\\u", "DIR_", ",_", "path_", ")_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "\"%", "s", ".", "html", "\"_", "%_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "\"%", "s", ".", "html", "\"_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"..\"_", "not_", "in_", "os_", "._", "path_", "._", "relpath_", "(_", "path_", ",_", "HTM", "L", "\\u", "DIR_", ")_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "and_", "(_", "extension_", "not_", "in_", "DISABLED", "\\u", "CONTE", "NT", "\\u", "EXTENSIONS_", "or_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "[_", "-_", "1_", "]_", "in_", "CONTE", "NT", "\\u", "EXTENSION", "S", "\\u", "EXC", "LUS", "IONS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mtime_", "=_", "time_", "._", "gmtime_", "(_", "os_", "._", "path_", "._", "getmtime_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "\\u", "modifi", "ed", "\\u", "since_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "IF", "\\u", "MODIFIE", "D", "\\u", "SIN", "CE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "if", "\\u", "modifi", "ed", "\\u", "since_", "and_", "extension_", "not_", "in_", "(_", "\".", "ht", "m", "\"_", ",_", "\".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if", "\\u", "modifi", "ed", "\\u", "since_", "=_", "[_", "\\u_", "for_", "\\u_", "in_", "if", "\\u", "modifi", "ed", "\\u", "since_", "._", "split_", "(_", "';'_", ")_", "if_", "\\u_", "._", "upper_", "(_", ")_", "._", "endswith_", "(_", "\"", "GM", "T", "\"_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time_", "._", "mktime_", "(_", "mtime_", ")_", "<=_", "time_", "._", "mktime_", "(_", "time_", "._", "strptime_", "(_", "if", "\\u", "modifi", "ed", "\\u", "since_", ",_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "NOT", "\\u", "MODIFIE", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "modified_", "=_", "time_", "._", "strftime_", "(_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ",_", "mtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "path_", ")_", "[_", "0_", "]_", "or_", "\"", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "LAS", "T", "\\u", "MODIFIE", "D_", ",_", "last", "\\u", "modified_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extension_", "not_", "in_", "(_", "\".", "ht", "m", "\"_", ",_", "\".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "EXPIRE", "S_", ",_", "\"", "Sun", ",", " ", "1", "7", "-", "Jan", "-", "203", "8", " ", "1", "9", ":", "14", ":", "0", "7", " ", "GM", "T", "\"_", ")_", "#", " ", "Reference", ":", " ", "http", "://", "blog", ".", "http", "watch", ".", "com", "/", "2007", "/", "1", "2", "/", "10", "/", "two", "-", "simple", "-", "rule", "s", "-", "for", "-", "http", "-", "caching", "/_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CACHE", "\\u", "CONTROL_", ",_", "\"", "max", "-", "age", "=", "3600", ",", " ", "must", "-", "rev", "alid", "ate", "\"_", ")_", "#", " ", "Reference", ":", " ", "http", "://", "stack", "overflow", ".", "com", "/", "a", "/", "508", "455", "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 ", " ", " _", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CACHE", "\\u", "CONTROL_", ",_", "\"", "no", "-", "cache", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "NOT", "\\u", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "'<!", "DOC", "TYPE", " ", "html", "><", "html", " ", "lang", "=\"", "en", "\">", "<", "head", "><", "title", ">", "404", " ", "Not", " ", "Foun", "d", "</", "title", "><", "/", "head", "><", "body", "><", "h1", ">", "Not", " ", "Foun", "d", "</", "h1", "><", "p", ">", "The", " ", "request", "ed", " ", "URL", " ", "%", "s", " ", "was", " ", "not", " ", "found", " ", "on", " ", "this", " ", "server", ".", "</", "p", "><", "/", "body", "><", "/", "html", ">'_", "%_", "self_", "._", "path_", "._", "split_", "(_", "'?'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "content_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"<", "\\\\", "!(", "\\\\", "w", "+)\\\\", "!", ">\"_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "getattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "name_", "._", "lower_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "self_", "._", "\\u", "format_", "(_", "content_", ",_", "**_", "{_", "name_", ":_", "\\u_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "gzip", "\"_", "in_", "self_", "._", "headers_", "._", "getheader_", "(_", "HTTP", "\\u", "HEADER_", "._", "ACCEPT", "\\u", "ENCODING_", ",_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "ENCODING_", ",_", "\"", "gzip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "=_", "gzip_", "._", "Gz", "ip", "File_", "(_", "\"\"_", ",_", "\"", "w", "+", "b", "\"_", ",_", "9_", ",_", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "\\u", "stream_", "=_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "compress_", "._", "\\u", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "LENGTH_", ",_", "str_", "(_", "len_", "(_", "content_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wfile_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "wfile_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "POST_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "self_", "._", "headers_", "._", "getheader_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "LENGTH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "rfile_", "._", "read_", "(_", "int_", "(_", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "urllib_", "._", "unqu", "ote", "\\u", "plus_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "\\u", "GET_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "session_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"%", "s", "\\\\", "s", "*=", "\\\\", "s", "*([", "^", ";", "]+)\"", "_", "%_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "cookie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "session_", "in_", "SES", "SION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "SES", "SION", "S_", "[_", "session_", "]_", "._", "client", "\\u", "ip_", "!=_", "self_", "._", "client", "\\u", "address_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "SES", "SION", "S_", "[_", "session_", "]_", "._", "expiration_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "retval_", "=_", "SES", "SION", "S_", "[_", "session_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "SES", "SION", "S_", "[_", "session_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "session_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cookie_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"%", "s", "=(", ".+)", "\"_", "%_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "cookie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "session_", "in_", "SES", "SION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "SES", "SION", "S_", "[_", "session_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "version", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SERVER", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "end", "\\u", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "\"\\u", "header", "s", "\\u", "ende", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", "._", "end", "\\u", "headers_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "header", "s", "\\u", "ended_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "message_", "(_", "self_", ",_", "format_", ",_", "*_", "args_", ")_", ":_", "\\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_", "def_", "finish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", "._", "finish_", "(_", "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 ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "def_", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "format_", "(_", "self_", ",_", "content_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "params_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "=_", "content_", "._", "replace_", "(_", "\"<", "!%", "s", "!", ">\"_", "%_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "login_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", "and_", "params_", "._", "get_", "(_", "\"", "hash", "\"_", ")_", "and_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", "not_", "in_", "DISP", "OSE", "D", "\\u", "NON", "CES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "DISP", "OSE", "D", "\\u", "NON", "CES", "_", "._", "add_", "(_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry_", "in_", "(_", "config_", "._", "USERS", "_", "or_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "entry_", "=_", "re_", "._", "sub_", "(_", "r", "\"\\\\", "s", "\"_", ",_", "\"\"_", ",_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", ",_", "store", "d\\u", "hash_", ",_", "uid_", ",_", "netf", "ilter_", "=_", "entry_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "==_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "params_", "._", "get_", "(_", "\"", "hash", "\"_", ")_", "==_", "hashlib_", "._", "sha256_", "(_", "store", "d\\u", "hash_", "._", "strip_", "(_", ")_", "+_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ")_", "._", "hexdigest_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session", "\\u", "id_", "=_", "os_", "._", "urandom_", "(_", "SES", "SION", "\\u", "ID", "\\u", "LENGTH_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expiration_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "3600_", "*_", "SES", "SION", "\\u", "EXP", "IRA", "TIO", "N", "\\u", "HOUR", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "SET", "\\u", "COOKIE", "_", ",_", "\"%", "s", "=", "%", "s", ";", " ", "expir", "es", "=", "%", "s", ";", " ", "path", "=", "/", ";", " ", "Http", "On", "ly", "\"_", "%_", "(_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "session", "\\u", "id_", ",_", "time_", "._", "strftime_", "(_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ",_", "time_", "._", "gmtime_", "(_", "expiration_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "netf", "ilter_", "in_", "(_", "\"\"_", ",_", "\"", "0.", "0.", "0.", "0", "/", "0", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "netf", "ilter", "s_", "=_", "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 ", " ", "_", "addresses_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "masks_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "set_", "(_", "re_", "._", "split_", "(_", "r", "\"[", ";", ",]", "\"_", ",_", "netf", "ilter_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item_", "=_", "item_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'/'_", "in_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u_", "=_", "item_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u_", "._", "isdigit_", "(_", ")_", "and_", "int_", "(_", "\\u_", ")_", ">=_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lower_", "=_", "addr", "\\u", "to", "\\u", "int_", "(_", "item_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "make", "\\u", "mask_", "(_", "int_", "(_", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper_", "=_", "lower_", "|_", "(_", "0xffffffff_", "^_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "lower_", "<=_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "int\\u", "to", "\\u", "addr_", "(_", "lower_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "net", "masks_", "._", "add_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'-'_", "in_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u_", "=_", "item_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", ",_", "upper_", "=_", "addr", "\\u", "to", "\\u", "int_", "(_", "\\u_", "[_", "0_", "]_", ")_", ",_", "addr", "\\u", "to", "\\u", "int_", "(_", "\\u_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "lower_", "<=_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "int\\u", "to", "\\u", "addr_", "(_", "lower_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\"_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "netf", "ilter", "s_", "=_", "net", "masks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addresses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "netf", "ilter", "s_", "._", "add_", "(_", "get", "\\u", "regex_", "(_", "addresses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SES", "SION", "S_", "[_", "session", "\\u", "id_", "]_", "=_", "Attrib", "Dict_", "(_", "{_", "\"", "user", "name", "\"_", ":_", "username_", ",_", "\"", "uid", "\"_", ":_", "uid_", ",_", "\"", "netf", "ilter", "s", "\"_", ":_", "netf", "ilter", "s_", ",_", "\"", "expir", "ation", "\"_", ":_", "expiration_", ",_", "\"", "client", "\\u", "ip", "\"_", ":_", "self_", "._", "client", "\\u", "address_", "[_", "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 ", " _", "time_", "._", "sleep_", "(_", "UNA", "UTH", "ORI", "ZED", "\\u", "SLEEP", "\\u", "TIME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "\"", "Logi", "n", " ", "%", "s", "\"_", "%_", "(_", "\"", "success", "\"_", "if_", "valid_", "else_", "\"", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "subprocess_", "._", "ms", "windows_", ":_", "\\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 ", " ", "_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\"", "logg", "er", " ", "-", "p", " ", "auth", ".", "info", " ", "-", "t", " ", "\\\\\"", "%", "s", "[", "%", "d", "]\\\\", "\"", " ", "\\\\\"", "%", "s", " ", "password", " ", "for", " ", "%", "s", " ", "from", " ", "%", "s", " ", "port", " ", "%", "s", "\\\\\"\"_", "%_", "(_", "NAME_", "._", "lower_", "(_", ")_", ",_", "os_", "._", "getpid_", "(_", ")_", ",_", "\"", "Accept", "ed", "\"_", "if_", "valid_", "else_", "\"", "Fail", "ed", "\"_", ",_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", ",_", "self_", "._", "client", "\\u", "address_", "[_", "0_", "]_", ",_", "self_", "._", "client", "\\u", "address_", "[_", "1_", "]_", ")_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "shell_", "=_", "True_", ")_", "\\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 ", " ", "_", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "logout_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delete", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "LOCATION_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "who", "ami_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "session_", "._", "username_", "if_", "session_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "ip_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\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 ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "worst", "_", "=_", "worst", "\\u", "asn", "s_", "(_", "params_", "._", "get_", "(_", "\"", "address", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "worst", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result", "\\u", "ipc", "at_", "=_", "result", "\\u", "worst", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u_", "=_", "(_", "ipc", "at", "\\u", "lookup_", "(_", "params_", "._", "get_", "(_", "\"", "address", "\"_", ")_", ")_", "or_", "\"\"_", ")_", "._", "lower_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "ipc", "at_", "=_", "\\u_", "[_", "1_", "]_", "if_", "\\u_", "[_", "0_", "]_", "==_", "'", "the", "'_", "else_", "\\u_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\"%", "s", "\"_", "if_", "not_", "params_", "._", "get_", "(_", "\"", "callback", "\"_", ")_", "else_", "\"%", "s", "(%", "%", "s", ")\"_", "%_", "params_", "._", "get_", "(_", "\"", "callback", "\"_", ")_", ")_", "%_", "json_", "._", "dumps_", "(_", "{_", "\"", "ipc", "at", "\"_", ":_", "result", "\\u", "ipc", "at_", ",_", "\"", "worst", "\\u", "asn", "s", "\"_", ":_", "str_", "(_", "result", "\\u", "worst", "_", "is_", "not_", "None_", ")_", "._", "lower_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "def_", "\\u", "trail", "s_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "open_", "(_", "TRA", "IL", "S", "\\u", "FILE_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ping_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "PING", "\\u", "RESPONSE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "events_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\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 ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", ",_", "end_", ",_", "size_", ",_", "total_", "=_", "None_", ",_", "None_", ",_", "-_", "1_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "log", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "LOG", "\\u", "DIR_", ",_", "\"%", "s", ".", "log", "\"_", "%_", "params_", "._", "get_", "(_", "\"", "date", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "event", "\\u", "log", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "=_", "os_", "._", "stat_", "(_", "event", "\\u", "log", "\\u", "path_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"", "bytes", "=(", "\\\\", "d", "+)", "-(", "\\\\", "d", "+)\"_", ",_", "self_", "._", "headers_", "[_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start_", ",_", "end_", "=_", "int_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", ",_", "int_", "(_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "size_", "=_", "end_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "min_", "(_", "total_", "-_", "1_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "end_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start_", "==_", "0_", "or_", "not_", "session_", "._", "range", "\\u", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "=_", "open_", "(_", "event", "\\u", "log", "\\u", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "session_", "._", "netf", "ilter", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "._", "seek_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "PARTI", "AL", "\\u", "CONTENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "%", "d", "-%", "d", "/", "%", "d", "\"_", "%_", "(_", "start_", ",_", "end_", ",_", "total_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "session_", "._", "range", "\\u", "handle_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", ",_", "addresses_", ",_", "net", "masks_", ",_", "regex_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", ",_", "set_", "(_", ")_", ",_", "[_", "]_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "netf", "ilter_", "in_", "session_", "._", "netf", "ilter", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "netf", "ilter_", ":_", "\\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_", "'/'_", "in_", "netf", "ilter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "net", "masks_", "._", "append_", "(_", "netf", "ilter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "\"\\\\", "A", "[\\\\", "d", ".]+", "\\\\", "Z", "\"_", ",_", "netf", "ilter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "netf", "ilter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'\\\\.", "'_", "in_", "netf", "ilter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "regex_", "=_", "r", "\"\\\\", "b", "(%", "s", ")\\\\", "b", "\"_", "%_", "netf", "ilter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "!]", " ", "invalid", " ", "network", " ", "filter", " ", "'%", "s", "'\"_", "%_", "netf", "ilter_", "\\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_", "for_", "line_", "in_", "session_", "._", "range", "\\u", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "display_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "regex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "match_", "=_", "re_", "._", "search_", "(_", "regex_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "ip_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "display_", "and_", "(_", "addresses_", "or_", "net", "masks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"\\\\", "b", "(\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+)\\\\", "b", "\"_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "if_", "not_", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "ip_", "=_", "match_", "._", "group_", "(_", "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 ", " ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ip_", "in_", "addresses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "display_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "net", "masks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "for_", "\\u_", "in_", "net", "masks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "prefix_", ",_", "mask_", "=_", "\\u_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addr", "\\u", "to", "\\u", "int_", "(_", "ip_", ")_", "&_", "make", "\\u", "mask_", "(_", "int_", "(_", "mask_", ")_", ")_", "==_", "addr", "\\u", "to", "\\u", "int_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "addresses_", "._", "add_", "(_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\",", "%", "s", "\"_", "%_", "ip_", "in_", "line_", "or_", "\"%", "s", ",\"_", "%_", "ip_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "line_", "=_", "re_", "._", "sub_", "(_", "r", "\"", " ", "([\\\\", "d", ".,", "]+", ",)", "?", "%", "s", "(", ",", "[\\\\", "d", ".,", "]+)", "?", " ", "\"_", "%_", "re_", "._", "escape_", "(_", "ip_", ")_", ",_", "\"", " ", "%", "s", " ", "\"_", "%_", "ip_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buffer_", "._", "write_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buffer_", "._", "tell_", "(_", ")_", ">=_", "max", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content_", "=_", "buffer_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "start_", "+_", "len_", "(_", "content_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "%", "d", "-%", "d", "/", "%", "d", "\"_", "%_", "(_", "start_", ",_", "end_", ",_", "end_", "+_", "1_", "+_", "max", "\\u", "size_", "*_", "(_", "len_", "(_", "content_", ")_", ">=_", "max", "\\u", "size_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", "<_", "max", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "range", "\\u", "handle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "size_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "event", "\\u", "log", "\\u", "path_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "f_", "._", "read_", "(_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "wfile_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "#", " ", "inst", "ead", " ", "of", " ", "http", "lib", ".", "NO", "\\u", "CONTE", "NT", " ", "(", "compatibility", " ", "reasons", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "0", "-0", "/", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "counts_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\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 ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\", "-\\\\", "d", "+\\\\", "-\\\\", "d", "+\"_", ",_", "params_", "._", "get_", "(_", "\"", "from", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "match_", "._", "group_", "(_", "0_", ")_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\", "-\\\\", "d", "+\\\\", "-\\\\", "d", "+\"_", ",_", "params_", "._", "get_", "(_", "\"", "to", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "match_", "._", "group_", "(_", "0_", ")_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u_", "=_", "min", "\\u_", "._", "replace_", "(_", "hour_", "=_", "0_", ",_", "minute_", "=_", "0_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u_", "=_", "max", "\\u_", "._", "replace_", "(_", "hour_", "=_", "23_", ",_", "minute_", "=_", "59_", ",_", "second_", "=_", "59_", ",_", "microsecond_", "=_", "999999", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filepath_", "in_", "sorted_", "(_", "glob_", "._", "glob_", "(_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "LOG", "\\u", "DIR_", ",_", "\"*", ".", "log", "\"_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "re_", "._", "search_", "(_", "r", "\"\\\\", "A", "\\\\", "d", "{", "4", "}-", "\\\\", "d", "{", "2", "}-", "\\\\", "d", "{", "2", "}\\\\.", "log", "\\\\", "Z", "\"_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "[_", "0_", "]_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "min", "\\u_", "<=_", "current_", "<=_", "max", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "timestamp_", "=_", "int_", "(_", "time_", "._", "mktime_", "(_", "current_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "os_", "._", "path_", "._", "getsize_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filepath_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "f_", "._", "read_", "(_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", ">=_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "total_", "=_", "1.0_", "*_", "content_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "*_", "size_", "/_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "[_", "timestamp_", "]_", "=_", "int_", "(_", "round_", "(_", "total_", "/_", "100_", ")_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "counts_", "[_", "timestamp_", "]_", "=_", "content_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SS", "LR", "eq", "Handler_", "(_", "Re", "q", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "self_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rfile_", "=_", "socket_", "._", "\\u", "fileo", "bject_", "(_", "self_", "._", "request_", ",_", "\"", "rb", "\"_", ",_", "self_", "._", "rbu", "fsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "=_", "socket_", "._", "\\u", "fileo", "bject_", "(_", "self_", "._", "request_", ",_", "\"", "wb", "\"_", ",_", "self_", "._", "wb", "uf", "size_", ")_", "\\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 ", " _", "if_", "pem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "SS", "LT", "hread", "ing", "Server_", "(_", "(_", "address_", "or_", "''_", ",_", "int_", "(_", "port_", ")_", "if_", "str_", "(_", "port_", "or_", "\"\"_", ")_", "._", "isdigit_", "(_", ")_", "else_", "0_", ")_", ",_", "pem_", ",_", "SS", "LR", "eq", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "Thread", "ing", "Server_", "(_", "(_", "address_", "or_", "''_", ",_", "int_", "(_", "port_", ")_", "if_", "str_", "(_", "port_", "or_", "\"\"_", ")_", "._", "isdigit_", "(_", ")_", "else_", "0_", ")_", ",_", "Re", "q", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "Address", " ", "alr", "ead", "y", " ", "in", " ", "use", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "anot", "her", " ", "instance", " ", "alr", "ead", "y", " ", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Name", " ", "or", " ", "service", " ", "not", " ", "know", "n", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "invalid", " ", "configura", "tion", " ", "value", " ", "for", " ", "'", "HTTP", "\\u", "ADDR", "ESS", "'", " ", "('", "%", "s", "')\"_", "%_", "config_", "._", "HTTP", "\\u", "ADDRESS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Cann", "ot", " ", "assign", " ", "request", "ed", " ", "address", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "can", "'", "t", " ", "use", " ", "configura", "tion", " ", "value", " ", "for", " ", "'", "HTTP", "\\u", "ADDR", "ESS", "'", " ", "('", "%", "s", "')\"_", "%_", "config_", "._", "HTTP", "\\u", "ADDRESS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "i", "]", " ", "startin", "g", " ", "HTTP", "%", "s", " ", "server", " ", "at", " ", "'", "http", "%", "s", "://", "%", "s", ":", "%", "d", "/'", "\"_", "%_", "(_", "'", "S", "'_", "if_", "pem_", "else_", "\"\"_", ",_", "'", "s", "'_", "if_", "pem_", "else_", "\"\"_", ",_", "server_", "._", "server", "\\u", "address_", "[_", "0_", "]_", ",_", "server_", "._", "server", "\\u", "address_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"[", "o", "]", " ", "runn", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "join_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "serve", "\\u", "forever_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "server_", "._", "serve", "\\u", "forever_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
kivy/kivy/kivy/tests/test_image.py
[ { "content": "import unittest\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ImageTestCase(unittest.TestCase):\n\n", "metadata": "root.ImageTestCase", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def setUp(self):\n from kivy.core.image import Image\n import os\n self.cls = Image\n self.image = os.path.join(os.path.dirname(__file__), 'test_button.png')\n print(self.image)\n self.root = Image(self.image)", "metadata": "root.ImageTestCase.setUp", "header": "['class', 'ImageTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 5 }, { "content": " def test_keep_data(self):\n root = self.root\n texture = root.texture\n self.assertEqual(root._image._data[0].data, None)\n i1 = self.cls(self.image, keep_data=True)\n if not i1._image._data[0].data:\n self.fail('Image has no data even with keep_data = True')", "metadata": "root.ImageTestCase.test_keep_data", "header": "['class', 'ImageTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Image", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "kivy_", "._", "core_", "._", "image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cls_", "=_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "image_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "test\\u", "button", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "self_", "._", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "=_", "Image_", "(_", "self_", "._", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "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", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "self_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "texture_", "=_", "root_", "._", "texture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "\\u", "image_", "._", "\\u", "data_", "[_", "0_", "]_", "._", "data_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i1_", "=_", "self_", "._", "cls_", "(_", "self_", "._", "image_", ",_", "keep", "\\u", "data_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i1_", "._", "\\u", "image_", "._", "\\u", "data_", "[_", "0_", "]_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Image", " ", "has", " ", "no", " ", "data", " ", "even", " ", "with", " ", "keep", "\\u", "data", " ", "=", " ", "Tru", "e", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
pycollada/pycollada/collada/camera.py
[ { "content": " def _checkValidParams(self):\n if self.xfov is not None and self.yfov is None \\\n and self.aspect_ratio is None:\n pass\n elif self.xfov is None and self.yfov is not None \\\n and self.aspect_ratio is None:\n pass\n elif self.xfov is not None and self.yfov is None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xfov is None and self.yfov is not None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xfov is not None and self.yfov is not None \\\n and self.aspect_ratio is None:\n pass\n else:\n raise DaeMalformedError(\"Received invalid combination of xfov (%s), yfov (%s), and aspect_ratio (%s)\" %\n (str(self.xfov), str(self.yfov), str(self.aspect_ratio)))", "metadata": "root.PerspectiveCamera._checkValidParams", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 111 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "Valid", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "\"", "Receive", "d", " ", "invalid", " ", "combinat", "ion", " ", "of", " ", "xf", "ov", " ", "(%", "s", "),", " ", "yf", "ov", " ", "(%", "s", "),", " ", "and", " ", "aspect", "\\u", "ratio", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "str_", "(_", "self_", "._", "xf", "ov_", ")_", ",_", "str_", "(_", "self_", "._", "yf", "ov_", ")_", ",_", "str_", "(_", "self_", "._", "aspect", "\\u", "ratio_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
plotly/plotly.py/plotly/tests/test_core/test_tools/test_validate.py
[ { "content": "from __future__ import absolute_import\n\nfrom nose.tools import raises\n\nfrom plotly.exceptions import PlotlyError\nimport plotly.tools as tls\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_validate_valid_fig():\n fig = {\n 'layout':{\n 'title':'something'\n },\n 'data':[\n {\n 'x':[1,2,3],\n 'y':[2,1,2]\n }\n ]\n }\n tls.validate(fig, 'Figure')", "metadata": "root.test_validate_valid_fig", "header": "['module', '___EOS___']", "index": 8 }, { "content": "@raises(PlotlyError)\ndef test_validate_invalid_fig():\n fig = {\n 'layout':{\n 'title':'something'\n },\n 'data':{\n 'x':[1,2,3],\n 'y':[2,1,2]\n }\n }\n tls.validate(fig, 'Figure')", "metadata": "root.test_validate_invalid_fig", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "plotly", "_", "._", "exceptions_", "import_", "Plot", "ly", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "plotly", "_", "._", "tools_", "as_", "tls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "validat", "e\\u", "valid", "\\u", "fig_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "layout", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "somet", "hing", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "x", "'_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y", "'_", ":_", "[_", "2_", ",_", "1_", ",_", "2_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tls_", "._", "validate_", "(_", "fig_", ",_", "'", "Fig", "ure", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Plot", "ly", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "validat", "e\\u", "invalid", "\\u", "fig_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "layout", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "somet", "hing", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "x", "'_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y", "'_", ":_", "[_", "2_", ",_", "1_", ",_", "2_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tls_", "._", "validate_", "(_", "fig_", ",_", "'", "Fig", "ure", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kashefy/nideep/nideep/nets/net_merge.py
[ { "content": "def merge_indep_net_spec(net_specs, suffix_fmt='_nidx_%02d'):\n \n data_tops = [l.top for n in net_specs for l in n.layer if l.type.lower() == 'data']\n data_tops = Set([item for sublist in data_tops for item in sublist])\n \n for idx, n in enumerate(net_specs):\n \n suffix = suffix_fmt % idx\n throw_away = []\n for l in n.layer:\n if l.type.lower() != 'data':\n \n l.name += suffix\n \n if np.prod([p.lr_mult for p in l.param]) == 0:\n print \"LAYER WITH FIXED WEIGHTS. MAKE SHARED?\"\n \n for b in list(l.bottom):\n l.bottom.remove(b)\n if b not in data_tops:\n l.bottom.append(unicode(b+suffix))\n else:\n l.bottom.append(unicode(b)) # preserve order of layer bottoms, label as bottom has to come last\n \n for b in list(l.top):\n l.top.remove(b)\n if b not in data_tops:\n l.top.append(unicode(b+suffix))\n else:\n l.top.append(unicode(b)) # preserve order of layer tops\n \n elif idx > 0:\n throw_away.append(l)\n \n for l in throw_away:\n n.layer.remove(l) # Data layers of first net only\n \n proto_str = '' \n for idx, n in enumerate(net_specs):\n \n s = text_format.MessageToString(n)\n if idx > 0 and s.startswith(\"name:\"):\n _, s = s.split('\\n', 1)\n proto_str += s\n \n return proto_str", "metadata": "root.merge_indep_net_spec", "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_", "merge", "\\u", "indep", "\\u", "net", "\\u", "spec_", "(_", "net", "\\u", "specs_", ",_", "suff", "ix", "\\u", "fmt_", "=_", "'\\u", "nid", "x", "\\u", "%", "02", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "tops", "_", "=_", "[_", "l_", "._", "top_", "for_", "n_", "in_", "net", "\\u", "specs_", "for_", "l_", "in_", "n_", "._", "layer_", "if_", "l_", "._", "type_", "._", "lower_", "(_", ")_", "==_", "'", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "tops", "_", "=_", "Set_", "(_", "[_", "item_", "for_", "sublist_", "in_", "data\\u", "tops", "_", "for_", "item_", "in_", "sublist_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "n_", "in_", "enumerate_", "(_", "net", "\\u", "specs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "suff", "ix", "\\u", "fmt_", "%_", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "throw", "\\u", "away_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "n_", "._", "layer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "type_", "._", "lower_", "(_", ")_", "!=_", "'", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "name_", "+=_", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "prod_", "(_", "[_", "p_", "._", "lr", "\\u", "mult_", "for_", "p_", "in_", "l_", "._", "param_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "LAYER", " ", "WITH", " ", "FIXED", " ", "WEIGHT", "S", ".", " ", "MAKE", " ", "SHARED", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "b_", "in_", "list_", "(_", "l_", "._", "bottom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "._", "bottom_", "._", "remove_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "not_", "in_", "data\\u", "tops", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "l_", "._", "bottom_", "._", "append_", "(_", "unicode_", "(_", "b_", "+_", "suffix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "l_", "._", "bottom_", "._", "append_", "(_", "unicode_", "(_", "b_", ")_", ")_", "#", " ", "preserve", " ", "order", " ", "of", " ", "layer", " ", "bottom", "s", ",", " ", "label", " ", "as", " ", "bottom", " ", "has", " ", "to", " ", "come", " ", "last_", "\\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_", "b_", "in_", "list_", "(_", "l_", "._", "top_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "._", "top_", "._", "remove_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "not_", "in_", "data\\u", "tops", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "l_", "._", "top_", "._", "append_", "(_", "unicode_", "(_", "b_", "+_", "suffix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "l_", "._", "top_", "._", "append_", "(_", "unicode_", "(_", "b_", ")_", ")_", "#", " ", "preserve", " ", "order", " ", "of", " ", "layer", " ", "tops", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "idx_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "throw", "\\u", "away_", "._", "append_", "(_", "l_", ")_", "\\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_", "l_", "in_", "throw", "\\u", "away_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "._", "layer_", "._", "remove_", "(_", "l_", ")_", "#", " ", "Data", " ", "layer", "s", " ", "of", " ", "first", " ", "net", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proto", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "n_", "in_", "enumerate_", "(_", "net", "\\u", "specs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "text", "\\u", "format_", "._", "Messag", "e", "To", "String_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "idx_", ">_", "0_", "and_", "s_", "._", "startswith_", "(_", "\"", "name", ":\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "s_", "=_", "s_", "._", "split_", "(_", "'\\\\", "n", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proto", "\\u", "str_", "+=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "proto", "\\u", "str_", "\\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, 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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 ]
Special method has incorrect signature
neovim/python-client/neovim/api/buffer.py
[ { "content": " def __getitem__(self, idx):\n if not isinstance(idx, slice):\n return self._buffer[self._normalize_index(idx)]\n start = self._normalize_index(idx.start)\n end = self._normalize_index(idx.stop)\n if start is None:\n start = self.start\n if end is None:\n end = self.end + 1\n return self._buffer[start:end]", "metadata": "root.Range.__getitem__", "header": "['class', 'Range', '(', 'object', ')', ':', '___EOS___']", "index": 161 } ]
[]
[]
0
true
[ "[CLS]_", "Special", "_", "method_", "has_", "incorrect", "_", "signature_", "[SEP]_", "class_", "Range_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "idx_", ",_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "buffer_", "[_", "self_", "._", "\\u", "normali", "ze", "\\u", "index_", "(_", "idx_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "=_", "self_", "._", "\\u", "normali", "ze", "\\u", "index_", "(_", "idx_", "._", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "self_", "._", "\\u", "normali", "ze", "\\u", "index_", "(_", "idx_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "self_", "._", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "self_", "._", "end_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "buffer_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
crosspop/asuka/asuka/web.py
[ { "content": "@WebApp.route('/hook/')\ndef hook(request):\n logger = logging.getLogger(__name__ + '.hook')\n app = request.app.app\n assert request.mimetype == 'application/json'\n data = request.data\n sig = hmac.new(app.github_client_secret, data, hashlib.sha1)\n assert request.headers['X-Hub-Signature'].split('=')[1] == sig.hexdigest()\n payload = json.loads(data)\n event = request.headers['X-GitHub-Event']\n logger.info('event = %r', event)\n logger.debug('payload = %r', payload)\n if event == 'push':\n message = payload.get('head_commit', {}).get('message', '')\n elif event == 'pull_request':\n try:\n number = payload['pull_request']['number']\n except KeyError:\n message = None\n else:\n pull_request = app.repository.pull_request(number)\n commits = pull_request.iter_commits()\n head = list(commits)[-1]\n message = head._json_data.get('commit', {}).get('message', '')\n else:\n message = None\n if message is None or IGNORE_PATTERN.search(message):\n return 'ignored'\n config_url = app.repository._build_url('contents', app.config_dir,\n base_url=app.repository._api)\n config_dir = app.repository._get(config_url.rstrip('/'), params={\n 'ref': payload['head_commit']['id']\n if event == 'push'\n else payload['pull_request']['head']['sha']\n })\n logger.info('config_dir.url = %r', config_dir.url)\n logger.info('config_dir.status_code = %r', config_dir.status_code)\n logger.debug('config_dir.json = %r', config_dir.json)\n if config_dir.status_code >= 400:\n return 'ignored'\n if event == 'pull_request':\n hook_pull_request(request.app, payload)\n elif event == 'push':\n hook_push(request.app, payload)\n return 'okay'", "metadata": "root.hook", "header": "['module', '___EOS___']", "index": 228 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Web", "App_", "._", "route_", "(_", "'/", "hook", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "hook_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", "+_", "'.", "hook", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "request_", "._", "app_", "._", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "request_", "._", "mimetype_", "==_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "request_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig_", "=_", "hmac_", "._", "new_", "(_", "app_", "._", "git", "hub", "\\u", "client", "\\u", "secret_", ",_", "data_", ",_", "hashlib_", "._", "sha1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "request_", "._", "headers_", "[_", "'", "X", "-", "Hub", "-", "Sign", "ature", "'_", "]_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "==_", "sig_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "json_", "._", "loads_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "request_", "._", "headers_", "[_", "'", "X", "-", "Git", "Hub", "-", "Event", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "event", " ", "=", " ", "%", "r", "'_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "payload", " ", "=", " ", "%", "r", "'_", ",_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "==_", "'", "push", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "payload_", "._", "get_", "(_", "'", "head", "\\u", "commit", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "message", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "==_", "'", "pull", "\\u", "request", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number_", "=_", "payload_", "[_", "'", "pull", "\\u", "request", "'_", "]_", "[_", "'", "number", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "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 ", " _", "pull", "\\u", "request_", "=_", "app_", "._", "repository_", "._", "pull", "\\u", "request_", "(_", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commits_", "=_", "pull", "\\u", "request_", "._", "iter", "\\u", "commits_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "=_", "list_", "(_", "commits_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "head_", "._", "\\u", "json", "\\u", "data_", "._", "get_", "(_", "'", "commit", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "message", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", "is_", "None_", "or_", "IGNORE", "\\u", "PATTERN_", "._", "search_", "(_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "ignore", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config", "\\u", "url_", "=_", "app_", "._", "repository_", "._", "\\u", "build", "\\u", "url_", "(_", "'", "content", "s", "'_", ",_", "app_", "._", "config", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "=_", "app_", "._", "repository_", "._", "\\u", "api_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "dir_", "=_", "app_", "._", "repository_", "._", "\\u", "get_", "(_", "config", "\\u", "url_", "._", "rstrip_", "(_", "'/'_", ")_", ",_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "'_", ":_", "payload_", "[_", "'", "head", "\\u", "commit", "'_", "]_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event_", "==_", "'", "push", "'_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "payload_", "[_", "'", "pull", "\\u", "request", "'_", "]_", "[_", "'", "head", "'_", "]_", "[_", "'", "sha", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "config", "\\u", "dir", ".", "url", " ", "=", " ", "%", "r", "'_", ",_", "config", "\\u", "dir_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "config", "\\u", "dir", ".", "status", "\\u", "code", " ", "=", " ", "%", "r", "'_", ",_", "config", "\\u", "dir_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "config", "\\u", "dir", ".", "json", " ", "=", " ", "%", "r", "'_", ",_", "config", "\\u", "dir_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config", "\\u", "dir_", "._", "status", "\\u", "code_", ">=_", "400_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "ignore", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "pull", "\\u", "request", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hook", "\\u", "pull", "\\u", "request_", "(_", "request_", "._", "app_", ",_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "==_", "'", "push", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hook", "\\u", "push_", "(_", "request_", "._", "app_", ",_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "oka", "y", "'_", "\\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, 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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 ]
Unnecessary pass
openstack/turbo-hipster/turbo_hipster/lib/utils.py
[ { "content": "def scp_push_files(results_set_name, file_path, local_config):\n \"\"\" Copy the file remotely over ssh \"\"\"\n # TODO!\n pass", "metadata": "root.scp_push_files", "header": "['module', '___EOS___']", "index": 434 } ]
[]
[]
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_", "def_", "scp", "\\u", "push", "\\u", "files_", "(_", "results", "\\u", "set\\u", "name_", ",_", "file", "\\u", "path_", ",_", "local", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Copy", " ", "the", " ", "file", " ", "remote", "ly", " ", "over", " ", "ssh", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
log2timeline/dfvfs/utils/review.py
[ { "content": "def Main():\n \"\"\"The main program function.\n\n Returns:\n A boolean containing True if successful or False if not.\n \"\"\"\n argument_parser = argparse.ArgumentParser(\n description=u'Script to manage code reviews.')\n\n # TODO: add option to directly pass code review issue number.\n\n argument_parser.add_argument(\n u'--allfiles', u'--all-files', u'--all_files', dest=u'all_files',\n action=u'store_true', default=False, help=(\n u'Apply command to all files, currently only affects the lint '\n u'command.'))\n\n argument_parser.add_argument(\n u'--diffbase', dest=u'diffbase', action=u'store', type=str,\n metavar=u'DIFFBASE', default=u'upstream/master', help=(\n u'The diffbase the default is upstream/master. This options is used '\n u'to indicate to what \"base\" the code changes are relative to and '\n u'can be used to \"chain\" code reviews.'))\n\n argument_parser.add_argument(\n u'--nobrowser', u'--no-browser', u'--no_browser', dest=u'no_browser',\n action=u'store_true', default=False, help=(\n u'Disable the functionality to use the webbrowser to get the OAuth '\n u'token should be disabled.'))\n\n argument_parser.add_argument(\n u'--noconfirm', u'--no-confirm', u'--no_confirm', dest=u'no_confirm',\n action=u'store_true', default=False, help=(\n u'Do not ask for confirmation apply defaults.\\n'\n u'WARNING: only use this when you are familiar with the defaults.'))\n\n commands_parser = argument_parser.add_subparsers(dest=u'command')\n\n close_command_parser = commands_parser.add_parser(u'close')\n\n # TODO: add this to help output.\n close_command_parser.add_argument(\n u'branch', action=u'store', metavar=u'BRANCH', default=None,\n help=(u'name of the corresponding feature branch.'))\n\n commands_parser.add_parser(u'create')\n\n merge_command_parser = commands_parser.add_parser(u'merge')\n\n # TODO: add this to help output.\n merge_command_parser.add_argument(\n u'codereview_issue_number', action=u'store',\n metavar=u'CODEREVIEW_ISSUE_NUMBER', default=None,\n help=(u'the codereview issue number to be merged.'))\n\n # TODO: add this to help output.\n merge_command_parser.add_argument(\n u'github_origin', action=u'store',\n metavar=u'GITHUB_ORIGIN', default=None,\n help=(u'the github origin to merged e.g. username:feature.'))\n\n commands_parser.add_parser(u'lint')\n\n open_command_parser = commands_parser.add_parser(u'open')\n\n # TODO: add this to help output.\n open_command_parser.add_argument(\n u'codereview_issue_number', action=u'store',\n metavar=u'CODEREVIEW_ISSUE_NUMBER', default=None,\n help=(u'the codereview issue number to be opened.'))\n\n # TODO: add this to help output.\n open_command_parser.add_argument(\n u'branch', action=u'store', metavar=u'BRANCH', default=None,\n help=(u'name of the corresponding feature branch.'))\n\n # TODO: add submit option?\n\n commands_parser.add_parser(u'test')\n\n # TODO: add dry-run option to run merge without commit.\n # useful to test pending CLs.\n\n commands_parser.add_parser(u'update')\n\n commands_parser.add_parser(u'update-version')\n commands_parser.add_parser(u'update_version')\n\n options = argument_parser.parse_args()\n\n codereview_issue_number = None\n feature_branch = None\n github_origin = None\n\n print_help_on_error = False\n if options.command in (u'close', u'open'):\n feature_branch = getattr(options, u'branch', None)\n if not feature_branch:\n print(u'Feature branch value is missing.')\n print_help_on_error = True\n\n if options.command in (u'merge', u'open'):\n codereview_issue_number = getattr(\n options, u'codereview_issue_number', None)\n if not codereview_issue_number:\n print(u'Codereview issue number value is missing.')\n print_help_on_error = True\n\n if options.command == u'merge':\n github_origin = getattr(options, u'github_origin', None)\n if not github_origin:\n print(u'Github origin value is missing.')\n print_help_on_error = True\n\n if print_help_on_error:\n print(u'')\n argument_parser.print_help()\n print(u'')\n return False\n\n home_path = os.path.expanduser(u'~')\n netrc_path = os.path.join(home_path, u'.netrc')\n if not os.path.exists(netrc_path):\n print(u'{0:s} aborted - unable to find .netrc.'.format(\n options.command.title()))\n return False\n\n review_helper = ReviewHelper(\n options.command, github_origin, feature_branch,\n options.diffbase, all_files=options.all_files,\n no_browser=options.no_browser, no_confirm=options.no_confirm)\n\n if not review_helper.InitializeHelpers():\n return False\n\n if not review_helper.CheckLocalGitState():\n return False\n\n if not review_helper.CheckRemoteGitState():\n return False\n\n if options.command == u'merge':\n if not review_helper.PrepareMerge(codereview_issue_number):\n return False\n\n if not review_helper.Lint():\n return False\n\n if not review_helper.Test():\n return False\n\n result = False\n if options.command == u'create':\n result = review_helper.Create()\n\n elif options.command == u'close':\n result = review_helper.Close()\n\n elif options.command == u'merge':\n result = review_helper.Merge(codereview_issue_number)\n\n elif options.command == u'open':\n result = review_helper.Open(codereview_issue_number)\n\n elif options.command == u'update':\n result = review_helper.Update()\n\n elif options.command in (u'update-version', u'update_version'):\n result = review_helper.UpdateVersion()\n\n return result", "metadata": "root.Main", "header": "['module', '___EOS___']", "index": 1829 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "main", " ", "program", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "boolean", " ", "contain", "ing", " ", "Tru", "e", " ", "if", " ", "success", "ful", " ", "or", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "u", "'", "Script", " ", "to", " ", "manage", " ", "code", " ", "review", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "option", " ", "to", " ", "direct", "ly", " ", "pass", " ", "code", " ", "review", " ", "issue", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'--", "all", "files", "'_", ",_", "u", "'--", "all", "-", "files", "'_", ",_", "u", "'--", "all", "\\u", "files", "'_", ",_", "dest_", "=_", "u", "'", "all", "\\u", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "u", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Apply", " ", "command", " ", "to", " ", "all", " ", "files", ",", " ", "currentl", "y", " ", "only", " ", "affect", "s", " ", "the", " ", "lint", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "command", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'--", "diff", "base", "'_", ",_", "dest_", "=_", "u", "'", "diff", "base", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "type_", "=_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "u", "'", "DIFF", "BASE", "'_", ",_", "default_", "=_", "u", "'", "ups", "tream", "/", "master", "'_", ",_", "help_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "The", " ", "diff", "base", " ", "the", " ", "default", " ", "is", " ", "ups", "tream", "/", "master", ".", " ", "Thi", "s", " ", "options", " ", "is", " ", "used", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "to", " ", "indicat", "e", " ", "to", " ", "what", " ", "\"", "base", "\"", " ", "the", " ", "code", " ", "change", "s", " ", "are", " ", "relative", " ", "to", " ", "and", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "can", " ", "be", " ", "used", " ", "to", " ", "\"", "chain", "\"", " ", "code", " ", "review", "s", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'--", "nob", "rowse", "r", "'_", ",_", "u", "'--", "no", "-", "browse", "r", "'_", ",_", "u", "'--", "no", "\\u", "browse", "r", "'_", ",_", "dest_", "=_", "u", "'", "no", "\\u", "browse", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "u", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Disa", "ble", " ", "the", " ", "functional", "it", "y", " ", "to", " ", "use", " ", "the", " ", "web", "browse", "r", " ", "to", " ", "get", " ", "the", " ", "OA", "uth", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "token", " ", "shou", "ld", " ", "be", " ", "disable", "d", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'--", "noco", "nfi", "rm", "'_", ",_", "u", "'--", "no", "-", "confirm", "'_", ",_", "u", "'--", "no", "\\u", "confirm", "'_", ",_", "dest_", "=_", "u", "'", "no", "\\u", "confirm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "u", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Do", " ", "not", " ", "ask", " ", "for", " ", "confirmation", " ", "appl", "y", " ", "default", "s", ".\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "WARN", "ING", ":", " ", "only", " ", "use", " ", "this", " ", "whe", "n", " ", "you", " ", "are", " ", "famil", "iar", " ", "with", " ", "the", " ", "default", "s", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "=_", "argu", "ment", "\\u", "parser_", "._", "add", "\\u", "subparsers_", "(_", "dest_", "=_", "u", "'", "command", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "close", "\\u", "command", "\\u", "parser_", "=_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "close", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "this", " ", "to", " ", "help", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "close", "\\u", "command", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "branch", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "metavar_", "=_", "u", "'", "BRANCH", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "u", "'", "name", " ", "of", " ", "the", " ", "correspond", "ing", " ", "feature", " ", "branch", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "command", "\\u", "parser_", "=_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "merge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "this", " ", "to", " ", "help", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "command", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "coder", "evi", "ew", "\\u", "issue", "\\u", "number", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "u", "'", "CODE", "REVI", "EW", "\\u", "ISSUE", "\\u", "NUMB", "ER", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "u", "'", "the", " ", "coder", "evi", "ew", " ", "issue", " ", "number", " ", "to", " ", "be", " ", "merge", "d", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "this", " ", "to", " ", "help", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "command", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "git", "hub", "\\u", "orig", "in", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "u", "'", "GIT", "HUB", "\\u", "ORIGIN", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "u", "'", "the", " ", "git", "hub", " ", "orig", "in", " ", "to", " ", "merge", "d", " ", "e", ".", "g", ".", " ", "user", "name", ":", "feature", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "lint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "open", "\\u", "command", "\\u", "parser_", "=_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "open", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "this", " ", "to", " ", "help", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "open", "\\u", "command", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "coder", "evi", "ew", "\\u", "issue", "\\u", "number", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "u", "'", "CODE", "REVI", "EW", "\\u", "ISSUE", "\\u", "NUMB", "ER", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "u", "'", "the", " ", "coder", "evi", "ew", " ", "issue", " ", "number", " ", "to", " ", "be", " ", "opene", "d", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "this", " ", "to", " ", "help", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "open", "\\u", "command", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "branch", "'_", ",_", "action_", "=_", "u", "'", "store", "'_", ",_", "metavar_", "=_", "u", "'", "BRANCH", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "u", "'", "name", " ", "of", " ", "the", " ", "correspond", "ing", " ", "feature", " ", "branch", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "submit", " ", "option", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "dry", "-", "run", " ", "option", " ", "to", " ", "run", " ", "merge", " ", "with", "out", " ", "commit", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usef", "ul", " ", "to", " ", "test", " ", "pend", "ing", " ", "CL", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "update", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "s", "\\u", "parser_", "._", "add", "\\u", "parser_", "(_", "u", "'", "update", "\\u", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "argu", "ment", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "branch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "hub", "\\u", "origin_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "help", "\\u", "on", "\\u", "error_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "command_", "in_", "(_", "u", "'", "close", "'_", ",_", "u", "'", "open", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feature", "\\u", "branch_", "=_", "getattr_", "(_", "options_", ",_", "u", "'", "branch", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "feature", "\\u", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "u", "'", "Feature", " ", "branch", " ", "value", " ", "is", " ", "missi", "ng", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "help", "\\u", "on", "\\u", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "command_", "in_", "(_", "u", "'", "merge", "'_", ",_", "u", "'", "open", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", "=_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "options_", ",_", "u", "'", "coder", "evi", "ew", "\\u", "issue", "\\u", "number", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "u", "'", "Coder", "evi", "ew", " ", "issue", " ", "number", " ", "value", " ", "is", " ", "missi", "ng", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "help", "\\u", "on", "\\u", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "command_", "==_", "u", "'", "merge", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "hub", "\\u", "origin_", "=_", "getattr_", "(_", "options_", ",_", "u", "'", "git", "hub", "\\u", "orig", "in", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "git", "hub", "\\u", "origin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "u", "'", "Git", "hub", " ", "orig", "in", " ", "value", " ", "is", " ", "missi", "ng", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "help", "\\u", "on", "\\u", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "print", "\\u", "help", "\\u", "on", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "u", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "\\u", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "u", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "home", "\\u", "path_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "u", "'~'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "rc", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "home", "\\u", "path_", ",_", "u", "'.", "net", "rc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "net", "rc", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "u", "'{", "0", ":", "s", "}", " ", "abort", "ed", " ", "-", " ", "una", "ble", " ", "to", " ", "find", " ", ".", "net", "rc", ".'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "command_", "._", "title_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "review", "\\u", "helper_", "=_", "Review", "Helper_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "command_", ",_", "git", "hub", "\\u", "origin_", ",_", "feature", "\\u", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "diff", "base_", ",_", "all", "\\u", "files_", "=_", "options_", "._", "all", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "browser_", "=_", "options_", "._", "no", "\\u", "browser_", ",_", "no", "\\u", "confirm_", "=_", "options_", "._", "no", "\\u", "confirm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "review", "\\u", "helper_", "._", "Initializ", "e", "Helpers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "review", "\\u", "helper_", "._", "Check", "Local", "Git", "State_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "review", "\\u", "helper_", "._", "Check", "Remo", "te", "Git", "State_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "command_", "==_", "u", "'", "merge", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "review", "\\u", "helper_", "._", "Prepare", "Merge_", "(_", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "review", "\\u", "helper_", "._", "Lint_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "review", "\\u", "helper_", "._", "Test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "command_", "==_", "u", "'", "create", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "command_", "==_", "u", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "command_", "==_", "u", "'", "merge", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Merge_", "(_", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "command_", "==_", "u", "'", "open", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Open_", "(_", "coder", "evi", "ew", "\\u", "issue", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "command_", "==_", "u", "'", "update", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "command_", "in_", "(_", "u", "'", "update", "-", "version", "'_", ",_", "u", "'", "update", "\\u", "version", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "review", "\\u", "helper_", "._", "Update", "Version_", "(_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
python-provy/provy/provy/more/debian/vcs/git.py
[ { "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n'''\nRoles in this namespace are meant to provide `Git <http://git-scm.com/>`_ repository creation operations within Debian distributions.\n'''\n\nfrom provy.core import Role\nfrom provy.more.debian.package.aptitude import AptitudeRole\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GitRole(Role):\n '''\n This role provides utility methods for `Git <http://git-scm.com/>`_ repositories management within Debian distributions.\n\n Example:\n ::\n\n from provy.core import Role\n from provy.more.debian import GitRole\n\n class MySampleRole(Role):\n def provision(self):\n with self.using(GitRole) as role:\n role.ensure_repository('git://github.com/python-provy/provy.git', '/home/user/provy',\n owner='user', branch='some-branch')\n '''\n\n\n\n\n", "metadata": "root.GitRole", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def provision(self):\n '''\n Installs `Git <http://git-scm.com/>`_ dependencies.\n This method should be called upon if overriden in base classes, or `Git <http://git-scm.com/>`_ won't work properly in the remote server.\n\n Example:\n ::\n\n class MySampleRole(Role):\n def provision(self):\n self.provision_role(GitRole) # does not need to be called if using with block.\n '''\n with self.using(AptitudeRole) as role:\n role.ensure_up_to_date()\n role.ensure_package_installed('git-core')", "metadata": "root.GitRole.provision", "header": "['class', 'GitRole', '(', 'Role', ')', ':', '___EOS___']", "index": 28 }, { "content": " def ensure_repository(self, repo, path, owner=None, branch=None, sudo=True):\n '''\n Makes sure the repository is create in the remote server.\n This method does not update the repository or perform any operations in it. It is merely used to ensure that the repository exists in the specified path.\n\n :param repo: Git repository url.\n :type repo: :class:`str`\n :param path: Path to create the local repository.\n :type path: :class:`str`\n :param owner: User that owns the repository directory. Defaults to :data:`None`, using the current one in the remote server.\n :type owner: :class:`str`\n :param branch: If specified, the given branch will be checked-out, otherwise it stays in the master branch.\n :type branch: :class:`str`\n :param sudo: If :data:`False`, won't sudo when creating the repository. Defaults to :data:`True`.\n :type sudo: :class:`bool`\n\n Example:\n ::\n\n from provy.core import Role\n from provy.more.debian import GitRole\n\n class MySampleRole(Role):\n def provision(self):\n with self.using(GitRole) as role:\n role.ensure_repository('git://github.com/python-provy/provy.git', '/home/user/provy',\n owner='user', branch='some-branch')\n '''\n self.__clone_repository(path, repo, sudo, owner)\n self.__checkout_branch(branch, path, repo, sudo, owner)\n self.__normalize_ownership(owner, path)", "metadata": "root.GitRole.ensure_repository", "header": "['class', 'GitRole', '(', 'Role', ')', ':', '___EOS___']", "index": 44 }, { "content": " def __normalize_ownership(self, owner, path):\n if owner:\n self.change_path_owner(path, owner)", "metadata": "root.GitRole.__normalize_ownership", "header": "['class', 'GitRole', '(', 'Role', ')', ':', '___EOS___']", "index": 76 }, { "content": " def __checkout_branch(self, branch, path, repo, sudo, owner):\n branch_name = \"# On branch %s\" % branch\n if branch and not branch_name in self.execute(\"git --git-dir=\\\"%s/.git\\\" --work-tree=\\\"%s\\\" status\" % (path, path),\n sudo=True, stdout=False):\n self.log(\"Repository for %s is not in branch %s ! Switching...\" % (repo, branch))\n self.execute('git --git-dir=\"%s/.git\" --work-tree=\"%s\" checkout %s' % (path, path, branch), sudo=sudo, user=owner)\n self.log(\"Repository %s currently in branch %s!\" % (repo, branch))", "metadata": "root.GitRole.__checkout_branch", "header": "['class', 'GitRole', '(', 'Role', ')', ':', '___EOS___']", "index": 80 }, { "content": " def __clone_repository(self, path, repo, sudo, owner):\n if not self.remote_exists_dir(path):\n self.log(\"Repository for %s does not exist! Cloning...\" % repo)\n self.execute(\"git clone %s %s\" % (repo, path), sudo=sudo, stdout=False, user=owner)\n self.log(\"Repository %s cloned!\" % repo)", "metadata": "root.GitRole.__clone_repository", "header": "['class', 'GitRole', '(', 'Role', ')', ':', '___EOS___']", "index": 88 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Ro", "les", " ", "in", " ", "this", " ", "namespace", " ", "are", " ", "mean", "t", " ", "to", " ", "provide", " ", "`", "Git", " ", "<", "http", "://", "git", "-", "scm", ".", "com", "/>", "`\\u", " ", "repos", "itor", "y", " ", "creati", "on", " ", "operati", "ons", " ", "within", " ", "Deb", "ian", " ", "distribu", "tion", "s", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "prov", "y_", "._", "core_", "import_", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "prov", "y_", "._", "more_", "._", "debi", "an_", "._", "package_", "._", "apt", "itude_", "import_", "Ap", "titu", "de", "Role_", "\\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_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "role", " ", "provide", "s", " ", "utility", " ", "method", "s", " ", "for", " ", "`", "Git", " ", "<", "http", "://", "git", "-", "scm", ".", "com", "/>", "`\\u", " ", "repos", "itori", "es", " ", "manage", "ment", " ", "within", " ", "Deb", "ian", " ", "distribu", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "prov", "y", ".", "core", " ", "import", " ", "Ro", "le", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "prov", "y", ".", "more", ".", "debi", "an", " ", "import", " ", "Git", "Ro", "le", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Sampl", "e", "Ro", "le", "(", "Ro", "le", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "provision", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "self", ".", "usi", "ng", "(", "Git", "Ro", "le", ")", " ", "as", " ", "role", ":", "\\", "10", ";", " ", " ", "role", ".", "ensure", "\\u", "repos", "itor", "y", "('", "git", "://", "git", "hub", ".", "com", "/", "python", "-", "prov", "y", "/", "prov", "y", ".", "git", "',", " ", "'/", "home", "/", "user", "/", "prov", "y", "',", "\\", "10", ";", " ", " ", " ", "owner", "='", "user", "',", " ", "branch", "='", "some", "-", "branch", "')", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "provision", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Install", "s", " ", "`", "Git", " ", "<", "http", "://", "git", "-", "scm", ".", "com", "/>", "`\\u", " ", "dependen", "cies", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "shou", "ld", " ", "be", " ", "call", "ed", " ", "upo", "n", " ", "if", " ", "override", "n", " ", "in", " ", "base", " ", "classe", "s", ",", " ", "or", " ", "`", "Git", " ", "<", "http", "://", "git", "-", "scm", ".", "com", "/>", "`\\u", " ", "won", "'", "t", " ", "work", " ", "proper", "ly", " ", "in", " ", "the", " ", "remote", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Sampl", "e", "Ro", "le", "(", "Ro", "le", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "provision", "(", "self", "):", "\\", "10", ";", " ", " ", "self", ".", "provision", "\\u", "role", "(", "Git", "Ro", "le", ")", " ", "#", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "call", "ed", " ", "if", " ", "usi", "ng", " ", "with", " ", "block", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "using_", "(_", "Ap", "titu", "de", "Role_", ")_", "as_", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "role_", "._", "ensure", "\\u", "up", "\\u", "to", "\\u", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role_", "._", "ensure", "\\u", "package", "\\u", "installed_", "(_", "'", "git", "-", "core", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\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", "repository_", "(_", "self_", ",_", "repo_", ",_", "path_", ",_", "owner_", "=_", "None_", ",_", "branch_", "=_", "None_", ",_", "sudo_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "sure", " ", "the", " ", "repos", "itor", "y", " ", "is", " ", "create", " ", "in", " ", "the", " ", "remote", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "doe", "s", " ", "not", " ", "update", " ", "the", " ", "repos", "itor", "y", " ", "or", " ", "perform", " ", "any", " ", "operati", "ons", " ", "in", " ", "it", ".", " ", "It", " ", "is", " ", "mer", "el", "y", " ", "used", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "repos", "itor", "y", " ", "exist", "s", " ", "in", " ", "the", " ", "specified", " ", "path", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "repo", ":", " ", "Git", " ", "repos", "itor", "y", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "repo", ":", " ", ":", "class", ":`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "path", ":", " ", "Path", " ", "to", " ", "create", " ", "the", " ", "local", " ", "repos", "itor", "y", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "path", ":", " ", ":", "class", ":`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "owner", ":", " ", "User", " ", "tha", "t", " ", "owns", " ", "the", " ", "repos", "itor", "y", " ", "director", "y", ".", " ", "Default", "s", " ", "to", " ", ":", "data", ":`", "Non", "e", "`", ",", " ", "usi", "ng", " ", "the", " ", "current", " ", "one", " ", "in", " ", "the", " ", "remote", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "owner", ":", " ", ":", "class", ":`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "branch", ":", " ", "If", " ", "specified", ",", " ", "the", " ", "give", "n", " ", "branch", " ", "will", " ", "be", " ", "checke", "d", "-", "out", ",", " ", "other", "wis", "e", " ", "it", " ", "stay", "s", " ", "in", " ", "the", " ", "master", " ", "branch", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "branch", ":", " ", ":", "class", ":`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "sudo", ":", " ", "If", " ", ":", "data", ":`", "Fal", "se", "`", ",", " ", "won", "'", "t", " ", "sudo", " ", "whe", "n", " ", "creati", "ng", " ", "the", " ", "repos", "itor", "y", ".", " ", "Default", "s", " ", "to", " ", ":", "data", ":`", "Tru", "e", "`.", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "sudo", ":", " ", ":", "class", ":`", "bool", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "prov", "y", ".", "core", " ", "import", " ", "Ro", "le", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "prov", "y", ".", "more", ".", "debi", "an", " ", "import", " ", "Git", "Ro", "le", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Sampl", "e", "Ro", "le", "(", "Ro", "le", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "provision", "(", "self", "):", "\\", "10", ";", " ", " ", "with", " ", "self", ".", "usi", "ng", "(", "Git", "Ro", "le", ")", " ", "as", " ", "role", ":", "\\", "10", ";", " ", " ", "role", ".", "ensure", "\\u", "repos", "itor", "y", "('", "git", "://", "git", "hub", ".", "com", "/", "python", "-", "prov", "y", "/", "prov", "y", ".", "git", "',", " ", "'/", "home", "/", "user", "/", "prov", "y", "',", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "owner", "='", "user", "',", " ", "branch", "='", "some", "-", "branch", "')", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "clone", "\\u", "repository_", "(_", "path_", ",_", "repo_", ",_", "sudo_", ",_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "check", "out", "\\u", "branch_", "(_", "branch_", ",_", "path_", ",_", "repo_", ",_", "sudo_", ",_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "normali", "ze", "\\u", "ownership_", "(_", "owner_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "normali", "ze", "\\u", "ownership_", "(_", "self_", ",_", "owner_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "change", "\\u", "path", "\\u", "owner_", "(_", "path_", ",_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\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", "check", "out", "\\u", "branch_", "(_", "self_", ",_", "branch_", ",_", "path_", ",_", "repo_", ",_", "sudo_", ",_", "owner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch", "\\u", "name_", "=_", "\"#", " ", "On", " ", "branch", " ", "%", "s", "\"_", "%_", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "branch_", "and_", "not_", "branch", "\\u", "name_", "in_", "self_", "._", "execute_", "(_", "\"", "git", " ", "--", "git", "-", "dir", "=\\\\\"", "%", "s", "/.", "git", "\\\\\"", " ", "--", "work", "-", "tree", "=\\\\\"", "%", "s", "\\\\\"", " ", "status", "\"_", "%_", "(_", "path_", ",_", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sudo_", "=_", "True_", ",_", "stdout_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "\"", "Repos", "itor", "y", " ", "for", " ", "%", "s", " ", "is", " ", "not", " ", "in", " ", "branch", " ", "%", "s", " ", "!", " ", "Switch", "ing", "...\"_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "'", "git", " ", "--", "git", "-", "dir", "=\"", "%", "s", "/.", "git", "\"", " ", "--", "work", "-", "tree", "=\"", "%", "s", "\"", " ", "check", "out", " ", "%", "s", "'_", "%_", "(_", "path_", ",_", "path_", ",_", "branch_", ")_", ",_", "sudo_", "=_", "sudo_", ",_", "user_", "=_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Repos", "itor", "y", " ", "%", "s", " ", "currentl", "y", " ", "in", " ", "branch", " ", "%", "s", "!\"_", "%_", "(_", "repo_", ",_", "branch_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Role_", "(_", "Role_", ")_", ":_", "\\u\\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", "clone", "\\u", "repository_", "(_", "self_", ",_", "path_", ",_", "repo_", ",_", "sudo_", ",_", "owner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "remote", "\\u", "exist", "s", "\\u", "dir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "\"", "Repos", "itor", "y", " ", "for", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "exist", "!", " ", "Clo", "ning", "...\"_", "%_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "\"", "git", " ", "clone", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "repo_", ",_", "path_", ")_", ",_", "sudo_", "=_", "sudo_", ",_", "stdout_", "=_", "False_", ",_", "user_", "=_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Repos", "itor", "y", " ", "%", "s", " ", "cloned", "!\"_", "%_", "repo_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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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timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python2/genshi/template/text.py
[ { "content": "class NewTextTemplate(Template):\n r\"\"\"Implementation of a simple text-based template engine. This class will\n replace `OldTextTemplate` in a future release.\n \n It uses a more explicit delimiting style for directives: instead of the old\n style which required putting directives on separate lines that were prefixed\n with a ``#`` sign, directives and commenbtsr are enclosed in delimiter pairs\n (by default ``{% ... %}`` and ``{# ... #}``, respectively).\n \n Variable substitution uses the same interpolation syntax as for markup\n languages: simple references are prefixed with a dollar sign, more complex\n expression enclosed in curly braces.\n \n >>> tmpl = NewTextTemplate('''Dear $name,\n ... \n ... {# This is a comment #}\n ... We have the following items for you:\n ... {% for item in items %}\n ... * ${'Item %d' % item}\n ... {% end %}\n ... ''')\n >>> print(tmpl.generate(name='Joe', items=[1, 2, 3]).render(encoding=None))\n Dear Joe,\n <BLANKLINE>\n <BLANKLINE>\n We have the following items for you:\n <BLANKLINE>\n * Item 1\n <BLANKLINE>\n * Item 2\n <BLANKLINE>\n * Item 3\n <BLANKLINE>\n <BLANKLINE>\n \n By default, no spaces or line breaks are removed. If a line break should\n not be included in the output, prefix it with a backslash:\n \n >>> tmpl = NewTextTemplate('''Dear $name,\n ... \n ... {# This is a comment #}\\\n ... We have the following items for you:\n ... {% for item in items %}\\\n ... * $item\n ... {% end %}\\\n ... ''')\n >>> print(tmpl.generate(name='Joe', items=[1, 2, 3]).render(encoding=None))\n Dear Joe,\n <BLANKLINE>\n We have the following items for you:\n * 1\n * 2\n * 3\n <BLANKLINE>\n \n Backslashes are also used to escape the start delimiter of directives and\n comments:\n\n >>> tmpl = NewTextTemplate('''Dear $name,\n ... \n ... \\{# This is a comment #}\n ... We have the following items for you:\n ... {% for item in items %}\\\n ... * $item\n ... {% end %}\\\n ... ''')\n >>> print(tmpl.generate(name='Joe', items=[1, 2, 3]).render(encoding=None))\n Dear Joe,\n <BLANKLINE>\n {# This is a comment #}\n We have the following items for you:\n * 1\n * 2\n * 3\n <BLANKLINE>\n \n :since: version 0.5\n \"\"\"\n directives = [('def', DefDirective),\n ('when', WhenDirective),\n ('otherwise', OtherwiseDirective),\n ('for', ForDirective),\n ('if', IfDirective),\n ('choose', ChooseDirective),\n ('with', WithDirective)]\n serializer = 'text'\n\n _DIRECTIVE_RE = r'((?<!\\\\)%s\\s*(\\w+)\\s*(.*?)\\s*%s|(?<!\\\\)%s.*?%s)'\n _ESCAPE_RE = r'\\\\\\n|\\\\(\\\\)|\\\\(%s)|\\\\(%s)'\n\n\n delimiters = property(_get_delims, _set_delims, \"\"\"\\\n The delimiters for directives and comments. This should be a four item tuple\n of the form ``(directive_start, directive_end, comment_start,\n comment_end)``, where each item is a string.\n \"\"\")\n", "metadata": "root.NewTextTemplate", "header": "['module', '___EOS___']", "index": 42 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "New", "Text", "Template_", "(_", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Implementation", " ", "of", " ", "a", " ", "simple", " ", "text", "-", "based", " ", "template", " ", "eng", "ine", ".", " ", "Thi", "s", " ", "class", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "replace", " ", "`", "Old", "Text", "Templa", "te", "`", " ", "in", " ", "a", " ", "future", " ", "release", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "use", "s", " ", "a", " ", "more", " ", "explicit", " ", "delim", "iti", "ng", " ", "style", " ", "for", " ", "directive", "s", ":", " ", "inst", "ead", " ", "of", " ", "the", " ", "old", "\\", "10", ";", " ", " ", " ", " ", "style", " ", "whi", "ch", " ", "require", "d", " ", "put", "ting", " ", "directive", "s", " ", "on", " ", "separate", " ", "lines", " ", "tha", "t", " ", "wer", "e", " ", "prefixed", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "a", " ", "``", "#", "``", " ", "sign", ",", " ", "directive", "s", " ", "and", " ", "comm", "enb", "ts", "r", " ", "are", " ", "enclose", "d", " ", "in", " ", "delimiter", " ", "pair", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "by", " ", "default", " ", "``", "{%", " ", "...", " ", "%}", "``", " ", "and", " ", "``", "{", "#", " ", "...", " ", "#}", "``", ",", " ", "respec", "tiv", "el", "y", ").", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Varia", "ble", " ", "substitution", " ", "use", "s", " ", "the", " ", "same", " ", "interpolati", "on", " ", "synta", "x", " ", "as", " ", "for", " ", "markup", "\\", "10", ";", " ", " ", " ", " ", "language", "s", ":", " ", "simple", " ", "reference", "s", " ", "are", " ", "prefixed", " ", "with", " ", "a", " ", "dollar", " ", "sign", ",", " ", "more", " ", "complex", "\\", "10", ";", " ", " ", " ", " ", "express", "ion", " ", "enclose", "d", " ", "in", " ", "curl", "y", " ", "braces", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tmpl", " ", "=", " ", "New", "Text", "Templa", "te", "(''", "'", "Dea", "r", " ", "$", "name", ",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "comment", " ", "#}", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "for", " ", "item", " ", "in", " ", "items", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", "*", " ", "${", "'", "Item", " ", "%", "d", "'", " ", "%", " ", "item", "}", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "end", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "'''", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "tmpl", ".", "generat", "e", "(", "name", "='", "Jo", "e", "',", " ", "items", "=[", "1", ",", " ", "2", ",", " ", "3", "])", ".", "render", "(", "encoding", "=", "Non", "e", "))\\", "10", ";", " ", " ", " ", " ", "Dea", "r", " ", "Jo", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", "*", " ", "Item", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", "*", " ", "Item", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", "*", " ", "Item", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "no", " ", "space", "s", " ", "or", " ", "line", " ", "breaks", " ", "are", " ", "remove", "d", ".", " ", "If", " ", "a", " ", "line", " ", "break", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "output", ",", " ", "prefix", " ", "it", " ", "with", " ", "a", " ", "backslash", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tmpl", " ", "=", " ", "New", "Text", "Templa", "te", "(''", "'", "Dea", "r", " ", "$", "name", ",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "comment", " ", "#}", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "for", " ", "item", " ", "in", " ", "items", " ", "%}", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", "*", " ", "$", "item", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "end", " ", "%}", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "'''", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "tmpl", ".", "generat", "e", "(", "name", "='", "Jo", "e", "',", " ", "items", "=[", "1", ",", " ", "2", ",", " ", "3", "])", ".", "render", "(", "encoding", "=", "Non", "e", "))\\", "10", ";", " ", " ", " ", " ", "Dea", "r", " ", "Jo", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", "*", " ", "1", "\\", "10", ";", " ", "*", " ", "2", "\\", "10", ";", " ", "*", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Back", "slash", "es", " ", "are", " ", "als", "o", " ", "used", " ", "to", " ", "escape", " ", "the", " ", "start", " ", "delimiter", " ", "of", " ", "directive", "s", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "comment", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tmpl", " ", "=", " ", "New", "Text", "Templa", "te", "(''", "'", "Dea", "r", " ", "$", "name", ",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\\\{", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "comment", " ", "#}", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "for", " ", "item", " ", "in", " ", "items", " ", "%}", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", "*", " ", "$", "item", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "{%", " ", "end", " ", "%}", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "'''", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "tmpl", ".", "generat", "e", "(", "name", "='", "Jo", "e", "',", " ", "items", "=[", "1", ",", " ", "2", ",", " ", "3", "])", ".", "render", "(", "encoding", "=", "Non", "e", "))\\", "10", ";", " ", " ", " ", " ", "Dea", "r", " ", "Jo", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "{", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "comment", " ", "#}", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "have", " ", "the", " ", "follow", "ing", " ", "items", " ", "for", " ", "you", ":", "\\", "10", ";", " ", "*", " ", "1", "\\", "10", ";", " ", "*", " ", "2", "\\", "10", ";", " ", "*", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "<", "BLANK", "LINE", ">", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "sinc", "e", ":", " ", "version", " ", "0.", "5", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directives_", "=_", "[_", "(_", "'", "def", "'_", ",_", "Def", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "whe", "n", "'_", ",_", "Whe", "n", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "other", "wis", "e", "'_", ",_", "Ot", "her", "wis", "e", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "for", "'_", ",_", "For", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", "'_", ",_", "If", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "choose", "'_", ",_", "Choose", "Directive", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "with", "'_", ",_", "With", "Directive", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serializer_", "=_", "'", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DIRECT", "IV", "E", "\\u", "RE_", "=_", "r", "'((", "?<", "!\\\\", "\\\\)", "%", "s", "\\\\", "s", "*(", "\\\\", "w", "+)\\\\", "s", "*(.", "*?)", "\\\\", "s", "*", "%", "s", "|(?", "<!", "\\\\\\\\", ")%", "s", ".*?", "%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ESCAPE", "\\u", "RE_", "=_", "r", "'\\\\\\\\", "\\\\", "n", "|\\\\\\\\", "(\\\\\\\\", ")|", "\\\\\\\\", "(%", "s", ")|", "\\\\\\\\", "(%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delimiter", "s_", "=_", "property_", "(_", "\\u", "get", "\\u", "delim", "s_", ",_", "\\u", "set\\u", "delim", "s_", ",_", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "delimiter", "s", " ", "for", " ", "directive", "s", " ", "and", " ", "comment", "s", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "four", " ", "item", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "form", " ", "``", "(", "directive", "\\u", "start", ",", " ", "directive", "\\u", "end", ",", " ", "comment", "\\u", "start", ",", "\\", "10", ";", " ", " ", " ", " ", "comment", "\\u", "end", ")`", "`", ",", " ", "where", " ", "each", " ", "item", " ", "is", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\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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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 ]
Except block handles 'BaseException'
GoogleCloudPlatform/gsutil/gslib/tests/util.py
[ { "content": "# -*- coding: utf-8 -*-\n# Copyright 2013 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\n\nfrom contextlib import contextmanager\nimport functools\nimport os\nimport pkgutil\nimport posixpath\nimport re\nimport tempfile\nimport unittest\nimport urlparse\n\nimport boto\nimport crcmod\nfrom gslib.encryption_helper import Base64Sha256FromBase64EncryptionKey\nimport gslib.tests as gslib_tests\nfrom gslib.util import UsingCrcmodExtension\n\nif not hasattr(unittest.TestCase, 'assertIsNone'):\n # external dependency unittest2 required for Python <= 2.6\n import unittest2 as unittest # pylint: disable=g-import-not-at-top\n\n# 256-bit base64 encryption keys used for testing AES256 customer-supplied\n# encryption. These are public and open-source, so don't ever use them for\n# real data.\nTEST_ENCRYPTION_KEY1 = 'iMSM9eeXliDZHSBJZO71R98tfeW/+87VXTpk5chGd6Y='\nTEST_ENCRYPTION_KEY1_SHA256_B64 = Base64Sha256FromBase64EncryptionKey(\n TEST_ENCRYPTION_KEY1)\n\nTEST_ENCRYPTION_KEY2 = '4TSaQ3S4U+5oxAbByA7HgIigD51zfzGed/c03Ts2TXc='\nTEST_ENCRYPTION_KEY2_SHA256_B64 = Base64Sha256FromBase64EncryptionKey(\n TEST_ENCRYPTION_KEY2)\n\nTEST_ENCRYPTION_KEY3 = 'HO4Q2X28N/6SmuAJ1v1CTuJjf5emQcXf7YriKzT1gj0='\nTEST_ENCRYPTION_KEY3_SHA256_B64 = Base64Sha256FromBase64EncryptionKey(\n TEST_ENCRYPTION_KEY3)\n\nTEST_ENCRYPTION_KEY4 = 'U6zIErjZCK/IpIeDS0pJrDayqlZurY8M9dvPJU0SXI8='\nTEST_ENCRYPTION_KEY4_SHA256_B64 = Base64Sha256FromBase64EncryptionKey(\n TEST_ENCRYPTION_KEY4)\n\nTEST_ENCRYPTION_CONTENT1 = 'bar'\nTEST_ENCRYPTION_CONTENT1_MD5 = 'N7UdGUp1E+RbVvZSTy1R8g=='\nTEST_ENCRYPTION_CONTENT1_CRC32C = 'CrcTMQ=='\nTEST_ENCRYPTION_CONTENT2 = 'bar2'\nTEST_ENCRYPTION_CONTENT2_MD5 = 'Ik4lOfUiA+szcorNIotEMg=='\nTEST_ENCRYPTION_CONTENT2_CRC32C = 'QScXtg=='\nTEST_ENCRYPTION_CONTENT3 = 'bar3'\nTEST_ENCRYPTION_CONTENT3_MD5 = '9iW6smjfu9hm0A//VQTQfw=='\nTEST_ENCRYPTION_CONTENT3_CRC32C = 's0yUtQ=='\nTEST_ENCRYPTION_CONTENT4 = 'bar4'\nTEST_ENCRYPTION_CONTENT4_MD5 = 'kPCx6uZiUOU7W6E+cDCZFg=='\nTEST_ENCRYPTION_CONTENT4_CRC32C = 'Z4bwXg=='\nTEST_ENCRYPTION_CONTENT5 = 'bar5'\nTEST_ENCRYPTION_CONTENT5_MD5 = '758XbXQOVkp8fTKMm83NXA=='\nTEST_ENCRYPTION_CONTENT5_CRC32C = 'le1zXQ=='\n\n# Flags for running different types of tests.\nRUN_INTEGRATION_TESTS = True\nRUN_UNIT_TESTS = True\nRUN_S3_TESTS = False\n\nPARALLEL_COMPOSITE_UPLOAD_TEST_CONFIG = '/tmp/.boto.parallel_upload_test_config'\n\n\n\nHAS_S3_CREDS = _HasS3Credentials()\n\n\n\nHAS_GS_HOST = _HasGSHost()\n\n\n\n\nHAS_GS_PORT = _HasGSPort()\n\n\n\nUSING_JSON_API = _UsingJSONApi()\n\n\n\nARGCOMPLETE_AVAILABLE = _ArgcompleteAvailable()\n\n\n\n\n\n\n\n# The mock storage service comes from the Boto library, but it is not\n# distributed with Boto when installed as a package. To get around this, we\n# copy the file to gslib/tests/mock_storage_service.py when building the gsutil\n# package. Try and import from both places here.\n# pylint: disable=g-import-not-at-top\ntry:\n from gslib.tests import mock_storage_service\nexcept ImportError:\n try:\n from boto.tests.integration.s3 import mock_storage_service\n except ImportError:\n try:\n from tests.integration.s3 import mock_storage_service\n except ImportError:\n import mock_storage_service\n\n\n\nmock_connection = GSMockConnection()\n\n\n\n\nTEST_BOTO_REMOVE_SECTION = 'TestRemoveSection'\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 } ]
[]
[]
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_", "#", " ", "Copy", "right", " ", "2013", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "posixpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "crc", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "encrypt", "ion", "\\u", "helper_", "import_", "Base", "64", "Sha", "256", "Fro", "m", "Base", "64", "Encrypt", "ion", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gsl", "ib_", "._", "tests_", "as_", "gsl", "ib", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gsl", "ib_", "._", "util_", "import_", "Us", "ing", "Cr", "cmo", "d", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "unittest_", "._", "Test", "Case_", ",_", "'", "assert", "Is", "Non", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "external", " ", "dependen", "cy", " ", "unittest", "2", " ", "require", "d", " ", "for", " ", "Pyth", "on", " ", "<=", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "import", "-", "not", "-", "at", "-", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "256", "-", "bit", " ", "base64", " ", "encrypt", "ion", " ", "keys", " ", "used", " ", "for", " ", "testi", "ng", " ", "AE", "S2", "56", " ", "customer", "-", "supplie", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encrypt", "ion", ".", " ", "The", "se", " ", "are", " ", "public", " ", "and", " ", "open", "-", "source", ",", " ", "so", " ", "don", "'", "t", " ", "ever", " ", "use", " ", "them", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "real", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "1_", "=_", "'", "i", "MS", "M", "9e", "e", "Xl", "i", "DZ", "HS", "BJ", "ZO", "7", "1", "R", "98", "tf", "e", "W", "/", "+", "87", "VX", "Tp", "k", "5c", "h", "Gd", "6", "Y", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "1", "\\u", "SHA", "256", "\\u", "B6", "4_", "=_", "Base", "64", "Sha", "256", "Fro", "m", "Base", "64", "Encrypt", "ion", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "2_", "=_", "'", "4", "TS", "a", "Q", "3", "S4", "U", "+", "5", "ox", "Ab", "By", "A7", "Hg", "Ii", "g", "D5", "1", "zf", "z", "Ge", "d", "/", "c0", "3", "Ts", "2", "TX", "c", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "2", "\\u", "SHA", "256", "\\u", "B6", "4_", "=_", "Base", "64", "Sha", "256", "Fro", "m", "Base", "64", "Encrypt", "ion", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "3_", "=_", "'", "HO", "4", "Q2", "X", "2", "8", "N", "/", "6", "Sm", "u", "AJ", "1", "v1", "CT", "u", "J", "jf", "5e", "m", "Qc", "Xf", "7", "Yr", "i", "Kz", "T1", "gj", "0", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "3", "\\u", "SHA", "256", "\\u", "B6", "4_", "=_", "Base", "64", "Sha", "256", "Fro", "m", "Base", "64", "Encrypt", "ion", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "4_", "=_", "'", "U", "6", "z", "IE", "rj", "ZC", "K", "/", "Ip", "Ie", "DS", "0", "p", "J", "r", "Day", "ql", "Zu", "r", "Y", "8", "M", "9", "dv", "PJ", "U", "0", "SX", "I", "8", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "4", "\\u", "SHA", "256", "\\u", "B6", "4_", "=_", "Base", "64", "Sha", "256", "Fro", "m", "Base", "64", "Encrypt", "ion", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "KEY", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "1_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "1", "\\u", "MD", "5_", "=_", "'", "N", "7", "Ud", "GU", "p1", "E+", "Rb", "V", "v", "ZS", "Ty", "1", "R", "8", "g", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "1", "\\u", "CR", "C3", "2", "C_", "=_", "'", "Cr", "c", "TM", "Q", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "2_", "=_", "'", "bar", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "2", "\\u", "MD", "5_", "=_", "'", "Ik", "4", "l", "Of", "Ui", "A", "+", "sz", "cor", "NI", "ot", "EM", "g", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "2", "\\u", "CR", "C3", "2", "C_", "=_", "'", "QS", "c", "Xt", "g", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "3_", "=_", "'", "bar", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "3", "\\u", "MD", "5_", "=_", "'", "9", "i", "W", "6", "sm", "jf", "u", "9", "hm", "0", "A", "//", "VQ", "TQ", "fw", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "3", "\\u", "CR", "C3", "2", "C_", "=_", "'", "s0", "y", "Ut", "Q", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "4_", "=_", "'", "bar", "4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "4", "\\u", "MD", "5_", "=_", "'", "k", "PC", "x6", "u", "Zi", "UO", "U", "7", "W", "6", "E+", "c", "DC", "ZF", "g", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "4", "\\u", "CR", "C3", "2", "C_", "=_", "'", "Z", "4b", "w", "Xg", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "5_", "=_", "'", "bar", "5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "5", "\\u", "MD", "5_", "=_", "'", "758", "Xb", "XQ", "OV", "kp", "8f", "TK", "Mm", "8", "3", "NX", "A", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "ENCRYPT", "ION", "\\u", "CONTE", "NT", "5", "\\u", "CR", "C3", "2", "C_", "=_", "'", "le", "1", "z", "XQ", "=='", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "gs", " ", "for", " ", "runn", "ing", " ", "different", " ", "types", " ", "of", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "RUN", "\\u", "INTEG", "RATION", "\\u", "TESTS_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RUN", "\\u", "UNIT", "\\u", "TESTS_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RUN", "\\u", "S", "3", "\\u", "TESTS_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PARA", "LLE", "L", "\\u", "COMPO", "SITE", "\\u", "UPLOAD", "\\u", "TEST", "\\u", "CONFIG_", "=_", "'/", "tmp", "/.", "boto", ".", "parall", "el", "\\u", "upload", "\\u", "test\\u", "config", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "HAS", "\\u", "S", "3", "\\u", "CRED", "S_", "=_", "\\u", "Has", "S", "3", "Credentials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "HAS", "\\u", "GS", "\\u", "HOST_", "=_", "\\u", "Has", "GS", "Host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "HAS", "\\u", "GS", "\\u", "PORT_", "=_", "\\u", "Has", "GS", "Port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "US", "ING", "\\u", "JSO", "N", "\\u", "API_", "=_", "\\u", "Us", "ing", "JSO", "NA", "pi_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "ARG", "COMPLET", "E", "\\u", "AVAILABLE_", "=_", "\\u", "Arg", "complete", "Available_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "mock", " ", "storage", " ", "service", " ", "come", "s", " ", "from", " ", "the", " ", "Bot", "o", " ", "librar", "y", ",", " ", "but", " ", "it", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "with", " ", "Bot", "o", " ", "whe", "n", " ", "install", "ed", " ", "as", " ", "a", " ", "package", ".", " ", "To", " ", "get", " ", "aro", "und", " ", "this", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "the", " ", "file", " ", "to", " ", "gsl", "ib", "/", "tests", "/", "mock", "\\u", "storage", "\\u", "service", ".", "py", " ", "whe", "n", " ", "buildi", "ng", " ", "the", " ", "gsu", "til_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "package", ".", " ", "Tr", "y", " ", "and", " ", "import", " ", "from", " ", "bot", "h", " ", "place", "s", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "import", "-", "not", "-", "at", "-", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gsl", "ib_", "._", "tests_", "import_", "mock", "\\u", "storage", "\\u", "service_", "\\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_", "boto_", "._", "tests_", "._", "integration_", "._", "s3_", "import_", "mock", "\\u", "storage", "\\u", "service_", "\\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_", "tests_", "._", "integration_", "._", "s3_", "import_", "mock", "\\u", "storage", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "mock", "\\u", "storage", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "mock", "\\u", "connection_", "=_", "GS", "Moc", "k", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "TEST", "\\u", "BOT", "O", "\\u", "REMOVE", "\\u", "SECTION_", "=_", "'", "Test", "Remove", "Sect", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 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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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 ]
Unused local variable
rsms/smisk/lib/smisk/mvc/routing.py
[ { "content": "\tdef __call__(self, *args, **params):\n\t\t'''Call leaf\n\t\t'''\n\t\ttry:\n\t\t\treturn self._call_leaf(*args, **params)\n\t\texcept TypeError, e:\n\t\t\tdesc = e.args[0]\n\t\t\t\n\t\t\t# Find out if the problem was caused in self._call_leaf or originates someplace else\n\t\t\ttb = sys.exc_info()[2]\n\t\t\tif not tb:\n\t\t\t\traise\n\t\t\twhile 1:\n\t\t\t\tif tb.tb_next:\n\t\t\t\t\ttb = tb.tb_next\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\tif tb.tb_lineno != self._call_leaf.im_func.func_code.co_firstlineno+1:\n\t\t\t\traise\n\t\t\t\n\t\t\tGOT_MUL = ' got multiple values for keyword argument '\n\t\t\t\n\t\t\tdef req_args():\n\t\t\t\tinfo = introspect.callable_info(self.leaf)\n\t\t\t\targs = []\n\t\t\t\tfor k,v in info['args']:\n\t\t\t\t\tif v is Undefined:\n\t\t\t\t\t\targs.append(k)\n\t\t\t\treturn ', '.join(args)\n\t\t\t\n\t\t\tif (desc.find(' takes at least ') > 0 and desc.find(' arguments ') > 0) or (desc.find(' takes exactly ') > 0):\n\t\t\t\tlog.debug('TypeError', exc_info=1)\n\t\t\t\traise http.BadRequest('Missing required parameters: %r (Received %r, %r)' % \\\n\t\t\t\t\t(req_args(), params, args))\n\t\t\telse:\n\t\t\t\tp = desc.find(GOT_MUL)\n\t\t\t\tif p > 0:\n\t\t\t\t\traise http.BadRequest('%s got multiple values for keyword argument %s'\\\n\t\t\t\t\t\t' -- received args %r and params %r' % \\\n\t\t\t\t\t\t(self.uri, desc[p+len(GOT_MUL):], args, params))\n\t\t\traise", "metadata": "root.Destination.__call__", "header": "['class', 'Destination', '(', 'object', ')', ':', '___EOS___']", "index": 60 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Destination_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", "Call", " ", "leaf", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "\\u", "call", "\\u", "leaf_", "(_", "*_", "args_", ",_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "desc_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "out", " ", "if", " ", "the", " ", "problem", " ", "was", " ", "caus", "ed", " ", "in", " ", "self", ".\\u", "call", "\\u", "leaf", " ", "or", " ", "originat", "es", " ", "some", "place", " ", "else_", "\\u\\u\\uNL\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "tb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "tb_", "._", "tb", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tb_", "=_", "tb_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tb_", "._", "tb", "\\u", "lineno_", "!=_", "self_", "._", "\\u", "call", "\\u", "leaf_", "._", "im", "\\u", "func_", "._", "func", "\\u", "code_", "._", "co", "\\u", "firstl", "inen", "o_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "GOT", "\\u", "MUL", "_", "=_", "'", " ", "got", " ", "multiple", " ", "values", " ", "for", " ", "keyw", "ord", " ", "argu", "ment", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "req", "\\u", "args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "info_", "=_", "introspect", "_", "._", "callable\\u", "info_", "(_", "self_", "._", "leaf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "info_", "[_", "'", "args", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "v_", "is_", "Unde", "fined", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "args_", "._", "append_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "',", " ", "'_", "._", "join_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "desc_", "._", "find_", "(_", "'", " ", "take", "s", " ", "at", " ", "leas", "t", " ", "'_", ")_", ">_", "0_", "and_", "desc_", "._", "find_", "(_", "'", " ", "argu", "ment", "s", " ", "'_", ")_", ">_", "0_", ")_", "or_", "(_", "desc_", "._", "find_", "(_", "'", " ", "take", "s", " ", "exact", "ly", " ", "'_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "log_", "._", "debug_", "(_", "'", "Type", "Error", "'_", ",_", "exc", "\\u", "info_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "http_", "._", "Ba", "d", "Request_", "(_", "'", "Missing", " ", "require", "d", " ", "parameter", "s", ":", " ", "%", "r", " ", "(", "Receive", "d", " ", "%", "r", ",", " ", "%", "r", ")'_", "%_", "(_", "req", "\\u", "args_", "(_", ")_", ",_", "params_", ",_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "p_", "=_", "desc_", "._", "find_", "(_", "GOT", "\\u", "MUL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "http_", "._", "Ba", "d", "Request_", "(_", "'%", "s", " ", "got", " ", "multiple", " ", "values", " ", "for", " ", "keyw", "ord", " ", "argu", "ment", " ", "%", "s", "'_", "'", " ", "--", " ", "receive", "d", " ", "args", " ", "%", "r", " ", "and", " ", "params", " ", "%", "r", "'_", "%_", "(_", "self_", "._", "uri_", ",_", "desc_", "[_", "p_", "+_", "len_", "(_", "GOT", "\\u", "MUL", "_", ")_", ":_", "]_", ",_", "args_", ",_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
openstack/python-openstacksdk/openstack/tests/unit/cluster/v1/test_proxy.py
[ { "content": " def test_cluster_scale_out_with_obj(self):\n mock_cluster = cluster.Cluster.from_id('FAKE_CLUSTER')\n self._verify(\"openstack.cluster.v1.cluster.Cluster.scale_out\",\n self.proxy.cluster_scale_out,\n method_args=[mock_cluster, 5],\n expected_args=[5])", "metadata": "root.TestClusterProxy.test_cluster_scale_out_with_obj", "header": "['class', 'TestClusterProxy', '(', 'test_proxy_base', '.', 'TestProxyBase', ')', ':', '___EOS___']", "index": 150 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Cluster", "Proxy_", "(_", "test\\u", "proxy", "\\u", "base_", "._", "Test", "Pro", "xy", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cluster", "\\u", "scale", "\\u", "out", "\\u", "with", "\\u", "obj_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "cluster_", "=_", "cluster_", "._", "Cluster_", "._", "from", "\\u", "id_", "(_", "'", "FAKE", "\\u", "CLUSTER", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify_", "(_", "\"", "openst", "ack", ".", "cluster", ".", "v1", ".", "cluster", ".", "Cluster", ".", "scale", "\\u", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proxy_", "._", "cluster", "\\u", "scale", "\\u", "out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "args_", "=_", "[_", "mock", "\\u", "cluster_", ",_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "args_", "=_", "[_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/common.py
[ { "content": "def subpackages(packagemod):\n \"\"\"\n Given a module object, returns an iterator which yields a tuple (modulename, moduleobject, ispkg)\n for the given module and all it's submodules/subpackages.\n \"\"\"\n modpkgs = []\n modpkgs_names = set()\n if hasattr(packagemod, '__path__'):\n yield packagemod.__name__, packagemod, True\n for importer, modname, ispkg in pkgutil.walk_packages(packagemod.__path__, packagemod.__name__+'.'):\n if modname not in sys.modules:\n try:\n mod = importer.find_module(modname).load_module(modname)\n except Exception, e:\n print \"error importing %s: %s\" % ( modname, e)\n else:\n mod = sys.modules[modname]\n yield modname, mod, ispkg\n else:\n yield packagemod.__name__, packagemod, False", "metadata": "root.subpackages", "header": "['module', '___EOS___']", "index": 119 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subpa", "ckage", "s_", "(_", "package", "mod_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "module", " ", "object", ",", " ", "return", "s", " ", "an", " ", "iter", "ator", " ", "whi", "ch", " ", "yield", "s", " ", "a", " ", "tuple", " ", "(", "modulename", ",", " ", "module", "object", ",", " ", "isp", "kg", ")", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "give", "n", " ", "module", " ", "and", " ", "all", " ", "it", "'", "s", " ", "submodules", "/", "subpa", "ckage", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modp", "kg", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modp", "kg", "s", "\\u", "names_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "package", "mod_", ",_", "'\\u", "\\u", "path", "\\u\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "package", "mod_", "._", "\\u\\u", "name\\u\\u_", ",_", "package", "mod_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "importer_", ",_", "modname_", ",_", "isp", "kg_", "in_", "pkg", "util_", "._", "walk", "\\u", "packages_", "(_", "package", "mod_", "._", "\\u\\u", "path\\u\\u_", ",_", "package", "mod_", "._", "\\u\\u", "name\\u\\u_", "+_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "modname_", "not_", "in_", "sys_", "._", "modules_", ":_", "\\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 ", " ", "_", "mod_", "=_", "importer_", "._", "find", "\\u", "module_", "(_", "modname_", ")_", "._", "load", "\\u", "module_", "(_", "modname_", ")_", "\\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_", "\"", "error", " ", "import", "ing", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "modname_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "sys_", "._", "modules_", "[_", "modname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "modname_", ",_", "mod_", ",_", "isp", "kg_", "\\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 ", " _", "yield_", "package", "mod_", "._", "\\u\\u", "name\\u\\u_", ",_", "package", "mod_", ",_", "False_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
openstack/python-mistralclient/mistralclient/tests/functional/cli/v2/cli_tests_v2.py
[ { "content": " def test_environment_create_without_description(self):\n self.create_file('env_without_des.yaml',\n 'name: env\\n'\n 'variables:\\n'\n ' var: \"value\"')\n\n env = self.mistral_admin('environment-create',\n params='env_without_des.yaml')\n\n env_name = self.get_value_of_field(env, 'Name')\n env_desc = self.get_value_of_field(env, 'Description')\n\n self.assertTableStruct(env, ['Field', 'Value'])\n\n envs = self.mistral_admin('environment-list')\n self.assertIn(env_name, [en['Name'] for en in envs])\n self.assertIn(env_desc, 'None')\n\n self.mistral_admin('environment-delete', params='env')\n\n envs = self.mistral_admin('environment-list')\n self.assertNotIn(env_name, [en['Name'] for en in envs])", "metadata": "root.EnvironmentCLITests.test_environment_create_without_description", "header": "['class', 'EnvironmentCLITests', '(', 'base_v2', '.', 'MistralClientTestBase', ')', ':', '___EOS___']", "index": 796 } ]
[]
[]
0
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "class_", "Environ", "ment", "CLI", "Tests_", "(_", "base", "\\u", "v2_", "._", "Mis", "tra", "l", "Client", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "environ", "ment", "\\u", "create", "\\u", "with", "out", "\\u", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "\\u", "file_", "(_", "'", "env", "\\u", "with", "out", "\\u", "des", ".", "yaml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", ":", " ", "env", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "variab", "les", ":\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "var", ":", " ", "\"", "value", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "self_", "._", "mist", "ral", "\\u", "admin_", "(_", "'", "environ", "ment", "-", "create", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "'", "env", "\\u", "with", "out", "\\u", "des", ".", "yaml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "name_", "=_", "self_", "._", "get", "\\u", "value", "\\u", "of", "\\u", "field_", "(_", "env_", ",_", "'", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "desc_", "=_", "self_", "._", "get", "\\u", "value", "\\u", "of", "\\u", "field_", "(_", "env_", ",_", "'", "Descripti", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Table", "Struct_", "(_", "env_", ",_", "[_", "'", "Field", "'_", ",_", "'", "Value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "envs_", "=_", "self_", "._", "mist", "ral", "\\u", "admin_", "(_", "'", "environ", "ment", "-", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "env", "\\u", "name_", ",_", "[_", "en_", "[_", "'", "Name", "'_", "]_", "for_", "en_", "in_", "envs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "env", "\\u", "desc_", ",_", "'", "Non", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mist", "ral", "\\u", "admin_", "(_", "'", "environ", "ment", "-", "delete", "'_", ",_", "params_", "=_", "'", "env", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "envs_", "=_", "self_", "._", "mist", "ral", "\\u", "admin_", "(_", "'", "environ", "ment", "-", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "env", "\\u", "name_", ",_", "[_", "en_", "[_", "'", "Name", "'_", "]_", "for_", "en_", "in_", "envs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
NeuralEnsemble/python-neo/neo/test/coretest/test_analogsignal.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nTests of the neo.core.analogsignal.AnalogSignal class and related functions\n\"\"\"\n\n# needed for python 3 compatibility\nfrom __future__ import division\n\nimport os\nimport pickle\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nimport numpy as np\nimport quantities as pq\n\ntry:\n from IPython.lib.pretty import pretty\nexcept ImportError as err:\n HAVE_IPYTHON = False\nelse:\n HAVE_IPYTHON = True\n\nfrom neo.core.analogsignal import AnalogSignal, _get_sampling_rate\nfrom neo.core import Segment, RecordingChannel\nfrom neo.test.tools import (assert_arrays_almost_equal, assert_arrays_equal,\n assert_neo_object_is_compliant,\n assert_same_sub_schema)\nfrom neo.test.generate_datasets import (get_fake_value, get_fake_values,\n fake_neo, TEST_ANNOTATIONS)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Test__generate_datasets(unittest.TestCase):\n\n\n", "metadata": "root.Test__generate_datasets", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def setUp(self):\n np.random.seed(0)\n self.annotations = dict([(str(x), TEST_ANNOTATIONS[x]) for x in\n range(len(TEST_ANNOTATIONS))])", "metadata": "root.Test__generate_datasets.setUp", "header": "['class', 'Test__generate_datasets', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test__get_fake_values(self):\n self.annotations['seed'] = 0\n signal = get_fake_value('signal', pq.Quantity, seed=0, dim=1)\n sampling_rate = get_fake_value('sampling_rate', pq.Quantity,\n seed=1, dim=0)\n t_start = get_fake_value('t_start', pq.Quantity, seed=2, dim=0)\n channel_index = get_fake_value('channel_index', int, seed=3)\n name = get_fake_value('name', str, seed=4, obj=AnalogSignal)\n description = get_fake_value('description', str, seed=5,\n obj='AnalogSignal')\n file_origin = get_fake_value('file_origin', str)\n attrs1 = {'channel_index': channel_index,\n 'name': name,\n 'description': description,\n 'file_origin': file_origin}\n attrs2 = attrs1.copy()\n attrs2.update(self.annotations)\n\n res11 = get_fake_values(AnalogSignal, annotate=False, seed=0)\n res12 = get_fake_values('AnalogSignal', annotate=False, seed=0)\n res21 = get_fake_values(AnalogSignal, annotate=True, seed=0)\n res22 = get_fake_values('AnalogSignal', annotate=True, seed=0)\n\n assert_arrays_equal(res11.pop('signal'), signal)\n assert_arrays_equal(res12.pop('signal'), signal)\n assert_arrays_equal(res21.pop('signal'), signal)\n assert_arrays_equal(res22.pop('signal'), signal)\n\n assert_arrays_equal(res11.pop('sampling_rate'), sampling_rate)\n assert_arrays_equal(res12.pop('sampling_rate'), sampling_rate)\n assert_arrays_equal(res21.pop('sampling_rate'), sampling_rate)\n assert_arrays_equal(res22.pop('sampling_rate'), sampling_rate)\n\n assert_arrays_equal(res11.pop('t_start'), t_start)\n assert_arrays_equal(res12.pop('t_start'), t_start)\n assert_arrays_equal(res21.pop('t_start'), t_start)\n assert_arrays_equal(res22.pop('t_start'), t_start)\n\n self.assertEqual(res11, attrs1)\n self.assertEqual(res12, attrs1)\n self.assertEqual(res21, attrs2)\n self.assertEqual(res22, attrs2)", "metadata": "root.Test__generate_datasets.test__get_fake_values", "header": "['class', 'Test__generate_datasets', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test__fake_neo__cascade(self):\n self.annotations['seed'] = None\n obj_type = AnalogSignal\n cascade = True\n res = fake_neo(obj_type=obj_type, cascade=cascade)\n\n self.assertTrue(isinstance(res, AnalogSignal))\n assert_neo_object_is_compliant(res)\n self.assertEqual(res.annotations, self.annotations)", "metadata": "root.Test__generate_datasets.test__fake_neo__cascade", "header": "['class', 'Test__generate_datasets', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test__fake_neo__nocascade(self):\n self.annotations['seed'] = None\n obj_type = 'AnalogSignal'\n cascade = False\n res = fake_neo(obj_type=obj_type, cascade=cascade)\n\n self.assertTrue(isinstance(res, AnalogSignal))\n assert_neo_object_is_compliant(res)\n self.assertEqual(res.annotations, self.annotations)", "metadata": "root.Test__generate_datasets.test__fake_neo__nocascade", "header": "['class', 'Test__generate_datasets', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": "class TestAnalogSignalConstructor(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n # signal must be 1D - should raise Exception if not 1D", "metadata": "root.TestAnalogSignalConstructor", "header": "['module', '___EOS___']", "index": 105 }, { "content": " def test__create_from_list(self):\n data = range(10)\n rate = 1000*pq.Hz\n signal = AnalogSignal(data, sampling_rate=rate, units=\"mV\")\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.t_start, 0*pq.ms)\n self.assertEqual(signal.t_stop, len(data)/rate)\n self.assertEqual(signal[9], 9000*pq.uV)", "metadata": "root.TestAnalogSignalConstructor.test__create_from_list", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test__create_from_np_array(self):\n data = np.arange(10.0)\n rate = 1*pq.kHz\n signal = AnalogSignal(data, sampling_rate=rate, units=\"uV\")\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.t_start, 0*pq.ms)\n self.assertEqual(signal.t_stop, data.size/rate)\n self.assertEqual(signal[9], 0.009*pq.mV)", "metadata": "root.TestAnalogSignalConstructor.test__create_from_np_array", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test__create_from_quantities_array(self):\n data = np.arange(10.0) * pq.mV\n rate = 5000*pq.Hz\n signal = AnalogSignal(data, sampling_rate=rate)\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.t_start, 0*pq.ms)\n self.assertEqual(signal.t_stop, data.size/rate)\n self.assertEqual(signal[9], 0.009*pq.V)", "metadata": "root.TestAnalogSignalConstructor.test__create_from_quantities_array", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test__create_from_array_no_units_ValueError(self):\n data = np.arange(10.0)\n self.assertRaises(ValueError, AnalogSignal, data,\n sampling_rate=1 * pq.kHz)", "metadata": "root.TestAnalogSignalConstructor.test__create_from_array_no_units_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test__create_from_quantities_array_inconsistent_units_ValueError(self):\n data = np.arange(10.0) * pq.mV\n self.assertRaises(ValueError, AnalogSignal, data,\n sampling_rate=1 * pq.kHz, units=\"nA\")", "metadata": "root.TestAnalogSignalConstructor.test__create_from_quantities_array_inconsistent_units_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test__create_without_sampling_rate_or_period_ValueError(self):\n data = np.arange(10.0) * pq.mV\n self.assertRaises(ValueError, AnalogSignal, data)", "metadata": "root.TestAnalogSignalConstructor.test__create_without_sampling_rate_or_period_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 143 }, { "content": " def test__create_with_None_sampling_rate_should_raise_ValueError(self):\n data = np.arange(10.0) * pq.mV\n self.assertRaises(ValueError, AnalogSignal, data, sampling_rate=None)", "metadata": "root.TestAnalogSignalConstructor.test__create_with_None_sampling_rate_should_raise_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": " def test__create_with_None_t_start_should_raise_ValueError(self):\n data = np.arange(10.0) * pq.mV\n rate = 5000 * pq.Hz\n self.assertRaises(ValueError, AnalogSignal, data,\n sampling_rate=rate, t_start=None)", "metadata": "root.TestAnalogSignalConstructor.test__create_with_None_t_start_should_raise_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 151 }, { "content": " def test__create_inconsistent_sampling_rate_and_period_ValueError(self):\n data = np.arange(10.0) * pq.mV\n self.assertRaises(ValueError, AnalogSignal, data,\n sampling_rate=1 * pq.kHz, sampling_period=5 * pq.s)", "metadata": "root.TestAnalogSignalConstructor.test__create_inconsistent_sampling_rate_and_period_ValueError", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 157 }, { "content": " def test__create_with_copy_true_should_return_copy(self):\n data = np.arange(10.0) * pq.mV\n rate = 5000*pq.Hz\n signal = AnalogSignal(data, copy=True, sampling_rate=rate)\n data[3] = 99*pq.mV\n assert_neo_object_is_compliant(signal)\n self.assertNotEqual(signal[3], 99*pq.mV)", "metadata": "root.TestAnalogSignalConstructor.test__create_with_copy_true_should_return_copy", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test__create_with_copy_false_should_return_view(self):\n data = np.arange(10.0) * pq.mV\n rate = 5000*pq.Hz\n signal = AnalogSignal(data, copy=False, sampling_rate=rate)\n data[3] = 99*pq.mV\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal[3], 99*pq.mV)", "metadata": "root.TestAnalogSignalConstructor.test__create_with_copy_false_should_return_view", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 170 }, { "content": " def test__create_with_additional_argument(self):\n signal = AnalogSignal([1, 2, 3], units=\"mV\", sampling_rate=1*pq.kHz,\n file_origin='crack.txt', ratname='Nicolas')\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.annotations, {'ratname': 'Nicolas'})\n\n # This one is universally recommended and handled by BaseNeo\n self.assertEqual(signal.file_origin, 'crack.txt')", "metadata": "root.TestAnalogSignalConstructor.test__create_with_additional_argument", "header": "['class', 'TestAnalogSignalConstructor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": "class TestAnalogSignalProperties(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestAnalogSignalProperties", "header": "['module', '___EOS___']", "index": 190 }, { "content": " def setUp(self):\n self.t_start = [0.0*pq.ms, 100*pq.ms, -200*pq.ms]\n self.rates = [1*pq.kHz, 420*pq.Hz, 999*pq.Hz]\n self.rates2 = [2*pq.kHz, 290*pq.Hz, 1111*pq.Hz]\n self.data = [np.arange(10.0)*pq.nA,\n np.arange(-100.0, 100.0, 10.0)*pq.mV,\n np.random.uniform(size=100)*pq.uV]\n self.signals = [AnalogSignal(D, sampling_rate=r, t_start=t,\n testattr='test')\n for r, D, t in zip(self.rates,\n self.data,\n self.t_start)]", "metadata": "root.TestAnalogSignalProperties.setUp", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test__compliant(self):\n for signal in self.signals:\n assert_neo_object_is_compliant(signal)", "metadata": "root.TestAnalogSignalProperties.test__compliant", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test__t_stop_getter(self):\n for i, signal in enumerate(self.signals):\n self.assertEqual(signal.t_stop,\n self.t_start[i] + self.data[i].size/self.rates[i])", "metadata": "root.TestAnalogSignalProperties.test__t_stop_getter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 208 }, { "content": " def test__duration_getter(self):\n for signal in self.signals:\n self.assertAlmostEqual(signal.duration,\n signal.t_stop - signal.t_start,\n delta=1e-15)", "metadata": "root.TestAnalogSignalProperties.test__duration_getter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " def test__sampling_rate_getter(self):\n for signal, rate in zip(self.signals, self.rates):\n self.assertEqual(signal.sampling_rate, rate)", "metadata": "root.TestAnalogSignalProperties.test__sampling_rate_getter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def test__sampling_period_getter(self):\n for signal, rate in zip(self.signals, self.rates):\n self.assertEqual(signal.sampling_period, 1 / rate)", "metadata": "root.TestAnalogSignalProperties.test__sampling_period_getter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 223 }, { "content": " def test__sampling_rate_setter(self):\n for signal, rate in zip(self.signals, self.rates2):\n signal.sampling_rate = rate\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.sampling_rate, rate)\n self.assertEqual(signal.sampling_period, 1 / rate)", "metadata": "root.TestAnalogSignalProperties.test__sampling_rate_setter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 227 }, { "content": " def test__sampling_period_setter(self):\n for signal, rate in zip(self.signals, self.rates2):\n signal.sampling_period = 1 / rate\n assert_neo_object_is_compliant(signal)\n self.assertEqual(signal.sampling_rate, rate)\n self.assertEqual(signal.sampling_period, 1 / rate)", "metadata": "root.TestAnalogSignalProperties.test__sampling_period_setter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 234 }, { "content": " def test__sampling_rate_setter_None_ValueError(self):\n self.assertRaises(ValueError, setattr, self.signals[0],\n 'sampling_rate', None)", "metadata": "root.TestAnalogSignalProperties.test__sampling_rate_setter_None_ValueError", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 241 }, { "content": " def test__sampling_rate_setter_not_quantity_ValueError(self):\n self.assertRaises(ValueError, setattr, self.signals[0],\n 'sampling_rate', 5.5)", "metadata": "root.TestAnalogSignalProperties.test__sampling_rate_setter_not_quantity_ValueError", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test__sampling_period_setter_None_ValueError(self):\n signal = self.signals[0]\n assert_neo_object_is_compliant(signal)\n self.assertRaises(ValueError, setattr, signal, 'sampling_period', None)", "metadata": "root.TestAnalogSignalProperties.test__sampling_period_setter_None_ValueError", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def test__sampling_period_setter_not_quantity_ValueError(self):\n self.assertRaises(ValueError, setattr, self.signals[0],\n 'sampling_period', 5.5)", "metadata": "root.TestAnalogSignalProperties.test__sampling_period_setter_not_quantity_ValueError", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 254 }, { "content": " def test__t_start_setter_None_ValueError(self):\n signal = self.signals[0]\n assert_neo_object_is_compliant(signal)\n self.assertRaises(ValueError, setattr, signal, 't_start', None)", "metadata": "root.TestAnalogSignalProperties.test__t_start_setter_None_ValueError", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def test__times_getter(self):\n for i, signal in enumerate(self.signals):\n targ = np.arange(self.data[i].size)\n targ = targ/self.rates[i] + self.t_start[i]\n assert_neo_object_is_compliant(signal)\n assert_arrays_almost_equal(signal.times, targ, 1e-12*pq.ms)", "metadata": "root.TestAnalogSignalProperties.test__times_getter", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 263 }, { "content": " def test__duplicate_with_new_array(self):\n signal1 = self.signals[1]\n signal2 = self.signals[2]\n data2 = self.data[2]\n signal1b = signal1.duplicate_with_new_array(data2)\n assert_arrays_almost_equal(np.asarray(signal1b),\n np.asarray(signal2/1000.), 1e-12)\n self.assertEqual(signal1b.t_start, signal1.t_start)\n self.assertEqual(signal1b.sampling_rate, signal1.sampling_rate)", "metadata": "root.TestAnalogSignalProperties.test__duplicate_with_new_array", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 270 }, { "content": " def test__children(self):\n signal = self.signals[0]\n\n segment = Segment(name='seg1')\n segment.analogsignals = [signal]\n segment.create_many_to_one_relationship()\n\n rchan = RecordingChannel(name='rchan1')\n rchan.analogsignals = [signal]\n rchan.create_many_to_one_relationship()\n\n self.assertEqual(signal._single_parent_objects,\n ('Segment', 'RecordingChannel'))\n self.assertEqual(signal._multi_parent_objects, ())\n\n self.assertEqual(signal._single_parent_containers,\n ('segment', 'recordingchannel'))\n self.assertEqual(signal._multi_parent_containers, ())\n\n self.assertEqual(signal._parent_objects,\n ('Segment', 'RecordingChannel'))\n self.assertEqual(signal._parent_containers,\n ('segment', 'recordingchannel'))\n\n self.assertEqual(len(signal.parents), 2)\n self.assertEqual(signal.parents[0].name, 'seg1')\n self.assertEqual(signal.parents[1].name, 'rchan1')\n\n assert_neo_object_is_compliant(signal)", "metadata": "root.TestAnalogSignalProperties.test__children", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 280 }, { "content": " def test__repr(self):\n for i, signal in enumerate(self.signals):\n prepr = repr(signal)\n targ = '<AnalogSignal(%s, [%s, %s], sampling rate: %s)>' % \\\n (repr(self.data[i]),\n self.t_start[i],\n self.t_start[i] + len(self.data[i])/self.rates[i],\n self.rates[i])\n self.assertEqual(prepr, targ)", "metadata": "root.TestAnalogSignalProperties.test__repr", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 310 }, { "content": " @unittest.skipUnless(HAVE_IPYTHON, \"requires IPython\")\n def test__pretty(self):\n for i, signal in enumerate(self.signals):\n prepr = pretty(signal)\n targ = (('AnalogSignal in %s with %s %s values\\n' %\n (signal.units, len(signal), signal.dtype)) +\n ('annotations: %s\\n' % signal.annotations) +\n ('channel index: %s\\n' % signal.channel_index) +\n ('sampling rate: %s\\n' % signal.sampling_rate) +\n ('time: %s to %s' % (signal.t_start, signal.t_stop)))\n\n self.assertEqual(prepr, targ)", "metadata": "root.TestAnalogSignalProperties.test__pretty", "header": "['class', 'TestAnalogSignalProperties', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 320 }, { "content": "class TestAnalogSignalArrayMethods(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestAnalogSignalArrayMethods", "header": "['module', '___EOS___']", "index": 334 }, { "content": " def setUp(self):\n self.data1 = np.arange(10.0)\n self.data1quant = self.data1 * pq.nA\n self.signal1 = AnalogSignal(self.data1quant, sampling_rate=1*pq.kHz,\n name='spam', description='eggs',\n file_origin='testfile.txt', arg1='test')", "metadata": "root.TestAnalogSignalArrayMethods.setUp", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 335 }, { "content": " def test__compliant(self):\n assert_neo_object_is_compliant(self.signal1)", "metadata": "root.TestAnalogSignalArrayMethods.test__compliant", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 342 }, { "content": " def test__slice_should_return_AnalogSignal(self):\n # slice\n result = self.signal1[3:8]\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(result.size, 5)\n self.assertEqual(result.sampling_period, self.signal1.sampling_period)\n self.assertEqual(result.sampling_rate, self.signal1.sampling_rate)\n self.assertEqual(result.t_start,\n self.signal1.t_start+3*result.sampling_period)\n self.assertEqual(result.t_stop,\n result.t_start + 5*result.sampling_period)\n assert_arrays_equal(result, self.data1[3:8])\n\n # Test other attributes were copied over (in this case, defaults)\n self.assertEqual(result.file_origin, self.signal1.file_origin)\n self.assertEqual(result.name, self.signal1.name)\n self.assertEqual(result.description, self.signal1.description)\n self.assertEqual(result.annotations, self.signal1.annotations)", "metadata": "root.TestAnalogSignalArrayMethods.test__slice_should_return_AnalogSignal", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 345 }, { "content": " def test__slice_should_change_sampling_period(self):\n result1 = self.signal1[:2]\n result2 = self.signal1[::2]\n result3 = self.signal1[1:7:2]\n\n self.assertIsInstance(result1, AnalogSignal)\n assert_neo_object_is_compliant(result1)\n self.assertEqual(result1.name, 'spam')\n self.assertEqual(result1.description, 'eggs')\n self.assertEqual(result1.file_origin, 'testfile.txt')\n self.assertEqual(result1.annotations, {'arg1': 'test'})\n\n self.assertIsInstance(result2, AnalogSignal)\n assert_neo_object_is_compliant(result2)\n self.assertEqual(result2.name, 'spam')\n self.assertEqual(result2.description, 'eggs')\n self.assertEqual(result2.file_origin, 'testfile.txt')\n self.assertEqual(result2.annotations, {'arg1': 'test'})\n\n self.assertIsInstance(result3, AnalogSignal)\n assert_neo_object_is_compliant(result3)\n self.assertEqual(result3.name, 'spam')\n self.assertEqual(result3.description, 'eggs')\n self.assertEqual(result3.file_origin, 'testfile.txt')\n self.assertEqual(result3.annotations, {'arg1': 'test'})\n\n self.assertEqual(result1.sampling_period, self.signal1.sampling_period)\n self.assertEqual(result2.sampling_period,\n self.signal1.sampling_period * 2)\n self.assertEqual(result3.sampling_period,\n self.signal1.sampling_period * 2)\n\n assert_arrays_equal(result1, self.data1[:2])\n assert_arrays_equal(result2, self.data1[::2])\n assert_arrays_equal(result3, self.data1[1:7:2])", "metadata": "root.TestAnalogSignalArrayMethods.test__slice_should_change_sampling_period", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 370 }, { "content": " def test__getitem_should_return_single_quantity(self):\n result1 = self.signal1[0]\n result2 = self.signal1[9]\n\n self.assertIsInstance(result1, pq.Quantity)\n self.assertFalse(hasattr(result1, 'name'))\n self.assertFalse(hasattr(result1, 'description'))\n self.assertFalse(hasattr(result1, 'file_origin'))\n self.assertFalse(hasattr(result1, 'annotations'))\n\n self.assertIsInstance(result2, pq.Quantity)\n self.assertFalse(hasattr(result2, 'name'))\n self.assertFalse(hasattr(result2, 'description'))\n self.assertFalse(hasattr(result2, 'file_origin'))\n self.assertFalse(hasattr(result2, 'annotations'))\n\n self.assertEqual(result1, 0*pq.nA)\n self.assertEqual(result2, 9*pq.nA)", "metadata": "root.TestAnalogSignalArrayMethods.test__getitem_should_return_single_quantity", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 406 }, { "content": " def test__getitem_out_of_bounds_IndexError(self):\n self.assertRaises(IndexError, self.signal1.__getitem__, 10)", "metadata": "root.TestAnalogSignalArrayMethods.test__getitem_out_of_bounds_IndexError", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 425 }, { "content": " def test_comparison_operators(self):\n assert_arrays_equal(self.signal1 >= 5*pq.nA,\n np.array([False, False, False, False, False,\n True, True, True, True, True]))\n assert_arrays_equal(self.signal1 >= 5*pq.pA,\n np.array([False, True, True, True, True,\n True, True, True, True, True]))", "metadata": "root.TestAnalogSignalArrayMethods.test_comparison_operators", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 428 }, { "content": " def test__comparison_with_inconsistent_units_should_raise_Exception(self):\n self.assertRaises(ValueError, self.signal1.__gt__, 5*pq.mV)", "metadata": "root.TestAnalogSignalArrayMethods.test__comparison_with_inconsistent_units_should_raise_Exception", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 436 }, { "content": " def test__simple_statistics(self):\n self.assertEqual(self.signal1.max(), 9*pq.nA)\n self.assertEqual(self.signal1.min(), 0*pq.nA)\n self.assertEqual(self.signal1.mean(), 4.5*pq.nA)", "metadata": "root.TestAnalogSignalArrayMethods.test__simple_statistics", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 439 }, { "content": " def test__rescale_same(self):\n result = self.signal1.copy()\n result = result.rescale(pq.nA)\n\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(result.units, 1*pq.nA)\n assert_arrays_equal(result, self.data1)\n assert_same_sub_schema(result, self.signal1)", "metadata": "root.TestAnalogSignalArrayMethods.test__rescale_same", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 444 }, { "content": " def test__rescale_new(self):\n result = self.signal1.copy()\n result = result.rescale(pq.pA)\n\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(result.units, 1*pq.pA)\n assert_arrays_almost_equal(np.array(result), self.data1*1000., 1e-10)", "metadata": "root.TestAnalogSignalArrayMethods.test__rescale_new", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 459 }, { "content": " def test__rescale_new_incompatible_ValueError(self):\n self.assertRaises(ValueError, self.signal1.rescale, pq.mV)", "metadata": "root.TestAnalogSignalArrayMethods.test__rescale_new_incompatible_ValueError", "header": "['class', 'TestAnalogSignalArrayMethods', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 473 }, { "content": "class TestAnalogSignalEquality(unittest.TestCase):", "metadata": "root.TestAnalogSignalEquality", "header": "['module', '___EOS___']", "index": 477 }, { "content": " def test__signals_with_different_data_complement_should_be_not_equal(self):\n signal1 = AnalogSignal(np.arange(10.0), units=\"mV\",\n sampling_rate=1*pq.kHz)\n signal2 = AnalogSignal(np.arange(10.0), units=\"mV\",\n sampling_rate=2*pq.kHz)\n assert_neo_object_is_compliant(signal1)\n assert_neo_object_is_compliant(signal2)\n self.assertNotEqual(signal1, signal2)", "metadata": "root.TestAnalogSignalEquality.test__signals_with_different_data_complement_should_be_not_equal", "header": "['class', 'TestAnalogSignalEquality', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 478 }, { "content": "class TestAnalogSignalCombination(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestAnalogSignalCombination", "header": "['module', '___EOS___']", "index": 488 }, { "content": " def setUp(self):\n self.data1 = np.arange(10.0)\n self.data1quant = self.data1 * pq.mV\n self.signal1 = AnalogSignal(self.data1quant,\n sampling_rate=1*pq.kHz,\n name='spam', description='eggs',\n file_origin='testfile.txt',\n arg1='test')", "metadata": "root.TestAnalogSignalCombination.setUp", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 489 }, { "content": " def test__compliant(self):\n assert_neo_object_is_compliant(self.signal1)\n self.assertEqual(self.signal1.name, 'spam')\n self.assertEqual(self.signal1.description, 'eggs')\n self.assertEqual(self.signal1.file_origin, 'testfile.txt')\n self.assertEqual(self.signal1.annotations, {'arg1': 'test'})", "metadata": "root.TestAnalogSignalCombination.test__compliant", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 498 }, { "content": " def test__add_const_quantity_should_preserve_data_complement(self):\n result = self.signal1 + 0.065*pq.V\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n assert_arrays_equal(result, self.data1 + 65)\n self.assertEqual(self.signal1[9], 9*pq.mV)\n self.assertEqual(result[9], 74*pq.mV)\n self.assertEqual(self.signal1.t_start, result.t_start)\n self.assertEqual(self.signal1.sampling_rate, result.sampling_rate)", "metadata": "root.TestAnalogSignalCombination.test__add_const_quantity_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 505 }, { "content": " def test__add_quantity_should_preserve_data_complement(self):\n data2 = np.arange(10.0, 20.0)\n data2quant = data2*pq.mV\n\n result = self.signal1 + data2quant\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n targ = AnalogSignal(np.arange(10.0, 30.0, 2.0), units=\"mV\",\n sampling_rate=1*pq.kHz,\n name='spam', description='eggs',\n file_origin='testfile.txt', arg1='test')\n assert_neo_object_is_compliant(targ)\n\n assert_arrays_equal(result, targ)\n assert_same_sub_schema(result, targ)", "metadata": "root.TestAnalogSignalCombination.test__add_quantity_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 520 }, { "content": " def test__add_two_consistent_signals_should_preserve_data_complement(self):\n data2 = np.arange(10.0, 20.0)\n data2quant = data2*pq.mV\n signal2 = AnalogSignal(data2quant, sampling_rate=1*pq.kHz)\n assert_neo_object_is_compliant(signal2)\n\n result = self.signal1 + signal2\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n targ = AnalogSignal(np.arange(10.0, 30.0, 2.0), units=\"mV\",\n sampling_rate=1*pq.kHz,\n name='spam', description='eggs',\n file_origin='testfile.txt', arg1='test')\n assert_neo_object_is_compliant(targ)\n\n assert_arrays_equal(result, targ)\n assert_same_sub_schema(result, targ)", "metadata": "root.TestAnalogSignalCombination.test__add_two_consistent_signals_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 541 }, { "content": " def test__add_signals_with_inconsistent_data_complement_ValueError(self):\n self.signal1.t_start = 0.0*pq.ms\n assert_neo_object_is_compliant(self.signal1)\n\n signal2 = AnalogSignal(np.arange(10.0), units=\"mV\",\n t_start=100.0*pq.ms, sampling_rate=0.5*pq.kHz)\n assert_neo_object_is_compliant(signal2)\n\n self.assertRaises(ValueError, self.signal1.__add__, signal2)", "metadata": "root.TestAnalogSignalCombination.test__add_signals_with_inconsistent_data_complement_ValueError", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 564 }, { "content": " def test__subtract_const_should_preserve_data_complement(self):\n result = self.signal1 - 65*pq.mV\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(self.signal1[9], 9*pq.mV)\n self.assertEqual(result[9], -56*pq.mV)\n assert_arrays_equal(result, self.data1 - 65)\n self.assertEqual(self.signal1.sampling_rate, result.sampling_rate)", "metadata": "root.TestAnalogSignalCombination.test__subtract_const_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 574 }, { "content": " def test__subtract_from_const_should_return_signal(self):\n result = 10*pq.mV - self.signal1\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(self.signal1[9], 9*pq.mV)\n self.assertEqual(result[9], 1*pq.mV)\n assert_arrays_equal(result, 10 - self.data1)\n self.assertEqual(self.signal1.sampling_rate, result.sampling_rate)", "metadata": "root.TestAnalogSignalCombination.test__subtract_from_const_should_return_signal", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 588 }, { "content": " def test__mult_by_const_float_should_preserve_data_complement(self):\n result = self.signal1*2\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(self.signal1[9], 9*pq.mV)\n self.assertEqual(result[9], 18*pq.mV)\n assert_arrays_equal(result, self.data1*2)\n self.assertEqual(self.signal1.sampling_rate, result.sampling_rate)", "metadata": "root.TestAnalogSignalCombination.test__mult_by_const_float_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 602 }, { "content": " def test__divide_by_const_should_preserve_data_complement(self):\n result = self.signal1/0.5\n self.assertIsInstance(result, AnalogSignal)\n assert_neo_object_is_compliant(result)\n self.assertEqual(result.name, 'spam')\n self.assertEqual(result.description, 'eggs')\n self.assertEqual(result.file_origin, 'testfile.txt')\n self.assertEqual(result.annotations, {'arg1': 'test'})\n\n self.assertEqual(self.signal1[9], 9*pq.mV)\n self.assertEqual(result[9], 18*pq.mV)\n assert_arrays_equal(result, self.data1/0.5)\n self.assertEqual(self.signal1.sampling_rate, result.sampling_rate)", "metadata": "root.TestAnalogSignalCombination.test__divide_by_const_should_preserve_data_complement", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 616 }, { "content": " def test__merge_NotImplementedError(self):\n self.assertRaises(NotImplementedError,\n self.signal1.merge, self.signal1)", "metadata": "root.TestAnalogSignalCombination.test__merge_NotImplementedError", "header": "['class', 'TestAnalogSignalCombination', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 630 }, { "content": "class TestAnalogSignalFunctions(unittest.TestCase):", "metadata": "root.TestAnalogSignalFunctions", "header": "['module', '___EOS___']", "index": 635 }, { "content": " def test__pickle(self):\n signal1 = AnalogSignal([1, 2, 3, 4], sampling_period=1*pq.ms,\n units=pq.S, channel_index=42)\n signal1.annotations['index'] = 2\n\n fobj = open('./pickle', 'wb')\n pickle.dump(signal1, fobj)\n fobj.close()\n\n fobj = open('./pickle', 'rb')\n try:\n signal2 = pickle.load(fobj)\n except ValueError:\n signal2 = None\n\n assert_arrays_equal(signal1, signal2)\n self.assertEqual(signal1.channel_index, signal2.channel_index, 42)\n fobj.close()\n os.remove('./pickle')", "metadata": "root.TestAnalogSignalFunctions.test__pickle", "header": "['class', 'TestAnalogSignalFunctions', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 636 }, { "content": "class TestAnalogSignalSampling(unittest.TestCase):\n\n\n\n\n\n", "metadata": "root.TestAnalogSignalSampling", "header": "['module', '___EOS___']", "index": 657 }, { "content": " def test___get_sampling_rate__period_none_rate_none_ValueError(self):\n sampling_rate = None\n sampling_period = None\n self.assertRaises(ValueError, _get_sampling_rate,\n sampling_rate, sampling_period)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_none_rate_none_ValueError", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 658 }, { "content": " def test___get_sampling_rate__period_quant_rate_none(self):\n sampling_rate = None\n sampling_period = pq.Quantity(10., units=pq.s)\n targ_rate = 1/sampling_period\n out_rate = _get_sampling_rate(sampling_rate, sampling_period)\n self.assertEqual(targ_rate, out_rate)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_quant_rate_none", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 664 }, { "content": " def test___get_sampling_rate__period_none_rate_quant(self):\n sampling_rate = pq.Quantity(10., units=pq.Hz)\n sampling_period = None\n targ_rate = sampling_rate\n out_rate = _get_sampling_rate(sampling_rate, sampling_period)\n self.assertEqual(targ_rate, out_rate)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_none_rate_quant", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 671 }, { "content": " def test___get_sampling_rate__period_rate_equivalent(self):\n sampling_rate = pq.Quantity(10., units=pq.Hz)\n sampling_period = pq.Quantity(0.1, units=pq.s)\n targ_rate = sampling_rate\n out_rate = _get_sampling_rate(sampling_rate, sampling_period)\n self.assertEqual(targ_rate, out_rate)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_rate_equivalent", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 678 }, { "content": " def test___get_sampling_rate__period_rate_not_equivalent_ValueError(self):\n sampling_rate = pq.Quantity(10., units=pq.Hz)\n sampling_period = pq.Quantity(10, units=pq.s)\n self.assertRaises(ValueError, _get_sampling_rate,\n sampling_rate, sampling_period)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_rate_not_equivalent_ValueError", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 685 }, { "content": " def test___get_sampling_rate__period_none_rate_float_TypeError(self):\n sampling_rate = 10.\n sampling_period = None\n self.assertRaises(TypeError, _get_sampling_rate,\n sampling_rate, sampling_period)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_none_rate_float_TypeError", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 691 }, { "content": " def test___get_sampling_rate__period_array_rate_none_TypeError(self):\n sampling_rate = None\n sampling_period = np.array(10.)\n self.assertRaises(TypeError, _get_sampling_rate,\n sampling_rate, sampling_period)", "metadata": "root.TestAnalogSignalSampling.test___get_sampling_rate__period_array_rate_none_TypeError", "header": "['class', 'TestAnalogSignalSampling', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 697 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", "s", " ", "of", " ", "the", " ", "neo", ".", "core", ".", "analog", "signal", ".", "Ana", "log", "Signal", " ", "class", " ", "and", " ", "relate", "d", " ", "function", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "ed", " ", "for", " ", "python", " ", "3", " ", "compatibility", "_", "\\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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\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_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "quantities", "_", "as_", "pq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "IP", "ython_", "._", "lib_", "._", "pretty_", "import_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HA", "VE", "\\u", "IP", "YT", "HON", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HA", "VE", "\\u", "IP", "YT", "HON", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "neo", "_", "._", "core_", "._", "analog", "signal_", "import_", "Ana", "log", "Signal_", ",_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neo", "_", "._", "core_", "import_", "Segment_", ",_", "Record", "ing", "Channel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neo", "_", "._", "test_", "._", "tools_", "import_", "(_", "assert", "\\u", "arrays", "\\u", "alm", "ost", "\\u", "equal_", ",_", "assert", "\\u", "arrays", "\\u", "equal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "same", "\\u", "sub\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neo", "_", "._", "test_", "._", "generat", "e\\u", "datasets_", "import_", "(_", "get", "\\u", "fake", "\\u", "value_", ",_", "get", "\\u", "fake", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "neo", "_", ",_", "TEST", "\\u", "ANNOTAT", "IONS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Test", "\\u\\u", "generat", "e\\u", "datasets_", "(_", "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_", "[SEP]_", "class_", "Test", "\\u\\u", "generat", "e\\u", "datasets_", "(_", "unittest_", "._", "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 ", " _", "np_", "._", "random_", "._", "seed_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annotations_", "=_", "dict_", "(_", "[_", "(_", "str_", "(_", "x_", ")_", ",_", "TEST", "\\u", "ANNOTAT", "IONS", "_", "[_", "x_", "]_", ")_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "range_", "(_", "len_", "(_", "TEST", "\\u", "ANNOTAT", "IONS", "_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u\\u", "generat", "e\\u", "datasets_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "get", "\\u", "fake", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annotations_", "[_", "'", "seed", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "signal", "'_", ",_", "pq_", "._", "Quantity_", ",_", "seed_", "=_", "0_", ",_", "dim_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "samp", "ling", "\\u", "rate", "'_", ",_", "pq_", "._", "Quantity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seed_", "=_", "1_", ",_", "dim_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "start_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "t", "\\u", "start", "'_", ",_", "pq_", "._", "Quantity_", ",_", "seed_", "=_", "2_", ",_", "dim_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "\\u", "index_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "channel", "\\u", "index", "'_", ",_", "int_", ",_", "seed_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "name", "'_", ",_", "str_", ",_", "seed_", "=_", "4_", ",_", "obj_", "=_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "description", "'_", ",_", "str_", ",_", "seed_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "'", "Ana", "log", "Signal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "origin_", "=_", "get", "\\u", "fake", "\\u", "value_", "(_", "'", "file", "\\u", "orig", "in", "'_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "s1_", "=_", "{_", "'", "channel", "\\u", "index", "'_", ":_", "channel", "\\u", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "orig", "in", "'_", ":_", "file", "\\u", "origin_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "s2_", "=_", "attr", "s1_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "s2_", "._", "update_", "(_", "self_", "._", "annotations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res", "11_", "=_", "get", "\\u", "fake", "\\u", "values_", "(_", "Ana", "log", "Signal_", ",_", "annotate_", "=_", "False_", ",_", "seed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "12_", "=_", "get", "\\u", "fake", "\\u", "values_", "(_", "'", "Ana", "log", "Signal", "'_", ",_", "annotate_", "=_", "False_", ",_", "seed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "21_", "=_", "get", "\\u", "fake", "\\u", "values_", "(_", "Ana", "log", "Signal_", ",_", "annotate_", "=_", "True_", ",_", "seed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "22_", "=_", "get", "\\u", "fake", "\\u", "values_", "(_", "'", "Ana", "log", "Signal", "'_", ",_", "annotate_", "=_", "True_", ",_", "seed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "11_", "._", "pop_", "(_", "'", "signal", "'_", ")_", ",_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "12_", "._", "pop_", "(_", "'", "signal", "'_", ")_", ",_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "21_", "._", "pop_", "(_", "'", "signal", "'_", ")_", ",_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "22_", "._", "pop_", "(_", "'", "signal", "'_", ")_", ",_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "11_", "._", "pop_", "(_", "'", "samp", "ling", "\\u", "rate", "'_", ")_", ",_", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "12_", "._", "pop_", "(_", "'", "samp", "ling", "\\u", "rate", "'_", ")_", ",_", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "21_", "._", "pop_", "(_", "'", "samp", "ling", "\\u", "rate", "'_", ")_", ",_", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "22_", "._", "pop_", "(_", "'", "samp", "ling", "\\u", "rate", "'_", ")_", ",_", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "11_", "._", "pop_", "(_", "'", "t", "\\u", "start", "'_", ")_", ",_", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "12_", "._", "pop_", "(_", "'", "t", "\\u", "start", "'_", ")_", ",_", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "21_", "._", "pop_", "(_", "'", "t", "\\u", "start", "'_", ")_", ",_", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "res", "22_", "._", "pop_", "(_", "'", "t", "\\u", "start", "'_", ")_", ",_", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res", "11_", ",_", "attr", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res", "12_", ",_", "attr", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res", "21_", ",_", "attr", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res", "22_", ",_", "attr", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u\\u", "generat", "e\\u", "datasets_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "fake", "\\u", "neo", "\\u\\u", "cascade_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annotations_", "[_", "'", "seed", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "type_", "=_", "Ana", "log", "Signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cascade_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "fake", "\\u", "neo", "_", "(_", "obj", "\\u", "type_", "=_", "obj", "\\u", "type_", ",_", "cascade_", "=_", "cascade_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "res_", ",_", "Ana", "log", "Signal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "annotations_", ",_", "self_", "._", "annotations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u\\u", "generat", "e\\u", "datasets_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "fake", "\\u", "neo", "\\u\\u", "noca", "sca", "de_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annotations_", "[_", "'", "seed", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "type_", "=_", "'", "Ana", "log", "Signal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cascade_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "fake", "\\u", "neo", "_", "(_", "obj", "\\u", "type_", "=_", "obj", "\\u", "type_", ",_", "cascade_", "=_", "cascade_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "res_", ",_", "Ana", "log", "Signal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "annotations_", ",_", "self_", "._", "annotations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", " ", "must", " ", "be", " ", "1", "D", " ", "-", " ", "shou", "ld", " ", "raise", " ", "Except", "ion", " ", "if", " ", "not", " ", "1", "D_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "\\u", "create", "\\u", "from", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "range_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "1000_", "*_", "pq_", "._", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Ana", "log", "Signal_", "(_", "data_", ",_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "start_", ",_", "0_", "*_", "pq_", "._", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "stop_", ",_", "len_", "(_", "data_", ")_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "[_", "9_", "]_", ",_", "9000", "_", "*_", "pq_", "._", "u", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "from", "\\u", "np", "\\u", "array_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Ana", "log", "Signal_", "(_", "data_", ",_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ",_", "units_", "=_", "\"", "u", "V", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "start_", ",_", "0_", "*_", "pq_", "._", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "stop_", ",_", "data_", "._", "size_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "[_", "9_", "]_", ",_", "0.009", "_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "from", "\\u", "quantities", "\\u", "array_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "5000_", "*_", "pq_", "._", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Ana", "log", "Signal_", "(_", "data_", ",_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "start_", ",_", "0_", "*_", "pq_", "._", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "stop_", ",_", "data_", "._", "size_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "[_", "9_", "]_", ",_", "0.009", "_", "*_", "pq_", "._", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "from", "\\u", "array", "\\u", "no", "\\u", "unit", "s", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "from", "\\u", "quantities", "\\u", "array", "\\u", "inconsistent", "\\u", "unit", "s", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "units_", "=_", "\"", "n", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "out", "\\u", "samp", "ling", "\\u", "rate", "\\u", "or", "\\u", "period", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "\\u", "Non", "e\\u", "samp", "ling", "\\u", "rate", "\\u", "shou", "ld", "\\u", "raise", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ",_", "samp", "ling", "\\u", "rate_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "\\u", "Non", "e\\u", "t", "\\u", "start", "\\u", "shou", "ld", "\\u", "raise", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "5000_", "*_", "pq_", "._", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ",_", "t", "\\u", "start_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "inconsistent", "\\u", "samp", "ling", "\\u", "rate", "\\u", "and", "\\u", "period", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Ana", "log", "Signal_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "samp", "ling", "\\u", "period_", "=_", "5_", "*_", "pq_", "._", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "\\u", "copy", "\\u", "true", "\\u", "shou", "ld", "\\u", "return", "\\u", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "5000_", "*_", "pq_", "._", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Ana", "log", "Signal_", "(_", "data_", ",_", "copy_", "=_", "True_", ",_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "3_", "]_", "=_", "99_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "signal_", "[_", "3_", "]_", ",_", "99_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "\\u", "copy", "\\u", "fal", "se", "\\u", "shou", "ld", "\\u", "return", "\\u", "view_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate_", "=_", "5000_", "*_", "pq_", "._", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "=_", "Ana", "log", "Signal_", "(_", "data_", ",_", "copy_", "=_", "False_", ",_", "samp", "ling", "\\u", "rate_", "=_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "3_", "]_", "=_", "99_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "[_", "3_", "]_", ",_", "99_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Constructor", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "create", "\\u", "with", "\\u", "addition", "al", "\\u", "argument_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "=_", "Ana", "log", "Signal_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "origin_", "=_", "'", "crack", ".", "txt", "'_", ",_", "rat", "name_", "=_", "'", "Nic", "ola", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "annotations_", ",_", "{_", "'", "rat", "name", "'_", ":_", "'", "Nic", "ola", "s", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "one", " ", "is", " ", "universal", "ly", " ", "recommende", "d", " ", "and", " ", "handle", "d", " ", "by", " ", "Base", "Neo", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "file", "\\u", "origin_", ",_", "'", "crack", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "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 ", " _", "self_", "._", "t", "\\u", "start_", "=_", "[_", "0.0_", "*_", "pq_", "._", "ms_", ",_", "100_", "*_", "pq_", "._", "ms_", ",_", "-_", "200_", "*_", "pq_", "._", "ms_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rates_", "=_", "[_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "420_", "*_", "pq_", "._", "Hz_", ",_", "999_", "*_", "pq_", "._", "Hz_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rate", "s2_", "=_", "[_", "2_", "*_", "pq_", "._", "k", "Hz_", ",_", "290_", "*_", "pq_", "._", "Hz_", ",_", "1111", "_", "*_", "pq_", "._", "Hz_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "[_", "np_", "._", "arange_", "(_", "10.0_", ")_", "*_", "pq_", "._", "n", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "arange_", "(_", "-_", "100.0_", ",_", "100.0_", ",_", "10.0_", ")_", "*_", "pq_", "._", "m", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "uniform_", "(_", "size_", "=_", "100_", ")_", "*_", "pq_", "._", "u", "V_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "signals_", "=_", "[_", "Ana", "log", "Signal_", "(_", "D_", ",_", "samp", "ling", "\\u", "rate_", "=_", "r_", ",_", "t", "\\u", "start_", "=_", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "testa", "ttr", "_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", ",_", "D_", ",_", "t_", "in_", "zip_", "(_", "self_", "._", "rates_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u", "start_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "compliant", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", "in_", "self_", "._", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "t", "\\u", "stop", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "signal_", "in_", "enumerate_", "(_", "self_", "._", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "t", "\\u", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u", "start_", "[_", "i_", "]_", "+_", "self_", "._", "data_", "[_", "i_", "]_", "._", "size_", "/_", "self_", "._", "rates_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "duration", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", "in_", "self_", "._", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "signal_", "._", "duration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "._", "t", "\\u", "stop_", "-_", "signal_", "._", "t", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delta_", "=_", "1e-1", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "rate", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", ",_", "rate_", "in_", "zip_", "(_", "self_", "._", "signals_", ",_", "self_", "._", "rates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "rate_", ",_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "period", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", ",_", "rate_", "in_", "zip_", "(_", "self_", "._", "signals_", ",_", "self_", "._", "rates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "period_", ",_", "1_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "rate", "\\u", "setter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", ",_", "rate_", "in_", "zip_", "(_", "self_", "._", "signals_", ",_", "self_", "._", "rate", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "samp", "ling", "\\u", "rate_", "=_", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "rate_", ",_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "period_", ",_", "1_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "period", "\\u", "setter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "signal_", ",_", "rate_", "in_", "zip_", "(_", "self_", "._", "signals_", ",_", "self_", "._", "rate", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "samp", "ling", "\\u", "period_", "=_", "1_", "/_", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "rate_", ",_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "samp", "ling", "\\u", "period_", ",_", "1_", "/_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "rate", "\\u", "sette", "r", "\\u", "Non", "e\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "self_", "._", "signals_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "samp", "ling", "\\u", "rate", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "rate", "\\u", "sette", "r", "\\u", "not", "\\u", "quanti", "ty", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "self_", "._", "signals_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "samp", "ling", "\\u", "rate", "'_", ",_", "5.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "period", "\\u", "sette", "r", "\\u", "Non", "e\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "=_", "self_", "._", "signals_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "signal_", ",_", "'", "samp", "ling", "\\u", "period", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "samp", "ling", "\\u", "period", "\\u", "sette", "r", "\\u", "not", "\\u", "quanti", "ty", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "self_", "._", "signals_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "samp", "ling", "\\u", "period", "'_", ",_", "5.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "t", "\\u", "start", "\\u", "sette", "r", "\\u", "Non", "e\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "=_", "self_", "._", "signals_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "signal_", ",_", "'", "t", "\\u", "start", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "times", "\\u", "getter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "signal_", "in_", "enumerate_", "(_", "self_", "._", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "targ", "_", "=_", "np_", "._", "arange_", "(_", "self_", "._", "data_", "[_", "i_", "]_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "_", "=_", "targ", "_", "/_", "self_", "._", "rates_", "[_", "i_", "]_", "+_", "self_", "._", "t", "\\u", "start_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "alm", "ost", "\\u", "equal_", "(_", "signal_", "._", "times_", ",_", "targ", "_", ",_", "1e-12_", "*_", "pq_", "._", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "duplicat", "e\\u", "with", "\\u", "new", "\\u", "array_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal", "1_", "=_", "self_", "._", "signals_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "2_", "=_", "self_", "._", "signals_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data2_", "=_", "self_", "._", "data_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "1b", "_", "=_", "signal", "1_", "._", "duplicat", "e\\u", "with", "\\u", "new", "\\u", "array_", "(_", "data2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "alm", "ost", "\\u", "equal_", "(_", "np_", "._", "asarray_", "(_", "signal", "1b", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "asarray_", "(_", "signal", "2_", "/_", "1000._", ")_", ",_", "1e-12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal", "1b", "_", "._", "t", "\\u", "start_", ",_", "signal", "1_", "._", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal", "1b", "_", "._", "samp", "ling", "\\u", "rate_", ",_", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "children_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "=_", "self_", "._", "signals_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "segment_", "=_", "Segment_", "(_", "name_", "=_", "'", "seg", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment_", "._", "analog", "signals_", "=_", "[_", "signal_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment_", "._", "create", "\\u", "many", "\\u", "to", "\\u", "one", "\\u", "relationship_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rch", "an_", "=_", "Record", "ing", "Channel_", "(_", "name_", "=_", "'", "rch", "an", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rch", "an_", "._", "analog", "signals_", "=_", "[_", "signal_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rch", "an_", "._", "create", "\\u", "many", "\\u", "to", "\\u", "one", "\\u", "relationship_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "single", "\\u", "parent", "\\u", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Segme", "nt", "'_", ",_", "'", "Record", "ing", "Chan", "nel", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "multi", "\\u", "parent", "\\u", "objects_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "single", "\\u", "parent", "\\u", "containers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "segment", "'_", ",_", "'", "record", "ing", "channel", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "multi", "\\u", "parent", "\\u", "containers_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "parent", "\\u", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Segme", "nt", "'_", ",_", "'", "Record", "ing", "Chan", "nel", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "\\u", "parent", "\\u", "containers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "segment", "'_", ",_", "'", "record", "ing", "channel", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "signal_", "._", "parents_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "parents_", "[_", "0_", "]_", "._", "name_", ",_", "'", "seg", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal_", "._", "parents_", "[_", "1_", "]_", "._", "name_", ",_", "'", "rch", "an", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "signal_", "in_", "enumerate_", "(_", "self_", "._", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prep", "r_", "=_", "repr_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "_", "=_", "'<", "Ana", "log", "Signal", "(%", "s", ",", " ", "[", "%", "s", ",", " ", "%", "s", "],", " ", "samp", "ling", " ", "rate", ":", " ", "%", "s", ")>", "'_", "%_", "(_", "repr_", "(_", "self_", "._", "data_", "[_", "i_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u", "start_", "[_", "i_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u", "start_", "[_", "i_", "]_", "+_", "len_", "(_", "self_", "._", "data_", "[_", "i_", "]_", ")_", "/_", "self_", "._", "rates_", "[_", "i_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "rates_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "prep", "r_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Properties_", "(_", "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_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "HA", "VE", "\\u", "IP", "YT", "HON", "_", ",_", "\"", "require", "s", " ", "IP", "yth", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "\\u", "pretty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "signal_", "in_", "enumerate_", "(_", "self_", "._", "signals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prep", "r_", "=_", "pretty_", "(_", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "_", "=_", "(_", "(_", "'", "Ana", "log", "Signal", " ", "in", " ", "%", "s", " ", "with", " ", "%", "s", " ", "%", "s", " ", "values", "\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "signal_", "._", "units_", ",_", "len_", "(_", "signal_", ")_", ",_", "signal_", "._", "dtype_", ")_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "annot", "ation", "s", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "signal_", "._", "annotations_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "channel", " ", "index", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "signal_", "._", "channel", "\\u", "index_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "samp", "ling", " ", "rate", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "signal_", "._", "samp", "ling", "\\u", "rate_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "time", ":", " ", "%", "s", " ", "to", " ", "%", "s", "'_", "%_", "(_", "signal_", "._", "t", "\\u", "start_", ",_", "signal_", "._", "t", "\\u", "stop_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "prep", "r_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "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 ", " _", "self_", "._", "data1_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data", "1", "quant", "_", "=_", "self_", "._", "data1_", "*_", "pq_", "._", "n", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "signal", "1_", "=_", "Ana", "log", "Signal_", "(_", "self_", "._", "data", "1", "quant", "_", ",_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "spam", "'_", ",_", "description_", "=_", "'", "egg", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "origin_", "=_", "'", "testfile", ".", "txt", "'_", ",_", "arg1_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "compliant", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "self_", "._", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "slice", "\\u", "shou", "ld", "\\u", "return", "\\u", "Ana", "log", "Signal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "[_", "3_", ":_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "size_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "samp", "ling", "\\u", "period_", ",_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "samp", "ling", "\\u", "rate_", ",_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "t", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "signal", "1_", "._", "t", "\\u", "start_", "+_", "3_", "*_", "result_", "._", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "t", "\\u", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "t", "\\u", "start_", "+_", "5_", "*_", "result_", "._", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", "[_", "3_", ":_", "8_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "other", " ", "attribute", "s", " ", "wer", "e", " ", "copie", "d", " ", "over", " ", "(", "in", " ", "this", " ", "case", ",", " ", "default", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "self_", "._", "signal", "1_", "._", "file", "\\u", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "self_", "._", "signal", "1_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "self_", "._", "signal", "1_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "self_", "._", "signal", "1_", "._", "annotations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "slice", "\\u", "shou", "ld", "\\u", "change", "\\u", "samp", "ling", "\\u", "period_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result1_", "=_", "self_", "._", "signal", "1_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result2_", "=_", "self_", "._", "signal", "1_", "[_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "3_", "=_", "self_", "._", "signal", "1_", "[_", "1_", ":_", "7_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result1_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result2_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result", "3_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result", "3_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result", "3_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result", "3_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result", "3_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", "._", "samp", "ling", "\\u", "period_", ",_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", "._", "samp", "ling", "\\u", "period_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "period_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result", "3_", "._", "samp", "ling", "\\u", "period_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "period_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result1_", ",_", "self_", "._", "data1_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result2_", ",_", "self_", "._", "data1_", "[_", ":_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result", "3_", ",_", "self_", "._", "data1_", "[_", "1_", ":_", "7_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "getitem", "\\u", "shou", "ld", "\\u", "return", "\\u", "single", "\\u", "quantity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result1_", "=_", "self_", "._", "signal", "1_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result2_", "=_", "self_", "._", "signal", "1_", "[_", "9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result1_", ",_", "pq_", "._", "Quantity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result1_", ",_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result1_", ",_", "'", "description", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result1_", ",_", "'", "file", "\\u", "orig", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result1_", ",_", "'", "annot", "ation", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result2_", ",_", "pq_", "._", "Quantity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result2_", ",_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result2_", ",_", "'", "description", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result2_", ",_", "'", "file", "\\u", "orig", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "result2_", ",_", "'", "annot", "ation", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result1_", ",_", "0_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result2_", ",_", "9_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "getitem", "\\u", "out", "\\u", "of", "\\u", "bound", "s", "\\u", "Index", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "signal", "1_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "compa", "ris", "on", "\\u", "operators_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "self_", "._", "signal", "1_", ">=_", "5_", "*_", "pq_", "._", "n", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "False_", ",_", "False_", ",_", "False_", ",_", "False_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "True_", ",_", "True_", ",_", "True_", ",_", "True_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "self_", "._", "signal", "1_", ">=_", "5_", "*_", "pq_", "._", "p", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "False_", ",_", "True_", ",_", "True_", ",_", "True_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "True_", ",_", "True_", ",_", "True_", ",_", "True_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "compa", "ris", "on", "\\u", "with", "\\u", "inconsistent", "\\u", "unit", "s", "\\u", "shou", "ld", "\\u", "raise", "\\u", "Exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "signal", "1_", "._", "\\u\\u", "gt", "\\u\\u_", ",_", "5_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "simple", "\\u", "statistics_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "max_", "(_", ")_", ",_", "9_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "min_", "(_", ")_", ",_", "0_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "mean_", "(_", ")_", ",_", "4.5_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "rescale", "\\u", "same_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "result_", "._", "rescale", "_", "(_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "units_", ",_", "1_", "*_", "pq_", "._", "n", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "sub\\u", "schema_", "(_", "result_", ",_", "self_", "._", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "rescale", "\\u", "new_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "result_", "._", "rescale", "_", "(_", "pq_", "._", "p", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "units_", ",_", "1_", "*_", "pq_", "._", "p", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "alm", "ost", "\\u", "equal_", "(_", "np_", "._", "array_", "(_", "result_", ")_", ",_", "self_", "._", "data1_", "*_", "1000._", ",_", "1e-10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Array", "Methods_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "rescale", "\\u", "new", "\\u", "incomp", "atible", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "signal", "1_", "._", "rescale", "_", ",_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Ana", "log", "Signal", "Equali", "ty_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Equali", "ty_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "\\u", "signal", "s", "\\u", "with", "\\u", "different", "\\u", "data\\u", "complement", "\\u", "shou", "ld", "\\u", "be", "\\u", "not", "\\u", "equal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal", "1_", "=_", "Ana", "log", "Signal_", "(_", "np_", "._", "arange_", "(_", "10.0_", ")_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "2_", "=_", "Ana", "log", "Signal_", "(_", "np_", "._", "arange_", "(_", "10.0_", ")_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "2_", "*_", "pq_", "._", "k", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "signal", "1_", ",_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "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 ", " _", "self_", "._", "data1_", "=_", "np_", "._", "arange_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data", "1", "quant", "_", "=_", "self_", "._", "data1_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "signal", "1_", "=_", "Ana", "log", "Signal_", "(_", "self_", "._", "data", "1", "quant", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "spam", "'_", ",_", "description_", "=_", "'", "egg", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "origin_", "=_", "'", "testfile", ".", "txt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "arg1_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "compliant", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "self_", "._", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "add", "\\u", "const", "\\u", "quanti", "ty", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "+_", "0.06", "5_", "*_", "pq_", "._", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", "+_", "65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "[_", "9_", "]_", ",_", "9_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "9_", "]_", ",_", "74_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "t", "\\u", "start_", ",_", "result_", "._", "t", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ",_", "result_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "add", "\\u", "quanti", "ty", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data2_", "=_", "np_", "._", "arange_", "(_", "10.0_", ",_", "20.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "2", "quant", "_", "=_", "data2_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "signal", "1_", "+_", "data", "2", "quant", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "targ", "_", "=_", "Ana", "log", "Signal_", "(_", "np_", "._", "arange_", "(_", "10.0_", ",_", "30.0_", ",_", "2.0_", ")_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "spam", "'_", ",_", "description_", "=_", "'", "egg", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "origin_", "=_", "'", "testfile", ".", "txt", "'_", ",_", "arg1_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "sub\\u", "schema_", "(_", "result_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "add", "\\u", "two", "\\u", "consistent", "\\u", "signal", "s", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data2_", "=_", "np_", "._", "arange_", "(_", "10.0_", ",_", "20.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "2", "quant", "_", "=_", "data2_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "2_", "=_", "Ana", "log", "Signal_", "(_", "data", "2", "quant", "_", ",_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "signal", "1_", "+_", "signal", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "targ", "_", "=_", "Ana", "log", "Signal_", "(_", "np_", "._", "arange_", "(_", "10.0_", ",_", "30.0_", ",_", "2.0_", ")_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", "=_", "1_", "*_", "pq_", "._", "k", "Hz_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "spam", "'_", ",_", "description_", "=_", "'", "egg", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "origin_", "=_", "'", "testfile", ".", "txt", "'_", ",_", "arg1_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "sub\\u", "schema_", "(_", "result_", ",_", "targ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "add", "\\u", "signal", "s", "\\u", "with", "\\u", "inconsistent", "\\u", "data\\u", "complement", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "signal", "1_", "._", "t", "\\u", "start_", "=_", "0.0_", "*_", "pq_", "._", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "self_", "._", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signal", "2_", "=_", "Ana", "log", "Signal_", "(_", "np_", "._", "arange_", "(_", "10.0_", ")_", ",_", "units_", "=_", "\"", "m", "V", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "start_", "=_", "100.0_", "*_", "pq_", "._", "ms_", ",_", "samp", "ling", "\\u", "rate_", "=_", "0.5_", "*_", "pq_", "._", "k", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "signal", "1_", "._", "\\u\\u", "add\\u\\u_", ",_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "subtract", "\\u", "const", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "-_", "65_", "*_", "pq_", "._", "m", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "[_", "9_", "]_", ",_", "9_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "9_", "]_", ",_", "-_", "56_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", "-_", "65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ",_", "result_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "subtract", "\\u", "from", "\\u", "const", "\\u", "shou", "ld", "\\u", "return", "\\u", "signal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "10_", "*_", "pq_", "._", "m", "V_", "-_", "self_", "._", "signal", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "[_", "9_", "]_", ",_", "9_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "9_", "]_", ",_", "1_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "10_", "-_", "self_", "._", "data1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ",_", "result_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "mult", "\\u", "by", "\\u", "const", "\\u", "float", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "[_", "9_", "]_", ",_", "9_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "9_", "]_", ",_", "18_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ",_", "result_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "divide", "\\u", "by", "\\u", "const", "\\u", "shou", "ld", "\\u", "preserve", "\\u", "data\\u", "complement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "signal", "1_", "/_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "result_", ",_", "Ana", "log", "Signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "neo", "\\u", "object\\u", "is", "\\u", "compliant", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "'", "spam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "description_", ",_", "'", "egg", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "file", "\\u", "origin_", ",_", "'", "testfile", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "annotations_", ",_", "{_", "'", "arg", "1", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "[_", "9_", "]_", ",_", "9_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "9_", "]_", ",_", "18_", "*_", "pq_", "._", "m", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "result_", ",_", "self_", "._", "data1_", "/_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "signal", "1_", "._", "samp", "ling", "\\u", "rate_", ",_", "result_", "._", "samp", "ling", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Combinat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "merge", "\\u", "Not", "Impl", "ement", "ed", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "signal", "1_", "._", "merge_", ",_", "self_", "._", "signal", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Ana", "log", "Signal", "Functions_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Functions_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "\\u", "pickle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal", "1_", "=_", "Ana", "log", "Signal_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ",_", "samp", "ling", "\\u", "period_", "=_", "1_", "*_", "pq_", "._", "ms_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "units_", "=_", "pq_", "._", "S_", ",_", "channel", "\\u", "index_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "1_", "._", "annotations_", "[_", "'", "index", "'_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fobj_", "=_", "open_", "(_", "'./", "pickle", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "signal", "1_", ",_", "fobj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fobj_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fobj_", "=_", "open_", "(_", "'./", "pickle", "'_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal", "2_", "=_", "pickle_", "._", "load_", "(_", "fobj_", ")_", "\\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 ", " _", "signal", "2_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "arrays", "\\u", "equal_", "(_", "signal", "1_", ",_", "signal", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "signal", "1_", "._", "channel", "\\u", "index_", ",_", "signal", "2_", "._", "channel", "\\u", "index_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fobj_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "'./", "pickle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Ana", "log", "Signal", "Sampl", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "none", "\\u", "rate", "\\u", "none", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "quant", "\\u", "rate", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "pq_", "._", "Quantity_", "(_", "10._", ",_", "units_", "=_", "pq_", "._", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "\\u", "rate_", "=_", "1_", "/_", "samp", "ling", "\\u", "period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "rate_", "=_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", "(_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "targ", "\\u", "rate_", ",_", "out", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "none", "\\u", "rate", "\\u", "quant", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "pq_", "._", "Quantity_", "(_", "10._", ",_", "units_", "=_", "pq_", "._", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "\\u", "rate_", "=_", "samp", "ling", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "rate_", "=_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", "(_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "targ", "\\u", "rate_", ",_", "out", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "rate", "\\u", "equivalent", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "pq_", "._", "Quantity_", "(_", "10._", ",_", "units_", "=_", "pq_", "._", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "pq_", "._", "Quantity_", "(_", "0.1_", ",_", "units_", "=_", "pq_", "._", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targ", "\\u", "rate_", "=_", "samp", "ling", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "rate_", "=_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", "(_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "targ", "\\u", "rate_", ",_", "out", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "rate", "\\u", "not", "\\u", "equivalent", "\\u", "Value", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "pq_", "._", "Quantity_", "(_", "10._", ",_", "units_", "=_", "pq_", "._", "Hz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "pq_", "._", "Quantity_", "(_", "10_", ",_", "units_", "=_", "pq_", "._", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "none", "\\u", "rate", "\\u", "float", "\\u", "Type", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "10._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ana", "log", "Signal", "Sampl", "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", "\\u\\u", "get", "\\u", "samp", "ling", "\\u", "rate", "\\u\\u", "period", "\\u", "array", "\\u", "rate", "\\u", "none", "\\u", "Type", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "samp", "ling", "\\u", "rate_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "ling", "\\u", "period_", "=_", "np_", "._", "array_", "(_", "10._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "\\u", "get", "\\u", "samp", "ling", "\\u", "rate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "ling", "\\u", "rate_", ",_", "samp", "ling", "\\u", "period_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kdart/pycopia/core/pycopia/smtp_envelope.py
[ { "content": "#!/usr/bin/python2.7\n# -*- coding: utf-8 -*-\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\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\"\"\"\nSMTP envelope object that encapsulates a SMTP protocol message envelope.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\n\n\nfrom io import StringIO\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_differences (msg1, msg2):\n diffs = []\n\n for header in ['subject', 'from', 'to']:\n h1 = msg1[header]\n h2 = msg2[header]\n if not h1 or not h2 or h1 != h2:\n diffs.append ((\"Header '%s' differs\" % repr(header), h1, h2))\n\n body1 = msg1.message.get_payload()\n body2 = msg2.message.get_payload()\n if body1 != body2:\n diffs.append ((\"Bodies differ\", body1, body2))\n\n return diffs", "metadata": "root.get_differences", "header": "['module', '___EOS___']", "index": 28 }, { "content": "class Envelope(object):\n \"\"\"Envelope([mail_from], [recpt_list]) An envelope holds an SMTP\n conversation from the MAIL FROM command to the end of a DATA part. It may\n be re-sent by calling the 'send()' method with an SMTP connection object.\n The message body can be parsed by passing in an 'ezmail' parser object to\n the 'parse_data()' method.\"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Envelope", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __init__ (self, mail_from=None, rcpt_to=None):\n self.mail_from = mail_from\n self.rcpt_to = rcpt_to or []\n self.data = None\n self.message = None", "metadata": "root.Envelope.__init__", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def __repr__ (self):\n return \"Envelope(%r, %r)\" % (self.mail_from, self.rcpt_to)", "metadata": "root.Envelope.__repr__", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def __str__(self):\n s = [\"MAIL FROM: %s\" % (self.mail_from,)]\n for rcpt in self.rcpt_to:\n s.append(\"RCPT TO: %s\" % (rcpt))\n s.append(\"\\n\")\n if self.message:\n s.append(str(self.message))\n elif self.data:\n s.append(self.data.getvalue())\n else:\n s.append(\"<no data!>\")\n return \"\\n\".join(s)", "metadata": "root.Envelope.__str__", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def has_data(self):\n \"\"\"has_data() is true if there is data or message.\"\"\"\n if self.data:\n return self.data.tell()\n elif self.message:\n return len(self.message)\n else:\n return 0", "metadata": "root.Envelope.has_data", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " def write(self, text):\n \"\"\"write(text)\nWrites text to the message body.\"\"\"\n if self.data is None:\n self.data = StringIO()\n self.data.write(text)", "metadata": "root.Envelope.write", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def writeln(self, text):\n \"\"\"writeln(text)\nWrites text to the message body, adding a newline.\"\"\"\n self.write(text)\n self.write(\"\\n\")", "metadata": "root.Envelope.writeln", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 90 }, { "content": " def set_from(self, frm):\n \"\"\"set_from(from_address)\nSets the MAIL FROM address for this Envelope.\"\"\"\n self.mail_from = frm", "metadata": "root.Envelope.set_from", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def add_rcpt(self, rcpt):\n \"\"\"add_rcpt(recipient)\nAdds a new recipient to the RCPT list.\"\"\"\n self.rcpt_to.append(rcpt)", "metadata": "root.Envelope.add_rcpt", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 101 }, { "content": " def parse_data(self, parser):\n \"\"\"parse_data(parser)\nInstructs the Envelope to convert its raw 'data' attribute to a 'message'\nattribute using the supplied parser object. A 'message' attribute is an\n'email' package Message type object.\"\"\"\n if self.data is not None:\n self.data.seek(0,0)\n # parser should be email.Parser.Parser object, or subclass thereof.\n self.message = parser.parse(self.data)\n self.data.close()\n if self.message:\n self.data = None", "metadata": "root.Envelope.parse_data", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": " def send(self, smtp, mail_options=[], rcpt_options=[]):\n \"\"\"send(smtp_client, mail_options=[], rcpt_options=[])\nMails this envelope using the supplied SMTP client object.\"\"\"\n if self.message:\n return smtp.sendmail(self.mail_from, self.rcpt_to, self.message.as_string(), mail_options, rcpt_options)\n elif self.data:\n return smtp.sendmail(self.mail_from, self.rcpt_to, self.data.getvalue(), mail_options, rcpt_options)\n else:\n body = \"From: %s\\nTo: %s\\n\\nEnvelope message.\" % (self.mail_from, \", \".join(self.rcpt_to))\n return smtp.sendmail(self.mail_from, self.rcpt_to, body, mail_options, rcpt_options)", "metadata": "root.Envelope.send", "header": "['class', 'Envelope', '(', 'object', ')', ':', '___EOS___']", "index": 119 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "ts", "=", "4", ":", "sw", "=", "4", ":", "soft", "tabs", "top", "=", "4", ":", "smart", "tab", ":", "expand", "tab_", "\\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_", "\"\"\"", "\\", "10", ";", "SMT", "P", " ", "envelop", "e", " ", "object", " ", "tha", "t", " ", "encapsulat", "es", " ", "a", " ", "SMT", "P", " ", "protoc", "ol", " ", "message", " ", "envelop", "e", ".", "\\", "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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "get", "\\u", "difference", "s_", "(_", "msg", "1_", ",_", "msg", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diffs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "header_", "in_", "[_", "'", "subject", "'_", ",_", "'", "from", "'_", ",_", "'", "to", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h1_", "=_", "msg", "1_", "[_", "header_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h2_", "=_", "msg", "2_", "[_", "header_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "h1_", "or_", "not_", "h2_", "or_", "h1_", "!=_", "h2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diffs_", "._", "append_", "(_", "(_", "\"", "Head", "er", " ", "'%", "s", "'", " ", "differs", "\"_", "%_", "repr_", "(_", "header_", ")_", ",_", "h1_", ",_", "h2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "1_", "=_", "msg", "1_", "._", "message_", "._", "get", "\\u", "payload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "2_", "=_", "msg", "2_", "._", "message_", "._", "get", "\\u", "payload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "body", "1_", "!=_", "body", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diffs_", "._", "append_", "(_", "(_", "\"", "Bod", "ies", " ", "differ", "\"_", ",_", "body", "1_", ",_", "body", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "diffs_", "\\u\\u\\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_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Env", "elope", "([", "mail", "\\u", "from", "],", " ", "[", "rec", "pt", "\\u", "list", "])", " ", "An", " ", "envelop", "e", " ", "hold", "s", " ", "an", " ", "SMT", "P", "\\", "10", ";", " ", " ", " ", " ", "conversation", " ", "from", " ", "the", " ", "MAIL", " ", "FROM", " ", "command", " ", "to", " ", "the", " ", "end", " ", "of", " ", "a", " ", "DATA", " ", "part", ".", " ", " ", "It", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "re", "-", "sent", " ", "by", " ", "calling", " ", "the", " ", "'", "send", "()'", " ", "method", " ", "with", " ", "an", " ", "SMT", "P", " ", "connecti", "on", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "message", " ", "body", " ", "can", " ", "be", " ", "parsed", " ", "by", " ", "passi", "ng", " ", "in", " ", "an", " ", "'", "ez", "mail", "'", " ", "parser", " ", "object", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "'", "parse", "\\u", "data", "()'", " ", "method", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "mail", "\\u", "from_", "=_", "None_", ",_", "rcp", "t", "\\u", "to_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mail", "\\u", "from_", "=_", "mail", "\\u", "from_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rcp", "t", "\\u", "to_", "=_", "rcp", "t", "\\u", "to_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "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_", "\"", "Env", "elope", "(%", "r", ",", " ", "%", "r", ")\"_", "%_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", "self_", "._", "rcp", "t", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "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 ", " _", "s_", "=_", "[_", "\"", "MAIL", " ", "FROM", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rcp", "t_", "in_", "self_", "._", "rcp", "t", "\\u", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "append_", "(_", "\"", "RC", "PT", " ", "TO", ":", " ", "%", "s", "\"_", "%_", "(_", "rcp", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "append_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "append_", "(_", "str_", "(_", "self_", "._", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "append_", "(_", "self_", "._", "data_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "append_", "(_", "\"<", "no", " ", "data", "!", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "has", "\\u", "data", "()", " ", "is", " ", "true", " ", "if", " ", "there", " ", "is", " ", "data", " ", "or", " ", "message", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "data_", "._", "tell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "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_", "write_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "write", "(", "text", ")", "\\", "10", ";", "Write", "s", " ", "text", " ", "to", " ", "the", " ", "message", " ", "body", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "data_", "._", "write_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "writeln_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "write", "ln", "(", "text", ")", "\\", "10", ";", "Write", "s", " ", "text", " ", "to", " ", "the", " ", "message", " ", "body", ",", " ", "addin", "g", " ", "a", " ", "newline", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "from_", "(_", "self_", ",_", "frm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set\\u", "from", "(", "from", "\\u", "address", ")", "\\", "10", ";", "Set", "s", " ", "the", " ", "MAIL", " ", "FROM", " ", "address", " ", "for", " ", "this", " ", "Env", "elope", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mail", "\\u", "from_", "=_", "frm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "rcp", "t_", "(_", "self_", ",_", "rcp", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "add", "\\u", "rcp", "t", "(", "recip", "ient", ")", "\\", "10", ";", "Add", "s", " ", "a", " ", "new", " ", "recip", "ient", " ", "to", " ", "the", " ", "RC", "PT", " ", "list", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rcp", "t", "\\u", "to_", "._", "append_", "(_", "rcp", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "data_", "(_", "self_", ",_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "parse", "\\u", "data", "(", "parser", ")", "\\", "10", ";", "Instr", "uct", "s", " ", "the", " ", "Env", "elope", " ", "to", " ", "convert", " ", "its", " ", "raw", " ", "'", "data", "'", " ", "attribute", " ", "to", " ", "a", " ", "'", "message", "'", "\\", "10", ";", "attribute", " ", "usi", "ng", " ", "the", " ", "supplie", "d", " ", "parser", " ", "object", ".", " ", "A", " ", "'", "message", "'", " ", "attribute", " ", "is", " ", "an", "\\", "10", ";'", "email", "'", " ", "package", " ", "Messag", "e", " ", "type", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "seek_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parser", " ", "shou", "ld", " ", "be", " ", "email", ".", "Parser", ".", "Parser", " ", "object", ",", " ", "or", " ", "subclass", " ", "there", "of", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "=_", "parser_", "._", "parse_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Env", "elope", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "smtp_", ",_", "mail", "\\u", "options_", "=_", "[_", "]_", ",_", "rcp", "t", "\\u", "options_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "send", "(", "smt", "p", "\\u", "client", ",", " ", "mail", "\\u", "options", "=[]", ",", " ", "rcp", "t", "\\u", "options", "=[]", ")", "\\", "10", ";", "Mail", "s", " ", "this", " ", "envelop", "e", " ", "usi", "ng", " ", "the", " ", "supplie", "d", " ", "SMT", "P", " ", "client", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "smtp_", "._", "sendmail_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", "self_", "._", "rcp", "t", "\\u", "to_", ",_", "self_", "._", "message_", "._", "as", "\\u", "string_", "(_", ")_", ",_", "mail", "\\u", "options_", ",_", "rcp", "t", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "smtp_", "._", "sendmail_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", "self_", "._", "rcp", "t", "\\u", "to_", ",_", "self_", "._", "data_", "._", "getvalue_", "(_", ")_", ",_", "mail", "\\u", "options_", ",_", "rcp", "t", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "\"", "Fro", "m", ":", " ", "%", "s", "\\\\", "n", "To", ":", " ", "%", "s", "\\\\", "n", "\\\\", "n", "Env", "elope", " ", "message", ".\"_", "%_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "self_", "._", "rcp", "t", "\\u", "to_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "smtp_", "._", "sendmail_", "(_", "self_", "._", "mail", "\\u", "from_", ",_", "self_", "._", "rcp", "t", "\\u", "to_", ",_", "body_", ",_", "mail", "\\u", "options_", ",_", "rcp", "t", "\\u", "options_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
wrobstory/climatic/tests/test_toolbox.py
[ { "content": " # -*- coding: utf-8 -*-\n'''\nTest Toolbox\n-------\n\nTest the toolbox module with nosetests \n\n'''\nimport pandas as pd\nimport numpy as np\nimport scipy.stats as spystats\nimport nose.tools as nt\nfrom scipy.special import gamma\nfrom pandas.util.testing import assert_almost_equal\n\n\nfrom climatic import toolbox\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestToolbox():\n '''Test the functions of the toolbox module'''\n \n \n \n ", "metadata": "root.TestToolbox", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def setup(self):\n bins = np.arange(0, 41, 1)\n Vmean = 9\n A = 9\n k = 2\n AVmean = Vmean/(gamma(1+1/k))\n step_size = bins[1]-bins[0]\n self.rv_A = spystats.exponweib(1, k, scale=A, floc=0)\n self.rv_Vmean = spystats.exponweib(1, k, scale=AVmean, floc=0)\n hourly_A = self.rv_A.pdf(bins)*8760*step_size\n normed_A = hourly_A/hourly_A.sum()\n hourly_Vmean = self.rv_Vmean.pdf(bins)*8760*step_size\n normed_Vmean = hourly_Vmean/hourly_Vmean.sum()\n self.hourlyA = pd.DataFrame({'Annual Hours': hourly_A,\n 'Normalized': normed_A},\n index=bins)\n self.hourlyVmean = pd.DataFrame({'Annual Hours': hourly_Vmean,\n 'Normalized': normed_Vmean},\n index=bins)", "metadata": "root.TestToolbox.setup", "header": "['class', 'TestToolbox', '(', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_weib_hourly_Ak(self):\n '''Test A and k input'''\n self.weibull = toolbox.weibull_hourly(k=2, A=9)\n \n assert_almost_equal(self.weibull, self.hourlyA)\n nt.assert_almost_equal(self.weibull['Normalized'].sum(), 1)", "metadata": "root.TestToolbox.test_weib_hourly_Ak", "header": "['class', 'TestToolbox', '(', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_weib_hourly_AVmean(self):\n '''Test Vmean and k input'''\n self.weibullv = toolbox.weibull_hourly(k=2, Vmean=9)\n \n assert_almost_equal(self.weibullv, self.hourlyA)\n nt.assert_almost_equal(self.weibullv['Normalized'].sum(), 1) ", "metadata": "root.TestToolbox.test_weib_hourly_AVmean", "header": "['class', 'TestToolbox', '(', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_bins(self):\n '''Test different bin sizes'''\n bin1 = np.arange(0, 40.5, 0.5)\n bin2 = np.arange(0, 40.1, 0.1)\n self.halfbins = toolbox.weibull_hourly(k=2, A=9, bins=bin1)\n self.tenthbins = toolbox.weibull_hourly(k=2, A=9, bins=bin2)\n \n nt.assert_greater_equal(8760, self.halfbins['Annual Hours'].sum())\n nt.assert_less_equal(8755, self.halfbins['Annual Hours'].sum())\n nt.assert_greater_equal(8760, self.tenthbins['Annual Hours'].sum())\n nt.assert_less_equal(8755, self.tenthbins['Annual Hours'].sum()) ", "metadata": "root.TestToolbox.test_bins", "header": "['class', 'TestToolbox', '(', ')', ':', '___EOS___']", "index": 55 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\", "652", "7", "9", ";_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", "Test", " ", "Toolb", "ox", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "Test", " ", "the", " ", "toolb", "ox", " ", "module", " ", "with", " ", "nose", "tests", " ", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "stats_", "as_", "spy", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nose_", "._", "tools_", "as_", "nt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "special_", "import_", "gamma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "._", "util_", "._", "testing_", "import_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "clim", "atic", "_", "import_", "toolbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Toolb", "ox_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "the", " ", "function", "s", " ", "of", " ", "the", " ", "toolb", "ox", " ", "module", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Toolb", "ox_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bins_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "41_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vm", "ean_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AV", "mean_", "=_", "Vm", "ean_", "/_", "(_", "gamma_", "(_", "1_", "+_", "1_", "/_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "\\u", "size_", "=_", "bins_", "[_", "1_", "]_", "-_", "bins_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rv", "\\u", "A_", "=_", "spy", "stats_", "._", "expon", "wei", "b_", "(_", "1_", ",_", "k_", ",_", "scale_", "=_", "A_", ",_", "flo", "c_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rv", "\\u", "Vm", "ean_", "=_", "spy", "stats_", "._", "expon", "wei", "b_", "(_", "1_", ",_", "k_", ",_", "scale_", "=_", "AV", "mean_", ",_", "flo", "c_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour", "ly", "\\u", "A_", "=_", "self_", "._", "rv", "\\u", "A_", "._", "pdf_", "(_", "bins_", ")_", "*_", "876", "0_", "*_", "step", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "ed", "\\u", "A_", "=_", "hour", "ly", "\\u", "A_", "/_", "hour", "ly", "\\u", "A_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour", "ly", "\\u", "Vm", "ean_", "=_", "self_", "._", "rv", "\\u", "Vm", "ean_", "._", "pdf_", "(_", "bins_", ")_", "*_", "876", "0_", "*_", "step", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "ed", "\\u", "Vm", "ean_", "=_", "hour", "ly", "\\u", "Vm", "ean_", "/_", "hour", "ly", "\\u", "Vm", "ean_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hour", "ly", "A_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "Ann", "ual", " ", "Hour", "s", "'_", ":_", "hour", "ly", "\\u", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Normalize", "d", "'_", ":_", "norm", "ed", "\\u", "A_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hour", "ly", "Vm", "ean_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "Ann", "ual", " ", "Hour", "s", "'_", ":_", "hour", "ly", "\\u", "Vm", "ean_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Normalize", "d", "'_", ":_", "norm", "ed", "\\u", "Vm", "ean_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Toolb", "ox_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wei", "b", "\\u", "hour", "ly", "\\u", "Ak", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "A", " ", "and", " ", "k", " ", "input", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wei", "bull", "_", "=_", "toolbox_", "._", "wei", "bull", "\\u", "hour", "ly_", "(_", "k_", "=_", "2_", ",_", "A_", "=_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "self_", "._", "wei", "bull", "_", ",_", "self_", "._", "hour", "ly", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "self_", "._", "wei", "bull", "_", "[_", "'", "Normalize", "d", "'_", "]_", "._", "sum_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Toolb", "ox_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wei", "b", "\\u", "hour", "ly", "\\u", "AV", "mean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "Vm", "ean", " ", "and", " ", "k", " ", "input", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wei", "bull", "v_", "=_", "toolbox_", "._", "wei", "bull", "\\u", "hour", "ly_", "(_", "k_", "=_", "2_", ",_", "Vm", "ean_", "=_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "self_", "._", "wei", "bull", "v_", ",_", "self_", "._", "hour", "ly", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "self_", "._", "wei", "bull", "v_", "[_", "'", "Normalize", "d", "'_", "]_", "._", "sum_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Toolb", "ox_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "different", " ", "bin", " ", "size", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "1_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "40.", "5_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "2_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "40.", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "half", "bins_", "=_", "toolbox_", "._", "wei", "bull", "\\u", "hour", "ly_", "(_", "k_", "=_", "2_", ",_", "A_", "=_", "9_", ",_", "bins_", "=_", "bin", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tent", "hb", "ins_", "=_", "toolbox_", "._", "wei", "bull", "\\u", "hour", "ly_", "(_", "k_", "=_", "2_", ",_", "A_", "=_", "9_", ",_", "bins_", "=_", "bin", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nt_", "._", "assert", "\\u", "great", "er", "\\u", "equal_", "(_", "876", "0_", ",_", "self_", "._", "half", "bins_", "[_", "'", "Ann", "ual", " ", "Hour", "s", "'_", "]_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "less", "\\u", "equal_", "(_", "875", "5_", ",_", "self_", "._", "half", "bins_", "[_", "'", "Ann", "ual", " ", "Hour", "s", "'_", "]_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "great", "er", "\\u", "equal_", "(_", "876", "0_", ",_", "self_", "._", "tent", "hb", "ins_", "[_", "'", "Ann", "ual", " ", "Hour", "s", "'_", "]_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "less", "\\u", "equal_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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fogleman/pg/examples/sprites.py
[ { "content": " def draw(self):\n w, h = self.size\n w, h = w / 2, h / 2\n matrix = pg.Matrix().orthographic(-w, w, -h, h, -1, 1)\n self.clear()\n self.batch.draw(matrix)", "metadata": "root.Window.draw", "header": "['class', 'Window', '(', 'pg', '.', 'Window', ')', ':', '___EOS___']", "index": 15 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Window_", "(_", "pg_", "._", "Window_", ")_", ":_", "\\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_", "draw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", ",_", "h_", "=_", "self_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", ",_", "h_", "=_", "w_", "/_", "2_", ",_", "h_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matrix_", "=_", "pg_", "._", "Matrix_", "(_", ")_", "._", "ortho", "graphic", "_", "(_", "-_", "w_", ",_", "w_", ",_", "-_", "h_", ",_", "h_", ",_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch_", "._", "draw_", "(_", "matrix_", ")_", "\\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 ]
Unused import
skibblenybbles/django-commando/commando/django/core/management/startproject.py
[ { "content": "from commando import management\n\n\nBaseStartProjectCommand = management.get_command_class(\n \"startproject\", exclude_packages=(\"commando\",))\n\nif BaseStartProjectCommand is not None:\n \n base = BaseStartProjectCommand()\n \n \n \n \nelse:\n \n StartProjectCommand = management.StandardCommand\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " class StartProjectCommandOptions(management.CommandOptions):\n \"\"\"\n StartProject command options.\n \n \"\"\"\n args = base.args\n help = base.help\n option_list = base.option_list[\n len(management.BaseCommandOptions.option_list):]\n option_groups = (\n (\"[startproject options]\",\n \"These options will be passed to startproject.\",\n option_list,\n ),) if option_list else ()\n actions = (\"startproject\",)\n ", "metadata": "root.StartProjectCommandOptions", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def handle_startproject(self, *args, **options):\n return self.call_command(\"startproject\", *args, **options)", "metadata": "root.StartProjectCommandOptions.handle_startproject", "header": "['class', 'StartProjectCommandOptions', '(', 'management', '.', 'CommandOptions', ')', ':', '___EOS___']", "index": 26 }, { "content": " class StartProjectCommand(StartProjectCommandOptions, management.StandardCommand):\n \"\"\"\n StartProject command.\n \n \"\"\"\n option_list = management.StandardCommand.option_list\n option_groups = \\\n StartProjectCommandOptions.option_groups + \\\n management.StandardCommand.option_groups", "metadata": "root.StartProjectCommand", "header": "['module', '___EOS___']", "index": 30 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "command", "o_", "import_", "management_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Start", "Project", "Command_", "=_", "management_", "._", "get", "\\u", "command", "\\u", "class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startp", "roj", "ect", "\"_", ",_", "exclu", "de", "\\u", "packages_", "=_", "(_", "\"", "command", "o", "\"_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "Base", "Start", "Project", "Command_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "Base", "Start", "Project", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Start", "Project", "Command_", "=_", "management_", "._", "Standard", "Command_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Start", "Project", "Command", "Options_", "(_", "management_", "._", "Command", "Options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "Project", " ", "command", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "base_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help_", "=_", "base_", "._", "help_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "list_", "=_", "base_", "._", "option", "\\u", "list_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "management_", "._", "Base", "Command", "Options_", "._", "option", "\\u", "list_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "groups_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"[", "startp", "roj", "ect", " ", "options", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", "se", " ", "options", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "startp", "roj", "ect", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "option", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", ")_", "if_", "option", "\\u", "list_", "else_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "(_", "\"", "startp", "roj", "ect", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Start", "Project", "Command", "Options_", "(_", "management_", "._", "Command", "Options_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle", "\\u", "startp", "roj", "ect_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "call", "\\u", "command_", "(_", "\"", "startp", "roj", "ect", "\"_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Start", "Project", "Command_", "(_", "Start", "Project", "Command", "Options_", ",_", "management_", "._", "Standard", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "Project", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "list_", "=_", "management_", "._", "Standard", "Command_", "._", "option", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "groups_", "=_", "Start", "Project", "Command", "Options_", "._", "option", "\\u", "groups_", "+_", "management_", "._", "Standard", "Command_", "._", "option", "\\u", "groups_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/lib/django-1.5/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
[ { "content": "from __future__ import unicode_literals\n\nfrom django.core.urlresolvers import reverse\nfrom django.http import QueryDict\nfrom django.test import TestCase\n\nfrom django.contrib.auth.models import User\n\nfrom django.contrib.formtools.wizard.views import (NamedUrlSessionWizardView,\n NamedUrlCookieWizardView)\nfrom django.contrib.formtools.tests.wizard.forms import get_request, Step1, Step2\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 NamedWizardTests(object):\n urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.NamedWizardTests", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def setUp(self):\n self.testuser, created = User.objects.get_or_create(username='testuser1')\n self.wizard_step_data[0]['form1-user'] = self.testuser.pk", "metadata": "root.NamedWizardTests.setUp", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_initial_call(self):\n response = self.client.get(reverse('%s_start' % self.wizard_urlname))\n self.assertEqual(response.status_code, 302)\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n wizard = response.context['wizard']\n self.assertEqual(wizard['steps'].current, 'form1')\n self.assertEqual(wizard['steps'].step0, 0)\n self.assertEqual(wizard['steps'].step1, 1)\n self.assertEqual(wizard['steps'].last, 'form4')\n self.assertEqual(wizard['steps'].prev, None)\n self.assertEqual(wizard['steps'].next, 'form2')\n self.assertEqual(wizard['steps'].count, 4)\n self.assertEqual(wizard['url_name'], self.wizard_urlname)", "metadata": "root.NamedWizardTests.test_initial_call", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_initial_call_with_params(self):\n get_params = {'getvar1': 'getval1', 'getvar2': 'getval2'}\n response = self.client.get(reverse('%s_start' % self.wizard_urlname),\n get_params)\n self.assertEqual(response.status_code, 302)\n\n # Test for proper redirect GET parameters\n location = response['Location']\n self.assertNotEqual(location.find('?'), -1)\n querydict = QueryDict(location[location.find('?') + 1:])\n self.assertEqual(dict(querydict.items()), get_params)", "metadata": "root.NamedWizardTests.test_initial_call_with_params", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_form_post_error(self):\n response = self.client.post(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}),\n self.wizard_step_1_data)\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')\n self.assertEqual(response.context['wizard']['form'].errors,\n {'name': ['This field is required.'],\n 'user': ['This field is required.']})", "metadata": "root.NamedWizardTests.test_form_post_error", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_form_post_success(self):\n response = self.client.post(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n wizard = response.context['wizard']\n self.assertEqual(wizard['steps'].current, 'form2')\n self.assertEqual(wizard['steps'].step0, 1)\n self.assertEqual(wizard['steps'].prev, 'form1')\n self.assertEqual(wizard['steps'].next, 'form3')", "metadata": "root.NamedWizardTests.test_form_post_success", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_form_stepback(self):\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}))\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')\n\n response = self.client.post(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form2')\n\n response = self.client.post(\n reverse(self.wizard_urlname, kwargs={\n 'step': response.context['wizard']['steps'].current\n }), {'wizard_goto_step': response.context['wizard']['steps'].prev})\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')", "metadata": "root.NamedWizardTests.test_form_stepback", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_form_jump(self):\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}))\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')\n\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form3'}))\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form3')", "metadata": "root.NamedWizardTests.test_form_jump", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_form_finish(self):\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}))\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form2')\n\n post_data = self.wizard_step_data[1]\n post_data['form2-file1'].close()\n post_data['form2-file1'] = open(__file__, 'rb')\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n post_data)\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form3')\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[2])\n response = self.client.get(response['Location'])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form4')\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[3])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n all_data = response.context['form_list']\n with open(__file__, 'rb') as f:\n self.assertEqual(all_data[1]['file1'].read(), f.read())\n all_data[1]['file1'].close()\n del all_data[1]['file1']\n self.assertEqual(all_data, [\n {'name': 'Pony', 'thirsty': True, 'user': self.testuser},\n {'address1': '123 Main St', 'address2': 'Djangoland'},\n {'random_crap': 'blah blah'},\n [{'random_crap': 'blah blah'}, {'random_crap': 'blah blah'}]])", "metadata": "root.NamedWizardTests.test_form_finish", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_cleaned_data(self):\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}))\n self.assertEqual(response.status_code, 200)\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n post_data = self.wizard_step_data[1]\n post_data['form2-file1'] = open(__file__, 'rb')\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n post_data)\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n step2_url = reverse(self.wizard_urlname, kwargs={'step': 'form2'})\n response = self.client.get(step2_url)\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form2')\n with open(__file__, 'rb') as f:\n self.assertEqual(\n response.context['wizard']['form'].files['form2-file1'].read(),\n f.read())\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[2])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[3])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n all_data = response.context['all_cleaned_data']\n with open(__file__, 'rb') as f:\n self.assertEqual(all_data['file1'].read(), f.read())\n all_data['file1'].close()\n del all_data['file1']\n self.assertEqual(\n all_data,\n {'name': 'Pony', 'thirsty': True, 'user': self.testuser,\n 'address1': '123 Main St', 'address2': 'Djangoland',\n 'random_crap': 'blah blah', 'formset-form4': [\n {'random_crap': 'blah blah'},\n {'random_crap': 'blah blah'}\n ]})", "metadata": "root.NamedWizardTests.test_cleaned_data", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_manipulated_data(self):\n response = self.client.get(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}))\n self.assertEqual(response.status_code, 200)\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n post_data = self.wizard_step_data[1]\n post_data['form2-file1'].close()\n post_data['form2-file1'] = open(__file__, 'rb')\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n post_data)\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[2])\n loc = response['Location']\n response = self.client.get(loc)\n self.assertEqual(response.status_code, 200, loc)\n\n self.client.cookies.pop('sessionid', None)\n self.client.cookies.pop('wizard_cookie_contact_wizard', None)\n\n response = self.client.post(\n reverse(self.wizard_urlname,\n kwargs={'step': response.context['wizard']['steps'].current}),\n self.wizard_step_data[3])\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')", "metadata": "root.NamedWizardTests.test_manipulated_data", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_form_reset(self):\n response = self.client.post(\n reverse(self.wizard_urlname, kwargs={'step': 'form1'}),\n self.wizard_step_data[0])\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form2')\n\n response = self.client.get(\n '%s?reset=1' % reverse('%s_start' % self.wizard_urlname))\n self.assertEqual(response.status_code, 302)\n\n response = self.client.get(response['Location'])\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context['wizard']['steps'].current, 'form1')", "metadata": "root.NamedWizardTests.test_form_reset", "header": "['class', 'NamedWizardTests', '(', 'object', ')', ':', '___EOS___']", "index": 261 }, { "content": "class NamedSessionWizardTests(NamedWizardTests, TestCase):\n wizard_urlname = 'nwiz_session'\n wizard_step_1_data = {\n 'session_contact_wizard-current_step': 'form1',\n }\n wizard_step_data = (\n {\n 'form1-name': 'Pony',\n 'form1-thirsty': '2',\n 'session_contact_wizard-current_step': 'form1',\n },\n {\n 'form2-address1': '123 Main St',\n 'form2-address2': 'Djangoland',\n 'session_contact_wizard-current_step': 'form2',\n },\n {\n 'form3-random_crap': 'blah blah',\n 'session_contact_wizard-current_step': 'form3',\n },\n {\n 'form4-INITIAL_FORMS': '0',\n 'form4-TOTAL_FORMS': '2',\n 'form4-MAX_NUM_FORMS': '0',\n 'form4-0-random_crap': 'blah blah',\n 'form4-1-random_crap': 'blah blah',\n 'session_contact_wizard-current_step': 'form4',\n }\n )", "metadata": "root.NamedSessionWizardTests", "header": "['module', '___EOS___']", "index": 278 }, { "content": "class NamedCookieWizardTests(NamedWizardTests, TestCase):\n wizard_urlname = 'nwiz_cookie'\n wizard_step_1_data = {\n 'cookie_contact_wizard-current_step': 'form1',\n }\n wizard_step_data = (\n {\n 'form1-name': 'Pony',\n 'form1-thirsty': '2',\n 'cookie_contact_wizard-current_step': 'form1',\n },\n {\n 'form2-address1': '123 Main St',\n 'form2-address2': 'Djangoland',\n 'cookie_contact_wizard-current_step': 'form2',\n },\n {\n 'form3-random_crap': 'blah blah',\n 'cookie_contact_wizard-current_step': 'form3',\n },\n {\n 'form4-INITIAL_FORMS': '0',\n 'form4-TOTAL_FORMS': '2',\n 'form4-MAX_NUM_FORMS': '0',\n 'form4-0-random_crap': 'blah blah',\n 'form4-1-random_crap': 'blah blah',\n 'cookie_contact_wizard-current_step': 'form4',\n }\n )", "metadata": "root.NamedCookieWizardTests", "header": "['module', '___EOS___']", "index": 309 }, { "content": "class NamedFormTests(object):\n urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'\n", "metadata": "root.NamedFormTests", "header": "['module', '___EOS___']", "index": 340 }, { "content": " def test_revalidation(self):\n request = get_request()\n\n testform = self.formwizard_class.as_view(\n [('start', Step1), ('step2', Step2)],\n url_name=self.wizard_urlname)\n response, instance = testform(request, step='done')\n\n instance.render_done(None)\n self.assertEqual(instance.storage.current_step, 'start')", "metadata": "root.NamedFormTests.test_revalidation", "header": "['class', 'NamedFormTests', '(', 'object', ')', ':', '___EOS___']", "index": 343 }, { "content": "class TestNamedUrlSessionWizardView(NamedUrlSessionWizardView):\n", "metadata": "root.TestNamedUrlSessionWizardView", "header": "['module', '___EOS___']", "index": 355 }, { "content": " def dispatch(self, request, *args, **kwargs):\n response = super(TestNamedUrlSessionWizardView, self).dispatch(request, *args, **kwargs)\n return response, self", "metadata": "root.TestNamedUrlSessionWizardView.dispatch", "header": "['class', 'TestNamedUrlSessionWizardView', '(', 'NamedUrlSessionWizardView', ')', ':', '___EOS___']", "index": 357 }, { "content": "class TestNamedUrlCookieWizardView(NamedUrlCookieWizardView):\n", "metadata": "root.TestNamedUrlCookieWizardView", "header": "['module', '___EOS___']", "index": 362 }, { "content": " def dispatch(self, request, *args, **kwargs):\n response = super(TestNamedUrlCookieWizardView, self).dispatch(request, *args, **kwargs)\n return response, self", "metadata": "root.TestNamedUrlCookieWizardView.dispatch", "header": "['class', 'TestNamedUrlCookieWizardView', '(', 'NamedUrlCookieWizardView', ')', ':', '___EOS___']", "index": 364 }, { "content": "class NamedSessionFormTests(NamedFormTests, TestCase):\n formwizard_class = TestNamedUrlSessionWizardView\n wizard_urlname = 'nwiz_session'", "metadata": "root.NamedSessionFormTests", "header": "['module', '___EOS___']", "index": 369 }, { "content": "class NamedCookieFormTests(NamedFormTests, TestCase):\n formwizard_class = TestNamedUrlCookieWizardView\n wizard_urlname = 'nwiz_cookie'", "metadata": "root.NamedCookieFormTests", "header": "['module', '___EOS___']", "index": 374 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Query", "Dict_", "\\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_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "form", "tools_", "._", "wizard_", "._", "views_", "import_", "(_", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "form", "tools_", "._", "tests_", "._", "wizard_", "._", "forms_", "import_", "get", "\\u", "request_", ",_", "Step", "1_", ",_", "Step", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "django", ".", "contrib", ".", "form", "tool", "s", ".", "tests", ".", "wiz", "ard", ".", "named", "wiz", "ard", "tests", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "testu", "ser_", ",_", "created_", "=_", "User_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "username_", "=_", "'", "testu", "ser", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", "[_", "'", "form", "1", "-", "user", "'_", "]_", "=_", "self_", "._", "testu", "ser_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "initial", "\\u", "call_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'%", "s", "\\u", "start", "'_", "%_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wizard_", "=_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "step", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "step", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "last_", ",_", "'", "form", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "prev_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "next_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "count_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "url", "\\u", "name", "'_", "]_", ",_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "initial", "\\u", "call", "\\u", "with", "\\u", "params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "params_", "=_", "{_", "'", "getv", "ar", "1", "'_", ":_", "'", "getv", "al", "1", "'_", ",_", "'", "getv", "ar", "2", "'_", ":_", "'", "getv", "al", "2", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'%", "s", "\\u", "start", "'_", "%_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "proper", " ", "redirec", "t", " ", "GET", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "location_", "=_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "location_", "._", "find_", "(_", "'?'_", ")_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "dict_", "=_", "Query", "Dict_", "(_", "location_", "[_", "location_", "._", "find_", "(_", "'?'_", ")_", "+_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dict_", "(_", "query", "dict_", "._", "items_", "(_", ")_", ")_", ",_", "get", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "post", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "1", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "form", "'_", "]_", "._", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "[_", "'", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "[_", "'", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "post", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wizard_", "=_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "step", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "prev_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "wizard_", "[_", "'", "step", "s", "'_", "]_", "._", "next_", ",_", "'", "form", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "step", "back_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "{_", "'", "wiz", "ard", "\\u", "got", "o", "\\u", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "prev_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "jump_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "3", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "finish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", "=_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "=_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "all", "\\u", "data_", "=_", "response_", "._", "context_", "[_", "'", "form", "\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "all", "\\u", "data_", "[_", "1_", "]_", "[_", "'", "file", "1", "'_", "]_", "._", "read_", "(_", ")_", ",_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "data_", "[_", "1_", "]_", "[_", "'", "file", "1", "'_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "all", "\\u", "data_", "[_", "1_", "]_", "[_", "'", "file", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "all", "\\u", "data_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "'", "Pon", "y", "'_", ",_", "'", "thi", "rst", "y", "'_", ":_", "True_", ",_", "'", "user", "'_", ":_", "self_", "._", "testu", "ser_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "1", "'_", ":_", "'", "123", " ", "Main", " ", "St", "'_", ",_", "'", "address", "2", "'_", ":_", "'", "Dj", "ang", "ola", "nd", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", "}_", ",_", "{_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", "}_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "clean", "ed", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ")_", "\\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_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "post", "\\u", "data_", "=_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "=_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "step", "2", "\\u", "url_", "=_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "step", "2", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "form", "'_", "]_", "._", "files_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "all", "\\u", "data_", "=_", "response_", "._", "context_", "[_", "'", "all", "\\u", "clean", "ed", "\\u", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "all", "\\u", "data_", "[_", "'", "file", "1", "'_", "]_", "._", "read_", "(_", ")_", ",_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "data_", "[_", "'", "file", "1", "'_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "all", "\\u", "data_", "[_", "'", "file", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "'", "Pon", "y", "'_", ",_", "'", "thi", "rst", "y", "'_", ":_", "True_", ",_", "'", "user", "'_", ":_", "self_", "._", "testu", "ser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "1", "'_", ":_", "'", "123", " ", "Main", " ", "St", "'_", ",_", "'", "address", "2", "'_", ":_", "'", "Dj", "ang", "ola", "nd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "'", "formset", "-", "form", "4", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "manipulate", "d\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ")_", "\\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_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "post", "\\u", "data_", "=_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "[_", "'", "form", "2", "-", "file", "1", "'_", "]_", "=_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\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_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "cookies_", "._", "pop_", "(_", "'", "sessionid", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "cookies_", "._", "pop_", "(_", "'", "wiz", "ard", "\\u", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Wiz", "ard", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "form", "\\u", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ",_", "kwargs_", "=_", "{_", "'", "step", "'_", ":_", "'", "form", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wiz", "ard", "\\u", "step", "\\u", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "?", "reset", "=", "1", "'_", "%_", "reverse_", "(_", "'%", "s", "\\u", "start", "'_", "%_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "wiz", "ard", "'_", "]_", "[_", "'", "step", "s", "'_", "]_", "._", "current_", ",_", "'", "form", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Name", "d", "Sess", "ion", "Wiz", "ard", "Tests_", "(_", "Name", "d", "Wiz", "ard", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wiz", "ard", "\\u", "url", "name_", "=_", "'", "nwi", "z", "\\u", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiz", "ard", "\\u", "step", "\\u", "1", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiz", "ard", "\\u", "step", "\\u", "data_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "1", "-", "name", "'_", ":_", "'", "Pon", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "1", "-", "thi", "rst", "y", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "2", "-", "address", "1", "'_", ":_", "'", "123", " ", "Main", " ", "St", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "2", "-", "address", "2", "'_", ":_", "'", "Dj", "ang", "ola", "nd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "3", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "INITIAL", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "TOTAL", "\\u", "FORM", "S", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "MAX", "\\u", "NUM", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-0", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-1", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "class_", "Name", "d", "Cooki", "e", "Wiz", "ard", "Tests_", "(_", "Name", "d", "Wiz", "ard", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wiz", "ard", "\\u", "url", "name_", "=_", "'", "nwi", "z", "\\u", "cookie", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiz", "ard", "\\u", "step", "\\u", "1", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiz", "ard", "\\u", "step", "\\u", "data_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "1", "-", "name", "'_", ":_", "'", "Pon", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "1", "-", "thi", "rst", "y", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "2", "-", "address", "1", "'_", ":_", "'", "123", " ", "Main", " ", "St", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "2", "-", "address", "2", "'_", ":_", "'", "Dj", "ang", "ola", "nd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "3", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "INITIAL", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "TOTAL", "\\u", "FORM", "S", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-", "MAX", "\\u", "NUM", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-0", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "4", "-1", "-", "random", "\\u", "cra", "p", "'_", ":_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "contact", "\\u", "wiz", "ard", "-", "current", "\\u", "step", "'_", ":_", "'", "form", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "class_", "Name", "d", "Form", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "'", "django", ".", "contrib", ".", "form", "tool", "s", ".", "tests", ".", "wiz", "ard", ".", "named", "wiz", "ard", "tests", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Form", "Tests_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "rev", "alid", "ation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "get", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "testf", "orm_", "=_", "self_", "._", "form", "wiz", "ard", "\\u", "class_", "._", "as", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "start", "'_", ",_", "Step", "1_", ")_", ",_", "(_", "'", "step", "2", "'_", ",_", "Step", "2_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "name_", "=_", "self_", "._", "wiz", "ard", "\\u", "url", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", ",_", "instance_", "=_", "testf", "orm_", "(_", "request_", ",_", "step_", "=_", "'", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "._", "render", "\\u", "done_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instance_", "._", "storage_", "._", "current", "\\u", "step_", ",_", "'", "start", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", "(_", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", "(_", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "super_", "(_", "Test", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ",_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", "(_", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", "(_", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "super_", "(_", "Test", "Name", "d", "Ur", "l", "Cooki", "e", "Wiz", "ard", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ",_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Name", "d", "Sess", "ion", "Form", "Tests_", "(_", "Name", "d", "Form", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "wiz", "ard", "\\u", "class_", "=_", "Test", "Name", "d", "Ur", "l", "Sess", "ion", "Wiz", "ard", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiz", "ard", "\\u", "url", "name_", "=_", "'", "nwi", "z", "\\u", "session", "'_", "\\u\\u\\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", "d", "Cooki", "e", "Form", "Tests_", "(_", "Name", "d", "Form", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "wiz", "ard", "\\u", "class_", "=_", "Test", "Name", "d", "Ur", "l", "Coo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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
ClusterHQ/flocker/flocker/common/script.py
[ { "content": " def __init__(self, script, options, logging=True,\n reactor=None, sys_module=None):\n \"\"\"\n :param ICommandLineScript script: The script object to be run.\n :param usage.Options options: An option parser object.\n :param logging: If ``True``, log to stdout; otherwise don't log.\n :param reactor: Optional reactor to override default one.\n :param sys_module: An optional ``sys`` like module for use in\n testing. Defaults to ``sys``.\n \"\"\"\n self.script = script\n self.options = options\n self.logging = logging\n if reactor is None:\n reactor = global_reactor\n self._reactor = reactor\n\n if sys_module is None:\n sys_module = sys\n self.sys_module = sys_module", "metadata": "root.FlockerScriptRunner.__init__", "header": "['class', 'FlockerScriptRunner', '(', 'object', ')', ':', '___EOS___']", "index": 225 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Flo", "cker", "Script", "Runner_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "script_", ",_", "options_", ",_", "logging_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reactor_", "=_", "None_", ",_", "sys", "\\u", "module_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "IC", "ommand", "Line", "Script", " ", "script", ":", " ", "The", " ", "script", " ", "object", " ", "to", " ", "be", " ", "run", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "usage", ".", "Optio", "ns", " ", "options", ":", " ", "An", " ", "option", " ", "parser", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "logg", "ing", ":", " ", "If", " ", "``", "Tru", "e", "``", ",", " ", "log", " ", "to", " ", "stdout", ";", " ", "other", "wis", "e", " ", "don", "'", "t", " ", "log", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "react", "or", ":", " ", "Optio", "nal", " ", "react", "or", " ", "to", " ", "override", " ", "default", " ", "one", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "sys", "\\u", "module", ":", " ", "An", " ", "option", "al", " ", "``", "sys", "``", " ", "like", " ", "module", " ", "for", " ", "use", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "testi", "ng", ".", " ", "Default", "s", " ", "to", " ", "``", "sys", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script_", "=_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logging_", "=_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reactor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "=_", "global", "\\u", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "reactor_", "=_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys", "\\u", "module_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys", "\\u", "module_", "=_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sys", "\\u", "module_", "=_", "sys", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
Kozea/WeasyPrint/weasyprint/text.py
[ { "content": "def split_first_line(text, style, hinting, max_width, line_width):\n \"\"\"Fit as much as possible in the available width for one line of text.\n\n Return ``(layout, length, resume_at, width, height, baseline)``.\n\n ``layout``: a pango Layout with the first line\n ``length``: length in UTF-8 bytes of the first line\n ``resume_at``: The number of UTF-8 bytes to skip for the next line.\n May be ``None`` if the whole text fits in one line.\n This may be greater than ``length`` in case of preserved\n newline characters.\n ``width``: width in pixels of the first line\n ``height``: height in pixels of the first line\n ``baseline``: baseline in pixels of the first line\n\n \"\"\"\n # Step #1: Get a draft layout with the first line\n layout = None\n if max_width:\n expected_length = int(max_width / style.font_size * 2.5)\n if expected_length < len(text):\n # Try to use a small amount of text instead of the whole text\n layout = create_layout(\n text[:expected_length], style, hinting, max_width)\n lines = layout.iter_lines()\n first_line = next(lines, None)\n second_line = next(lines, None)\n if second_line is None:\n # The small amount of text fits in one line, give up and use\n # the whole text\n layout = None\n if layout is None:\n layout = create_layout(text, style, hinting, max_width)\n lines = layout.iter_lines()\n first_line = next(lines, None)\n second_line = next(lines, None)\n resume_at = None if second_line is None else second_line.start_index\n\n # Step #2: Don't hyphenize when it's not needed\n if max_width is None:\n # The first line can take all the place needed\n return first_line_metrics(first_line, text, layout, resume_at)\n first_line_width, _height = get_size(first_line)\n if second_line is None and first_line_width <= max_width:\n # The first line fits in the available width\n return first_line_metrics(first_line, text, layout, resume_at)\n\n # Step #3: Try to put the first word of the second line on the first line\n if first_line_width <= max_width:\n # The first line may have been cut too early by Pango\n second_line_index = second_line.start_index\n first_line_text = utf8_slice(text, slice(second_line_index))\n second_line_text = utf8_slice(text, slice(second_line_index, None))\n else:\n # The first word is longer than the line, try to hyphenize it\n first_line_text = ''\n second_line_text = text\n\n next_word = second_line_text.split(' ', 1)[0]\n if next_word:\n # next_word might fit without a space afterwards\n new_first_line_text = first_line_text + next_word\n layout.set_text(new_first_line_text)\n lines = layout.iter_lines()\n first_line = next(lines, None)\n second_line = next(lines, None)\n first_line_width, _height = get_size(first_line)\n if second_line is None and first_line_width <= max_width:\n # The next word fits in the first line, keep the layout\n resume_at = len(new_first_line_text.encode('utf-8')) + 1\n if resume_at == len(text.encode('utf-8')):\n resume_at = None\n return first_line_metrics(first_line, text, layout, resume_at)\n elif first_line_text:\n # We found something on the first line but we did not find a word on\n # the next line, no need to hyphenate, we can keep the current layout\n return first_line_metrics(first_line, text, layout, resume_at)\n\n # Step #4: Try to hyphenize\n hyphens = style.hyphens\n lang = style.lang and pyphen.language_fallback(style.lang)\n total, left, right = style.hyphenate_limit_chars\n\n hyphenated = False\n\n # Automatic hyphenation possible and next word is long enough\n if hyphens not in ('none', 'manual') and lang and len(next_word) >= total:\n first_line_width, _height = get_size(first_line)\n space = max_width - first_line_width\n if style.hyphenate_limit_zone.unit == '%':\n limit_zone = max_width * style.hyphenate_limit_zone.value / 100.\n else:\n limit_zone = style.hyphenate_limit_zone.value\n\n if space > limit_zone or space < 0:\n # The next word does not fit, try hyphenation\n dictionary_key = (lang, left, right, total)\n dictionary = PYPHEN_DICTIONARY_CACHE.get(dictionary_key)\n if dictionary is None:\n dictionary = pyphen.Pyphen(lang=lang, left=left, right=right)\n PYPHEN_DICTIONARY_CACHE[dictionary_key] = dictionary\n for first_word_part, _ in dictionary.iterate(next_word):\n hyphenated_first_line_text = (\n first_line_text + first_word_part +\n style.hyphenate_character)\n temp_layout = create_layout(\n hyphenated_first_line_text, style, hinting, max_width)\n temp_lines = temp_layout.iter_lines()\n temp_first_line = next(temp_lines, None)\n temp_second_line = next(temp_lines, None)\n\n if (temp_second_line is None and space >= 0) or space < 0:\n hyphenated = True\n resume_at = len(\n (first_line_text + first_word_part).encode('utf8'))\n layout = temp_layout\n first_line = temp_first_line\n second_line = temp_second_line\n temp_first_line_width, _height = get_size(temp_first_line)\n if temp_first_line_width <= max_width:\n break\n\n # Step 5: Try to break word if it's too long for the line\n overflow_wrap = style.overflow_wrap\n first_line_width, _height = get_size(first_line)\n space = max_width - first_line_width\n # If we can break words and the first line is too long\n if overflow_wrap == 'break-word' and space < 0:\n # Is it really OK to remove hyphenation for word-break ?\n hyphenated = False\n # TODO: Modify code to preserve W3C condition:\n # \"Shaping characters are still shaped as if the word were not broken\"\n # The way new lines are processed in this function (one by one with no\n # memory of the last) prevents shaping characters (arabic, for\n # instance) from keeping their shape when wrapped on the next line with\n # pango layout. Maybe insert Unicode shaping characters in text ?\n temp_layout = create_layout(text, style, hinting, max_width)\n temp_layout.set_wrap(PANGO_WRAP_MODE['WRAP_WORD_CHAR'])\n temp_lines = temp_layout.iter_lines()\n temp_first_line = next(temp_lines, None)\n temp_second_line = next(temp_lines, None)\n temp_second_line_index = (\n len(text.encode('utf-8')) if temp_second_line is None\n else temp_second_line.start_index)\n resume_at = temp_second_line_index\n first_line_text = utf8_slice(text, slice(temp_second_line_index))\n layout = create_layout(first_line_text, style, hinting, max_width)\n lines = layout.iter_lines()\n first_line = next(lines, None)\n\n return first_line_metrics(first_line, text, layout, resume_at, hyphenated)", "metadata": "root.split_first_line", "header": "['module', '___EOS___']", "index": 403 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "split", "\\u", "first", "\\u", "line_", "(_", "text_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ",_", "line", "\\u", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fit", " ", "as", " ", "muc", "h", " ", "as", " ", "possib", "le", " ", "in", " ", "the", " ", "avail", "able", " ", "widt", "h", " ", "for", " ", "one", " ", "line", " ", "of", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "``", "(", "layout", ",", " ", "length", ",", " ", "resum", "e\\u", "at", ",", " ", "widt", "h", ",", " ", "height", ",", " ", "baseline", ")``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "layout", "``", ":", " ", "a", " ", "pango", " ", "Lay", "out", " ", "with", " ", "the", " ", "first", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "``", "length", "``", ":", " ", "length", " ", "in", " ", "UT", "F", "-", "8", " ", "bytes", " ", "of", " ", "the", " ", "first", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "``", "resum", "e\\u", "at", "``", ":", " ", "The", " ", "number", " ", "of", " ", "UT", "F", "-", "8", " ", "bytes", " ", "to", " ", "skip", " ", "for", " ", "the", " ", "next", " ", "line", ".", "\\", "10", ";", " ", "Ma", "y", " ", "be", " ", "``", "Non", "e", "``", " ", "if", " ", "the", " ", "whole", " ", "text", " ", "fits", " ", "in", " ", "one", " ", "line", ".", "\\", "10", ";", " ", "Thi", "s", " ", "may", " ", "be", " ", "great", "er", " ", "than", " ", "``", "length", "``", " ", "in", " ", "case", " ", "of", " ", "preserved", "\\", "10", ";", " ", "newline", " ", "character", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "``", "widt", "h", "``", ":", " ", "widt", "h", " ", "in", " ", "pixel", "s", " ", "of", " ", "the", " ", "first", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "``", "height", "``", ":", " ", "height", " ", "in", " ", "pixel", "s", " ", "of", " ", "the", " ", "first", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "``", "baseline", "``", ":", " ", "baseline", " ", "in", " ", "pixel", "s", " ", "of", " ", "the", " ", "first", " ", "line", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Step", " ", "#", "1", ":", " ", "Get", " ", "a", " ", "draft", " ", "layout", " ", "with", " ", "the", " ", "first", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "length_", "=_", "int_", "(_", "max", "\\u", "width_", "/_", "style_", "._", "font", "\\u", "size_", "*_", "2.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expected", "\\u", "length_", "<_", "len_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "use", " ", "a", " ", "small", " ", "amo", "unt", " ", "of", " ", "text", " ", "inst", "ead", " ", "of", " ", "the", " ", "whole", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layout_", "=_", "create", "\\u", "layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "[_", ":_", "expected", "\\u", "length_", "]_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "second", "\\u", "line_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "small", " ", "amo", "unt", " ", "of", " ", "text", " ", "fits", " ", "in", " ", "one", " ", "line", ",", " ", "give", " ", "up", " ", "and", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "whole", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "layout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layout_", "=_", "create", "\\u", "layout_", "(_", "text_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resum", "e\\u", "at_", "=_", "None_", "if_", "second", "\\u", "line_", "is_", "None_", "else_", "second", "\\u", "line_", "._", "start", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "#", "2", ":", " ", "Don", "'", "t", " ", "hyphen", "ize", " ", "whe", "n", " ", "it", "'", "s", " ", "not", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max", "\\u", "width_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "line", " ", "can", " ", "take", " ", "all", " ", "the", " ", "place", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "first", "\\u", "line", "\\u", "metrics_", "(_", "first", "\\u", "line_", ",_", "text_", ",_", "layout_", ",_", "resum", "e\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "first", "\\u", "line", "\\u", "width_", ",_", "\\u", "height_", "=_", "get", "\\u", "size_", "(_", "first", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "second", "\\u", "line_", "is_", "None_", "and_", "first", "\\u", "line", "\\u", "width_", "<=_", "max", "\\u", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "line", " ", "fits", " ", "in", " ", "the", " ", "avail", "able", " ", "width_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "first", "\\u", "line", "\\u", "metrics_", "(_", "first", "\\u", "line_", ",_", "text_", ",_", "layout_", ",_", "resum", "e\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "#", "3", ":", " ", "Tr", "y", " ", "to", " ", "put", " ", "the", " ", "first", " ", "word", " ", "of", " ", "the", " ", "second", " ", "line", " ", "on", " ", "the", " ", "first", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "first", "\\u", "line", "\\u", "width_", "<=_", "max", "\\u", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "line", " ", "may", " ", "have", " ", "bee", "n", " ", "cut", " ", "too", " ", "ear", "ly", " ", "by", " ", "Pan", "go_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "second", "\\u", "line", "\\u", "index_", "=_", "second", "\\u", "line_", "._", "start", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line", "\\u", "text_", "=_", "utf", "8", "\\u", "slice_", "(_", "text_", ",_", "slice_", "(_", "second", "\\u", "line", "\\u", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line", "\\u", "text_", "=_", "utf", "8", "\\u", "slice_", "(_", "text_", ",_", "slice_", "(_", "second", "\\u", "line", "\\u", "index_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "word", " ", "is", " ", "long", "er", " ", "than", " ", "the", " ", "line", ",", " ", "try", " ", "to", " ", "hyphen", "ize", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "line", "\\u", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line", "\\u", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next", "\\u", "word_", "=_", "second", "\\u", "line", "\\u", "text_", "._", "split_", "(_", "'", " ", "'_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "word_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "next", "\\u", "word", " ", "mig", "ht", " ", "fit", " ", "with", "out", " ", "a", " ", "space", " ", "after", "ward", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "first", "\\u", "line", "\\u", "text_", "=_", "first", "\\u", "line", "\\u", "text_", "+_", "next", "\\u", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "set\\u", "text_", "(_", "new", "\\u", "first", "\\u", "line", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line", "\\u", "width_", ",_", "\\u", "height_", "=_", "get", "\\u", "size_", "(_", "first", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "second", "\\u", "line_", "is_", "None_", "and_", "first", "\\u", "line", "\\u", "width_", "<=_", "max", "\\u", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "next", " ", "word", " ", "fits", " ", "in", " ", "the", " ", "first", " ", "line", ",", " ", "keep", " ", "the", " ", "layout_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resum", "e\\u", "at_", "=_", "len_", "(_", "new", "\\u", "first", "\\u", "line", "\\u", "text_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resum", "e\\u", "at_", "==_", "len_", "(_", "text_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resum", "e\\u", "at_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "first", "\\u", "line", "\\u", "metrics_", "(_", "first", "\\u", "line_", ",_", "text_", ",_", "layout_", ",_", "resum", "e\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "first", "\\u", "line", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "found", " ", "somet", "hing", " ", "on", " ", "the", " ", "first", " ", "line", " ", "but", " ", "we", " ", "did", " ", "not", " ", "find", " ", "a", " ", "word", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "next", " ", "line", ",", " ", "no", " ", "need", " ", "to", " ", "hyphen", "ate", ",", " ", "we", " ", "can", " ", "keep", " ", "the", " ", "current", " ", "layout_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "first", "\\u", "line", "\\u", "metrics_", "(_", "first", "\\u", "line_", ",_", "text_", ",_", "layout_", ",_", "resum", "e\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "#", "4", ":", " ", "Tr", "y", " ", "to", " ", "hyphen", "ize_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hyphen", "s_", "=_", "style_", "._", "hyphen", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", "=_", "style_", "._", "lang_", "and_", "pyp", "hen", "_", "._", "language", "\\u", "fallback_", "(_", "style_", "._", "lang_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", ",_", "left_", ",_", "right_", "=_", "style_", "._", "hyphen", "ate", "\\u", "limit", "\\u", "chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hyphen", "ated", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Automat", "ic", " ", "hyphen", "ation", " ", "possib", "le", " ", "and", " ", "next", " ", "word", " ", "is", " ", "long", " ", "eno", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hyphen", "s_", "not_", "in_", "(_", "'", "none", "'_", ",_", "'", "manu", "al", "'_", ")_", "and_", "lang_", "and_", "len_", "(_", "next", "\\u", "word_", ")_", ">=_", "total_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "line", "\\u", "width_", ",_", "\\u", "height_", "=_", "get", "\\u", "size_", "(_", "first", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "=_", "max", "\\u", "width_", "-_", "first", "\\u", "line", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style_", "._", "hyphen", "ate", "\\u", "limit", "\\u", "zone_", "._", "unit_", "==_", "'%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "\\u", "zone_", "=_", "max", "\\u", "width_", "*_", "style_", "._", "hyphen", "ate", "\\u", "limit", "\\u", "zone_", "._", "value_", "/_", "100._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "\\u", "zone_", "=_", "style_", "._", "hyphen", "ate", "\\u", "limit", "\\u", "zone_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "space_", ">_", "limit", "\\u", "zone_", "or_", "space_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "next", " ", "word", " ", "doe", "s", " ", "not", " ", "fit", ",", " ", "try", " ", "hyphen", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dictionar", "y", "\\u", "key_", "=_", "(_", "lang_", ",_", "left_", ",_", "right_", ",_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dictionary_", "=_", "PY", "PH", "EN", "\\u", "DICT", "ION", "ARY", "\\u", "CACHE_", "._", "get_", "(_", "dictionar", "y", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dictionary_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dictionary_", "=_", "pyp", "hen", "_", "._", "Py", "phe", "n_", "(_", "lang_", "=_", "lang_", ",_", "left_", "=_", "left_", ",_", "right_", "=_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "PH", "EN", "\\u", "DICT", "ION", "ARY", "\\u", "CACHE_", "[_", "dictionar", "y", "\\u", "key_", "]_", "=_", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "first", "\\u", "word", "\\u", "part_", ",_", "\\u_", "in_", "dictionary_", "._", "iterate_", "(_", "next", "\\u", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hyphen", "ated", "\\u", "first", "\\u", "line", "\\u", "text_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "line", "\\u", "text_", "+_", "first", "\\u", "word", "\\u", "part_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "hyphen", "ate", "\\u", "character_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "layout_", "=_", "create", "\\u", "layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hyphen", "ated", "\\u", "first", "\\u", "line", "\\u", "text_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "lines_", "=_", "temp", "\\u", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "first", "\\u", "line_", "=_", "next_", "(_", "temp", "\\u", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "second", "\\u", "line_", "=_", "next_", "(_", "temp", "\\u", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "temp", "\\u", "second", "\\u", "line_", "is_", "None_", "and_", "space_", ">=_", "0_", ")_", "or_", "space_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hyphen", "ated", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resum", "e\\u", "at_", "=_", "len_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "first", "\\u", "line", "\\u", "text_", "+_", "first", "\\u", "word", "\\u", "part_", ")_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "temp", "\\u", "layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line_", "=_", "temp", "\\u", "first", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "\\u", "line_", "=_", "temp", "\\u", "second", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "first", "\\u", "line", "\\u", "width_", ",_", "\\u", "height_", "=_", "get", "\\u", "size_", "(_", "temp", "\\u", "first", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "temp", "\\u", "first", "\\u", "line", "\\u", "width_", "<=_", "max", "\\u", "width_", ":_", "\\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_", "#", " ", "Step", " ", "5", ":", " ", "Tr", "y", " ", "to", " ", "break", " ", "word", " ", "if", " ", "it", "'", "s", " ", "too", " ", "long", " ", "for", " ", "the", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "overflow", "\\u", "wrap_", "=_", "style_", "._", "overflow", "\\u", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line", "\\u", "width_", ",_", "\\u", "height_", "=_", "get", "\\u", "size_", "(_", "first", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "=_", "max", "\\u", "width_", "-_", "first", "\\u", "line", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", " ", "break", " ", "words", " ", "and", " ", "the", " ", "first", " ", "line", " ", "is", " ", "too", " ", "long_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "overflow", "\\u", "wrap_", "==_", "'", "break", "-", "word", "'_", "and_", "space_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Is", " ", "it", " ", "reall", "y", " ", "OK", " ", "to", " ", "remove", " ", "hyphen", "ation", " ", "for", " ", "word", "-", "break", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hyphen", "ated", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Modif", "y", " ", "code", " ", "to", " ", "preserve", " ", "W3", "C", " ", "condition", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Sha", "ping", " ", "character", "s", " ", "are", " ", "still", " ", "shaped", " ", "as", " ", "if", " ", "the", " ", "word", " ", "wer", "e", " ", "not", " ", "broken", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "way", " ", "new", " ", "lines", " ", "are", " ", "process", "ed", " ", "in", " ", "this", " ", "function", " ", "(", "one", " ", "by", " ", "one", " ", "with", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "memory", " ", "of", " ", "the", " ", "last", ")", " ", "prevent", "s", " ", "sha", "ping", " ", "character", "s", " ", "(", "arabi", "c", ",", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", ")", " ", "from", " ", "keep", "ing", " ", "thei", "r", " ", "shape", " ", "whe", "n", " ", "wrapp", "ed", " ", "on", " ", "the", " ", "next", " ", "line", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pango", " ", "layout", ".", " ", " ", "Ma", "yb", "e", " ", "insert", " ", "Unic", "ode", " ", "sha", "ping", " ", "character", "s", " ", "in", " ", "text", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "layout_", "=_", "create", "\\u", "layout_", "(_", "text_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "layout_", "._", "set\\u", "wrap_", "(_", "PAN", "GO", "\\u", "WRAP", "\\u", "MODE_", "[_", "'", "WRAP", "\\u", "WORD", "\\u", "CHAR", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "lines_", "=_", "temp", "\\u", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "first", "\\u", "line_", "=_", "next_", "(_", "temp", "\\u", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "second", "\\u", "line_", "=_", "next_", "(_", "temp", "\\u", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "second", "\\u", "line", "\\u", "index_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "text_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "if_", "temp", "\\u", "second", "\\u", "line_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "temp", "\\u", "second", "\\u", "line_", "._", "start", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resum", "e\\u", "at_", "=_", "temp", "\\u", "second", "\\u", "line", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line", "\\u", "text_", "=_", "utf", "8", "\\u", "slice_", "(_", "text_", ",_", "slice_", "(_", "temp", "\\u", "second", "\\u", "line", "\\u", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "create", "\\u", "layout_", "(_", "first", "\\u", "line", "\\u", "text_", ",_", "style_", ",_", "hin", "ting_", ",_", "max", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "layout_", "._", "iter", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "line_", "=_", "next_", "(_", "lines_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "first", "\\u", "line", "\\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 ]
Unreachable code
zzzeek/sqlalchemy/test/orm/test_lazy_relations.py
[ { "content": " def test_no_orphan(self):\n \"\"\"test that a lazily loaded child object is not marked as an orphan\"\"\"\n\n users, Address, addresses, User = (\n self.tables.users,\n self.classes.Address,\n self.tables.addresses,\n self.classes.User)\n\n mapper(User, users, properties={\n 'addresses': relationship(\n Address, cascade=\"all,delete-orphan\", lazy='select')\n })\n mapper(Address, addresses)\n\n sess = create_session()\n user = sess.query(User).get(7)\n assert getattr(User, 'addresses').hasparent(\n attributes.instance_state(user.addresses[0]), optimistic=True)\n assert not sa.orm.class_mapper(Address)._is_orphan(\n attributes.instance_state(user.addresses[0]))", "metadata": "root.LazyTest.test_no_orphan", "header": "['class', 'LazyTest', '(', '_fixtures', '.', 'FixtureTest', ')', ':', '___EOS___']", "index": 151 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "La", "zy", "Test_", "(_", "\\u", "fixtures_", "._", "Fix", "ture", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "orphan", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "test", " ", "tha", "t", " ", "a", " ", "laz", "il", "y", " ", "load", "ed", " ", "child", " ", "object", " ", "is", " ", "not", " ", "marked", " ", "as", " ", "an", " ", "orphan", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "Address_", ",_", "addresses_", ",_", "User_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tables_", "._", "users_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "classes_", "._", "Address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tables_", "._", "addresses_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "classes_", "._", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapper_", "(_", "User_", ",_", "users_", ",_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addresse", "s", "'_", ":_", "relationship_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Address_", ",_", "cascade_", "=_", "\"", "all", ",", "delete", "-", "orphan", "\"_", ",_", "lazy_", "=_", "'", "select", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper_", "(_", "Address_", ",_", "addresses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sess_", "=_", "create", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "sess_", "._", "query_", "(_", "User_", ")_", "._", "get_", "(_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "getattr_", "(_", "User_", ",_", "'", "addresse", "s", "'_", ")_", "._", "has", "parent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "._", "instance", "\\u", "state_", "(_", "user_", "._", "addresses_", "[_", "0_", "]_", ")_", ",_", "optimis", "tic_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sa_", "._", "orm_", "._", "class", "\\u", "mapper_", "(_", "Address_", ")_", "._", "\\u", "is", "\\u", "orphan", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "._", "instance", "\\u", "state_", "(_", "user_", "._", "addresses_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pistatium/houkago_app/server_appengine/app/models/appc.py
[ { "content": "# coding: utf-8\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom google.appengine.ext import ndb\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AppC(ndb.Model):\n grant_user = ndb.IntegerProperty()\n serial = ndb.StringProperty()\n status = ndb.IntegerProperty(default=0) # 1 配布済\n created_at = ndb.DateTimeProperty(auto_now_add=True)\n updated_at = ndb.DateTimeProperty(auto_now=True)\n\n\n", "metadata": "root.AppC", "header": "['module', '___EOS___']", "index": 7 }, { "content": " @classmethod\n def grant(cls, developer_id):\n codes = cls.query(cls.grant_user == developer_id).fetch(1)\n if codes:\n return codes[0]\n codes = cls.query(cls.status == 0).fetch(1)\n if not codes:\n return None\n code = codes[0]\n code.grant_user = developer_id\n code.status = 1\n code.put()\n return code", "metadata": "root.AppC.grant", "header": "['class', 'AppC', '(', 'ndb', '.', 'Model', ')', ':', '___EOS___']", "index": 14 }, { "content": " @classmethod\n def batch_import(cls, serials):\n codes = []\n for serial in serials:\n # insert uniq\n appc_key = ndb.Key(cls, serial)\n codes.append(AppC(serial=serial, key=appc_key))\n ndb.put_multi(codes)", "metadata": "root.AppC.batch_import", "header": "['class', 'AppC', '(', 'ndb', '.', 'Model', ')', ':', '___EOS___']", "index": 28 }, { "content": " @classmethod\n def get_list(cls, page=0):\n COUNT = 100\n offset = page * COUNT\n return cls.query().order(cls.status).fetch(COUNT, offset=offset)", "metadata": "root.AppC.get_list", "header": "['class', 'AppC', '(', 'ndb', '.', 'Model', ')', ':', '___EOS___']", "index": 37 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "ndb_", "\\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_", "App", "C_", "(_", "ndb_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grant", "\\u", "user_", "=_", "ndb_", "._", "Integer", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serial_", "=_", "ndb_", "._", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "ndb_", "._", "Integer", "Property_", "(_", "default_", "=_", "0_", ")_", "#", " ", "1", " ", "\\", "371", "9", "7", ";", "\\", "240", "6", "7", ";", "\\", "281", "6", "8", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "at_", "=_", "ndb_", "._", "Date", "Time", "Property_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "at_", "=_", "ndb_", "._", "Date", "Time", "Property_", "(_", "auto", "\\u", "now_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "App", "C_", "(_", "ndb_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "grant_", "(_", "cls_", ",_", "developer", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "codes_", "=_", "cls_", "._", "query_", "(_", "cls_", "._", "grant", "\\u", "user_", "==_", "developer", "\\u", "id_", ")_", "._", "fetch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "codes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "codes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "codes_", "=_", "cls_", "._", "query_", "(_", "cls_", "._", "status_", "==_", "0_", ")_", "._", "fetch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "codes_", ":_", "\\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_", "code_", "=_", "codes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "grant", "\\u", "user_", "=_", "developer", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "status_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "C_", "(_", "ndb_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "batch", "\\u", "import_", "(_", "cls_", ",_", "serial", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "codes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "serial_", "in_", "serial", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "uniq", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appc", "\\u", "key_", "=_", "ndb_", "._", "Key_", "(_", "cls_", ",_", "serial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "codes_", "._", "append_", "(_", "App", "C_", "(_", "serial_", "=_", "serial_", ",_", "key_", "=_", "appc", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ndb_", "._", "put", "\\u", "multi_", "(_", "codes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "C_", "(_", "ndb_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "list_", "(_", "cls_", ",_", "page_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COUNT_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "page_", "*_", "COUNT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tangentlabs/django-fancypages/tests/functional/test_api.py
[ { "content": " def test_moves_a_block_up_within_a_container(self):\n for idx, pos in [(0, 0), (1, 1), (2, 2)]:\n block = TextBlock.objects.get(id=self.left_blocks[idx].id)\n self.assertEquals(block.display_order, pos)\n\n self.app.put(\n reverse('fp-api:block-move', kwargs={\n 'uuid': self.main_blocks[1].uuid}),\n params={'container': self.left_container.uuid, 'index': 1},\n user=self.user)\n\n moved_block = TextBlock.objects.get(id=self.main_blocks[1].id)\n self.assertEquals(\n moved_block.container,\n self.page.get_container_from_name('left-container'))\n self.assertEquals(moved_block.display_order, 1)\n\n for idx, pos in [(0, 0), (1, 2), (2, 3)]:\n block = TextBlock.objects.get(id=self.left_blocks[idx].id)\n self.assertEquals(block.display_order, pos)\n\n for idx, pos in [(0, 0), (2, 1)]:\n block = TextBlock.objects.get(id=self.main_blocks[idx].id)\n self.assertEquals(block.display_order, pos)", "metadata": "root.TestTheBlockMoveApi.test_moves_a_block_up_within_a_container", "header": "['class', 'TestTheBlockMoveApi', '(', 'testcases', '.', 'FancyPagesWebTest', ')', ':', '___EOS___']", "index": 151 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "The", "Block", "Move", "Api_", "(_", "testcases", "_", "._", "Fan", "cy", "Page", "s", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "moves", "\\u", "a", "\\u", "block", "\\u", "up", "\\u", "within", "\\u", "a", "\\u", "container_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "idx_", ",_", "pos_", "in_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "2_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", "=_", "Text", "Block_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "left", "\\u", "blocks_", "[_", "idx_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "block_", "._", "display", "\\u", "order_", ",_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "put_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "fp", "-", "api", ":", "block", "-", "move", "'_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uuid", "'_", ":_", "self_", "._", "main", "\\u", "blocks_", "[_", "1_", "]_", "._", "uuid_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "container", "'_", ":_", "self_", "._", "left", "\\u", "container_", "._", "uuid_", ",_", "'", "index", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "moved", "\\u", "block_", "=_", "Text", "Block_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "main", "\\u", "blocks_", "[_", "1_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "moved", "\\u", "block_", "._", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "page_", "._", "get", "\\u", "container", "\\u", "from", "\\u", "name_", "(_", "'", "left", "-", "container", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "moved", "\\u", "block_", "._", "display", "\\u", "order_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "pos_", "in_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "2_", ")_", ",_", "(_", "2_", ",_", "3_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", "=_", "Text", "Block_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "left", "\\u", "blocks_", "[_", "idx_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "block_", "._", "display", "\\u", "order_", ",_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "idx_", ",_", "pos_", "in_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "2_", ",_", "1_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", "=_", "Text", "Block_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "main", "\\u", "blocks_", "[_", "idx_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "block_", "._", "display", "\\u", "order_", ",_", "pos_", ")_", "\\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 ]
Except block handles 'BaseException'
CiscoSystems/avos/openstack_dashboard/dashboards/project/data_processing/utils/workflow_helpers.py
[ { "content": "def safe_call(func, *args, **kwargs):\n try:\n return func(*args, **kwargs)\n except Exception:\n return None", "metadata": "root.safe_call", "header": "['module', '___EOS___']", "index": 137 } ]
[]
[]
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_", "safe", "\\u", "call_", "(_", "func_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
renmengye/imageqa-public/src/imageqa_render.py
[ { "content": "import sys\nimport os\nimport json\nimport re\nimport cPickle as pkl\n\nfrom nn.func import *\nimport imageqa_test as it\nimport imageqa_ensemble as ie\nimport requests\n\njsonTrainFilename = '/ais/gobi3/datasets/mscoco/annotations/captions_train2014.json'\njsonValidFilename = '/ais/gobi3/datasets/mscoco/annotations/captions_val2014.json'\nhtmlHyperLink = '%d.html'\ncssHyperLink = 'style.css'\ndaquarImageFolder = 'http://www.cs.toronto.edu/~mren/imageqa/data/nyu-depth-v2/jpg/'\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n \"\"\"\n Render HTML of a single model.\n Usage: python imageqa_render.py \n -m[odel] {name:modelId}\n -em[odel] {name:ensembleModelId1,ensembleModelId2,...}\n -pem[odel] {name:ensembleModelId3,ensembleModelId4,...}\n -aem[odel] {name:ensembleModelId5,ensembleModelId6,...}\n -d[ata] {data folder}\n -o[utput] {output folder}\n [-k {Top K answers}]\n [-dataset {daquar/cocoqa}]\n [-r[esults] {results folder}]\n Parameters:\n -m[odel]: Model ID\n -em[odel]: Ensemble model ID\n -pem[odel]: Ensemble model ID with prior\n -d[ata]: Data folder\n -o[utput]: Output folder\n -k: Top K answers\n -dataset: DAQUAR/COCO-QA dataset\n \"\"\"\n params = parseComparativeParams(sys.argv)\n\n print('Loading test data...')\n urlDict = loadImgUrl(params['dataset'], params['dataFolder'])\n data = it.loadDataset(params['dataFolder'])\n\n if len(params['models']) > 0:\n print('Running models...')\n singleModel = [params['models'][0]]\n modelOutputs = ie.runAllModels(\n data['testData'][0], \n data['questionTypeArray'], \n singleModel, \n params['resultsFolder'],\n params['dataset'],\n params['dataFolder'])\n else:\n modelOutputs = None\n\n # Render\n print('Rendering HTML to %s' % params['outputFolder'])\n if not os.path.exists(params['outputFolder']):\n os.makedirs(params['outputFolder'])\n\n pages = renderHtml(\n data['testData'][0], \n data['testData'][1], \n data['questionIdict'], \n data['ansIdict'], \n urlDict, \n topK=params['topK'], \n modelOutputs=modelOutputs,\n modelNames=getModelNames(singleModel),\n questionIds=np.arange(data['testData'][0].shape[0]))\n\n for i, page in enumerate(pages):\n with open(os.path.join(params['outputFolder'], \n htmlHyperLink % i), 'w') as f:\n f.write(page)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def renderLatexAnswerList(\n correctAnswer, \n topAnswers, \n topAnswerScores):\n result = []\n for i, answer in enumerate(topAnswers):\n if answer == correctAnswer:\n colorStr = '\\\\textcolor{green}{%s}'\n elif i == 0:\n colorStr = '\\\\textcolor{red}{%s}'\n else:\n colorStr = '%s'\n result.append(colorStr % ('%s (%.4f) ' % \\\n (answer, topAnswerScores[i])))\n return ''.join(result)", "metadata": "root.renderLatexAnswerList", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def renderLatexSingleItem(\n questionIndex,\n question,\n correctAnswer,\n pictureFolder='img',\n comment=None,\n topAnswers=None,\n topAnswerScores=None,\n modelNames=None):\n result = []\n imgPath = os.path.join(pictureFolder, '%d.jpg' % questionIndex)\n result.append(' \\\\scalebox{0.3}{\\n')\n result.append(' \\\\includegraphics[width=\\\\textwidth, \\\n height=.7\\\\textwidth]{%s}}\\n' % imgPath)\n result.append(' \\\\parbox{5cm}{\\n')\n result.append(' \\\\vskip 0.05in\\n')\n result.append(' Q%d: %s\\\\\\\\\\n' % (questionIndex, question))\n result.append(' Ground truth: %s\\\\\\\\\\n' % correctAnswer)\n i = 0\n if modelNames is not None and len(modelNames) > 1:\n for modelAnswer, modelAnswerScore, modelName in \\\n zip(topAnswers, topAnswerScores, modelNames):\n result.append('%s: ' % modelName)\n result.append(\n renderLatexAnswerList(\n correctAnswer,\n modelAnswer,\n modelAnswerScore))\n if i != len(modelNames) - 1:\n result.append('\\\\\\\\')\n i += 1\n result.append('\\n')\n elif topAnswers is not None:\n result.append(\n renderLatexAnswerList(\n correctAnswer,\n topAnswers, \n topAnswerScores))\n result.append('\\n')\n if comment is not None:\n result.append('\\\\\\\\\\n' + comment)\n result.append('}\\n')\n return ''.join(result)", "metadata": "root.renderLatexSingleItem", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def renderLatexSinglePage(\n inputData,\n targetData,\n questionIdict,\n ansIdict,\n urlDict,\n outputFolder,\n pictureFolder='img',\n topK=10,\n comments=None,\n caption=None,\n modelOutputs=None,\n modelNames=None,\n questionIds=None):\n result = []\n result.append('\\\\begin{figure*}[ht!]\\n')\n result.append('\\\\centering\\\\small\\n')\n result.append('$\\\\begin{array}{p{5cm} p{5cm} p{5cm}}\\n')\n imgPerRow = 3\n imgFolder = os.path.join(outputFolder, pictureFolder)\n for n in range(inputData.shape[0]):\n # Download the images\n imageId = inputData[n, 0, 0]\n imageFilename = urlDict[imageId - 1]\n r = requests.get(imageFilename)\n qid = questionIds[n] if questionIds is not None else n\n if not os.path.exists(imgFolder):\n os.makedirs(imgFolder)\n with open(os.path.join(imgFolder, '%d.jpg' % qid), 'wb') as f:\n f.write(r.content)\n question = it.decodeQuestion(inputData[n], questionIdict)\n answer = ansIdict[targetData[n, 0]]\n topAnswers, topAnswerScores = \\\n pickTopAnswers(\n ansIdict,\n n,\n topK=topK,\n modelOutputs=modelOutputs, \n modelNames=modelNames)\n comment = comments[n] \\\n if comments is not None else None\n result.append(\n renderLatexSingleItem(\n qid,\n question,\n answer,\n pictureFolder=pictureFolder,\n comment=comment,\n topAnswers=topAnswers,\n topAnswerScores=topAnswerScores,\n modelNames=modelNames))\n if np.mod(n, imgPerRow) == imgPerRow - 1:\n result.append('\\\\\\\\\\n')\n if n != inputData.shape[0] - 1:\n result.append('\\\\noalign{\\\\smallskip}\\\\\\\n noalign{\\\\smallskip}\\\\noalign{\\\\smallskip}\\n')\n else:\n result.append('&\\n')\n result.append('\\end{array}$\\n')\n result.append('\\caption{%s}\\n' % caption if caption is not None else '')\n result.append('\\end{figure*}\\n')\n return ''.join(result)", "metadata": "root.renderLatexSinglePage", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def renderLatex(\n inputData,\n targetData,\n questionIdict,\n ansIdict,\n urlDict,\n outputFolder,\n pictureFolder='img',\n topK=10,\n comments=None,\n caption=None,\n modelOutputs=None,\n modelNames=None,\n questionIds=None,\n filename='result.tex'):\n imgPerRow = 3\n rowsPerPage = 3\n imgPerPage = imgPerRow * rowsPerPage\n imgFolder = os.path.join(outputFolder, 'img')\n if inputData.shape[0] < imgPerPage:\n latexStr = renderLatexSinglePage(\n inputData,\n targetData,\n questionIdict,\n ansIdict,\n urlDict,\n outputFolder,\n pictureFolder=pictureFolder,\n topK=topK,\n comments=comments,\n caption=caption,\n modelOutputs=modelOutputs,\n modelNames=modelNames,\n questionIds=questionIds)\n else:\n result = []\n numPages = int(np.ceil(inputData.shape[0] / float(imgPerPage)))\n for i in range(numPages):\n start = imgPerPage * i\n end = min(inputData.shape[0], imgPerPage * (i + 1))\n if modelOutputs is not None:\n modelOutputSlice = []\n for j in range(len(modelNames)):\n modelOutputSlice.append(modelOutputs[j][start:end])\n else:\n modelOutputSlice = None\n page = renderLatexSinglePage(\n inputData[start:end],\n targetData[start:end],\n questionIdict,\n ansIdict,\n urlDict,\n outputFolder,\n pictureFolder=pictureFolder,\n topK=topK,\n comments=comments[start:end] \\\n if comments is not None else None,\n caption=caption,\n modelOutputs=modelOutputSlice,\n modelNames=modelNames, \n questionIds=questionIds[start:end])\n result.append(page)\n latexStr = ''.join(result)\n with open(os.path.join(outputFolder, filename), 'w') as f:\n f.write(latexStr)", "metadata": "root.renderLatex", "header": "['module', '___EOS___']", "index": 141 }, { "content": "def renderHtml(\n inputData,\n targetData,\n questionIdict,\n ansIdict,\n urlDict,\n topK=10,\n modelOutputs=None,\n modelNames=None,\n questionIds=None):\n imgPerPage = 1000\n if inputData.shape[0] < imgPerPage:\n return [renderSinglePage(\n inputData,\n targetData,\n questionIdict,\n ansIdict,\n urlDict,\n iPage=0,\n numPages=1,\n topK=topK,\n modelOutputs=modelOutputs,\n modelNames=modelNames, \n questionIds=questionIds)]\n else:\n result = []\n numPages = int(np.ceil(inputData.shape[0] / float(imgPerPage)))\n for i in range(numPages):\n start = imgPerPage * i\n end = min(inputData.shape[0], imgPerPage * (i + 1))\n if modelOutputs is not None:\n modelOutputSlice = []\n for j in range(len(modelNames)):\n modelOutputSlice.append(modelOutputs[j][start:end])\n else:\n modelOutputSlice = None\n page = renderSinglePage(\n inputData[start:end],\n targetData[start:end],\n questionIdict,\n ansIdict,\n urlDict, \n iPage=i,\n numPages=numPages,\n topK=topK,\n modelOutputs=modelOutputSlice,\n modelNames=modelNames,\n questionIds=questionIds[start:end])\n result.append(page)\n return result", "metadata": "root.renderHtml", "header": "['module', '___EOS___']", "index": 207 }, { "content": "def renderMenu(iPage, numPages):\n htmlList = []\n htmlList.append('<div>Navigation: ')\n for n in range(numPages):\n if n != iPage:\n htmlList.append('<a href=%s> %d </a>' % \\\n ((htmlHyperLink % n), n))\n else:\n htmlList.append('<span> %d </span>' % n)\n\n htmlList.append('</div>')\n return ''.join(htmlList)", "metadata": "root.renderMenu", "header": "['module', '___EOS___']", "index": 258 }, { "content": "def renderCss():\n cssList = []\n cssList.append('table {\\\n width:1200px;\\\n border-spacing:10px;\\\n }\\n')\n cssList.append('td.item {\\\n padding:5px;\\\n border:1px solid gray;\\\n vertical-align:top;\\\n }\\n')\n cssList.append('div.ans {\\\n margin-top:10px;\\\n width:300px;\\\n }')\n cssList.append('img {width:300px; height:200px;}\\n')\n cssList.append('span.good {color:green;}\\n')\n cssList.append('span.bad {color:red;}\\n')\n return ''.join(cssList)", "metadata": "root.renderCss", "header": "['module', '___EOS___']", "index": 271 }, { "content": "def renderAnswerList(\n correctAnswer, \n topAnswers, \n topAnswerScores):\n htmlList = []\n for i, answer in enumerate(topAnswers):\n if answer == correctAnswer:\n colorStr = 'class=\"good\"'\n elif i == 0:\n colorStr = 'class=\"bad\"'\n else:\n colorStr = ''\n htmlList.append('<span %s>%d. %s %.4f</span><br/>' % \\\n (colorStr, i + 1, \n answer, topAnswerScores[i]))\n return ''.join(htmlList)", "metadata": "root.renderAnswerList", "header": "['module', '___EOS___']", "index": 291 }, { "content": "def renderSingleItem(\n imageFilename,\n questionIndex,\n question,\n correctAnswer,\n topAnswers=None,\n topAnswerScores=None,\n modelNames=None):\n \"\"\"\n Render a single item.\n topAnswers: a list of top answer strings\n topAnswerScores: a list of top answer scores\n modelNames: if multiple items, then above are list of lists.\n \"\"\"\n htmlList = []\n htmlList.append('<td class=\"item\">\\\n <div class=\"img\">\\\n <img src=\"%s\"/></div>\\n' % \\\n imageFilename)\n htmlList.append('<div class=\"ans\">Q%d: %s<br/>' % \\\n (questionIndex, question))\n htmlList.append('Correct answer: <span class=\"good\">\\\n %s</span><br/>' % correctAnswer)\n if topAnswers is not None:\n for modelAnswer, modelAnswerScore, modelName in \\\n zip(topAnswers, topAnswerScores, modelNames):\n htmlList.append('%s:<br/>' % modelName)\n htmlList.append(\n renderAnswerList(\n correctAnswer,\n modelAnswer,\n modelAnswerScore))\n htmlList.append('</div></td>')\n return ''.join(htmlList)", "metadata": "root.renderSingleItem", "header": "['module', '___EOS___']", "index": 308 }, { "content": "def pickTopAnswers(\n ansIdict,\n n,\n topK=10,\n modelOutputs=None, \n modelNames=None,\n questionIds=None):\n if modelOutputs is not None:\n topAnswers = []\n topAnswerScores = []\n for j, modelOutput in enumerate(modelOutputs):\n sortIdx = np.argsort(modelOutput[n], axis=0)\n sortIdx = sortIdx[::-1]\n topAnswers.append([])\n topAnswerScores.append([])\n for i in range(0, topK):\n topAnswers[-1].append(ansIdict[sortIdx[i]])\n topAnswerScores[-1].append(modelOutput[n, sortIdx[i]])\n else:\n topAnswers = None\n topAnswerScores = None\n return topAnswers, topAnswerScores", "metadata": "root.pickTopAnswers", "header": "['module', '___EOS___']", "index": 343 }, { "content": "def renderSinglePage(\n inputData, \n targetData, \n questionIdict, \n ansIdict, \n urlDict,\n iPage=0, \n numPages=1,\n topK=10,\n modelOutputs=None,\n modelNames=None,\n questionIds=None):\n htmlList = []\n htmlList.append('<html><head>\\n')\n htmlList.append('<style>%s</style>' % renderCss())\n htmlList.append('</head><body>\\n')\n htmlList.append('<table>')\n imgPerRow = 4\n htmlList.append(renderMenu(iPage, numPages))\n for n in range(inputData.shape[0]):\n if np.mod(n, imgPerRow) == 0:\n htmlList.append('<tr>')\n imageId = inputData[n, 0, 0]\n imageFilename = urlDict[imageId - 1]\n question = it.decodeQuestion(inputData[n], questionIdict)\n\n qid = questionIds[n] if questionIds is not None else n\n topAnswers, topAnswerScores = pickTopAnswers(\n ansIdict, \n n,\n topK=topK,\n modelOutputs=modelOutputs, \n modelNames=modelNames,\n questionIds=questionIds)\n htmlList.append(renderSingleItem(\n imageFilename, \n qid, \n question, \n ansIdict[targetData[n, 0]], \n topAnswers=topAnswers, \n topAnswerScores=topAnswerScores, \n modelNames=modelNames))\n\n if np.mod(n, imgPerRow) == imgPerRow - 1:\n htmlList.append('</tr>')\n htmlList.append('</table>')\n htmlList.append(renderMenu(iPage, numPages))\n htmlList.append('</body></html>')\n return ''.join(htmlList)", "metadata": "root.renderSinglePage", "header": "['module', '___EOS___']", "index": 366 }, { "content": "def readImgDictCocoqa(imgidDict):\n with open(jsonTrainFilename) as f:\n captiontxt = f.read()\n urlDict = {}\n caption = json.loads(captiontxt)\n for item in caption['images']:\n urlDict[item['id']] = item['url']\n\n with open(jsonValidFilename) as f:\n captiontxt = f.read()\n caption = json.loads(captiontxt)\n for item in caption['images']:\n urlDict[item['id']] = item['url']\n urlList = [None] * len(imgidDict)\n for i, key in enumerate(imgidDict):\n urlList[i] = urlDict[int(key)]\n return urlList", "metadata": "root.readImgDictCocoqa", "header": "['module', '___EOS___']", "index": 416 }, { "content": "def readImgDictDaquar():\n urlList = []\n for i in range(1, 1450):\n urlList.append(daquarImageFolder + 'image%d.jpg' % i)\n return urlList", "metadata": "root.readImgDictDaquar", "header": "['module', '___EOS___']", "index": 434 }, { "content": "def loadImgUrl(dataset, dataFolder):\n print 'Loading image urls...'\n if dataset == 'cocoqa':\n imgidDictFilename = \\\n os.path.join(dataFolder, 'imgid_dict.pkl')\n with open(imgidDictFilename, 'rb') as f:\n imgidDict = pkl.load(f)\n urlDict = readImgDictCocoqa(imgidDict)\n elif dataset == 'daquar':\n urlDict = readImgDictDaquar()\n return urlDict", "metadata": "root.loadImgUrl", "header": "['module', '___EOS___']", "index": 440 }, { "content": "def loadImgPath(dataset, dataFolder):\n print 'Loading image paths...'\n cocoImgIdRegex = 'COCO_((train)|(val))2014_0*(?P<imgid>[1-9][0-9]*)'\n if dataset == 'cocoqa':\n imgidDictFilename = \\\n os.path.join(dataFolder, 'imgid_dict.pkl')\n with open(imgidDictFilename, 'rb') as f:\n imgidDict = pkl.load(f)\n pathList = [None] * len(imgidDict)\n pathDict = {}\n with open('/u/mren/data/mscoco/train/image_list.txt') as f:\n imageList = f.readlines()\n with open('/u/mren/data/mscoco/valid/image_list.txt') as f:\n imageList.extend(f.readlines())\n for imgPath in imageList:\n match = re.search(cocoImgIdRegex, imgPath)\n imgid = match.group('imgid')\n pathDict[imgid] = imgPath[:-1]\n for i, key in enumerate(imgidDict):\n pathList[i] = pathDict[key]\n return pathList\n elif dataset == 'daquar':\n pathList = []\n for i in range(1, 1450):\n pathList.append('/u/mren/data/nyu-depth/jpg/image%d.jpg' % i)\n return pathList\n else:\n raise Exception('Unknown dataset: ' + dataset)", "metadata": "root.loadImgPath", "header": "['module', '___EOS___']", "index": 452 }, { "content": "def escapeLatexIdict(idict):\n for i in range(len(idict)):\n if '_' in idict[i]:\n idict[i] = idict[i].replace('_', '\\\\_')\n return idict", "metadata": "root.escapeLatexIdict", "header": "['module', '___EOS___']", "index": 481 }, { "content": "def parseComparativeParams(argv):\n \"\"\"\n Parse parameter list for rendering comparative results.\n Usage:\n -m[odel] {name1:modelId1}\n -m[odel] {name2:modelId2}\n -em[odel] {name3:ensembleModelId3,ensembleModelId4,...}\n -pem[odel] {name4:ensembleModelId5,ensembleModelId6,...}\n -aem[odel] {name4:ensembleModelId7,ensembleModelId8,...}\n \n ...\n -d[ata] {dataFolder}\n -i[nput] {listFile}\n -o[utput] {outputFolder}\n [-k {top K answers}]\n [-p[icture] {pictureFolder}]\n [-r[esults] {resultsFolder}]\n [-f[ile] {outputFilename}]\n [-dataset {daquar/cocoqa}]\n [-format {html/latex}]\n\n Parameters:\n -m[odel]: Normal models\n -em[odel]: Class-specific-ensemble models\n -pem[odel]: Class-specific-ensemble + prior models\n -aem[odel]: Ensemble average of regular models\n -d[ata]: Data folder\n -i[nput]: Task-specific input file\n -o[utput]: Output folder\n -k: Top K answers, default 1\n -p[icture]: Picture folder name, default \"img\"\n -r[esults]: Results folder, default \"../results\"\n -f[ile]: Output TeX file name, default \"result\"\n -dataset: daquar/cocoqa dataset, default \"cocoqa\"\n -format: Output format, default \"html\"\n\n Returns:\n A dictionary with following keys:\n models: List of dictionaries, with following keys:\n modelName: string\n isClassEnsemble: boolean\n runPrior: boolean\n dataFolder: string\n inputFile: string\n outputFolder: string\n topK: int\n pictureFolder: string\n outputFilename: string\n dataset: string\n \"\"\"\n dataset = 'cocoqa'\n filename = 'result'\n pictureFolder = 'img'\n resultsFolder = '../results'\n K = 1\n models = []\n format = 'html'\n inputFile = None\n for i, flag in enumerate(argv):\n if flag == '-m' or flag == '-model':\n parts = sys.argv[i + 1].split(':')\n models.append({\n 'name': parts[0],\n 'id': parts[1],\n 'isClassEnsemble': False,\n 'isAverageEnsemble': False,\n 'runPrior': False\n })\n elif flag == '-em' or flag == '-emodel':\n parts = sys.argv[i + 1].split(':')\n models.append({\n 'name': parts[0],\n 'id': parts[1],\n 'isClassEnsemble': True,\n 'isAverageEnsemble': False,\n 'runPrior': False\n })\n elif flag == '-pem' or flag == '-pemodel':\n parts = sys.argv[i + 1].split(':')\n models.append({\n 'name': parts[0],\n 'id': parts[1],\n 'isClassEnsemble': True,\n 'isAverageEnsemble': False,\n 'runPrior': True\n })\n elif flag == '-aem' or flag == '-aemodel':\n parts = sys.argv[i + 1].split(':')\n models.append({\n 'name': parts[0],\n 'id': parts[1],\n 'isClassEnsemble': False,\n 'isAverageEnsemble': True,\n 'runPrior': False\n })\n elif flag == '-d' or flag == '-data':\n dataFolder = sys.argv[i + 1]\n elif flag == '-i' or flag == '-input':\n inputFile = sys.argv[i + 1]\n elif flag == '-k':\n K = int(sys.argv[i + 1])\n elif flag == '-p' or flag == '-picture':\n pictureFolder = sys.argv[i + 1]\n elif flag == '-o' or flag == '-output':\n outputFolder = sys.argv[i + 1]\n elif flag == '-r' or flag == '-results':\n resultsFolder = sys.argv[i + 1]\n elif flag == '-f' or flag == '-file':\n filename = sys.argv[i + 1]\n elif flag == '-dataset':\n dataset = sys.argv[i + 1]\n elif flag == '-format':\n format = sys.argv[i + 1]\n return {\n 'models': models,\n 'dataFolder': dataFolder,\n 'inputFile': inputFile,\n 'outputFolder': outputFolder,\n 'resultsFolder': resultsFolder,\n 'topK': K,\n 'pictureFolder': pictureFolder,\n 'outputFilename': filename,\n 'dataset': dataset,\n 'format': format\n }", "metadata": "root.parseComparativeParams", "header": "['module', '___EOS___']", "index": 487 }, { "content": "def getModelNames(modelSpecs):\n modelNames = []\n for spec in modelSpecs:\n modelNames.append(spec['name'])\n return modelNames", "metadata": "root.getModelNames", "header": "['module', '___EOS___']", "index": 613 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pkl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nn_", "._", "func_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "image", "qa", "\\u", "test_", "as_", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "image", "qa", "\\u", "ensemble_", "as_", "ie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json", "Train", "Filename_", "=_", "'/", "ais", "/", "gob", "i3", "/", "dataset", "s", "/", "msc", "oco", "/", "annot", "ation", "s", "/", "captions", "\\u", "train", "2014", ".", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "Valid", "Filename_", "=_", "'/", "ais", "/", "gob", "i3", "/", "dataset", "s", "/", "msc", "oco", "/", "annot", "ation", "s", "/", "captions", "\\u", "val", "2014", ".", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "Hyper", "Link_", "=_", "'%", "d", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "Hyper", "Link_", "=_", "'", "style", ".", "css", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "quar", "Image", "Folder_", "=_", "'", "http", "://", "www", ".", "cs", ".", "tor", "onto", ".", "edu", "/", "~", "mre", "n", "/", "image", "qa", "/", "data", "/", "ny", "u", "-", "depth", "-", "v2", "/", "jp", "g", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Render", " ", "HTM", "L", " ", "of", " ", "a", " ", "single", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", ":", " ", "python", " ", "image", "qa", "\\u", "render", ".", "py", " ", "\\", "10", ";", " ", " ", "-", "m", "[", "odel", "]", " ", "{", "name", ":", "model", "Id", "}", "\\", "10", ";", " ", " ", "-", "em", "[", "odel", "]", " ", "{", "name", ":", "ensembl", "e", "Model", "Id", "1", ",", "ensembl", "e", "Model", "Id", "2", ",...", "}", "\\", "10", ";", " ", " ", "-", "pe", "m", "[", "odel", "]", " ", "{", "name", ":", "ensembl", "e", "Model", "Id", "3", ",", "ensembl", "e", "Model", "Id", "4", ",...", "}", "\\", "10", ";", " ", " ", "-", "ae", "m", "[", "odel", "]", " ", "{", "name", ":", "ensembl", "e", "Model", "Id", "5", ",", "ensembl", "e", "Model", "Id", "6", ",...", "}", "\\", "10", ";", " ", " ", "-", "d", "[", "ata", "]", " ", "{", "data", " ", "folder", "}", "\\", "10", ";", " ", " ", "-", "o", "[", "ut", "put", "]", " ", "{", "output", " ", "folder", "}", "\\", "10", ";", " ", " ", "[-", "k", " ", "{", "Top", " ", "K", " ", "answer", "s", "}]", "\\", "10", ";", " ", " ", "[-", "dataset", " ", "{", "da", "quar", "/", "coco", "qa", "}]", "\\", "10", ";", " ", " ", "[-", "r", "[", "esult", "s", "]", " ", "{", "results", " ", "folder", "}]", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", "m", "[", "odel", "]:", " ", "Model", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", "-", "em", "[", "odel", "]:", " ", "Ensemble", " ", "model", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", "-", "pe", "m", "[", "odel", "]:", " ", "Ensemble", " ", "model", " ", "ID", " ", "with", " ", "prior", "\\", "10", ";", " ", " ", " ", " ", "-", "d", "[", "ata", "]:", " ", "Data", " ", "folder", "\\", "10", ";", " ", " ", " ", " ", "-", "o", "[", "ut", "put", "]:", " ", "Output", " ", "folder", "\\", "10", ";", " ", " ", " ", " ", "-", "k", ":", " ", "Top", " ", "K", " ", "answer", "s", "\\", "10", ";", " ", " ", " ", " ", "-", "dataset", ":", " ", "DA", "QUA", "R", "/", "CO", "CO", "-", "QA", " ", "dataset", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "parse", "Compara", "tiv", "e", "Params_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Load", "ing", " ", "test", " ", "data", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "Dict_", "=_", "load", "Im", "g", "Url_", "(_", "params_", "[_", "'", "dataset", "'_", "]_", ",_", "params_", "[_", "'", "data", "Fold", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "it_", "._", "load", "Dataset_", "(_", "params_", "[_", "'", "data", "Fold", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "params_", "[_", "'", "model", "s", "'_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Run", "ning", " ", "model", "s", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "Model_", "=_", "[_", "params_", "[_", "'", "model", "s", "'_", "]_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Output", "s_", "=_", "ie_", "._", "run", "All", "Models_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "test", "Data", "'_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "question", "Type", "Array", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "single", "Model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "[_", "'", "results", "Fold", "er", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "[_", "'", "dataset", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "[_", "'", "data", "Fold", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Output", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Render_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "Rendering", " ", "HTM", "L", " ", "to", " ", "%", "s", "'_", "%_", "params_", "[_", "'", "output", "Fold", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "params_", "[_", "'", "output", "Fold", "er", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "params_", "[_", "'", "output", "Fold", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pages_", "=_", "render", "Html_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "test", "Data", "'_", "]_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "test", "Data", "'_", "]_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "question", "Id", "ict", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ans", "Id", "ict", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "params_", "[_", "'", "top", "K", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "get", "Model", "Names_", "(_", "single", "Model_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "np_", "._", "arange_", "(_", "data_", "[_", "'", "test", "Data", "'_", "]_", "[_", "0_", "]_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "page_", "in_", "enumerate_", "(_", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "params_", "[_", "'", "output", "Fold", "er", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html", "Hyper", "Link_", "%_", "i_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "page_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render", "Latex", "Answer", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "answer_", "in_", "enumerate_", "(_", "top", "Answer", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "answer_", "==_", "correct", "Answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "'\\\\\\\\", "textco", "lor", "{", "green", "}{", "%", "s", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "'\\\\\\\\", "textco", "lor", "{", "red", "}{", "%", "s", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "'%", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "color", "Str_", "%_", "(_", "'%", "s", " ", "(%", ".4", "f", ")", " ", "'_", "%_", "(_", "answer_", ",_", "top", "Answer", "Scores_", "[_", "i_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Latex", "Sing", "le", "Item_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "'", "img", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pic", "ture", "Folder_", ",_", "'%", "d", ".", "jp", "g", "'_", "%_", "question", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "\\\\\\\\", "scale", "box", "{", "0.", "3", "}{\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "\\\\\\\\", "include", "graphic", "s", "[", "widt", "h", "=\\\\", "\\\\", "text", "widt", "h", ",", " ", "\\\\", "\\", "10", ";", " ", " ", "height", "=.", "7", "\\\\\\\\", "text", "widt", "h", "]{", "%", "s", "}}\\", "\\", "n", "'_", "%_", "img", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "\\\\\\\\", "par", "box", "{", "5c", "m", "}{\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "\\\\\\\\", "vs", "kip", " ", "0.05", "in", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "Q", "%", "d", ":", " ", "%", "s", "\\\\\\\\\\\\\\\\", "\\\\", "n", "'_", "%_", "(_", "question", "Index_", ",_", "question_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'", " ", " ", " ", " ", "Gro", "und", " ", "truth", ":", " ", "%", "s", "\\\\\\\\\\\\\\\\", "\\\\", "n", "'_", "%_", "correct", "Answer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Names_", "is_", "not_", "None_", "and_", "len_", "(_", "model", "Names_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Answer_", ",_", "model", "Answer", "Score_", ",_", "model", "Name_", "in_", "zip_", "(_", "top", "Answer", "s_", ",_", "top", "Answer", "Scores_", ",_", "model", "Names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'%", "s", ":", " ", "'_", "%_", "model", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "render", "Latex", "Answer", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Answer", "Score_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "!=_", "len_", "(_", "model", "Names_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'\\\\\\\\\\\\\\\\", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "top", "Answer", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "render", "Latex", "Answer", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "comment_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'\\\\\\\\\\\\\\\\", "\\\\", "n", "'_", "+_", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "'}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Latex", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "'", "img", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comments_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caption_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\\\\\", "begin", "{", "figure", "*}", "[", "ht", "!]", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\\\\\", "center", "ing", "\\\\\\\\", "small", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'$", "\\\\\\\\", "begin", "{", "array", "}{", "p", "{", "5c", "m", "}", " ", "p", "{", "5c", "m", "}", " ", "p", "{", "5c", "m", "}}\\", "\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Per", "Row_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "Folder_", ",_", "pic", "ture", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Down", "load", " ", "the", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "Id_", "=_", "input", "Data_", "[_", "n_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "Filename_", "=_", "url", "Dict_", "[_", "image", "Id_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "requests_", "._", "get_", "(_", "image", "Filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qid_", "=_", "question", "Ids_", "[_", "n_", "]_", "if_", "question", "Ids_", "is_", "not_", "None_", "else_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "img", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "img", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "img", "Folder_", ",_", "'%", "d", ".", "jp", "g", "'_", "%_", "qid_", ")_", ",_", "'", "wb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "r_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "question_", "=_", "it_", "._", "decode", "Question_", "(_", "input", "Data_", "[_", "n_", "]_", ",_", "question", "Id", "ict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "ans", "Id", "ict_", "[_", "target", "Data_", "[_", "n_", ",_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "s_", ",_", "top", "Answer", "Scores_", "=_", "pick", "Top", "Answer", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "comments_", "[_", "n_", "]_", "if_", "comments_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "render", "Latex", "Sing", "le", "Item_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "qid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "pic", "ture", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "comment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", "=_", "top", "Answer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "top", "Answer", "Scores_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "mod_", "(_", "n_", ",_", "img", "Per", "Row_", ")_", "==_", "img", "Per", "Row_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'\\\\\\\\\\\\\\\\", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "!=_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'\\\\\\\\", "noa", "lign", "{\\\\", "\\\\", "small", "skip", "}\\\\", "\\\\\\\\", "\\", "10", ";", " ", " ", "noa", "lign", "{\\\\", "\\\\", "small", "skip", "}\\\\", "\\\\", "noa", "lign", "{\\\\", "\\\\", "small", "skip", "}\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "'&", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\", "end", "{", "array", "}$", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\", "caption", "{%", "s", "}\\\\", "n", "'_", "%_", "caption_", "if_", "caption_", "is_", "not_", "None_", "else_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "'\\\\", "end", "{", "figure", "*}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Latex", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "'", "img", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comments_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caption_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "'", "result", ".", "tex", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "Per", "Row_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows", "Per", "Page_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Per", "Page_", "=_", "img", "Per", "Row_", "*_", "rows", "Per", "Page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "Folder_", ",_", "'", "img", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", "<_", "img", "Per", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "late", "x", "Str_", "=_", "render", "Latex", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "pic", "ture", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comments_", "=_", "comments_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caption_", "=_", "caption_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "question", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Pages_", "=_", "int_", "(_", "np_", "._", "ceil_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", "/_", "float_", "(_", "img", "Per", "Page_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "img", "Per", "Page_", "*_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "min_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", ",_", "img", "Per", "Page_", "*_", "(_", "i_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Output", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Output", "Slice_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "model", "Names_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model", "Output", "Slice_", "._", "append_", "(_", "model", "Output", "s_", "[_", "j_", "]_", "[_", "start_", ":_", "end_", "]_", ")_", "\\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 ", " _", "model", "Output", "Slice_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "render", "Latex", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", "[_", "start_", ":_", "end_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", "[_", "start_", ":_", "end_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "pic", "ture", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comments_", "=_", "comments_", "[_", "start_", ":_", "end_", "]_", "if_", "comments_", "is_", "not_", "None_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caption_", "=_", "caption_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "Slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "question", "Ids_", "[_", "start_", ":_", "end_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "late", "x", "Str_", "=_", "''_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "output", "Folder_", ",_", "filename_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "late", "x", "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_", "def_", "render", "Html_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "Per", "Page_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", "<_", "img", "Per", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "render", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "i", "Page_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Pages_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "question", "Ids_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Pages_", "=_", "int_", "(_", "np_", "._", "ceil_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", "/_", "float_", "(_", "img", "Per", "Page_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "img", "Per", "Page_", "*_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "min_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", ",_", "img", "Per", "Page_", "*_", "(_", "i_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Output", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Output", "Slice_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "model", "Names_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model", "Output", "Slice_", "._", "append_", "(_", "model", "Output", "s_", "[_", "j_", "]_", "[_", "start_", ":_", "end_", "]_", ")_", "\\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 ", " _", "model", "Output", "Slice_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "render", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", "[_", "start_", ":_", "end_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", "[_", "start_", ":_", "end_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "i", "Page_", "=_", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Pages_", "=_", "num", "Pages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "Slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "question", "Ids_", "[_", "start_", ":_", "end_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Menu_", "(_", "i", "Page_", ",_", "num", "Pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "div", ">", "Navigat", "ion", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "num", "Pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "!=_", "i", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "._", "append_", "(_", "'<", "a", " ", "href", "=", "%", "s", ">", " ", "%", "d", " ", "</", "a", ">'_", "%_", "(_", "(_", "html", "Hyper", "Link_", "%_", "n_", ")_", ",_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "._", "append_", "(_", "'<", "span", ">", " ", "%", "d", " ", "</", "span", ">'_", "%_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "html", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Cs", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "table", " ", "{\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "widt", "h", ":", "1200", "px", ";\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "border", "-", "spaci", "ng", ":", "10", "px", ";\\\\", "\\", "10", ";", " ", " ", " ", " ", "}\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "td", ".", "item", " ", "{\\\\", "\\", "10", ";", " ", " ", " ", "padd", "ing", ":", "5", "px", ";\\\\", "\\", "10", ";", " ", " ", " ", "border", ":", "1p", "x", " ", "solid", " ", "gray", ";\\\\", "\\", "10", ";", " ", " ", " ", "vertical", "-", "align", ":", "top", ";\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "}\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "div", ".", "ans", " ", "{\\\\", "\\", "10", ";", " ", " ", " ", "marg", "in", "-", "top", ":", "10", "px", ";\\\\", "\\", "10", ";", " ", " ", " ", "widt", "h", ":", "300", "px", ";\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "img", " ", "{", "widt", "h", ":", "300", "px", ";", " ", "height", ":", "200", "px", ";}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "span", ".", "good", " ", "{", "color", ":", "green", ";}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "List_", "._", "append_", "(_", "'", "span", ".", "bad", " ", "{", "color", ":", "red", ";}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "css", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Answer", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "answer_", "in_", "enumerate_", "(_", "top", "Answer", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "answer_", "==_", "correct", "Answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "'", "class", "=\"", "good", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "'", "class", "=\"", "bad", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "Str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "span", " ", "%", "s", ">", "%", "d", ".", " ", "%", "s", " ", "%", ".4", "f", "</", "span", "><", "br", "/>'_", "%_", "(_", "color", "Str_", ",_", "i_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "answer_", ",_", "top", "Answer", "Scores_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "html", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Sing", "le", "Item_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "Filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Render", " ", "a", " ", "single", " ", "item", ".", "\\", "10", ";", " ", " ", " ", " ", "top", "Answer", "s", ":", " ", "a", " ", "list", " ", "of", " ", "top", " ", "answer", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", "top", "Answer", "Score", "s", ":", " ", "a", " ", "list", " ", "of", " ", "top", " ", "answer", " ", "score", "s", "\\", "10", ";", " ", " ", " ", " ", "model", "Names", ":", " ", "if", " ", "multiple", " ", "items", ",", " ", "then", " ", "above", " ", "are", " ", "list", " ", "of", " ", "lists", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "td", " ", "class", "=\"", "item", "\">", "\\\\", "\\", "10", ";", " ", " ", "<", "div", " ", "class", "=\"", "img", "\">", "\\\\", "\\", "10", ";", " ", " ", "<", "img", " ", "src", "=\"", "%", "s", "\"/><", "/", "div", ">\\\\", "n", "'_", "%_", "image", "Filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "div", " ", "class", "=\"", "ans", "\">", "Q", "%", "d", ":", " ", "%", "s", "<", "br", "/>'_", "%_", "(_", "question", "Index_", ",_", "question_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'", "Correct", " ", "answer", ":", " ", "<", "span", " ", "class", "=\"", "good", "\">", "\\\\", "\\", "10", ";", " ", " ", "%", "s", "</", "span", "><", "br", "/>'_", "%_", "correct", "Answer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "top", "Answer", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Answer_", ",_", "model", "Answer", "Score_", ",_", "model", "Name_", "in_", "zip_", "(_", "top", "Answer", "s_", ",_", "top", "Answer", "Scores_", ",_", "model", "Names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "._", "append_", "(_", "'%", "s", ":", "<", "br", "/>'_", "%_", "model", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "render", "Answer", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Answer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Answer", "Score_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "/", "div", "><", "/", "td", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "html", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pick", "Top", "Answer", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model", "Output", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top", "Answer", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", ",_", "model", "Output_", "in_", "enumerate_", "(_", "model", "Output", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort", "Idx_", "=_", "np_", "._", "argsort_", "(_", "model", "Output_", "[_", "n_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "Idx_", "=_", "sort", "Idx_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "s_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "Scores_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "top", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top", "Answer", "s_", "[_", "-_", "1_", "]_", "._", "append_", "(_", "ans", "Id", "ict_", "[_", "sort", "Idx_", "[_", "i_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "Scores_", "[_", "-_", "1_", "]_", "._", "append_", "(_", "model", "Output_", "[_", "n_", ",_", "sort", "Idx_", "[_", "i_", "]_", "]_", ")_", "\\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 ", " _", "top", "Answer", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "top", "Answer", "s_", ",_", "top", "Answer", "Scores_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Sing", "le", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "i", "Page_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Pages_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "html", "><", "head", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "style", ">", "%", "s", "</", "style", ">'_", "%_", "render", "Cs", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "/", "head", "><", "body", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "table", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "Per", "Row_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "render", "Menu_", "(_", "i", "Page_", ",_", "num", "Pages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "input", "Data_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "mod_", "(_", "n_", ",_", "img", "Per", "Row_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "._", "append_", "(_", "'<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "Id_", "=_", "input", "Data_", "[_", "n_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "Filename_", "=_", "url", "Dict_", "[_", "image", "Id_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "question_", "=_", "it_", "._", "decode", "Question_", "(_", "input", "Data_", "[_", "n_", "]_", ",_", "question", "Id", "ict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qid_", "=_", "question", "Ids_", "[_", "n_", "]_", "if_", "question", "Ids_", "is_", "not_", "None_", "else_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "Answer", "s_", ",_", "top", "Answer", "Scores_", "=_", "pick", "Top", "Answer", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "K_", "=_", "top", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Output", "s_", "=_", "model", "Output", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "Ids_", "=_", "question", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "render", "Sing", "le", "Item_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "Filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans", "Id", "ict_", "[_", "target", "Data_", "[_", "n_", ",_", "0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "s_", "=_", "top", "Answer", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Answer", "Scores_", "=_", "top", "Answer", "Scores_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Names_", "=_", "model", "Names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "mod_", "(_", "n_", ",_", "img", "Per", "Row_", ")_", "==_", "img", "Per", "Row_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html", "List_", "._", "append_", "(_", "'<", "/", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "/", "table", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "render", "Menu_", "(_", "i", "Page_", ",_", "num", "Pages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "List_", "._", "append_", "(_", "'<", "/", "body", "><", "/", "html", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "html", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Im", "g", "Dict", "Coc", "oq", "a_", "(_", "img", "id", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "json", "Train", "Filename_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption", "txt_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "caption_", "=_", "json_", "._", "loads_", "(_", "caption", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "caption_", "[_", "'", "images", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "Dict_", "[_", "item_", "[_", "'", "id", "'_", "]_", "]_", "=_", "item_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "json", "Valid", "Filename_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption", "txt_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "caption_", "=_", "json_", "._", "loads_", "(_", "caption", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "caption_", "[_", "'", "images", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "Dict_", "[_", "item_", "[_", "'", "id", "'_", "]_", "]_", "=_", "item_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url", "List_", "=_", "[_", "None_", "]_", "*_", "len_", "(_", "img", "id", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "key_", "in_", "enumerate_", "(_", "img", "id", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "List_", "[_", "i_", "]_", "=_", "url", "Dict_", "[_", "int_", "(_", "key_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "url", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Im", "g", "Dict", "Da", "quar", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "145", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "List_", "._", "append_", "(_", "da", "quar", "Image", "Folder_", "+_", "'", "image", "%", "d", ".", "jp", "g", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "url", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Im", "g", "Url_", "(_", "dataset_", ",_", "data", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Load", "ing", " ", "image", " ", "urls", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset_", "==_", "'", "coco", "qa", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "id", "Dict", "Filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "data", "Folder_", ",_", "'", "img", "id", "\\u", "dict", ".", "pkl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "img", "id", "Dict", "Filename_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "id", "Dict_", "=_", "pkl", "_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url", "Dict_", "=_", "read", "Im", "g", "Dict", "Coc", "oq", "a_", "(_", "img", "id", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dataset_", "==_", "'", "da", "quar", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "Dict_", "=_", "read", "Im", "g", "Dict", "Da", "quar", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "url", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Im", "g", "Path_", "(_", "dataset_", ",_", "data", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Load", "ing", " ", "image", " ", "path", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coco", "Im", "g", "Id", "Regex_", "=_", "'", "CO", "CO", "\\u(", "(", "train", ")|(", "val", "))", "2014", "\\u", "0", "*(", "?", "P", "<", "img", "id", ">[", "1", "-", "9", "][", "0", "-", "9", "]*)", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset_", "==_", "'", "coco", "qa", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "id", "Dict", "Filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "data", "Folder_", ",_", "'", "img", "id", "\\u", "dict", ".", "pkl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "img", "id", "Dict", "Filename_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img", "id", "Dict_", "=_", "pkl", "_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path", "List_", "=_", "[_", "None_", "]_", "*_", "len_", "(_", "img", "id", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "'/", "u", "/", "mre", "n", "/", "data", "/", "msc", "oco", "/", "train", "/", "image", "\\u", "list", ".", "txt", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "List_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "'/", "u", "/", "mre", "n", "/", "data", "/", "msc", "oco", "/", "valid", "/", "image", "\\u", "list", ".", "txt", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "List_", "._", "extend_", "(_", "f_", "._", "readlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "img", "Path_", "in_", "image", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "coco", "Im", "g", "Id", "Regex_", ",_", "img", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "id_", "=_", "match_", "._", "group_", "(_", "'", "img", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "Dict_", "[_", "img", "id_", "]_", "=_", "img", "Path_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "key_", "in_", "enumerate_", "(_", "img", "id", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "List_", "[_", "i_", "]_", "=_", "path", "Dict_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dataset_", "==_", "'", "da", "quar", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "145", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "List_", "._", "append_", "(_", "'/", "u", "/", "mre", "n", "/", "data", "/", "ny", "u", "-", "depth", "/", "jp", "g", "/", "image", "%", "d", ".", "jp", "g", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Un", "know", "n", " ", "dataset", ":", " ", "'_", "+_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "escape", "Latex", "Id", "ict_", "(_", "idi", "ct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "idi", "ct_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'\\u'_", "in_", "idi", "ct_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idi", "ct_", "[_", "i_", "]_", "=_", "idi", "ct_", "[_", "i_", "]_", "._", "replace_", "(_", "'\\u'_", ",_", "'\\\\\\\\", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "idi", "ct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Compara", "tiv", "e", "Params_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "parameter", " ", "list", " ", "for", " ", "render", "ing", " ", "compara", "tiv", "e", " ", "results", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", ":", "\\", "10", ";", " ", " ", " ", " ", "-", "m", "[", "odel", "]", " ", "{", "name", "1", ":", "model", "Id", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "m", "[", "odel", "]", " ", "{", "name2", ":", "model", "Id", "2", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "em", "[", "odel", "]", " ", "{", "name", "3", ":", "ensembl", "e", "Model", "Id", "3", ",", "ensembl", "e", "Model", "Id", "4", ",...", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "pe", "m", "[", "odel", "]", " ", "{", "name", "4", ":", "ensembl", "e", "Model", "Id", "5", ",", "ensembl", "e", "Model", "Id", "6", ",...", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "ae", "m", "[", "odel", "]", " ", "{", "name", "4", ":", "ensembl", "e", "Model", "Id", "7", ",", "ensembl", "e", "Model", "Id", "8", ",...", "}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "-", "d", "[", "ata", "]", " ", "{", "data", "Fold", "er", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "i", "[", "nput", "]", " ", "{", "list", "File", "}", "\\", "10", ";", " ", " ", " ", " ", "-", "o", "[", "ut", "put", "]", " ", "{", "output", "Fold", "er", "}", "\\", "10", ";", " ", " ", " ", " ", "[-", "k", " ", "{", "top", " ", "K", " ", "answer", "s", "}]", "\\", "10", ";", " ", " ", " ", " ", "[-", "p", "[", "ict", "ure", "]", " ", "{", "pic", "ture", "Fold", "er", "}]", "\\", "10", ";", " ", " ", " ", " ", "[-", "r", "[", "esult", "s", "]", " ", "{", "results", "Fold", "er", "}]", "\\", "10", ";", " ", " ", " ", " ", "[-", "f", "[", "ile", "]", " ", "{", "output", "File", "name", "}]", "\\", "10", ";", " ", " ", " ", " ", "[-", "dataset", " ", "{", "da", "quar", "/", "coco", "qa", "}]", "\\", "10", ";", " ", " ", " ", " ", "[-", "format", " ", "{", "html", "/", "late", "x", "}]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", "m", "[", "odel", "]:", " ", "Normal", " ", "model", "s", "\\", "10", ";", " ", " ", " ", " ", "-", "em", "[", "odel", "]:", " ", "Class", "-", "specific", "-", "ensembl", "e", " ", "model", "s", "\\", "10", ";", " ", " ", " ", " ", "-", "pe", "m", "[", "odel", "]:", " ", "Class", "-", "specific", "-", "ensembl", "e", " ", "+", " ", "prior", " ", "model", "s", "\\", "10", ";", " ", " ", " ", " ", "-", "ae", "m", "[", "odel", "]:", " ", "Ensemble", " ", "averag", "e", " ", "of", " ", "regular", " ", "model", "s", "\\", "10", ";", " ", " ", " ", " ", "-", "d", "[", "ata", "]:", " ", "Data", " ", "folder", "\\", "10", ";", " ", " ", " ", " ", "-", "i", "[", "nput", "]:", " ", "Task", "-", "specific", " ", "input", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "-", "o", "[", "ut", "put", "]:", " ", "Output", " ", "folder", "\\", "10", ";", " ", " ", " ", " ", "-", "k", ":", " ", "Top", " ", "K", " ", "answer", "s", ",", " ", "default", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "-", "p", "[", "ict", "ure", "]:", " ", "Picture", " ", "folder", " ", "name", ",", " ", "default", " ", "\"", "img", "\"", "\\", "10", ";", " ", " ", " ", " ", "-", "r", "[", "esult", "s", "]:", " ", "Result", "s", " ", "folder", ",", " ", "default", " ", "\"..", "/", "results", "\"", "\\", "10", ";", " ", " ", " ", " ", "-", "f", "[", "ile", "]:", " ", "Output", " ", "Te", "X", " ", "file", " ", "name", ",", " ", "default", " ", "\"", "result", "\"", "\\", "10", ";", " ", " ", " ", " ", "-", "dataset", ":", " ", "da", "quar", "/", "coco", "qa", " ", "dataset", ",", " ", "default", " ", "\"", "coco", "qa", "\"", "\\", "10", ";", " ", " ", " ", " ", "-", "format", ":", " ", "Output", " ", "format", ",", " ", "default", " ", "\"", "html", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "with", " ", "follow", "ing", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", " ", "model", "s", ":", " ", "List", " ", "of", " ", "dictionar", "ies", ",", " ", "with", " ", "follow", "ing", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", " ", "model", "Name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "is", "Class", "Ensemble", ":", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "run", "Prior", ":", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "data", "Fold", "er", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "input", "File", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "output", "Fold", "er", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "top", "K", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "pic", "ture", "Fold", "er", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "output", "File", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "dataset", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset_", "=_", "'", "coco", "qa", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'", "result", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pic", "ture", "Folder_", "=_", "'", "img", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "Folder_", "=_", "'../", "results", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "File_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "flag_", "in_", "enumerate_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "flag_", "==_", "'-", "m", "'_", "or_", "flag_", "==_", "'-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "parts_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "parts_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Class", "Ensemble", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Average", "Ensemble", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "Prior", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "em", "'_", "or_", "flag_", "==_", "'-", "emo", "del", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "parts_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "parts_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Class", "Ensemble", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Average", "Ensemble", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "Prior", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "pe", "m", "'_", "or_", "flag_", "==_", "'-", "pe", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "parts_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "parts_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Class", "Ensemble", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Average", "Ensemble", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "Prior", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "ae", "m", "'_", "or_", "flag_", "==_", "'-", "ae", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "parts_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "parts_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Class", "Ensemble", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Average", "Ensemble", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "Prior", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "d", "'_", "or_", "flag_", "==_", "'-", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Folder_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "i", "'_", "or_", "flag_", "==_", "'-", "input", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "File_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "k", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "K_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "p", "'_", "or_", "flag_", "==_", "'-", "pic", "ture", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pic", "ture", "Folder_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "o", "'_", "or_", "flag_", "==_", "'-", "output", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "Folder_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "r", "'_", "or_", "flag_", "==_", "'-", "results", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results", "Folder_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "f", "'_", "or_", "flag_", "==_", "'-", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "dataset", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flag_", "==_", "'-", "format", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "s", "'_", ":_", "models_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "Fold", "er", "'_", ":_", "data", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "input", "File", "'_", ":_", "input", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "Fold", "er", "'_", ":_", "output", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "results", "Fold", "er", "'_", ":_", "results", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "top", "K", "'_", ":_", "K_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pic", "ture", "Fold", "er", "'_", ":_", "pic", "ture", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "File", "name", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dataset", "'_", ":_", "dataset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "format_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Model", "Names_", "(_", "model", "Specs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "spec_", "in_", "model", "Specs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Names_", "._", "append_", "(_", "spec_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "model", "Names_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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ikit-learn/scikit-learn/sklearn/model_selection/_split.py
[ { "content": "class BaseCrossValidator(with_metaclass(ABCMeta)):\n \"\"\"Base class for all cross-validators\n\n Implementations must define `_iter_test_masks` or `_iter_test_indices`.\n \"\"\"\n\n\n\n # Since subclasses must implement either _iter_test_masks or\n # _iter_test_indices, neither can be abstract.\n\n\n", "metadata": "root.BaseCrossValidator", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def __init__(self):\n # We need this for the build_repr to work properly in py2.7\n # see #6304\n pass", "metadata": "root.BaseCrossValidator.__init__", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 58 }, { "content": " def split(self, X, y=None, labels=None):\n \"\"\"Generate indices to split data into training and test set.\n\n Parameters\n ----------\n X : array-like, shape (n_samples, n_features)\n Training data, where n_samples is the number of samples\n and n_features is the number of features.\n\n y : array-like, of length n_samples\n The target variable for supervised learning problems.\n\n labels : array-like, with shape (n_samples,), optional\n Group labels for the samples used while splitting the dataset into\n train/test set.\n\n Returns\n -------\n train : ndarray\n The training set indices for that split.\n\n test : ndarray\n The testing set indices for that split.\n \"\"\"\n X, y, labels = indexable(X, y, labels)\n indices = np.arange(_num_samples(X))\n for test_index in self._iter_test_masks(X, y, labels):\n train_index = indices[np.logical_not(test_index)]\n test_index = indices[test_index]\n yield train_index, test_index", "metadata": "root.BaseCrossValidator.split", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 63 }, { "content": " def _iter_test_masks(self, X=None, y=None, labels=None):\n \"\"\"Generates boolean masks corresponding to test sets.\n\n By default, delegates to _iter_test_indices(X, y, labels)\n \"\"\"\n for test_index in self._iter_test_indices(X, y, labels):\n test_mask = np.zeros(_num_samples(X), dtype=np.bool)\n test_mask[test_index] = True\n yield test_mask", "metadata": "root.BaseCrossValidator._iter_test_masks", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 96 }, { "content": " def _iter_test_indices(self, X=None, y=None, labels=None):\n \"\"\"Generates integer indices corresponding to test sets.\"\"\"\n raise NotImplementedError", "metadata": "root.BaseCrossValidator._iter_test_indices", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 106 }, { "content": " @abstractmethod\n def get_n_splits(self, X=None, y=None, labels=None):\n \"\"\"Returns the number of splitting iterations in the cross-validator\"\"\"", "metadata": "root.BaseCrossValidator.get_n_splits", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 110 }, { "content": " def __repr__(self):\n return _build_repr(self)", "metadata": "root.BaseCrossValidator.__repr__", "header": "['class', 'BaseCrossValidator', '(', 'with_metaclass', '(', 'ABCMeta', ')', ')', ':', '___EOS___']", "index": 114 }, { "content": "class LeavePLabelOut(BaseCrossValidator):\n \"\"\"Leave P Labels Out cross-validator\n\n Provides train/test indices to split data according to a third-party\n provided label. This label information can be used to encode arbitrary\n domain specific stratifications of the samples as integers.\n\n For instance the labels could be the year of collection of the samples\n and thus allow for cross-validation against time-based splits.\n\n The difference between LeavePLabelOut and LeaveOneLabelOut is that\n the former builds the test sets with all the samples assigned to\n ``p`` different values of the labels while the latter uses samples\n all assigned the same labels.\n\n Read more in the :ref:`User Guide <cross_validation>`.\n\n Parameters\n ----------\n n_labels : int\n Number of labels (``p``) to leave out in the test split.\n\n Examples\n --------\n >>> from sklearn.model_selection import LeavePLabelOut\n >>> X = np.array([[1, 2], [3, 4], [5, 6]])\n >>> y = np.array([1, 2, 1])\n >>> labels = np.array([1, 2, 3])\n >>> lpl = LeavePLabelOut(n_labels=2)\n >>> lpl.get_n_splits(X, y, labels)\n 3\n >>> print(lpl)\n LeavePLabelOut(n_labels=2)\n >>> for train_index, test_index in lpl.split(X, y, labels):\n ... print(\"TRAIN:\", train_index, \"TEST:\", test_index)\n ... X_train, X_test = X[train_index], X[test_index]\n ... y_train, y_test = y[train_index], y[test_index]\n ... print(X_train, X_test, y_train, y_test)\n TRAIN: [2] TEST: [0 1]\n [[5 6]] [[1 2]\n [3 4]] [1] [1 2]\n TRAIN: [1] TEST: [0 2]\n [[3 4]] [[1 2]\n [5 6]] [2] [1 1]\n TRAIN: [0] TEST: [1 2]\n [[1 2]] [[3 4]\n [5 6]] [1] [2 1]\n\n See also\n --------\n LabelKFold: K-fold iterator variant with non-overlapping labels.\n \"\"\"\n\n\n", "metadata": "root.LeavePLabelOut", "header": "['module', '___EOS___']", "index": 710 }, { "content": " def __init__(self, n_labels):\n self.n_labels = n_labels", "metadata": "root.LeavePLabelOut.__init__", "header": "['class', 'LeavePLabelOut', '(', 'BaseCrossValidator', ')', ':', '___EOS___']", "index": 763 }, { "content": " def _iter_test_masks(self, X, y, labels):\n if labels is None:\n raise ValueError(\"The labels parameter should not be None\")\n labels = np.array(labels, copy=True)\n unique_labels = np.unique(labels)\n combi = combinations(range(len(unique_labels)), self.n_labels)\n for indices in combi:\n test_index = np.zeros(_num_samples(X), dtype=np.bool)\n for l in unique_labels[np.array(indices)]:\n test_index[labels == l] = True\n yield test_index", "metadata": "root.LeavePLabelOut._iter_test_masks", "header": "['class', 'LeavePLabelOut', '(', 'BaseCrossValidator', ')', ':', '___EOS___']", "index": 766 }, { "content": " def get_n_splits(self, X, y, labels):\n \"\"\"Returns the number of splitting iterations in the cross-validator\n\n Parameters\n ----------\n X : object\n Always ignored, exists for compatibility.\n\n y : object\n Always ignored, exists for compatibility.\n\n labels : array-like, with shape (n_samples,), optional\n Group labels for the samples used while splitting the dataset into\n train/test set.\n\n Returns\n -------\n n_splits : int\n Returns the number of splitting iterations in the cross-validator.\n \"\"\"\n if labels is None:\n raise ValueError(\"The labels parameter should not be None\")\n return int(comb(len(np.unique(labels)), self.n_labels, exact=True))", "metadata": "root.LeavePLabelOut.get_n_splits", "header": "['class', 'LeavePLabelOut', '(', 'BaseCrossValidator', ')', ':', '___EOS___']", "index": 778 } ]
[]
[]
0
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "all", " ", "cross", "-", "validator", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Implementation", "s", " ", "must", " ", "defin", "e", " ", "`\\u", "iter", "\\u", "test\\u", "mask", "s", "`", " ", "or", " ", "`\\u", "iter", "\\u", "test\\u", "indice", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "subclasses", " ", "must", " ", "implement", " ", "eit", "her", " ", "\\u", "iter", "\\u", "test\\u", "mask", "s", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "iter", "\\u", "test\\u", "indice", "s", ",", " ", "nei", "ther", " ", "can", " ", "be", " ", "abstract", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\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_", "#", " ", "We", " ", "need", " ", "this", " ", "for", " ", "the", " ", "build", "\\u", "repr", " ", "to", " ", "work", " ", "proper", "ly", " ", "in", " ", "py2", ".7_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "#", "630", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "split_", "(_", "self_", ",_", "X_", ",_", "y_", "=_", "None_", ",_", "labels_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "indice", "s", " ", "to", " ", "split", " ", "data", " ", "int", "o", " ", "train", "ing", " ", "and", " ", "test", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "X", " ", ":", " ", "array", "-", "like", ",", " ", "shape", " ", "(", "n", "\\u", "samples", ",", " ", "n", "\\u", "features", ")", "\\", "10", ";", " ", " ", " ", " ", "Train", "ing", " ", "data", ",", " ", "where", " ", "n", "\\u", "samples", " ", "is", " ", "the", " ", "number", " ", "of", " ", "samples", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "n", "\\u", "features", " ", "is", " ", "the", " ", "number", " ", "of", " ", "features", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "y", " ", ":", " ", "array", "-", "like", ",", " ", "of", " ", "length", " ", "n", "\\u", "samples", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "target", " ", "variab", "le", " ", "for", " ", "supervis", "ed", " ", "learn", "ing", " ", "problem", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "labels", " ", ":", " ", "array", "-", "like", ",", " ", "with", " ", "shape", " ", "(", "n", "\\u", "samples", ",)", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Group", " ", "labels", " ", "for", " ", "the", " ", "samples", " ", "used", " ", "whi", "le", " ", "splitting", " ", "the", " ", "dataset", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "train", "/", "test", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "train", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "train", "ing", " ", "set", " ", "indice", "s", " ", "for", " ", "tha", "t", " ", "split", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "test", " ", ":", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "testi", "ng", " ", "set", " ", "indice", "s", " ", "for", " ", "tha", "t", " ", "split", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "y_", ",_", "labels_", "=_", "index", "able_", "(_", "X_", ",_", "y_", ",_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "=_", "np_", "._", "arange_", "(_", "\\u", "num", "\\u", "samples_", "(_", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "test\\u", "index_", "in_", "self_", "._", "\\u", "iter", "\\u", "test\\u", "masks_", "(_", "X_", ",_", "y_", ",_", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "\\u", "index_", "=_", "indices_", "[_", "np_", "._", "logical", "\\u", "not_", "(_", "test\\u", "index_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "index_", "=_", "indices_", "[_", "test\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "train", "\\u", "index_", ",_", "test\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\u\\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", "iter", "\\u", "test\\u", "masks_", "(_", "self_", ",_", "X_", "=_", "None_", ",_", "y_", "=_", "None_", ",_", "labels_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", "s", " ", "boolean", " ", "mask", "s", " ", "correspond", "ing", " ", "to", " ", "test", " ", "sets", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "delegate", "s", " ", "to", " ", "\\u", "iter", "\\u", "test\\u", "indice", "s", "(", "X", ",", " ", "y", ",", " ", "labels", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "test\\u", "index_", "in_", "self_", "._", "\\u", "iter", "\\u", "test\\u", "indices_", "(_", "X_", ",_", "y_", ",_", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "mask_", "=_", "np_", "._", "zeros_", "(_", "\\u", "num", "\\u", "samples_", "(_", "X_", ")_", ",_", "dtype_", "=_", "np_", "._", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "mask_", "[_", "test\\u", "index_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "test\\u", "mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\u\\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", "iter", "\\u", "test\\u", "indices_", "(_", "self_", ",_", "X_", "=_", "None_", ",_", "y_", "=_", "None_", ",_", "labels_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", "s", " ", "integ", "er", " ", "indice", "s", " ", "correspond", "ing", " ", "to", " ", "test", " ", "sets", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "n", "\\u", "splits_", "(_", "self_", ",_", "X_", "=_", "None_", ",_", "y_", "=_", "None_", ",_", "labels_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "splitting", " ", "iterati", "ons", " ", "in", " ", "the", " ", "cross", "-", "validator", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Cross", "Validator_", "(_", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ")_", ")_", ":_", "\\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_", "\\u", "build", "\\u", "repr_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Leav", "e", "PL", "abel", "Out_", "(_", "Base", "Cross", "Validator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Leav", "e", " ", "P", " ", "Label", "s", " ", "Out", " ", "cross", "-", "validator", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Prov", "ides", " ", "train", "/", "test", " ", "indice", "s", " ", "to", " ", "split", " ", "data", " ", "according", " ", "to", " ", "a", " ", "third", "-", "part", "y", "\\", "10", ";", " ", " ", " ", " ", "provided", " ", "label", ".", " ", "Thi", "s", " ", "label", " ", "informati", "on", " ", "can", " ", "be", " ", "used", " ", "to", " ", "encode", " ", "arbitra", "ry", "\\", "10", ";", " ", " ", " ", " ", "domain", " ", "specific", " ", "strat", "ificatio", "ns", " ", "of", " ", "the", " ", "samples", " ", "as", " ", "integ", "ers", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "instance", " ", "the", " ", "labels", " ", "coul", "d", " ", "be", " ", "the", " ", "year", " ", "of", " ", "collection", " ", "of", " ", "the", " ", "samples", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "thu", "s", " ", "allow", " ", "for", " ", "cross", "-", "validation", " ", "against", " ", "time", "-", "based", " ", "split", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "difference", " ", "bet", "ween", " ", "Leav", "e", "PL", "abel", "Out", " ", "and", " ", "Leav", "e", "One", "Label", "Out", " ", "is", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "former", " ", "builds", " ", "the", " ", "test", " ", "sets", " ", "with", " ", "all", " ", "the", " ", "samples", " ", "assign", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "``", " ", "different", " ", "values", " ", "of", " ", "the", " ", "labels", " ", "whi", "le", " ", "the", " ", "latt", "er", " ", "use", "s", " ", "samples", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "assign", "ed", " ", "the", " ", "same", " ", "labels", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "more", " ", "in", " ", "the", " ", ":", "ref", ":`", "User", " ", "Guide", " ", "<", "cross", "\\u", "validation", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "n", "\\u", "labels", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Number", " ", "of", " ", "labels", " ", "(", "``", "p", "``)", " ", "to", " ", "lea", "ve", " ", "out", " ", "in", " ", "the", " ", "test", " ", "split", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "skl", "earn", ".", "model", "\\u", "selection", " ", "import", " ", "Leav", "e", "PL", "abel", "Out", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "X", " ", "=", " ", "np", ".", "array", "([", "[", "1", ",", " ", "2", "],", " ", "[", "3", ",", " ", "4", "],", " ", "[", "5", ",", " ", "6", "]])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "np", ".", "array", "([", "1", ",", " ", "2", ",", " ", "1", "])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "labels", " ", "=", " ", "np", ".", "array", "([", "1", ",", " ", "2", ",", " ", "3", "])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lp", "l", " ", "=", " ", "Leav", "e", "PL", "abel", "Out", "(", "n", "\\u", "labels", "=", "2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lp", "l", ".", "get", "\\u", "n", "\\u", "split", "s", "(", "X", ",", " ", "y", ",", " ", "labels", ")", "\\", "10", ";", " ", " ", " ", " ", "3", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "lp", "l", ")", "\\", "10", ";", " ", " ", " ", " ", "Leav", "e", "PL", "abel", "Out", "(", "n", "\\u", "labels", "=", "2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "train", "\\u", "index", ",", " ", "test\\u", "index", " ", "in", " ", "lp", "l", ".", "split", "(", "X", ",", " ", "y", ",", " ", "labels", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "print", "(\"", "TRAIN", ":\"", ",", " ", "train", "\\u", "index", ",", " ", "\"", "TEST", ":\"", ",", " ", "test\\u", "index", ")", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "X", "\\u", "train", ",", " ", "X", "\\u", "test", " ", "=", " ", "X", "[", "train", "\\u", "index", "],", " ", "X", "[", "test\\u", "index", "]", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "y", "\\u", "train", ",", " ", "y", "\\u", "test", " ", "=", " ", "y", "[", "train", "\\u", "index", "],", " ", "y", "[", "test\\u", "index", "]", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "print", "(", "X", "\\u", "train", ",", " ", "X", "\\u", "test", ",", " ", "y", "\\u", "train", ",", " ", "y", "\\u", "test", ")", "\\", "10", ";", " ", " ", " ", " ", "TRAIN", ":", " ", "[", "2", "]", " ", "TEST", ":", " ", "[", "0", " ", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "[[", "5", " ", "6", "]]", " ", "[[", "1", " ", "2", "]", "\\", "10", ";", " ", "[", "3", " ", "4", "]]", " ", "[", "1", "]", " ", "[", "1", " ", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "TRAIN", ":", " ", "[", "1", "]", " ", "TEST", ":", " ", "[", "0", " ", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "[[", "3", " ", "4", "]]", " ", "[[", "1", " ", "2", "]", "\\", "10", ";", " ", "[", "5", " ", "6", "]]", " ", "[", "2", "]", " ", "[", "1", " ", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "TRAIN", ":", " ", "[", "0", "]", " ", "TEST", ":", " ", "[", "1", " ", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "[[", "1", " ", "2", "]]", " ", "[[", "3", " ", "4", "]", "\\", "10", ";", " ", "[", "5", " ", "6", "]]", " ", "[", "1", "]", " ", "[", "2", " ", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "Label", "KF", "old", ":", " ", "K", "-", "fold", " ", "iter", "ator", " ", "variant", " ", "with", " ", "non", "-", "overlapping", " ", "labels", ".", "\\", "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_", "Leav", "e", "PL", "abel", "Out_", "(_", "Base", "Cross", "Validator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "n", "\\u", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "n", "\\u", "labels_", "=_", "n", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Leav", "e", "PL", "abel", "Out_", "(_", "Base", "Cross", "Validator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "iter", "\\u", "test\\u", "masks_", "(_", "self_", ",_", "X_", ",_", "y_", ",_", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "labels_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "labels", " ", "parameter", " ", "shou", "ld", " ", "not", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labels_", "=_", "np_", "._", "array_", "(_", "labels_", ",_", "copy_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "\\u", "labels_", "=_", "np_", "._", "unique_", "(_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comb", "i_", "=_", "combinations_", "(_", "range_", "(_", "len_", "(_", "unique", "\\u", "labels_", ")_", ")_", ",_", "self_", "._", "n", "\\u", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "indices_", "in_", "comb", "i_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "index_", "=_", "np_", "._", "zeros_", "(_", "\\u", "num", "\\u", "samples_", "(_", "X_", ")_", ",_", "dtype_", "=_", "np_", "._", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "unique", "\\u", "labels_", "[_", "np_", "._", "array_", "(_", "indices_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "index_", "[_", "labels_", "==_", "l_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "test\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Leav", "e", "PL", "abel", "Out_", "(_", "Base", "Cross", "Validator_", ")_", ":_", "\\u\\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", "n", "\\u", "splits_", "(_", "self_", ",_", "X_", ",_", "y_", ",_", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "splitting", " ", "iterati", "ons", " ", "in", " ", "the", " ", "cross", "-", "validator", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "X", " ", ":", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Al", "way", "s", " ", "ignore", "d", ",", " ", "exist", "s", " ", "for", " ", "compatibility", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "y", " ", ":", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Al", "way", "s", " ", "ignore", "d", ",", " ", "exist", "s", " ", "for", " ", "compatibility", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "labels", " ", ":", " ", "array", "-", "like", ",", " ", "with", " ", "shape", " ", "(", "n", "\\u", "samples", ",)", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Group", " ", "labels", " ", "for", " ", "the", " ", "samples", " ", "used", " ", "whi", "le", " ", "splitting", " ", "the", " ", "dataset", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "train", "/", "test", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "n", "\\u", "split", "s", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "splitting", " ", "iterati", "ons", " ", "in", " ", "the", " ", "cross", "-", "validator", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "labels_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "labels", " ", "parameter", " ", "shou", "ld", " ", "not", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "int_", "(_", "comb_", "(_", "len_", "(_", "np_", "._", "unique_", "(_", "labels_", ")_", ")_", ",_", "self_", "._", "n", "\\u", "labels_", ",_", "exact_", "=_", "True_", ")_", ")_", "\\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,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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 ]
Except block handles 'BaseException'
weblabdeusto/weblabdeusto/server/src/test/unit/weblab/core/coordinator/test_meta_scheduler.py
[ { "content": " def _test_schedulers(self, best, all_status):\n best_reservation_status = sorted(all_status)[0]\n\n try:\n best[0]\n except TypeError:\n self.assertEquals(best, best_reservation_status)\n else:\n self.assertTrue(best_reservation_status in best)", "metadata": "root.MetaSchedulerTestCase._test_schedulers", "header": "['class', 'MetaSchedulerTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Meta", "Schedule", "r", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "schedule", "rs_", "(_", "self_", ",_", "best_", ",_", "all", "\\u", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "reserva", "tion", "\\u", "status_", "=_", "sorted_", "(_", "all", "\\u", "status_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "best_", ",_", "best", "\\u", "reserva", "tion", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "best", "\\u", "reserva", "tion", "\\u", "status_", "in_", "best_", ")_", "\\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 ]
Except block handles 'BaseException'
bretth/django-pq/test_pq/test_worker.py
[ { "content": " def tearDown(self):\n try:\n os.unlink(self.sentinel_file)\n except OSError as e:\n if e.errno == 2:\n pass", "metadata": "root.TestWorkerTimeouts.tearDown", "header": "['class', 'TestWorkerTimeouts', '(', 'TransactionTestCase', ')', ':', '___EOS___']", "index": 177 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Worke", "r", "Time", "outs_", "(_", "Transa", "ction", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "unlink_", "(_", "self_", "._", "sentinel", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/utils.py
[ { "content": "# Copyright 2011 OpenStack Foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport errno\nimport platform\nimport socket\nimport sys\n\nfrom oslo_config import cfg\nfrom six.moves import range\n\nfrom nova.compute import flavors\nimport nova.context\nimport nova.db\nfrom nova import exception\nfrom nova.image import glance\nfrom nova.network import minidns\nfrom nova.network import model as network_model\nfrom nova import objects\nimport nova.utils\n\nCONF = cfg.CONF\nCONF.import_opt('use_ipv6', 'nova.netconf')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ntest_dns_managers = []\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_test_admin_context():\n return nova.context.get_admin_context()", "metadata": "root.get_test_admin_context", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def get_test_image_object(context, instance_ref):\n if not context:\n context = get_test_admin_context()\n\n image_ref = instance_ref['image_ref']\n image_service, image_id = glance.get_remote_image_service(context,\n image_ref)\n return objects.ImageMeta.from_dict(\n image_service.show(context, image_id))", "metadata": "root.get_test_image_object", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def get_test_flavor(context=None, options=None):\n options = options or {}\n if not context:\n context = get_test_admin_context()\n\n test_flavor = {'name': 'kinda.big',\n 'flavorid': 'someid',\n 'memory_mb': 2048,\n 'vcpus': 4,\n 'root_gb': 40,\n 'ephemeral_gb': 80,\n 'swap': 1024}\n\n test_flavor.update(options)\n\n try:\n flavor_ref = nova.db.flavor_create(context, test_flavor)\n except (exception.FlavorExists, exception.FlavorIdExists):\n flavor_ref = nova.db.flavor_get_by_name(context, 'kinda.big')\n return flavor_ref", "metadata": "root.get_test_flavor", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def get_test_instance(context=None, flavor=None, obj=False):\n if not context:\n context = get_test_admin_context()\n\n if not flavor:\n flavor = get_test_flavor(context)\n\n test_instance = {'memory_kb': '2048000',\n 'basepath': '/some/path',\n 'bridge_name': 'br100',\n 'vcpus': 4,\n 'root_gb': 40,\n 'bridge': 'br101',\n 'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175',\n 'instance_type_id': flavor['id'],\n 'system_metadata': {},\n 'extra_specs': {},\n 'user_id': context.user_id,\n 'project_id': context.project_id,\n }\n\n if obj:\n instance = objects.Instance(context, **test_instance)\n instance.flavor = objects.Flavor.get_by_id(context, flavor['id'])\n instance.create()\n else:\n flavors.save_flavor_info(test_instance['system_metadata'], flavor, '')\n instance = nova.db.instance_create(context, test_instance)\n return instance", "metadata": "root.get_test_instance", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def get_test_network_info(count=1):\n ipv6 = CONF.use_ipv6\n fake = 'fake'\n fake_ip = '0.0.0.0'\n fake_vlan = 100\n fake_bridge_interface = 'eth0'\n\n def current():\n subnet_4 = network_model.Subnet(cidr=fake_ip,\n dns=[network_model.IP(fake_ip),\n network_model.IP(fake_ip)],\n gateway=network_model.IP(fake_ip),\n ips=[network_model.IP(fake_ip),\n network_model.IP(fake_ip)],\n routes=None,\n dhcp_server=fake_ip)\n subnet_6 = network_model.Subnet(cidr=fake_ip,\n gateway=network_model.IP(fake_ip),\n ips=[network_model.IP(fake_ip),\n network_model.IP(fake_ip),\n network_model.IP(fake_ip)],\n routes=None,\n version=6)\n subnets = [subnet_4]\n if ipv6:\n subnets.append(subnet_6)\n network = network_model.Network(id=None,\n bridge=fake,\n label=None,\n subnets=subnets,\n vlan=fake_vlan,\n bridge_interface=fake_bridge_interface,\n injected=False)\n vif = network_model.VIF(id='vif-xxx-yyy-zzz',\n address=fake,\n network=network,\n type=network_model.VIF_TYPE_BRIDGE,\n devname=None,\n ovs_interfaceid=None)\n\n return vif\n\n return network_model.NetworkInfo([current() for x in range(0, count)])", "metadata": "root.get_test_network_info", "header": "['module', '___EOS___']", "index": 104 }, { "content": "def is_osx():\n return platform.mac_ver()[0] != ''", "metadata": "root.is_osx", "header": "['module', '___EOS___']", "index": 149 }, { "content": "def is_linux():\n return platform.system() == 'Linux'", "metadata": "root.is_linux", "header": "['module', '___EOS___']", "index": 153 }, { "content": "def coreutils_readlink_available():\n _out, err = nova.utils.trycmd('readlink', '-nm', '/')\n return err == ''", "metadata": "root.coreutils_readlink_available", "header": "['module', '___EOS___']", "index": 157 }, { "content": "def dns_manager():\n global test_dns_managers\n manager = minidns.MiniDNS()\n test_dns_managers.append(manager)\n return manager", "metadata": "root.dns_manager", "header": "['module', '___EOS___']", "index": 165 }, { "content": "def cleanup_dns_managers():\n global test_dns_managers\n for manager in test_dns_managers:\n manager.delete_dns_file()\n test_dns_managers = []", "metadata": "root.cleanup_dns_managers", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def killer_xml_body():\n return ((\"\"\"<!DOCTYPE x [\n <!ENTITY a \"%(a)s\">\n <!ENTITY b \"%(b)s\">\n <!ENTITY c \"%(c)s\">]>\n <foo>\n <bar>\n <v1>%(d)s</v1>\n </bar>\n </foo>\"\"\") % {\n 'a': 'A' * 10,\n 'b': '&a;' * 10,\n 'c': '&b;' * 10,\n 'd': '&c;' * 9999,\n }).strip()", "metadata": "root.killer_xml_body", "header": "['module', '___EOS___']", "index": 179 }, { "content": "def is_ipv6_supported():\n has_ipv6_support = socket.has_ipv6\n try:\n s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)\n s.close()\n except socket.error as e:\n if e.errno == errno.EAFNOSUPPORT:\n has_ipv6_support = False\n else:\n raise\n\n # check if there is at least one interface with ipv6\n if has_ipv6_support and sys.platform.startswith('linux'):\n try:\n with open('/proc/net/if_inet6') as f:\n if not f.read():\n has_ipv6_support = False\n except IOError:\n has_ipv6_support = False\n\n return has_ipv6_support", "metadata": "root.is_ipv6_supported", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def get_api_version(request):\n if request.path[2:3].isdigit():\n return int(request.path[2:3])", "metadata": "root.get_api_version", "header": "['module', '___EOS___']", "index": 219 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", " ", "Copy", "right", " ", "2011", " ", "Open", "Stack", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "flavors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "image_", "import_", "glance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "network_", "import_", "mini", "dns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "network_", "import_", "model_", "as_", "network", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "cfg_", "._", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "._", "import", "\\u", "opt_", "(_", "'", "use", "\\u", "ipv", "6", "'_", ",_", "'", "nova", ".", "netconf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "dns", "\\u", "managers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "test\\u", "admin", "\\u", "context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "nova_", "._", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "test\\u", "image", "\\u", "object_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "get", "\\u", "test\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "\\u", "ref_", "=_", "instance", "\\u", "ref_", "[_", "'", "image", "\\u", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "service_", ",_", "image", "\\u", "id_", "=_", "glance_", "._", "get", "\\u", "remote", "\\u", "image", "\\u", "service_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "objects_", "._", "Image", "Meta_", "._", "from", "\\u", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "service_", "._", "show_", "(_", "context_", ",_", "image", "\\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_", "get", "\\u", "test\\u", "flavor_", "(_", "context_", "=_", "None_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "options_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "get", "\\u", "test\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "flavor_", "=_", "{_", "'", "name", "'_", ":_", "'", "kind", "a", ".", "big", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flavor", "id", "'_", ":_", "'", "some", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "memory", "\\u", "mb", "'_", ":_", "2048_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vcpu", "s", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "gb", "'_", ":_", "40_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ephemeral", "\\u", "gb", "'_", ":_", "80_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "swap", "'_", ":_", "1024_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "flavor_", "._", "update_", "(_", "options_", ")_", "\\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 ", " _", "flavor", "\\u", "ref_", "=_", "nova_", "._", "db_", "._", "flavor", "\\u", "create_", "(_", "context_", ",_", "test\\u", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "exception_", "._", "Fla", "vor", "Exists_", ",_", "exception_", "._", "Fla", "vor", "Id", "Exists_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor", "\\u", "ref_", "=_", "nova_", "._", "db_", "._", "flavor", "\\u", "get", "\\u", "by", "\\u", "name_", "(_", "context_", ",_", "'", "kind", "a", ".", "big", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "flavor", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "test\\u", "instance_", "(_", "context_", "=_", "None_", ",_", "flavor_", "=_", "None_", ",_", "obj_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "get", "\\u", "test\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "flavor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor_", "=_", "get", "\\u", "test\\u", "flavor_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "instance_", "=_", "{_", "'", "memory", "\\u", "kb", "'_", ":_", "'", "204", "800", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "basep", "ath", "'_", ":_", "'/", "some", "/", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bridge", "\\u", "name", "'_", ":_", "'", "br", "100", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vcpu", "s", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "gb", "'_", ":_", "40_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bridge", "'_", ":_", "'", "br", "101", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "ref", "'_", ":_", "'", "ced", "ef", "40", "a", "-", "ed", "6", "7", "-", "4d", "10", "-", "800", "e-1", "745", "5e", "dce", "175", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "type", "\\u", "id", "'_", ":_", "flavor_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "system", "\\u", "metadata", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "spec", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "context_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "id", "'_", ":_", "context_", "._", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "objects_", "._", "Instance_", "(_", "context_", ",_", "**_", "test\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "flavor_", "=_", "objects_", "._", "Flavor_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "context_", ",_", "flavor_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavors_", "._", "save", "\\u", "flavor", "\\u", "info_", "(_", "test\\u", "instance_", "[_", "'", "system", "\\u", "metadata", "'_", "]_", ",_", "flavor_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "nova_", "._", "db_", "._", "instance", "\\u", "create_", "(_", "context_", ",_", "test\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "test\\u", "network", "\\u", "info_", "(_", "count_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipv6_", "=_", "CONF_", "._", "use", "\\u", "ipv6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake_", "=_", "'", "fake", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "ip_", "=_", "'", "0.", "0.", "0.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "vlan_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "bridge", "\\u", "interface_", "=_", "'", "eth", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "current_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnet", "\\u", "4_", "=_", "network", "\\u", "model_", "._", "Subnet", "_", "(_", "cidr_", "=_", "fake", "\\u", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dns_", "=_", "[_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ips_", "=_", "[_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "routes_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dhcp", "\\u", "server_", "=_", "fake", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subnet", "\\u", "6_", "=_", "network", "\\u", "model_", "._", "Subnet", "_", "(_", "cidr_", "=_", "fake", "\\u", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ips_", "=_", "[_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "model_", "._", "IP_", "(_", "fake", "\\u", "ip_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "routes_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subnets_", "=_", "[_", "subnet", "\\u", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ipv6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnets_", "._", "append_", "(_", "subnet", "\\u", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network_", "=_", "network", "\\u", "model_", "._", "Network_", "(_", "id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bridge_", "=_", "fake_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subnets_", "=_", "subnets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vlan_", "=_", "fake", "\\u", "vlan_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bridge", "\\u", "interface_", "=_", "fake", "\\u", "bridge", "\\u", "interface_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "injected", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vif_", "=_", "network", "\\u", "model_", "._", "VIF", "_", "(_", "id_", "=_", "'", "vi", "f", "-", "xxx", "-", "yyy", "-", "zzz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "fake_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network_", "=_", "network_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "network", "\\u", "model_", "._", "VIF", "\\u", "TYPE", "\\u", "BRIDGE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "devn", "ame_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ovs", "\\u", "interface", "id_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "vif_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "network", "\\u", "model_", "._", "Network", "Info_", "(_", "[_", "current_", "(_", ")_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "count_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "os", "x_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "platform_", "._", "mac", "\\u", "ver_", "(_", ")_", "[_", "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_", "is", "\\u", "linux_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Lin", "ux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "core", "util", "s", "\\u", "readli", "nk", "\\u", "available_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "out_", ",_", "err_", "=_", "nova_", "._", "utils_", "._", "try", "cmd_", "(_", "'", "readli", "nk", "'_", ",_", "'-", "nm", "'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "err_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dns", "\\u", "manager_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "test\\u", "dns", "\\u", "managers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "mini", "dns_", "._", "Mini", "DNS", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "dns", "\\u", "managers_", "._", "append_", "(_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "up", "\\u", "dns", "\\u", "managers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "test\\u", "dns", "\\u", "managers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "manager_", "in_", "test\\u", "dns", "\\u", "managers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "._", "delete", "\\u", "dns", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "dns", "\\u", "managers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kille", "r", "\\u", "xml", "\\u", "body_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "\"\"\"", "<!", "DOC", "TYPE", " ", "x", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "<!", "ENTITY", " ", "a", " ", "\"%", "(", "a", ")", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<!", "ENTITY", " ", "b", " ", "\"%", "(", "b", ")", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<!", "ENTITY", " ", "c", " ", "\"%", "(", "c", ")", "s", "\">", "]>", "\\", "10", ";", " ", " ", " ", " ", "<", "foo", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "bar", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "v1", ">", "%", "(", "d", ")", "s", "</", "v1", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "bar", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "foo", ">\"\"\"_", ")_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "'_", ":_", "'", "A", "'_", "*_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", "'_", ":_", "'&", "a", ";'_", "*_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c", "'_", ":_", "'&", "b", ";'_", "*_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "d", "'_", ":_", "'&", "c", ";'_", "*_", "9999_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\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", "ipv", "6", "\\u", "supported_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "ipv", "6", "\\u", "support_", "=_", "socket_", "._", "has", "\\u", "ipv6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "EA", "FN", "OS", "UP", "PORT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "ipv", "6", "\\u", "support_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "there", " ", "is", " ", "at", " ", "leas", "t", " ", "one", " ", "interface", " ", "with", " ", "ipv6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "ipv", "6", "\\u", "support_", "and_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "linux", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "proc", "/", "net", "/", "if", "\\u", "inet", "6", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "read_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "has", "\\u", "ipv", "6", "\\u", "support_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "ipv", "6", "\\u", "support_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "has", "\\u", "ipv", "6", "\\u", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "version_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "path_", "[_", "2_", ":_", "3_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "request_", "._", "path_", "[_", "2_", ":_", "3_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Redundant assignment
dask/dask/dask/tests/test_delayed.py
[ { "content": "def test_kwargs():\n def mysum(a, b, c=(), **kwargs):\n return a + b + sum(c) + sum(kwargs.values())\n dmysum = delayed(mysum)\n ten = dmysum(1, 2, c=[delayed(3), 0], four=dmysum(2, 2))\n assert ten.compute() == 10\n dmysum = delayed(mysum, pure=True)\n ten = dmysum(1, 2, c=[delayed(3), 0], four=dmysum(2, 2))\n assert ten.compute() == 10", "metadata": "root.test_kwargs", "header": "['module', '___EOS___']", "index": 169 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "kwargs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "mys", "um_", "(_", "a_", ",_", "b_", ",_", "c_", "=_", "(_", ")_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "+_", "b_", "+_", "sum_", "(_", "c_", ")_", "+_", "sum_", "(_", "kwargs_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dm", "ys", "um_", "=_", "delayed_", "(_", "mys", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ten_", "=_", "dm", "ys", "um_", "(_", "1_", ",_", "2_", ",_", "c_", "=_", "[_", "delayed_", "(_", "3_", ")_", ",_", "0_", "]_", ",_", "four", "_", "=_", "dm", "ys", "um_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ten_", "._", "compute_", "(_", ")_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dm", "ys", "um_", "=_", "delayed_", "(_", "mys", "um_", ",_", "pure", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ten_", "=_", "dm", "ys", "um_", "(_", "1_", ",_", "2_", ",_", "c_", "=_", "[_", "delayed_", "(_", "3_", ")_", ",_", "0_", "]_", ",_", "four", "_", "=_", "dm", "ys", "um_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ten_", "._", "compute_", "(_", ")_", "==_", "10_", "\\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 ]
Suspicious unused loop iteration variable
mne-tools/mne-python/mne/viz/topo.py
[ { "content": "def _plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None,\n border='none', ylim=None, scalings=None, title=None,\n proj=False, vline=(0.,), hline=(0.,), fig_facecolor='k',\n fig_background=None, axis_facecolor='k', font_color='w',\n merge_grads=False, show=True):\n \"\"\"Plot 2D topography of evoked responses.\n\n Clicking on the plot of an individual sensor opens a new figure showing\n the evoked response for the selected sensor.\n\n Parameters\n ----------\n evoked : list of Evoked | Evoked\n The evoked response to plot.\n layout : instance of Layout | None\n Layout instance specifying sensor positions (does not need to\n be specified for Neuromag data). If possible, the correct layout is\n inferred from the data.\n layout_scale: float\n Scaling factor for adjusting the relative size of the layout\n on the canvas\n color : list of color objects | color object | None\n Everything matplotlib accepts to specify colors. If not list-like,\n the color specified will be repeated. If None, colors are\n automatically drawn.\n border : str\n matplotlib borders style to be used for each sensor plot.\n ylim : dict | None\n ylim for plots (after scaling has been applied). The value\n determines the upper and lower subplot limits. e.g.\n ylim = dict(eeg=[-20, 20]). Valid keys are eeg, mag, grad. If None,\n the ylim parameter for each channel is determined by the maximum\n absolute peak.\n scalings : dict | None\n The scalings of the channel types to be applied for plotting. If None,`\n defaults to `dict(eeg=1e6, grad=1e13, mag=1e15)`.\n title : str\n Title of the figure.\n proj : bool | 'interactive'\n If true SSP projections are applied before display. If 'interactive',\n a check box for reversible selection of SSP projection vectors will\n be shown.\n vline : list of floats | None\n The values at which to show a vertical line.\n hline : list of floats | None\n The values at which to show a horizontal line.\n fig_facecolor : str | obj\n The figure face color. Defaults to black.\n fig_background : None | numpy ndarray\n A background image for the figure. This must work with a call to\n plt.imshow. Defaults to None.\n axis_facecolor : str | obj\n The face color to be used for each sensor plot. Defaults to black.\n font_color : str | obj\n The color of text in the colorbar and title. Defaults to white.\n merge_grads : bool\n Whether to use RMS value of gradiometer pairs. Only works for Neuromag\n data. Defaults to False.\n show : bool\n Show figure if True.\n\n Returns\n -------\n fig : Instance of matplotlib.figure.Figure\n Images of evoked responses at sensor locations\n \"\"\"\n if not type(evoked) in (tuple, list):\n evoked = [evoked]\n\n if type(color) in (tuple, list):\n if len(color) != len(evoked):\n raise ValueError('Lists of evoked objects and colors'\n ' must have the same length')\n elif color is None:\n colors = ['w'] + COLORS\n stop = (slice(len(evoked)) if len(evoked) < len(colors)\n else slice(len(colors)))\n color = cycle(colors[stop])\n if len(evoked) > len(colors):\n warn('More evoked objects than colors available. You should pass '\n 'a list of unique colors.')\n else:\n color = cycle([color])\n\n times = evoked[0].times\n if not all((e.times == times).all() for e in evoked):\n raise ValueError('All evoked.times must be the same')\n\n evoked = [e.copy() for e in evoked]\n info = evoked[0].info\n ch_names = evoked[0].ch_names\n scalings = _handle_default('scalings', scalings)\n if not all(e.ch_names == ch_names for e in evoked):\n raise ValueError('All evoked.picks must be the same')\n ch_names = _clean_names(ch_names)\n if merge_grads:\n picks = _pair_grad_sensors(info, topomap_coords=False)\n chs = list()\n for pick in picks[::2]:\n ch = info['chs'][pick]\n ch['ch_name'] = ch['ch_name'][:-1] + 'X'\n chs.append(ch)\n info['chs'] = chs\n info['bads'] = list() # bads dropped on pair_grad_sensors\n info._update_redundant()\n info._check_consistency()\n new_picks = list()\n for e in evoked:\n data = _merge_grad_data(e.data[picks]) * scalings['grad']\n e.data = data\n new_picks.append(range(len(data)))\n picks = new_picks\n types_used = ['grad']\n y_label = 'RMS amplitude (%s)' % _handle_default('units')['grad']\n\n if layout is None:\n layout = find_layout(info)\n\n if not merge_grads:\n # XXX. at the moment we are committed to 1- / 2-sensor-types layouts\n chs_in_layout = set(layout.names) & set(ch_names)\n types_used = set(channel_type(info, ch_names.index(ch))\n for ch in chs_in_layout)\n # remove possible reference meg channels\n types_used = set.difference(types_used, set('ref_meg'))\n # one check for all vendors\n meg_types = set(('mag', 'grad'))\n is_meg = len(set.intersection(types_used, meg_types)) > 0\n if is_meg:\n types_used = list(types_used)[::-1] # -> restore kwarg order\n picks = [pick_types(info, meg=kk, ref_meg=False, exclude=[])\n for kk in types_used]\n else:\n types_used_kwargs = dict((t, True) for t in types_used)\n picks = [pick_types(info, meg=False, exclude=[],\n **types_used_kwargs)]\n assert isinstance(picks, list) and len(types_used) == len(picks)\n\n for e in evoked:\n for pick, ch_type in zip(picks, types_used):\n e.data[pick] = e.data[pick] * scalings[ch_type]\n\n if proj is True and all(e.proj is not True for e in evoked):\n evoked = [e.apply_proj() for e in evoked]\n elif proj == 'interactive': # let it fail early.\n for e in evoked:\n _check_delayed_ssp(e)\n # Y labels for picked plots must be reconstructed\n y_label = ['Amplitude (%s)' % _handle_default('units')[channel_type(\n info, ch_idx)] for ch_idx in range(len(chs_in_layout))]\n\n if ylim is None:\n def set_ylim(x):\n return np.abs(x).max()\n ylim_ = [set_ylim([e.data[t] for e in evoked]) for t in picks]\n ymax = np.array(ylim_)\n ylim_ = (-ymax, ymax)\n elif isinstance(ylim, dict):\n ylim_ = _handle_default('ylim', ylim)\n ylim_ = [ylim_[kk] for kk in types_used]\n # extra unpack to avoid bug #1700\n if len(ylim_) == 1:\n ylim_ = ylim_[0]\n else:\n ylim_ = zip(*[np.array(yl) for yl in ylim_])\n else:\n raise ValueError('ylim must be None ore a dict')\n\n data = [e.data for e in evoked]\n show_func = partial(_plot_timeseries_unified, data=data,\n color=color, times=times, vline=vline, hline=hline)\n click_func = partial(_plot_timeseries, data=data,\n color=color, times=times, vline=vline, hline=hline)\n\n fig = _plot_topo(info=info, times=times, show_func=show_func,\n click_func=click_func, layout=layout,\n colorbar=False, ylim=ylim_, cmap=None,\n layout_scale=layout_scale, border=border,\n fig_facecolor=fig_facecolor, font_color=font_color,\n axis_facecolor=axis_facecolor, title=title,\n x_label='Time (s)', y_label=y_label, unified=True)\n\n if fig_background is not None:\n add_background_image(fig, fig_background)\n\n if proj == 'interactive':\n for e in evoked:\n _check_delayed_ssp(e)\n params = dict(evokeds=evoked, times=times,\n plot_update_proj_callback=_plot_update_evoked_topo_proj,\n projs=evoked[0].info['projs'], fig=fig)\n _draw_proj_checkbox(None, params)\n\n plt_show(show)\n return fig", "metadata": "root._plot_evoked_topo", "header": "['module', '___EOS___']", "index": 418 } ]
[]
[]
0
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "plot", "\\u", "evo", "ked", "\\u", "topo_", "(_", "evo", "ked", "_", ",_", "layout_", "=_", "None_", ",_", "layout", "\\u", "scale_", "=_", "0.94", "5_", ",_", "color_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "border_", "=_", "'", "none", "'_", ",_", "ylim_", "=_", "None_", ",_", "scal", "ings_", "=_", "None_", ",_", "title_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proj_", "=_", "False_", ",_", "vlin", "e_", "=_", "(_", "0._", ",_", ")_", ",_", "hline", "_", "=_", "(_", "0._", ",_", ")_", ",_", "fig", "\\u", "facecolor_", "=_", "'", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fig", "\\u", "background_", "=_", "None_", ",_", "axis", "\\u", "facecolor_", "=_", "'", "k", "'_", ",_", "font", "\\u", "color_", "=_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "grads_", "=_", "False_", ",_", "show_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Plot", " ", "2", "D", " ", "topo", "graph", "y", " ", "of", " ", "evo", "ked", " ", "response", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Click", "ing", " ", "on", " ", "the", " ", "plot", " ", "of", " ", "an", " ", "individual", " ", "sensor", " ", "opens", " ", "a", " ", "new", " ", "figure", " ", "showin", "g", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "evo", "ked", " ", "response", " ", "for", " ", "the", " ", "selecte", "d", " ", "sensor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "evo", "ked", " ", ":", " ", "list", " ", "of", " ", "Ev", "oke", "d", " ", "|", " ", "Ev", "oke", "d", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "evo", "ked", " ", "response", " ", "to", " ", "plot", ".", "\\", "10", ";", " ", " ", " ", " ", "layout", " ", ":", " ", "instance", " ", "of", " ", "Lay", "out", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Lay", "out", " ", "instance", " ", "speci", "fy", "ing", " ", "sensor", " ", "position", "s", " ", "(", "doe", "s", " ", "not", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "specified", " ", "for", " ", "Neu", "rom", "ag", " ", "data", ").", " ", "If", " ", "possib", "le", ",", " ", "the", " ", "correct", " ", "layout", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "inferred", " ", "from", " ", "the", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "layout", "\\u", "scale", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Sca", "ling", " ", "factor", " ", "for", " ", "adjust", "ing", " ", "the", " ", "relative", " ", "size", " ", "of", " ", "the", " ", "layout", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "canv", "as", "\\", "10", ";", " ", " ", " ", " ", "color", " ", ":", " ", "list", " ", "of", " ", "color", " ", "object", "s", " ", "|", " ", "color", " ", "object", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Every", "thing", " ", "mat", "plotlib", " ", "accepts", " ", "to", " ", "speci", "fy", " ", "colors", ".", " ", "If", " ", "not", " ", "list", "-", "like", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "color", " ", "specified", " ", "will", " ", "be", " ", "repeated", ".", " ", "If", " ", "Non", "e", ",", " ", "colors", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "automati", "call", "y", " ", "draw", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "border", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "mat", "plotlib", " ", "border", "s", " ", "style", " ", "to", " ", "be", " ", "used", " ", "for", " ", "each", " ", "sensor", " ", "plot", ".", "\\", "10", ";", " ", " ", " ", " ", "ylim", " ", ":", " ", "dict", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "ylim", " ", "for", " ", "plots", " ", "(", "after", " ", "scal", "ing", " ", "has", " ", "bee", "n", " ", "applied", ").", " ", "The", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "dete", "rmin", "es", " ", "the", " ", "upper", " ", "and", " ", "lower", " ", "subplot", " ", "limit", "s", ".", " ", "e", ".", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "ylim", " ", "=", " ", "dict", "(", "ee", "g", "=[", "-", "20", ",", " ", "20", "])", ".", " ", "Valid", " ", "keys", " ", "are", " ", "ee", "g", ",", " ", "mag", ",", " ", "grad", ".", " ", "If", " ", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "ylim", " ", "parameter", " ", "for", " ", "each", " ", "channel", " ", "is", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "maxim", "um", "\\", "10", ";", " ", " ", " ", " ", "abs", "olute", " ", "peak", ".", "\\", "10", ";", " ", " ", " ", " ", "scal", "ings", " ", ":", " ", "dict", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "scal", "ings", " ", "of", " ", "the", " ", "channel", " ", "types", " ", "to", " ", "be", " ", "applied", " ", "for", " ", "plott", "ing", ".", " ", "If", " ", "Non", "e", ",", "`", "\\", "10", ";", " ", " ", " ", " ", "default", "s", " ", "to", " ", "`", "dict", "(", "ee", "g", "=", "1e", "6", ",", " ", "grad", "=", "1e1", "3", ",", " ", "mag", "=", "1e1", "5", ")`", ".", "\\", "10", ";", " ", " ", " ", " ", "title", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Tit", "le", " ", "of", " ", "the", " ", "figure", ".", "\\", "10", ";", " ", " ", " ", " ", "proj", " ", ":", " ", "bool", " ", "|", " ", "'", "interactive", "'", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "true", " ", "SSP", " ", "projections", " ", "are", " ", "applied", " ", "bef", "ore", " ", "display", ".", " ", "If", " ", "'", "interactive", "',", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "check", " ", "box", " ", "for", " ", "reversi", "ble", " ", "selection", " ", "of", " ", "SSP", " ", "projecti", "on", " ", "vector", "s", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "shown", ".", "\\", "10", ";", " ", " ", " ", " ", "vlin", "e", " ", ":", " ", "list", " ", "of", " ", "float", "s", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "values", " ", "at", " ", "whi", "ch", " ", "to", " ", "show", " ", "a", " ", "vertical", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "hline", " ", ":", " ", "list", " ", "of", " ", "float", "s", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "values", " ", "at", " ", "whi", "ch", " ", "to", " ", "show", " ", "a", " ", "horizon", "tal", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "fig", "\\u", "face", "color", " ", ":", " ", "str", " ", "|", " ", "obj", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "figure", " ", "face", " ", "color", ".", " ", "Default", "s", " ", "to", " ", "black", ".", "\\", "10", ";", " ", " ", " ", " ", "fig", "\\u", "background", " ", ":", " ", "Non", "e", " ", "|", " ", "nump", "y", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "background", " ", "image", " ", "for", " ", "the", " ", "figure", ".", " ", "Thi", "s", " ", "must", " ", "work", " ", "with", " ", "a", " ", "call", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "ims", "how", ".", " ", "Default", "s", " ", "to", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "axis", "\\u", "face", "color", " ", ":", " ", "str", " ", "|", " ", "obj", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "face", " ", "color", " ", "to", " ", "be", " ", "used", " ", "for", " ", "each", " ", "sensor", " ", "plot", ".", " ", "Default", "s", " ", "to", " ", "black", ".", "\\", "10", ";", " ", " ", " ", " ", "font", "\\u", "color", " ", ":", " ", "str", " ", "|", " ", "obj", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "color", " ", "of", " ", "text", " ", "in", " ", "the", " ", "colorbar", " ", "and", " ", "title", ".", " ", "Default", "s", " ", "to", " ", "white", ".", "\\", "10", ";", " ", " ", " ", " ", "merge", "\\u", "grads", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "use", " ", "RMS", " ", "value", " ", "of", " ", "gradi", "ometer", " ", "pair", "s", ".", " ", "On", "ly", " ", "works", " ", "for", " ", "Neu", "rom", "ag", "\\", "10", ";", " ", " ", " ", " ", "data", ".", " ", "Default", "s", " ", "to", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "show", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "figure", " ", "if", " ", "Tru", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "fig", " ", ":", " ", "Insta", "nce", " ", "of", " ", "mat", "plotlib", ".", "figure", ".", "Fig", "ure", "\\", "10", ";", " ", " ", " ", " ", "Image", "s", " ", "of", " ", "evo", "ked", " ", "response", "s", " ", "at", " ", "sensor", " ", "location", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "type_", "(_", "evo", "ked", "_", ")_", "in_", "(_", "tuple_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "evo", "ked", "_", "=_", "[_", "evo", "ked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "color_", ")_", "in_", "(_", "tuple_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "color_", ")_", "!=_", "len_", "(_", "evo", "ked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "List", "s", " ", "of", " ", "evo", "ked", " ", "object", "s", " ", "and", " ", "colors", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "must", " ", "have", " ", "the", " ", "same", " ", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "color_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "[_", "'", "w", "'_", "]_", "+_", "COLORS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop_", "=_", "(_", "slice_", "(_", "len_", "(_", "evo", "ked", "_", ")_", ")_", "if_", "len_", "(_", "evo", "ked", "_", ")_", "<_", "len_", "(_", "colors_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "slice_", "(_", "len_", "(_", "colors_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "cycle_", "(_", "colors_", "[_", "stop_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "evo", "ked", "_", ")_", ">_", "len_", "(_", "colors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn_", "(_", "'", "Mor", "e", " ", "evo", "ked", " ", "object", "s", " ", "than", " ", "colors", " ", "avail", "able", ".", " ", "You", " ", "shou", "ld", " ", "pass", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", " ", "list", " ", "of", " ", "unique", " ", "colors", ".'_", ")_", "\\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 ", " _", "color_", "=_", "cycle_", "(_", "[_", "color_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "times_", "=_", "evo", "ked", "_", "[_", "0_", "]_", "._", "times_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "(_", "e_", "._", "times_", "==_", "times_", ")_", "._", "all_", "(_", ")_", "for_", "e_", "in_", "evo", "ked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "All", " ", "evo", "ked", ".", "times", " ", "must", " ", "be", " ", "the", " ", "same", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "evo", "ked", "_", "=_", "[_", "e_", "._", "copy_", "(_", ")_", "for_", "e_", "in_", "evo", "ked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "evo", "ked", "_", "[_", "0_", "]_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch", "\\u", "names_", "=_", "evo", "ked", "_", "[_", "0_", "]_", "._", "ch", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scal", "ings_", "=_", "\\u", "handle", "\\u", "default_", "(_", "'", "scal", "ings", "'_", ",_", "scal", "ings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "e_", "._", "ch", "\\u", "names_", "==_", "ch", "\\u", "names_", "for_", "e_", "in_", "evo", "ked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "All", " ", "evo", "ked", ".", "picks", " ", "must", " ", "be", " ", "the", " ", "same", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ch", "\\u", "names_", "=_", "\\u", "clean", "\\u", "names_", "(_", "ch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "merge", "\\u", "grads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picks", "_", "=_", "\\u", "pair", "\\u", "grad", "\\u", "sensors_", "(_", "info_", ",_", "topo", "map", "\\u", "coords_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chs", "_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pick_", "in_", "picks", "_", "[_", ":_", ":_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ch_", "=_", "info_", "[_", "'", "chs", "'_", "]_", "[_", "pick_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", "[_", "'", "ch", "\\u", "name", "'_", "]_", "=_", "ch_", "[_", "'", "ch", "\\u", "name", "'_", "]_", "[_", ":_", "-_", "1_", "]_", "+_", "'", "X", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chs", "_", "._", "append_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "[_", "'", "chs", "'_", "]_", "=_", "chs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "'", "bad", "s", "'_", "]_", "=_", "list_", "(_", ")_", "#", " ", "bad", "s", " ", "dropped", " ", "on", " ", "pair", "\\u", "grad", "\\u", "sensors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "._", "\\u", "update", "\\u", "redundant", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "._", "\\u", "check", "\\u", "consiste", "ncy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "picks", "_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "evo", "ked", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "\\u", "merge", "\\u", "grad", "\\u", "data_", "(_", "e_", "._", "data_", "[_", "picks", "_", "]_", ")_", "*_", "scal", "ings_", "[_", "'", "grad", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "picks", "_", "._", "append_", "(_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "picks", "_", "=_", "new", "\\u", "picks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types", "\\u", "used_", "=_", "[_", "'", "grad", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "'", "RMS", " ", "amplitude", " ", "(%", "s", ")'_", "%_", "\\u", "handle", "\\u", "default_", "(_", "'", "unit", "s", "'_", ")_", "[_", "'", "grad", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "layout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layout_", "=_", "find", "\\u", "layout_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "merge", "\\u", "grads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ".", " ", "at", " ", "the", " ", "moment", " ", "we", " ", "are", " ", "committ", "ed", " ", "to", " ", "1", "-", " ", "/", " ", "2", "-", "sensor", "-", "types", " ", "layouts", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chs", "\\u", "in", "\\u", "layout_", "=_", "set_", "(_", "layout_", "._", "names_", ")_", "&_", "set_", "(_", "ch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types", "\\u", "used_", "=_", "set_", "(_", "channel", "\\u", "type_", "(_", "info_", ",_", "ch", "\\u", "names_", "._", "index_", "(_", "ch_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ch_", "in_", "chs", "\\u", "in", "\\u", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "possib", "le", " ", "reference", " ", "me", "g", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "types", "\\u", "used_", "=_", "set_", "._", "difference_", "(_", "types", "\\u", "used_", ",_", "set_", "(_", "'", "ref", "\\u", "me", "g", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "one", " ", "check", " ", "for", " ", "all", " ", "vendor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "me", "g", "\\u", "types_", "=_", "set_", "(_", "(_", "'", "mag", "'_", ",_", "'", "grad", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "me", "g_", "=_", "len_", "(_", "set_", "._", "intersection_", "(_", "types", "\\u", "used_", ",_", "me", "g", "\\u", "types_", ")_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "me", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "types", "\\u", "used_", "=_", "list_", "(_", "types", "\\u", "used_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", "#", " ", "->", " ", "restore", " ", "kwarg", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picks", "_", "=_", "[_", "pick", "\\u", "types_", "(_", "info_", ",_", "me", "g_", "=_", "kk_", ",_", "ref", "\\u", "me", "g_", "=_", "False_", ",_", "exclude_", "=_", "[_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "kk_", "in_", "types", "\\u", "used_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "types", "\\u", "used", "\\u", "kwargs_", "=_", "dict_", "(_", "(_", "t_", ",_", "True_", ")_", "for_", "t_", "in_", "types", "\\u", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picks", "_", "=_", "[_", "pick", "\\u", "types_", "(_", "info_", ",_", "me", "g_", "=_", "False_", ",_", "exclude_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "types", "\\u", "used", "\\u", "kwargs_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "isinstance_", "(_", "picks", "_", ",_", "list_", ")_", "and_", "len_", "(_", "types", "\\u", "used_", ")_", "==_", "len_", "(_", "picks", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "e_", "in_", "evo", "ked", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pick_", ",_", "ch", "\\u", "type_", "in_", "zip_", "(_", "picks", "_", ",_", "types", "\\u", "used_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "data_", "[_", "pick_", "]_", "=_", "e_", "._", "data_", "[_", "pick_", "]_", "*_", "scal", "ings_", "[_", "ch", "\\u", "type_", "]_", "\\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_", "proj_", "is_", "True_", "and_", "all_", "(_", "e_", "._", "proj_", "is_", "not_", "True_", "for_", "e_", "in_", "evo", "ked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "evo", "ked", "_", "=_", "[_", "e_", "._", "appl", "y", "\\u", "proj_", "(_", ")_", "for_", "e_", "in_", "evo", "ked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "proj_", "==_", "'", "interactive", "'_", ":_", "#", " ", "let", " ", "it", " ", "fail", " ", "ear", "ly", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "evo", "ked", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "check", "\\u", "delayed", "\\u", "ssp", "_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Y", " ", "labels", " ", "for", " ", "picked", " ", "plots", " ", "must", " ", "be", " ", "reconstruct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y", "\\u", "label_", "=_", "[_", "'", "Amplitude", " ", "(%", "s", ")'_", "%_", "\\u", "handle", "\\u", "default_", "(_", "'", "unit", "s", "'_", ")_", "[_", "channel", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "info_", ",_", "ch", "\\u", "idx_", ")_", "]_", "for_", "ch", "\\u", "idx_", "in_", "range_", "(_", "len_", "(_", "chs", "\\u", "in", "\\u", "layout_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ylim_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set\\u", "ylim_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "abs_", "(_", "x_", ")_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ylim", "\\u_", "=_", "[_", "set\\u", "ylim_", "(_", "[_", "e_", "._", "data_", "[_", "t_", "]_", "for_", "e_", "in_", "evo", "ked", "_", "]_", ")_", "for_", "t_", "in_", "picks", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "np_", "._", "array_", "(_", "ylim", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim", "\\u_", "=_", "(_", "-_", "ymax_", ",_", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ylim_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ylim", "\\u_", "=_", "\\u", "handle", "\\u", "default_", "(_", "'", "ylim", "'_", ",_", "ylim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim", "\\u_", "=_", "[_", "ylim", "\\u_", "[_", "kk_", "]_", "for_", "kk_", "in_", "types", "\\u", "used_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extra", " ", "unpack", " ", "to", " ", "avoid", " ", "bug", " ", "#", "1700", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "ylim", "\\u_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ylim", "\\u_", "=_", "ylim", "\\u_", "[_", "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 ", " _", "ylim", "\\u_", "=_", "zip_", "(_", "*_", "[_", "np_", "._", "array_", "(_", "yl", "_", ")_", "for_", "yl", "_", "in_", "ylim", "\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "ylim", " ", "must", " ", "be", " ", "Non", "e", " ", "ore", " ", "a", " ", "dict", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "[_", "e_", "._", "data_", "for_", "e_", "in_", "evo", "ked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "func_", "=_", "partial_", "(_", "\\u", "plot", "\\u", "times", "eries", "\\u", "unifie", "d_", ",_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", ",_", "times_", "=_", "times_", ",_", "vlin", "e_", "=_", "vlin", "e_", ",_", "hline", "_", "=_", "hline", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "click", "\\u", "func_", "=_", "partial_", "(_", "\\u", "plot", "\\u", "timeseries_", ",_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", ",_", "times_", "=_", "times_", ",_", "vlin", "e_", "=_", "vlin", "e_", ",_", "hline", "_", "=_", "hline", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "\\u", "plot", "\\u", "topo_", "(_", "info_", "=_", "info_", ",_", "times_", "=_", "times_", ",_", "show", "\\u", "func_", "=_", "show", "\\u", "func_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "click", "\\u", "func_", "=_", "click", "\\u", "func_", ",_", "layout_", "=_", "layout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colorbar_", "=_", "False_", ",_", "ylim_", "=_", "ylim", "\\u_", ",_", "cmap_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "scale_", "=_", "layout", "\\u", "scale_", ",_", "border_", "=_", "border_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fig", "\\u", "facecolor_", "=_", "fig", "\\u", "facecolor_", ",_", "font", "\\u", "color_", "=_", "font", "\\u", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "facecolor_", "=_", "axis", "\\u", "facecolor_", ",_", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "label_", "=_", "'", "Time", " ", "(", "s", ")'_", ",_", "y", "\\u", "label_", "=_", "y", "\\u", "label_", ",_", "unifie", "d_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fig", "\\u", "background_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "background", "\\u", "image_", "(_", "fig_", ",_", "fig", "\\u", "background_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proj_", "==_", "'", "interactive", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "evo", "ked", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "check", "\\u", "delayed", "\\u", "ssp", "_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "dict_", "(_", "evo", "ked", "s_", "=_", "evo", "ked", "_", ",_", "times_", "=_", "times_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plot", "\\u", "update", "\\u", "proj", "\\u", "callback_", "=_", "\\u", "plot", "\\u", "update", "\\u", "evo", "ked", "\\u", "topo", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proj", "s_", "=_", "evo", "ked", "_", "[_", "0_", "]_", "._", "info_", "[_", "'", "proj", "s", "'_", "]_", ",_", "fig_", "=_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "draw", "\\u", "proj", "\\u", "checkbox_", "(_", "None_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt", "\\u", "show_", "(_", "show_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fig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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 ]
Unused import
ellmetha/django-machina/machina/apps/forum_conversation/forms.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom django import forms\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db.models import F\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom machina.conf import settings as machina_settings\nfrom machina.core.db.models import get_model\nfrom machina.core.loading import get_class\n\nPost = get_model('forum_conversation', 'Post')\nTopic = get_model('forum_conversation', 'Topic')\nTopicPoll = get_model('forum_polls', 'TopicPoll')\n\nPermissionHandler = get_class('forum_permission.handler', 'PermissionHandler')\n\nget_anonymous_user_forum_key = get_class(\n 'forum_permission.shortcuts', 'get_anonymous_user_forum_key')\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PostForm(forms.ModelForm):\n class Meta:\n model = Post\n fields = ['subject', 'content', 'username', 'update_reason', ]\n\n\n", "metadata": "root.PostForm", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, *args, **kwargs):\n self.user = kwargs.pop('user', None)\n self.user_ip = kwargs.pop('user_ip', None)\n self.forum = kwargs.pop('forum', None)\n self.topic = kwargs.pop('topic', None)\n\n self.perm_handler = PermissionHandler()\n\n super(PostForm, self).__init__(*args, **kwargs)\n\n # Updates the 'subject' and 'content' fields attributes\n self.fields['subject'].widget.attrs['placeholder'] = _('Enter your subject')\n self.fields['content'].label = _('Message')\n self.fields['content'].widget.attrs['placeholder'] = _('Enter your message')\n\n # Handles anonymous users\n if self.user and self.user.is_anonymous():\n self.fields['username'].required = True\n else:\n # The 'username' field is not really usefull if the user is\n # authenticated\n del self.fields['username']\n\n # Handles the definition of a default subject if we are\n # considering an answer\n if not self.instance.pk and self.topic:\n self.fields['subject'].initial = '{} {}'.format(\n machina_settings.TOPIC_ANSWER_SUBJECT_PREFIX,\n self.topic.subject)\n\n # Delete the 'update_reason' field if we are\n # considering a post update\n if not self.instance.pk:\n del self.fields['update_reason']", "metadata": "root.PostForm.__init__", "header": "['class', 'PostForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 28 }, { "content": " def clean(self):\n if not self.user.is_anonymous():\n self.instance.poster = self.user\n else:\n self.instance.anonymous_key = get_anonymous_user_forum_key(self.user)\n return super(PostForm, self).clean()", "metadata": "root.PostForm.clean", "header": "['class', 'PostForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 63 }, { "content": " def save(self, commit=True):\n if self.instance.pk:\n # First handle updates\n post = super(PostForm, self).save(commit=False)\n post.updated_by = self.user\n post.updates_count = F('updates_count') + 1\n else:\n post = Post(\n topic=self.topic,\n poster_ip=self.user_ip,\n subject=self.cleaned_data['subject'],\n approved=self.perm_handler.can_post_without_approval(self.forum, self.user),\n content=self.cleaned_data['content'])\n if not self.user.is_anonymous():\n post.poster = self.user\n else:\n post.username = self.cleaned_data['username']\n post.anonymous_key = get_anonymous_user_forum_key(self.user)\n\n if commit:\n post.save()\n\n return post", "metadata": "root.PostForm.save", "header": "['class', 'PostForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 70 }, { "content": "class TopicForm(PostForm):\n topic_type = forms.ChoiceField(\n label=_('Post topic as'), choices=Topic.TYPE_CHOICES, required=False)\n\n", "metadata": "root.TopicForm", "header": "['module', '___EOS___']", "index": 95 }, { "content": " def __init__(self, *args, **kwargs):\n super(TopicForm, self).__init__(*args, **kwargs)\n\n # Perform some checks before doing anything\n self.can_add_stickies = self.perm_handler.can_add_stickies(self.forum, self.user)\n self.can_add_announcements = self.perm_handler.can_add_announcements(self.forum, self.user)\n self.can_create_polls = self.perm_handler.can_create_polls(self.forum, self.user)\n\n if not self.can_add_stickies:\n choices = filter(\n lambda t: t[0] != Topic.TOPIC_STICKY,\n self.fields['topic_type'].choices)\n self.fields['topic_type'].choices = choices\n if not self.can_add_announcements:\n choices = filter(\n lambda t: t[0] != Topic.TOPIC_ANNOUNCE,\n self.fields['topic_type'].choices)\n self.fields['topic_type'].choices = choices\n\n # Append polls fields to the form if the user is allowed to create such things\n if self.can_create_polls:\n self.fields['poll_question'] = forms.CharField(\n label=_('Poll question'), required=False,\n help_text=_('Enter a question to associate a poll with the topic or leave blank to '\n 'not create a poll.'),\n max_length=TopicPoll._meta.get_field('question').max_length)\n self.fields['poll_max_options'] = forms.IntegerField(\n label=_('Maximum number of poll options per user'), required=False,\n help_text=_('This is the number of options each user may select when voting.'),\n validators=TopicPoll._meta.get_field('max_options').validators,\n initial=1)\n self.fields['poll_duration'] = forms.IntegerField(\n label=_('For how many days the poll should be run?'), required=False,\n help_text=_('Enter 0 or leave blank for a never ending poll.'),\n min_value=0, initial=0)\n self.fields['poll_user_changes'] = forms.BooleanField(\n label=_('Allow re-voting?'), required=False,\n help_text=_('If enabled users are able to change their vote.'),\n initial=False)\n\n # Set the initial values\n try:\n if hasattr(self.instance, 'topic'):\n self.fields['topic_type'].initial = self.instance.topic.type\n\n if self.can_create_polls and self.instance.topic.poll is not None:\n self.fields['poll_question'].initial = self.instance.topic.poll.question\n self.fields['poll_max_options'].initial = self.instance.topic.poll.max_options\n self.fields['poll_duration'].initial = self.instance.topic.poll.duration\n self.fields['poll_user_changes'].initial = self.instance.topic.poll.user_changes\n except ObjectDoesNotExist:\n pass", "metadata": "root.TopicForm.__init__", "header": "['class', 'TopicForm', '(', 'PostForm', ')', ':', '___EOS___']", "index": 99 }, { "content": " def save(self, commit=True):\n if not self.instance.pk:\n # First, handle topic creation\n if 'topic_type' in self.cleaned_data and len(self.cleaned_data['topic_type']):\n topic_type = self.cleaned_data['topic_type']\n else:\n topic_type = Topic.TOPIC_POST\n\n topic = Topic(\n forum=self.forum,\n subject=self.cleaned_data['subject'], # The topic's name is the post's name\n type=topic_type,\n status=Topic.TOPIC_UNLOCKED,\n approved=self.perm_handler.can_post_without_approval(self.forum, self.user))\n if not self.user.is_anonymous():\n topic.poster = self.user\n self.topic = topic\n if commit:\n topic.save()\n else:\n if 'topic_type' in self.cleaned_data and len(self.cleaned_data['topic_type']):\n if self.instance.topic.type != self.cleaned_data['topic_type']:\n self.instance.topic.type = self.cleaned_data['topic_type']\n self.instance.topic._simple_save()\n\n return super(TopicForm, self).save(commit)", "metadata": "root.TopicForm.save", "header": "['class', 'TopicForm', '(', 'PostForm', ')', ':', '___EOS___']", "index": 152 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mach", "ina", "_", "._", "conf_", "import_", "settings_", "as_", "mach", "ina", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mach", "ina", "_", "._", "core_", "._", "db_", "._", "models_", "import_", "get", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mach", "ina", "_", "._", "core_", "._", "loading_", "import_", "get", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Post_", "=_", "get", "\\u", "model_", "(_", "'", "forum", "\\u", "conversation", "'_", ",_", "'", "Post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Topic_", "=_", "get", "\\u", "model_", "(_", "'", "forum", "\\u", "conversation", "'_", ",_", "'", "Topic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Topic", "Poll", "_", "=_", "get", "\\u", "model_", "(_", "'", "forum", "\\u", "polls", "'_", ",_", "'", "Topic", "Poll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Permi", "ssion", "Handler_", "=_", "get", "\\u", "class_", "(_", "'", "forum", "\\u", "permissi", "on", ".", "handler", "'_", ",_", "'", "Permi", "ssion", "Handle", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "anonym", "ous", "\\u", "user", "\\u", "forum", "\\u", "key_", "=_", "get", "\\u", "class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forum", "\\u", "permissi", "on", ".", "shortcut", "s", "'_", ",_", "'", "get", "\\u", "anonym", "ous", "\\u", "user", "\\u", "forum", "\\u", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Post", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "subject", "'_", ",_", "'", "content", "'_", ",_", "'", "user", "name", "'_", ",_", "'", "update", "\\u", "reason", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "kwargs_", "._", "pop_", "(_", "'", "user", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "ip_", "=_", "kwargs_", "._", "pop_", "(_", "'", "user", "\\u", "ip", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "forum_", "=_", "kwargs_", "._", "pop_", "(_", "'", "forum", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "topic_", "=_", "kwargs_", "._", "pop_", "(_", "'", "topic", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "perm", "\\u", "handler_", "=_", "Permi", "ssion", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Post", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", "s", " ", "the", " ", "'", "subject", "'", " ", "and", " ", "'", "content", "'", " ", "fields", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "subject", "'_", "]_", "._", "widget_", "._", "attrs_", "[_", "'", "placehold", "er", "'_", "]_", "=_", "\\u_", "(_", "'", "Enter", " ", "your", " ", "subject", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Messag", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "widget_", "._", "attrs_", "[_", "'", "placehold", "er", "'_", "]_", "=_", "\\u_", "(_", "'", "Enter", " ", "your", " ", "message", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", "s", " ", "anonym", "ous", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "user_", "and_", "self_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "user", "name", "'_", "]_", "._", "required_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "'", "user", "name", "'", " ", "field", " ", "is", " ", "not", " ", "reall", "y", " ", "usef", "ull", " ", "if", " ", "the", " ", "user", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "authenticated_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "fields_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", "s", " ", "the", " ", "definit", "ion", " ", "of", " ", "a", " ", "default", " ", "subject", " ", "if", " ", "we", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", "ing", " ", "an", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "instance_", "._", "pk_", "and_", "self_", "._", "topic_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "subject", "'_", "]_", "._", "initial_", "=_", "'{}", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mach", "ina", "\\u", "settings_", "._", "TOPIC", "\\u", "ANSWER", "\\u", "SUBJECT", "\\u", "PREFIX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "topic_", "._", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "the", " ", "'", "update", "\\u", "reason", "'", " ", "field", " ", "if", " ", "we", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", "ing", " ", "a", " ", "post", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "fields_", "[_", "'", "update", "\\u", "reason", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "poster_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "anonym", "ous", "\\u", "key_", "=_", "get", "\\u", "anonym", "ous", "\\u", "user", "\\u", "forum", "\\u", "key_", "(_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Post", "Form_", ",_", "self_", ")_", "._", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\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 ", " _", "if_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "handle", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "=_", "super_", "(_", "Post", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "update", "d\\u", "by_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "update", "s", "\\u", "count_", "=_", "F_", "(_", "'", "update", "s", "\\u", "count", "'_", ")_", "+_", "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 ", " _", "post_", "=_", "Post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "topic_", "=_", "self_", "._", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poster", "\\u", "ip_", "=_", "self_", "._", "user", "\\u", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "subject", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approved", "_", "=_", "self_", "._", "perm", "\\u", "handler_", "._", "can", "\\u", "post", "\\u", "with", "out", "\\u", "approval", "_", "(_", "self_", "._", "forum_", ",_", "self_", "._", "user_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "._", "poster_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "._", "username_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "anonym", "ous", "\\u", "key_", "=_", "get", "\\u", "anonym", "ous", "\\u", "user", "\\u", "forum", "\\u", "key_", "(_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Topic", "Form_", "(_", "Post", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic", "\\u", "type_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "'", "Post", " ", "topic", " ", "as", "'_", ")_", ",_", "choices_", "=_", "Topic_", "._", "TYPE", "\\u", "CHOICES_", ",_", "required_", "=_", "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_", "[SEP]_", "class_", "Topic", "Form_", "(_", "Post", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Topic", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "some", " ", "checks", " ", "bef", "ore", " ", "doi", "ng", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "can", "\\u", "add", "\\u", "stick", "ies_", "=_", "self_", "._", "perm", "\\u", "handler_", "._", "can", "\\u", "add", "\\u", "stick", "ies_", "(_", "self_", "._", "forum_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "can", "\\u", "add", "\\u", "announcement", "s_", "=_", "self_", "._", "perm", "\\u", "handler_", "._", "can", "\\u", "add", "\\u", "announcement", "s_", "(_", "self_", "._", "forum_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "can", "\\u", "create", "\\u", "polls", "_", "=_", "self_", "._", "perm", "\\u", "handler_", "._", "can", "\\u", "create", "\\u", "polls", "_", "(_", "self_", "._", "forum_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "can", "\\u", "add", "\\u", "stick", "ies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "=_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "t_", ":_", "t_", "[_", "0_", "]_", "!=_", "Topic_", "._", "TOPIC", "\\u", "STIC", "KY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "._", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "can", "\\u", "add", "\\u", "announcement", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "=_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "t_", ":_", "t_", "[_", "0_", "]_", "!=_", "Topic_", "._", "TOPIC", "\\u", "ANN", "OUN", "CE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "._", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Append", " ", "polls", " ", "fields", " ", "to", " ", "the", " ", "form", " ", "if", " ", "the", " ", "user", " ", "is", " ", "allow", "ed", " ", "to", " ", "create", " ", "suc", "h", " ", "things_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "can", "\\u", "create", "\\u", "polls", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "question", "'_", "]_", "=_", "forms_", "._", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "'", "Poll", " ", "question", "'_", ")_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "question", " ", "to", " ", "associate", " ", "a", " ", "poll", " ", "with", " ", "the", " ", "topic", " ", "or", " ", "lea", "ve", " ", "blank", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "not", " ", "create", " ", "a", " ", "poll", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "Topic", "Poll", "_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "question", "'_", ")_", "._", "max", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "max", "\\u", "options", "'_", "]_", "=_", "forms_", "._", "Integer", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "'", "Maxim", "um", " ", "number", " ", "of", " ", "poll", " ", "options", " ", "per", " ", "user", "'_", ")_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "'", "Thi", "s", " ", "is", " ", "the", " ", "number", " ", "of", " ", "options", " ", "each", " ", "user", " ", "may", " ", "select", " ", "whe", "n", " ", "voting", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validators_", "=_", "Topic", "Poll", "_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "max", "\\u", "options", "'_", ")_", "._", "validators_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "duration", "'_", "]_", "=_", "forms_", "._", "Integer", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "'", "For", " ", "how", " ", "many", " ", "day", "s", " ", "the", " ", "poll", " ", "shou", "ld", " ", "be", " ", "run", "?'_", ")_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "'", "Enter", " ", "0", " ", "or", " ", "lea", "ve", " ", "blank", " ", "for", " ", "a", " ", "neve", "r", " ", "ending", " ", "poll", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "value_", "=_", "0_", ",_", "initial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "user", "\\u", "change", "s", "'_", "]_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "'", "All", "ow", " ", "re", "-", "voting", "?'_", ")_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "'", "If", " ", "enable", "d", " ", "users", " ", "are", " ", "able", " ", "to", " ", "change", " ", "thei", "r", " ", "vote", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "initial", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "instance_", ",_", "'", "topic", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "topic_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "can", "\\u", "create", "\\u", "polls", "_", "and_", "self_", "._", "instance_", "._", "topic_", "._", "poll_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "question", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "topic_", "._", "poll_", "._", "question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "max", "\\u", "options", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "topic_", "._", "poll_", "._", "max", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "duration", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "topic_", "._", "poll_", "._", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "poll", "\\u", "user", "\\u", "change", "s", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "topic_", "._", "poll_", "._", "user", "\\u", "changes_", "\\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_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Topic", "Form_", "(_", "Post", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "handle", " ", "topic", " ", "creation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "topic", "\\u", "type", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "and_", "len_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "topic", "\\u", "type", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic", "\\u", "type_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "topic", "\\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 ", " _", "topic", "\\u", "type_", "=_", "Topic_", "._", "TOPIC", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "topic_", "=_", "Topic_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "forum_", "=_", "self_", "._", "forum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "subject", "'_", "]_", ",_", "#", " ", "The", " ", "topic", "'", "s", " ", "name", " ", "is", " ", "the", " ", "post", "'", "s", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "topic", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Topic_", "._", "TOPIC", "\\u", "UNL", "OCK", "ED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approved", "_", "=_", "self_", "._", "perm", "\\u", "handler_", "._", "can", "\\u", "post", "\\u", "with", "out", "\\u", "approval", "_", "(_", "self_", "._", "forum_", ",_", "self_", "._", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "._", "poster_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "topic_", "=_", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "topic", "\\u", "type", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "and_", "len_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "topic", "\\u", "type", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "instance_", "._", "topic_", "._", "type_", "!=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "topic", "\\u", "type", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "instance_", "._", "topic_", "._", "type_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "topic", "\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "._", "topic_", "._", "\\u", "simple", "\\u", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Topic", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Implicit string concatenation in a list
AppScale/appscale/AppServer/lib/django-1.3/tests/regressiontests/forms/tests/formsets.py
[ { "content": " def test_regression_12878(self):\n # Regression test for #12878 #################################################\n\n data = {\n 'drinks-TOTAL_FORMS': '2', # the number of forms rendered\n 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data\n 'drinks-MAX_NUM_FORMS': '0', # max number of forms\n 'drinks-0-name': 'Gin and Tonic',\n 'drinks-1-name': 'Gin and Tonic',\n }\n\n formset = FavoriteDrinksFormSet(data, prefix='drinks')\n self.assertFalse(formset.is_valid())\n self.assertEqual(formset.non_form_errors(), [u'You may only specify a drink once.'])", "metadata": "root.FormsFormsetTestCase.test_regression_12878", "header": "['class', 'FormsFormsetTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 759 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Form", "s", "Form", "set", "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", "regress", "ion", "\\u", "128", "78_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Regr", "ession", " ", "test", " ", "for", " ", "#", "128", "7", "8", " ", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drink", "s", "-", "TOTAL", "\\u", "FORM", "S", "'_", ":_", "'", "2", "'_", ",_", "#", " ", "the", " ", "number", " ", "of", " ", "forms", " ", "rendered_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drink", "s", "-", "INITIAL", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "#", " ", "the", " ", "number", " ", "of", " ", "forms", " ", "with", " ", "initial", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drink", "s", "-", "MAX", "\\u", "NUM", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "#", " ", "max", " ", "number", " ", "of", " ", "forms_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drink", "s", "-0", "-", "name", "'_", ":_", "'", "Gi", "n", " ", "and", " ", "Ton", "ic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drink", "s", "-1", "-", "name", "'_", ":_", "'", "Gi", "n", " ", "and", " ", "Ton", "ic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formset_", "=_", "Favorite", "Dri", "nks", "Form", "Set_", "(_", "data_", ",_", "prefix_", "=_", "'", "drink", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "formset_", "._", "non", "\\u", "form", "\\u", "errors_", "(_", ")_", ",_", "[_", "u", "'", "You", " ", "may", " ", "only", " ", "speci", "fy", " ", "a", " ", "drink", " ", "onc", "e", ".'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
unlimitedlabs/orchestra/orchestra/urls.py
[ { "content": "from django.conf import settings\nfrom django.conf.urls import include\nfrom django.conf.urls import url\nfrom django.views.generic import RedirectView\n\nfrom orchestra.views import index\nfrom orchestra.views import status\n\nurlpatterns = [\n url(r'^api/',\n include('orchestra.api_urls', namespace='orchestra')),\n url(r'^communication/',\n include('orchestra.communication.urls')),\n url(r'^app/?', index, name='index'),\n url(r'', include('orchestra.accounts.urls')),\n url(r'^bots/', include('orchestra.bots.urls', namespace='bots')),\n\n # Health check status\n url(r'^status/', status, name='status'),\n\n # Favicon redirect for crawlers\n url(r'^favicon.ico/$', RedirectView.as_view(\n url=settings.STATIC_URL + 'orchestra/icons/favicon.ico',\n permanent=True),\n name='favicon'),\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "include_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Redirect", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "orch", "estra", "_", "._", "views_", "import_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "orch", "estra", "_", "._", "views_", "import_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "api", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "(_", "'", "orch", "estra", ".", "api", "\\u", "urls", "'_", ",_", "namespace_", "=_", "'", "orch", "estra", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "communication", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "(_", "'", "orch", "estra", ".", "communication", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "app", "/?", "'_", ",_", "index_", ",_", "name_", "=_", "'", "index", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "''_", ",_", "include_", "(_", "'", "orch", "estra", ".", "account", "s", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "bot", "s", "/'_", ",_", "include_", "(_", "'", "orch", "estra", ".", "bot", "s", ".", "urls", "'_", ",_", "namespace_", "=_", "'", "bot", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Health", " ", "check", " ", "status_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "status", "/'_", ",_", "status_", ",_", "name_", "=_", "'", "status", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fav", "icon", " ", "redirec", "t", " ", "for", " ", "crawle", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "fav", "icon", ".", "ico", "/$'_", ",_", "Redirect", "View_", "._", "as", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "settings_", "._", "STATI", "C", "\\u", "URL_", "+_", "'", "orch", "estra", "/", "icons", "/", "fav", "icon", ".", "ico", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permanent", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "fav", "icon", "'_", ")_", ",_", "\\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 ]
Unused local variable
lisa-lab/DeepLearningTutorials/code/rnnslu.py
[ { "content": " def __init__(self, nh, nc, ne, de, cs):\n '''\n nh :: dimension of the hidden layer\n nc :: number of classes\n ne :: number of word embeddings in the vocabulary\n de :: dimension of the word embeddings\n cs :: word window context size\n '''\n # parameters of the model\n self.emb = theano.shared(name='embeddings',\n value=0.2 * numpy.random.uniform(-1.0, 1.0,\n (ne+1, de))\n # add one for padding at the end\n .astype(theano.config.floatX))\n self.wx = theano.shared(name='wx',\n value=0.2 * numpy.random.uniform(-1.0, 1.0,\n (de * cs, nh))\n .astype(theano.config.floatX))\n self.wh = theano.shared(name='wh',\n value=0.2 * numpy.random.uniform(-1.0, 1.0,\n (nh, nh))\n .astype(theano.config.floatX))\n self.w = theano.shared(name='w',\n value=0.2 * numpy.random.uniform(-1.0, 1.0,\n (nh, nc))\n .astype(theano.config.floatX))\n self.bh = theano.shared(name='bh',\n value=numpy.zeros(nh,\n dtype=theano.config.floatX))\n self.b = theano.shared(name='b',\n value=numpy.zeros(nc,\n dtype=theano.config.floatX))\n self.h0 = theano.shared(name='h0',\n value=numpy.zeros(nh,\n dtype=theano.config.floatX))\n\n # bundle\n self.params = [self.emb, self.wx, self.wh, self.w,\n self.bh, self.b, self.h0]\n # end-snippet-2\n # as many columns as context window size\n # as many lines as words in the sentence\n # start-snippet-3\n idxs = T.imatrix()\n x = self.emb[idxs].reshape((idxs.shape[0], de*cs))\n y_sentence = T.ivector('y_sentence') # labels\n # end-snippet-3 start-snippet-4\n\n def recurrence(x_t, h_tm1):\n h_t = T.nnet.sigmoid(T.dot(x_t, self.wx)\n + T.dot(h_tm1, self.wh) + self.bh)\n s_t = T.nnet.softmax(T.dot(h_t, self.w) + self.b)\n return [h_t, s_t]\n\n [h, s], _ = theano.scan(fn=recurrence,\n sequences=x,\n outputs_info=[self.h0, None],\n n_steps=x.shape[0])\n\n p_y_given_x_sentence = s[:, 0, :]\n y_pred = T.argmax(p_y_given_x_sentence, axis=1)\n # end-snippet-4\n\n # cost and gradients and learning rate\n # start-snippet-5\n lr = T.scalar('lr')\n\n sentence_nll = -T.mean(T.log(p_y_given_x_sentence)\n [T.arange(x.shape[0]), y_sentence])\n sentence_gradients = T.grad(sentence_nll, self.params)\n sentence_updates = OrderedDict((p, p - lr*g)\n for p, g in\n zip(self.params, sentence_gradients))\n # end-snippet-5\n\n # theano functions to compile\n # start-snippet-6\n self.classify = theano.function(inputs=[idxs], outputs=y_pred)\n self.sentence_train = theano.function(inputs=[idxs, y_sentence, lr],\n outputs=sentence_nll,\n updates=sentence_updates)\n # end-snippet-6 start-snippet-7\n self.normalize = theano.function(inputs=[],\n updates={self.emb:\n self.emb /\n T.sqrt((self.emb**2)\n .sum(axis=1))\n .dimshuffle(0, 'x')})\n # end-snippet-7", "metadata": "root.RNNSLU.__init__", "header": "['class', 'RNNSLU', '(', 'object', ')', ':', '___EOS___']", "index": 154 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "RN", "NS", "LU_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "nh_", ",_", "nc_", ",_", "ne_", ",_", "de_", ",_", "cs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "nh", " ", "::", " ", "dimension", " ", "of", " ", "the", " ", "hidden", " ", "layer", "\\", "10", ";", " ", " ", " ", " ", "nc", " ", "::", " ", "number", " ", "of", " ", "classe", "s", "\\", "10", ";", " ", " ", " ", " ", "ne", " ", "::", " ", "number", " ", "of", " ", "word", " ", "embed", "dings", " ", "in", " ", "the", " ", "vocab", "ular", "y", "\\", "10", ";", " ", " ", " ", " ", "de", " ", "::", " ", "dimension", " ", "of", " ", "the", " ", "word", " ", "embed", "dings", "\\", "10", ";", " ", " ", " ", " ", "cs", " ", "::", " ", "word", " ", "window", " ", "context", " ", "size", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parameter", "s", " ", "of", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "emb_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "embed", "dings", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "0.2_", "*_", "numpy_", "._", "random_", "._", "uniform_", "(_", "-_", "1.0_", ",_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ne_", "+_", "1_", ",_", "de_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "one", " ", "for", " ", "padd", "ing", " ", "at", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wx_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "wx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "0.2_", "*_", "numpy_", "._", "random_", "._", "uniform_", "(_", "-_", "1.0_", ",_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "de_", "*_", "cs_", ",_", "nh_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wh_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "wh", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "0.2_", "*_", "numpy_", "._", "random_", "._", "uniform_", "(_", "-_", "1.0_", ",_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "nh_", ",_", "nh_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "0.2_", "*_", "numpy_", "._", "random_", "._", "uniform_", "(_", "-_", "1.0_", ",_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "nh_", ",_", "nc_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "astype_", "(_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bh_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "bh", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "numpy_", "._", "zeros_", "(_", "nh_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "numpy_", "._", "zeros_", "(_", "nc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h0_", "=_", "theano_", "._", "shared_", "(_", "name_", "=_", "'", "h", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "numpy_", "._", "zeros_", "(_", "nh_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bundle_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "=_", "[_", "self_", "._", "emb_", ",_", "self_", "._", "wx_", ",_", "self_", "._", "wh_", ",_", "self_", "._", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bh_", ",_", "self_", "._", "b_", ",_", "self_", "._", "h0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "many", " ", "column", "s", " ", "as", " ", "context", " ", "window", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "many", " ", "lines", " ", "as", " ", "words", " ", "in", " ", "the", " ", "sentence_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "-", "snippet", "-3_", "\\u\\u\\uNL\\u\\u\\u_", "idxs_", "=_", "T_", "._", "imat", "rix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "self_", "._", "emb_", "[_", "idxs_", "]_", "._", "reshape_", "(_", "(_", "idxs_", "._", "shape_", "[_", "0_", "]_", ",_", "de_", "*_", "cs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "sentence_", "=_", "T_", "._", "ive", "ctor_", "(_", "'", "y", "\\u", "sentence", "'_", ")_", "#", " ", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-", "3", " ", "start", "-", "snippet", "-", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "recurrence", "_", "(_", "x", "\\u", "t_", ",_", "h", "\\u", "tm1", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "T_", "._", "dot_", "(_", "x", "\\u", "t_", ",_", "self_", "._", "wx_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "self_", "._", "wh_", ")_", "+_", "self_", "._", "bh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "softmax_", "(_", "T_", "._", "dot_", "(_", "h", "\\u", "t_", ",_", "self_", "._", "w_", ")_", "+_", "self_", "._", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "h", "\\u", "t_", ",_", "s", "\\u", "t_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "h_", ",_", "s_", "]_", ",_", "\\u_", "=_", "theano_", "._", "scan_", "(_", "fn_", "=_", "recurrence", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", "=_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "s", "\\u", "info_", "=_", "[_", "self_", "._", "h0_", ",_", "None_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "steps_", "=_", "x_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "y", "\\u", "give", "n", "\\u", "x", "\\u", "sentence_", "=_", "s_", "[_", ":_", ",_", "0_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "pred_", "=_", "T_", "._", "argmax_", "(_", "p", "\\u", "y", "\\u", "give", "n", "\\u", "x", "\\u", "sentence_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cost", " ", "and", " ", "gradi", "ents", " ", "and", " ", "learn", "ing", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "-", "snippet", "-", "5_", "\\u\\u\\uNL\\u\\u\\u_", "lr_", "=_", "T_", "._", "scalar_", "(_", "'", "lr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sentence", "\\u", "nl", "l_", "=_", "-_", "T_", "._", "mean_", "(_", "T_", "._", "log_", "(_", "p", "\\u", "y", "\\u", "give", "n", "\\u", "x", "\\u", "sentence_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "T_", "._", "arange_", "(_", "x_", "._", "shape_", "[_", "0_", "]_", ")_", ",_", "y", "\\u", "sentence_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentence", "\\u", "gradients_", "=_", "T_", "._", "grad_", "(_", "sentence", "\\u", "nl", "l_", ",_", "self_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentence", "\\u", "updates_", "=_", "Order", "ed", "Dict_", "(_", "(_", "p_", ",_", "p_", "-_", "lr_", "*_", "g_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", ",_", "g_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "zip_", "(_", "self_", "._", "params_", ",_", "sentence", "\\u", "gradients_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-", "5_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "theano", " ", "function", "s", " ", "to", " ", "compile_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "-", "snippet", "-6_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "classify_", "=_", "theano_", "._", "function_", "(_", "inputs_", "=_", "[_", "idxs_", "]_", ",_", "outputs_", "=_", "y", "\\u", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sentence", "\\u", "train_", "=_", "theano_", "._", "function_", "(_", "inputs_", "=_", "[_", "idxs_", ",_", "y", "\\u", "sentence_", ",_", "lr_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "sentence", "\\u", "nl", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "sentence", "\\u", "updates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-", "6", " ", "start", "-", "snippet", "-", "7_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "normalize_", "=_", "theano_", "._", "function_", "(_", "inputs_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "{_", "self_", "._", "emb_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "emb_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "sqrt_", "(_", "(_", "self_", "._", "emb_", "**_", "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 ]
Unused local variable
oppia/oppia/core/domain/collection_domain_test.py
[ { "content": " def test_next_explorations_with_invalid_exploration_ids(self):\n collection = collection_domain.Collection.create_default_collection(\n 'collection_id', 'A title', 'A category', 'An objective')\n collection.add_node('exp_id_1')\n\n # There should be one suggested exploration to complete by default.\n self.assertEqual(collection.get_next_exploration_ids([]), ['exp_id_1'])\n\n # If an invalid exploration ID is passed to get_next_exploration_ids(),\n # it should be ignored. This tests the situation where an exploration\n # is deleted from a collection after being completed by a user.\n self.assertEqual(\n collection.get_next_exploration_ids(['fake_exp_id']), ['exp_id_1'])", "metadata": "root.ExplorationGraphUnitTests.test_next_explorations_with_invalid_exploration_ids", "header": "['class', 'ExplorationGraphUnitTests', '(', 'test_utils', '.', 'GenericTestBase', ')', ':', '___EOS___']", "index": 394 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Explo", "ration", "Graph", "Unit", "Tests_", "(_", "test\\u", "utils_", "._", "Gene", "ric", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "next", "\\u", "exploration", "s", "\\u", "with", "\\u", "invalid", "\\u", "exploration", "\\u", "ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collection_", "=_", "collection", "\\u", "domain_", "._", "Collection_", "._", "create", "\\u", "default", "\\u", "collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "\\u", "id", "'_", ",_", "'", "A", " ", "title", "'_", ",_", "'", "A", " ", "category", "'_", ",_", "'", "An", " ", "objecti", "ve", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection_", "._", "add", "\\u", "node_", "(_", "'", "exp", "\\u", "id", "\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "shou", "ld", " ", "be", " ", "one", " ", "suggested", " ", "exploration", " ", "to", " ", "complete", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "collection_", "._", "get", "\\u", "next", "\\u", "exploration", "\\u", "ids_", "(_", "[_", "]_", ")_", ",_", "[_", "'", "exp", "\\u", "id", "\\u", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "an", " ", "invalid", " ", "exploration", " ", "ID", " ", "is", " ", "pass", "ed", " ", "to", " ", "get", "\\u", "next", "\\u", "exploration", "\\u", "ids", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "shou", "ld", " ", "be", " ", "ignore", "d", ".", " ", "Thi", "s", " ", "tests", " ", "the", " ", "situation", " ", "where", " ", "an", " ", "exploration", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "delete", "d", " ", "from", " ", "a", " ", "collection", " ", "after", " ", "bei", "ng", " ", "complete", "d", " ", "by", " ", "a", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collection_", "._", "get", "\\u", "next", "\\u", "exploration", "\\u", "ids_", "(_", "[_", "'", "fake", "\\u", "exp", "\\u", "id", "'_", "]_", ")_", ",_", "[_", "'", "exp", "\\u", "id", "\\u", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
maxpumperla/hyperas/examples/cifar_generator_cnn.py
[ { "content": "from __future__ import print_function\nfrom hyperopt import Trials, STATUS_OK, tpe\nfrom hyperas import optim\nfrom hyperas.distributions import uniform\nfrom keras.models import Sequential\nfrom keras.layers.core import Dense, Dropout, Activation, Flatten\nfrom keras.layers.convolutional import Convolution2D, MaxPooling2D\nfrom keras.optimizers import SGD\nfrom keras.preprocessing.image import ImageDataGenerator\nfrom keras.datasets import cifar10\nfrom keras.utils import np_utils\n\n\n\n\n\n\nif __name__ == '__main__':\n\n datagen, X_train, Y_train, X_test, Y_test = data()\n\n best_run, best_model = optim.minimize(model=model,\n data=data,\n algo=tpe.suggest,\n max_evals=5,\n trials=Trials())\n\n print(\"Evalutation of best performing model:\")\n print(best_model.evaluate(X_test, Y_test))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def data():\n nb_classes = 10\n # the data, shuffled and split between train and test sets\n (X_train, y_train), (X_test, y_test) = cifar10.load_data()\n print('X_train shape:', X_train.shape)\n print(X_train.shape[0], 'train samples')\n print(X_test.shape[0], 'test samples')\n\n # convert class vectors to binary class matrices\n Y_train = np_utils.to_categorical(y_train, nb_classes)\n Y_test = np_utils.to_categorical(y_test, nb_classes)\n\n X_train = X_train.astype('float32')\n X_test = X_test.astype('float32')\n X_train /= 255\n X_test /= 255\n\n # this will do preprocessing and realtime data augmentation\n datagen = ImageDataGenerator(\n featurewise_center=False, # set input mean to 0 over the dataset\n samplewise_center=False, # set each sample mean to 0\n featurewise_std_normalization=False, # divide inputs by std of the dataset\n samplewise_std_normalization=False, # divide each input by its std\n zca_whitening=False, # apply ZCA whitening\n rotation_range=0, # randomly rotate images in the range (degrees, 0 to 180)\n width_shift_range=0.1, # randomly shift images horizontally (fraction of total width)\n height_shift_range=0.1, # randomly shift images vertically (fraction of total height)\n horizontal_flip=True, # randomly flip images\n vertical_flip=False) # randomly flip images\n\n # compute quantities required for featurewise normalization\n # (std, mean, and principal components if ZCA whitening is applied)\n datagen.fit(X_train)\n\n return datagen, X_train, Y_train, X_test, Y_test", "metadata": "root.data", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def model(datagen, X_train, Y_train, X_test, Y_test):\n batch_size = 32\n nb_epoch = 200\n\n # input image dimensions\n img_rows, img_cols = 32, 32\n # the CIFAR10 images are RGB\n img_channels = 3\n\n model = Sequential()\n\n model.add(Convolution2D(32, 3, 3, border_mode='same',\n input_shape=(img_channels, img_rows, img_cols)))\n model.add(Activation('relu'))\n model.add(Convolution2D(32, 3, 3))\n model.add(Activation('relu'))\n model.add(MaxPooling2D(pool_size=(2, 2)))\n model.add(Dropout({{uniform(0, 1)}}))\n\n model.add(Convolution2D(64, 3, 3, border_mode='same'))\n model.add(Activation('relu'))\n model.add(Convolution2D(64, 3, 3))\n model.add(Activation('relu'))\n model.add(MaxPooling2D(pool_size=(2, 2)))\n model.add(Dropout({{uniform(0, 1)}}))\n\n model.add(Flatten())\n model.add(Dense(512))\n model.add(Activation('relu'))\n model.add(Dropout(0.5))\n model.add(Dense(nb_classes))\n model.add(Activation('softmax'))\n\n # let's train the model using SGD + momentum (how original).\n sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)\n model.compile(loss='categorical_crossentropy',\n optimizer=sgd,\n metrics=['accuracy'])\n\n # fit the model on the batches generated by datagen.flow()\n model.fit_generator(datagen.flow(X_train, Y_train,\n batch_size=batch_size),\n samples_per_epoch=X_train.shape[0],\n nb_epoch=nb_epoch,\n validation_data=(X_test, Y_test))\n\n score, acc = model.evaluate(X_test, Y_test, verbose=0)\n\n return {'loss': -acc, 'status': STATUS_OK, 'model': model}", "metadata": "root.model", "header": "['module', '___EOS___']", "index": 50 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hyper", "opt_", "import_", "Trial", "s_", ",_", "STATUS", "\\u", "OK_", ",_", "tp", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hyper", "as_", "import_", "optim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hyper", "as_", "._", "distributions_", "import_", "uniform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "models_", "import_", "Sequential_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "core_", "import_", "Dense_", ",_", "Dropout_", ",_", "Activation_", ",_", "Flatten_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "layers_", "._", "convolution", "al_", "import_", "Convolution", "2", "D_", ",_", "Max", "Pooling", "2", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "optimizers_", "import_", "SGD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "preprocessing_", "._", "image_", "import_", "Image", "Data", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "datasets_", "import_", "cifar", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keras_", "._", "utils_", "import_", "np", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "gen_", ",_", "X", "\\u", "train_", ",_", "Y", "\\u", "train_", ",_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", "=_", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "best", "\\u", "run_", ",_", "best", "\\u", "model_", "=_", "optim_", "._", "minimize_", "(_", "model_", "=_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algo_", "=_", "tp", "e_", "._", "suggest", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "evals_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trials_", "=_", "Trial", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Eval", "utat", "ion", " ", "of", " ", "best", " ", "perform", "ing", " ", "model", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "best", "\\u", "model_", "._", "evaluate_", "(_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb", "\\u", "classes_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "data", ",", " ", "shuffled", " ", "and", " ", "split", " ", "bet", "ween", " ", "train", " ", "and", " ", "test", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "X", "\\u", "train_", ",_", "y", "\\u", "train_", ")_", ",_", "(_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", ")_", "=_", "cifar", "10_", "._", "load", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "X", "\\u", "train", " ", "shape", ":'_", ",_", "X", "\\u", "train_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "X", "\\u", "train_", "._", "shape_", "[_", "0_", "]_", ",_", "'", "train", " ", "samples", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "X", "\\u", "test_", "._", "shape_", "[_", "0_", "]_", ",_", "'", "test", " ", "samples", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "class", " ", "vector", "s", " ", "to", " ", "binar", "y", " ", "class", " ", "matrices_", "\\u\\u\\uNL\\u\\u\\u_", "Y", "\\u", "train_", "=_", "np", "\\u", "utils_", "._", "to", "\\u", "categorical_", "(_", "y", "\\u", "train_", ",_", "nb", "\\u", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "test_", "=_", "np", "\\u", "utils_", "._", "to", "\\u", "categorical_", "(_", "y", "\\u", "test_", ",_", "nb", "\\u", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X", "\\u", "train_", "=_", "X", "\\u", "train_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "test_", "=_", "X", "\\u", "test_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "train_", "/=_", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "test_", "/=_", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "do", " ", "preproc", "essi", "ng", " ", "and", " ", "realtime", " ", "data", " ", "augmenta", "tion_", "\\u\\u\\uNL\\u\\u\\u_", "data", "gen_", "=_", "Image", "Data", "Generator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "wis", "e\\u", "center_", "=_", "False_", ",_", "#", " ", "set", " ", "input", " ", "mean", " ", "to", " ", "0", " ", "over", " ", "the", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "wis", "e\\u", "center_", "=_", "False_", ",_", "#", " ", "set", " ", "each", " ", "sample", " ", "mean", " ", "to", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "wis", "e\\u", "std", "\\u", "normalization_", "=_", "False_", ",_", "#", " ", "divide", " ", "inputs", " ", "by", " ", "std", " ", "of", " ", "the", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "wis", "e\\u", "std", "\\u", "normalization_", "=_", "False_", ",_", "#", " ", "divide", " ", "each", " ", "input", " ", "by", " ", "its", " ", "std_", "\\u\\u\\uNL\\u\\u\\u_", "zc", "a", "\\u", "whiten", "ing_", "=_", "False_", ",_", "#", " ", "appl", "y", " ", "ZC", "A", " ", "whiten", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "rotati", "on", "\\u", "range_", "=_", "0_", ",_", "#", " ", "random", "ly", " ", "rota", "te", " ", "images", " ", "in", " ", "the", " ", "range", " ", "(", "degr", "ees", ",", " ", "0", " ", "to", " ", "180", ")_", "\\u\\u\\uNL\\u\\u\\u_", "widt", "h", "\\u", "shift", "\\u", "range_", "=_", "0.1_", ",_", "#", " ", "random", "ly", " ", "shift", " ", "images", " ", "horizon", "tally", " ", "(", "fract", "ion", " ", "of", " ", "total", " ", "widt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "height", "\\u", "shift", "\\u", "range_", "=_", "0.1_", ",_", "#", " ", "random", "ly", " ", "shift", " ", "images", " ", "vertical", "ly", " ", "(", "fract", "ion", " ", "of", " ", "total", " ", "height", ")_", "\\u\\u\\uNL\\u\\u\\u_", "horizon", "tal", "\\u", "flip_", "=_", "True_", ",_", "#", " ", "random", "ly", " ", "flip", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "vertical", "\\u", "flip_", "=_", "False_", ")_", "#", " ", "random", "ly", " ", "flip", " ", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "quantities", " ", "require", "d", " ", "for", " ", "feature", "wis", "e", " ", "normalization_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "std", ",", " ", "mean", ",", " ", "and", " ", "principal", " ", "component", "s", " ", "if", " ", "ZC", "A", " ", "whiten", "ing", " ", "is", " ", "applied", ")_", "\\u\\u\\uNL\\u\\u\\u_", "data", "gen_", "._", "fit_", "(_", "X", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data", "gen_", ",_", "X", "\\u", "train_", ",_", "Y", "\\u", "train_", ",_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "model_", "(_", "data", "gen_", ",_", "X", "\\u", "train_", ",_", "Y", "\\u", "train_", ",_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch", "\\u", "size_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "epoch_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "image", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "rows_", ",_", "img", "\\u", "cols_", "=_", "32_", ",_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "CIF", "AR", "10", " ", "images", " ", "are", " ", "RGB_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "channels_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "Sequential_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "add_", "(_", "Convolution", "2", "D_", "(_", "32_", ",_", "3_", ",_", "3_", ",_", "border", "\\u", "mode_", "=_", "'", "same", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "shape_", "=_", "(_", "img", "\\u", "channels_", ",_", "img", "\\u", "rows_", ",_", "img", "\\u", "cols_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "relu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Convolution", "2", "D_", "(_", "32_", ",_", "3_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "relu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Max", "Pooling", "2", "D_", "(_", "pool", "\\u", "size_", "=_", "(_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Dropout_", "(_", "{_", "{_", "uniform_", "(_", "0_", ",_", "1_", ")_", "}_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "add_", "(_", "Convolution", "2", "D_", "(_", "64_", ",_", "3_", ",_", "3_", ",_", "border", "\\u", "mode_", "=_", "'", "same", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "relu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Convolution", "2", "D_", "(_", "64_", ",_", "3_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "relu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Max", "Pooling", "2", "D_", "(_", "pool", "\\u", "size_", "=_", "(_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Dropout_", "(_", "{_", "{_", "uniform_", "(_", "0_", ",_", "1_", ")_", "}_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "add_", "(_", "Flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Dense_", "(_", "512_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "relu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Dropout_", "(_", "0.5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Dense_", "(_", "nb", "\\u", "classes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Activation_", "(_", "'", "soft", "max", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "train", " ", "the", " ", "model", " ", "usi", "ng", " ", "SGD", " ", "+", " ", "moment", "um", " ", "(", "how", " ", "original", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "sgd", "_", "=_", "SGD", "_", "(_", "lr_", "=_", "0.01_", ",_", "decay_", "=_", "1e-6_", ",_", "momentum_", "=_", "0.9_", ",_", "nest", "ero", "v_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "compile_", "(_", "loss_", "=_", "'", "categor", "ical", "\\u", "crossentropy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "optimizer_", "=_", "sgd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metrics_", "=_", "[_", "'", "accu", "rac", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fit", " ", "the", " ", "model", " ", "on", " ", "the", " ", "batche", "s", " ", "generat", "ed", " ", "by", " ", "data", "gen", ".", "flow", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "fit", "\\u", "generator_", "(_", "data", "gen_", "._", "flow_", "(_", "X", "\\u", "train_", ",_", "Y", "\\u", "train_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "batch", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "samples", "\\u", "per", "\\u", "epoch_", "=_", "X", "\\u", "train_", "._", "shape_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nb", "\\u", "epoch_", "=_", "nb", "\\u", "epoch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validation", "\\u", "data_", "=_", "(_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "score_", ",_", "acc_", "=_", "model_", "._", "evaluate_", "(_", "X", "\\u", "test_", ",_", "Y", "\\u", "test_", ",_", "verbose_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "loss", "'_", ":_", "-_", "acc_", ",_", "'", "status", "'_", ":_", "STATUS", "\\u", "OK_", ",_", "'", "model", "'_", ":_", "model_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused local variable
chango/inferno/inferno/lib/result.py
[ { "content": "def reduce_result(iter, **kwargs):\n\n import csv\n import sys\n\n def default_flush_callback(stream):\n stream.flush()\n return stream\n\n output_stream = kwargs.get('output_stream', sys.stdout)\n flush_schedule = kwargs.get('flush_schedule', 5000)\n flush_callback = kwargs.get('flush_callback', default_flush_callback)\n\n writer = csv.writer(output_stream)\n count = 0\n for keys, values in iter:\n data = keys + values\n row = [unicode(x).encode('utf-8') for x in data]\n writer.writerow(row)\n count += 1\n if count > flush_schedule:\n output_stream = flush_callback(output_stream)\n count = 0\n flush_callback(output_stream)", "metadata": "root.reduce_result", "header": "['module', '___EOS___']", "index": 27 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reduce", "\\u", "result_", "(_", "iter_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "default", "\\u", "flush", "\\u", "callback_", "(_", "stream_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "stream_", "=_", "kwargs_", "._", "get_", "(_", "'", "output", "\\u", "stream", "'_", ",_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush", "\\u", "schedule_", "=_", "kwargs_", "._", "get_", "(_", "'", "flush", "\\u", "schedule", "'_", ",_", "5000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush", "\\u", "callback_", "=_", "kwargs_", "._", "get_", "(_", "'", "flush", "\\u", "callback", "'_", ",_", "default", "\\u", "flush", "\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "=_", "csv_", "._", "writer_", "(_", "output", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "keys_", ",_", "values_", "in_", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "keys_", "+_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "[_", "unicode_", "(_", "x_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "for_", "x_", "in_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", ">_", "flush", "\\u", "schedule_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "stream_", "=_", "flush", "\\u", "callback_", "(_", "output", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flush", "\\u", "callback_", "(_", "output", "\\u", "stream_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
metglobal/django-easy-cms/easy_cms/utils.py
[ { "content": "def generic_autodiscover(module_name):\n \"\"\"\n I have copy/pasted this code too many times...Dynamically autodiscover a\n particular module_name in a django project's INSTALLED_APPS directories,\n a-la django admin's autodiscover() method.\n Usage:\n generic_autodiscover('commands') <-- find all commands.py and load 'em\n \"\"\"\n from django.utils.importlib import import_module\n from django.core.exceptions import ImproperlyConfigured\n import imp\n import sys\n from django.conf import settings\n\n for app in settings.INSTALLED_APPS:\n try:\n import_module(app)\n app_path = sys.modules[app].__path__\n except AttributeError:\n continue\n try:\n imp.find_module(module_name, app_path)\n except ImportError:\n continue\n try:\n import_module('%s.%s' % (app, module_name))\n except ImproperlyConfigured:\n continue\n app_path = sys.modules['%s.%s' % (app, module_name)]", "metadata": "root.generic_autodiscover", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "gener", "ic", "\\u", "autodiscover", "_", "(_", "module", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "I", " ", "have", " ", "copy", "/", "paste", "d", " ", "this", " ", "code", " ", "too", " ", "many", " ", "times", "...", "Dynamic", "ally", " ", "autodiscover", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "partic", "ular", " ", "module", "\\u", "name", " ", "in", " ", "a", " ", "django", " ", "project", "'", "s", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "director", "ies", ",", "\\", "10", ";", " ", " ", " ", " ", "a", "-", "la", " ", "django", " ", "admin", "'", "s", " ", "autodiscover", "()", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", ":", "\\", "10", ";", " ", " ", " ", " ", "gener", "ic", "\\u", "autodiscover", "('", "command", "s", "')", " ", "<-", "-", " ", "find", " ", "all", " ", "command", "s", ".", "py", " ", "and", " ", "load", " ", "'", "em", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "importlib_", "import_", "import", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\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", "\\u", "module_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "path_", "=_", "sys_", "._", "modules_", "[_", "app_", "]_", "._", "\\u\\u", "path\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imp_", "._", "find", "\\u", "module_", "(_", "module", "\\u", "name_", ",_", "app", "\\u", "path_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import", "\\u", "module_", "(_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "app_", ",_", "module", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Impro", "perl", "y", "Configured_", ":_", "\\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_", "app", "\\u", "path_", "=_", "sys_", "._", "modules_", "[_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "app_", ",_", "module", "\\u", "name_", ")_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
jdunck/django-template-help/template_help/templatetags/context_helper_exhaustive.py
[ { "content": "def _hash(o, seen=None):\n if seen is None:\n seen = set()\n if id(o) in seen:\n return \"recursion on %s\" % id(o)\n else:\n seen.add(id(o))\n print \"h%s\" % o\n try:\n return hash(o)\n except TypeError:\n pass\n if isinstance(o, dict):\n return ('dict', (tuple((_hash(k, seen), _hash(v, seen)) for k,v in sorted(o.items()))))\n elif isinstance(o, list):\n return ('list', tuple(_hash(v, seen) for v in o))\n elif isinstance(o, set):\n return ('set', tuple(_hash(v, seen) for v in sorted(o)))\n else:\n raise TypeError, \"Unable to hash %s\" % o", "metadata": "root._hash", "header": "['module', '___EOS___']", "index": 55 } ]
[]
[]
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", "hash_", "(_", "o_", ",_", "seen_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "seen_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seen_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "id_", "(_", "o_", ")_", "in_", "seen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "recursion", " ", "on", " ", "%", "s", "\"_", "%_", "id_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seen_", "._", "add_", "(_", "id_", "(_", "o_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "h", "%", "s", "\"_", "%_", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "o_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "dict", "'_", ",_", "(_", "tuple_", "(_", "(_", "\\u", "hash_", "(_", "k_", ",_", "seen_", ")_", ",_", "\\u", "hash_", "(_", "v_", ",_", "seen_", ")_", ")_", "for_", "k_", ",_", "v_", "in_", "sorted_", "(_", "o_", "._", "items_", "(_", ")_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "o_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "list", "'_", ",_", "tuple_", "(_", "\\u", "hash_", "(_", "v_", ",_", "seen_", ")_", "for_", "v_", "in_", "o_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "o_", ",_", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "set", "'_", ",_", "tuple_", "(_", "\\u", "hash_", "(_", "v_", ",_", "seen_", ")_", "for_", "v_", "in_", "sorted_", "(_", "o_", ")_", ")_", ")_", "\\u\\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_", ",_", "\"", "Una", "ble", " ", "to", " ", "hash", " ", "%", "s", "\"_", "%_", "o_", "\\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 ]
Unused local variable
lonelycode/Mojo/Mojo/Backends/PyMongoBackend/pymongo_backend.py
[ { "content": " def insert(self, documents, *args, **kwargs):\n ret_vals = []\n if type(documents) != list:\n raise ValueError(\"Insert requires a list as input, for single query use [document]\")\n else:\n insert_list = []\n for doc in documents:\n del doc['_id']\n insert_list.append(doc.get_value())\n\n ids = self.session._db[self.collection_name].insert(insert_list)\n\n index = 0\n for doc in documents:\n doc['_id'] = ids[index]\n index += 1\n\n ret_vals.append(doc)\n\n return ret_vals", "metadata": "root.Collection.insert", "header": "['class', 'Collection', '(', 'CollectionModelInterface', ')', ':', '___EOS___']", "index": 21 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Collection_", "(_", "Collecti", "on", "Model", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert_", "(_", "self_", ",_", "documents_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret", "\\u", "vals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "documents_", ")_", "!=_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Insert", " ", "require", "s", " ", "a", " ", "list", " ", "as", " ", "input", ",", " ", "for", " ", "single", " ", "query", " ", "use", " ", "[", "document", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "documents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "doc_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "\\u", "list_", "._", "append_", "(_", "doc_", "._", "get", "\\u", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ids_", "=_", "self_", "._", "session_", "._", "\\u", "db_", "[_", "self_", "._", "collection", "\\u", "name_", "]_", "._", "insert_", "(_", "insert", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "documents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "[_", "'\\u", "id", "'_", "]_", "=_", "ids_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "vals_", "._", "append_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret", "\\u", "vals_", "\\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 ]
Should use a 'with' statement
stal888/Tox-QuickDNS/yuu-lite.py
[ { "content": "def main():\n with open(\"config.json\", \"r\") as config_file:\n cfg = json.load(config_file)\n\n cc = cryptocore.CryptoCore()\n print(\"Hi.\")\n print(\"My tox3 public key is {0}.\".format(cc.public_key))\n\n if \"pid_file\" in cfg:\n with open(cfg[\"pid_file\"], \"w\") as pid:\n pid.write(str(os.getpid()))\n\n try:\n server = make_server(cc, cfg)\n if \"suid\" in cfg:\n print(\"SUID...\")\n if os.getuid() == 0:\n if \":\" not in cfg[\"suid\"]:\n user = cfg[\"suid\"]\n group = None\n else:\n user, group = cfg[\"suid\"].split(\":\", 1)\n uid = pwd.getpwnam(user).pw_uid\n if group:\n gid = grp.getgrnam(group).gr_gid\n else:\n gid = pwd.getpwnam(user).pw_gid\n os.setgid(gid)\n os.setuid(uid)\n else:\n print(\"error: we're not root. Exiting.\")\n sys.exit()\n server.start()\n finally:\n os.remove(cfg[\"pid_file\"])", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 174 } ]
[]
[]
0
true
[ "[CLS]_", "Sho", "ul", "d_", "use_", "a_", "'", "with", "'_", "statement_", "[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 ", " _", "with_", "open_", "(_", "\"", "config", ".", "json", "\"_", ",_", "\"", "r", "\"_", ")_", "as_", "config", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg_", "=_", "json_", "._", "load_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cc_", "=_", "crypto", "core_", "._", "Crypto", "Core_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Hi", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "My", " ", "tox", "3", " ", "public", " ", "key", " ", "is", " ", "{", "0", "}.\"_", "._", "format_", "(_", "cc_", "._", "public", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "pid", "\\u", "file", "\"_", "in_", "cfg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "cfg_", "[_", "\"", "pid", "\\u", "file", "\"_", "]_", ",_", "\"", "w", "\"_", ")_", "as_", "pid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "._", "write_", "(_", "str_", "(_", "os_", "._", "getpid_", "(_", ")_", ")_", ")_", "\\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 ", " _", "server_", "=_", "make", "\\u", "server_", "(_", "cc_", ",_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "sui", "d", "\"_", "in_", "cfg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "SU", "ID", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "getu", "id_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\":\"_", "not_", "in_", "cfg_", "[_", "\"", "sui", "d", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user_", "=_", "cfg_", "[_", "\"", "sui", "d", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "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 ", " ", "_", "user_", ",_", "group_", "=_", "cfg_", "[_", "\"", "sui", "d", "\"_", "]_", "._", "split_", "(_", "\":\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uid_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "user_", ")_", "._", "pw", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gid_", "=_", "grp_", "._", "getg", "rnam", "_", "(_", "group_", ")_", "._", "gr", "\\u", "gid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gid_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "user_", ")_", "._", "pw", "\\u", "gid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "set", "gid_", "(_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "set", "uid_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "error", ":", " ", "we", "'", "re", " ", "not", " ", "root", ".", " ", "Exi", "ting", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "start_", "(_", ")_", "\\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 ", " _", "os_", "._", "remove_", "(_", "cfg_", "[_", "\"", "pid", "\\u", "file", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Duplicate key in dict literal
home-assistant/home-assistant/tests/components/test_mqtt_eventstream.py
[ { "content": " @patch('homeassistant.components.mqtt.publish')\n @patch('homeassistant.core.dt_util.utcnow')\n def test_state_changed_event_sends_message(self, mock_utcnow, mock_pub):\n \"\"\"\"Test the sending of a new message if event changed.\"\"\"\n now = dt_util.as_utc(dt_util.now())\n e_id = 'fake.entity'\n pub_topic = 'bar'\n mock_utcnow.return_value = now\n\n # Add the eventstream component for publishing events\n self.assertTrue(self.add_eventstream(pub_topic=pub_topic))\n self.hass.pool.block_till_done()\n\n # Reset the mock because it will have already gotten calls for the\n # mqtt_eventstream state change on initialization, etc.\n mock_pub.reset_mock()\n\n # Set a state of an entity\n mock_state_change_event(self.hass, State(e_id, 'on'))\n self.hass.pool.block_till_done()\n\n # The order of the JSON is indeterminate,\n # so first just check that publish was called\n mock_pub.assert_called_with(self.hass, pub_topic, ANY)\n self.assertTrue(mock_pub.called)\n\n # Get the actual call to publish and make sure it was the one\n # we were looking for\n msg = mock_pub.call_args[0][2]\n event = {}\n event['event_type'] = EVENT_STATE_CHANGED\n new_state = {\n \"last_updated\": now.isoformat(),\n \"state\": \"on\",\n \"entity_id\": e_id,\n \"attributes\": {},\n \"last_changed\": now.isoformat()\n }\n event['event_data'] = {\"new_state\": new_state, \"entity_id\": e_id}\n\n # Verify that the message received was that expected\n self.assertEqual(json.loads(msg), event)", "metadata": "root.TestMqttEventStream.test_state_changed_event_sends_message", "header": "['class', 'TestMqttEventStream', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[]
[]
0
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "Test", "Mq", "tt", "Event", "Stream_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "home", "assistan", "t", ".", "component", "s", ".", "mqtt", ".", "publi", "sh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "patch_", "(_", "'", "home", "assistan", "t", ".", "core", ".", "dt", "\\u", "util", ".", "utc", "now", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "state", "\\u", "change", "d\\u", "event", "\\u", "send", "s", "\\u", "message_", "(_", "self_", ",_", "mock", "\\u", "utcnow_", ",_", "mock", "\\u", "pub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\"", "Test", " ", "the", " ", "sendin", "g", " ", "of", " ", "a", " ", "new", " ", "message", " ", "if", " ", "event", " ", "change", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "dt", "\\u", "util_", "._", "as", "\\u", "utc_", "(_", "dt", "\\u", "util_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "id_", "=_", "'", "fake", ".", "entity", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "\\u", "topic_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "utcnow_", "._", "return", "\\u", "value_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "events", "tream", " ", "component", " ", "for", " ", "publishing", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "add", "\\u", "events", "tream_", "(_", "pub", "\\u", "topic_", "=_", "pub", "\\u", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hass_", "._", "pool_", "._", "block", "\\u", "till", "\\u", "done_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "the", " ", "mock", " ", "bec", "aus", "e", " ", "it", " ", "will", " ", "have", " ", "alr", "ead", "y", " ", "got", "ten", " ", "calls", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mqtt", "\\u", "events", "tream", " ", "state", " ", "change", " ", "on", " ", "initialization", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "pub_", "._", "reset", "\\u", "mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "a", " ", "state", " ", "of", " ", "an", " ", "entity_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "state", "\\u", "change", "\\u", "event_", "(_", "self_", "._", "hass_", ",_", "State_", "(_", "e\\u", "id_", ",_", "'", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hass_", "._", "pool_", "._", "block", "\\u", "till", "\\u", "done_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "order", " ", "of", " ", "the", " ", "JSO", "N", " ", "is", " ", "inde", "terminate", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "first", " ", "just", " ", "check", " ", "tha", "t", " ", "publi", "sh", " ", "was", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "pub_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "self_", "._", "hass_", ",_", "pub", "\\u", "topic_", ",_", "ANY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock", "\\u", "pub_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "actual", " ", "call", " ", "to", " ", "publi", "sh", " ", "and", " ", "make", " ", "sure", " ", "it", " ", "was", " ", "the", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "wer", "e", " ", "look", "ing", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "mock", "\\u", "pub_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "[_", "'", "event", "\\u", "type", "'_", "]_", "=_", "EVENT", "\\u", "STATE", "\\u", "CHANGED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "state_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "last", "\\u", "update", "d", "\"_", ":_", "now_", "._", "isoformat_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "state", "\"_", ":_", "\"", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entity", "\\u", "id", "\"_", ":_", "e\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "attribute", "s", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "last", "\\u", "change", "d", "\"_", ":_", "now_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "[_", "'", "event", "\\u", "data", "'_", "]_", "=_", "{_", "\"", "new", "\\u", "state", "\"_", ":_", "new", "\\u", "state_", ",_", "\"", "entity", "\\u", "id", "\"_", ":_", "e\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "the", " ", "message", " ", "receive", "d", " ", "was", " ", "tha", "t", " ", "expected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "json_", "._", "loads_", "(_", "msg_", ")_", ",_", "event_", ")_", "\\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, 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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 ]
Testing equality to None
bradfitz/addressbooker/gdata/service.py
[ { "content": " def SetAuthSubToken(self, token, scopes=None):\n \"\"\"Sets the token sent in requests to an AuthSub token.\n\n Sets the current_token and attempts to add the token to the token_store.\n \n Only use this method if you have received a token from the AuthSub\n service. The auth token is set automatically when UpgradeToSessionToken()\n is used. See documentation for Google AuthSub here:\n http://code.google.com/apis/accounts/AuthForWebApps.html \n\n Args:\n token: gdata.auth.AuthSubToken or string The token returned by the\n AuthSub service. If the token is an AuthSubToken, the scope\n information stored in the AuthSubToken is used. If the token\n is a string, the scopes parameter is used to determine the\n valid scopes.\n scopes: list of URLs for which the token is valid. This is only used\n if the token parameter is a string.\n \"\"\"\n if not isinstance(token, gdata.auth.AuthSubToken):\n token_string = token\n token = gdata.auth.AuthSubToken()\n token.set_token_string(token_string)\n\n # If no scopes were set for the token, use the scopes passed in, or\n # try to determine the scopes based on the current service name. If\n # all else fails, set the token to match all requests.\n if not token.scopes:\n if scopes is None:\n scopes = lookup_scopes(self.service)\n if scopes is None:\n scopes = [atom.token_store.SCOPE_ALL]\n token.scopes = scopes\n if self.auto_set_current_token:\n self.current_token = token\n if self.auto_store_tokens:\n self.token_store.add_token(token)", "metadata": "root.GDataService.SetAuthSubToken", "header": "['class', 'GDataService', '(', 'atom', '.', 'service', '.', 'AtomService', ')', ':', '___EOS___']", "index": 345 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "GD", "ata", "Service_", "(_", "atom_", "._", "service_", "._", "Atom", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Set", "Auth", "Sub", "Token_", "(_", "self_", ",_", "token_", ",_", "scopes_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "token", " ", "sent", " ", "in", " ", "request", "s", " ", "to", " ", "an", " ", "Auth", "Sub", " ", "token", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "current", "\\u", "token", " ", "and", " ", "atte", "mpt", "s", " ", "to", " ", "add", " ", "the", " ", "token", " ", "to", " ", "the", " ", "token", "\\u", "store", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "use", " ", "this", " ", "method", " ", "if", " ", "you", " ", "have", " ", "receive", "d", " ", "a", " ", "token", " ", "from", " ", "the", " ", "Auth", "Sub", "\\", "10", ";", " ", " ", " ", " ", "service", ".", " ", "The", " ", "auth", " ", "token", " ", "is", " ", "set", " ", "automati", "call", "y", " ", "whe", "n", " ", "Upgrade", "To", "Sess", "ion", "Token", "()", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", ".", " ", "See", " ", "documentation", " ", "for", " ", "Goo", "gle", " ", "Auth", "Sub", " ", "here", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "account", "s", "/", "Auth", "For", "Web", "App", "s", ".", "html", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", "token", ":", " ", "gdat", "a", ".", "auth", ".", "Auth", "Sub", "Token", " ", "or", " ", "string", " ", "The", " ", "token", " ", "return", "ed", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Auth", "Sub", " ", "service", ".", " ", "If", " ", "the", " ", "token", " ", "is", " ", "an", " ", "Auth", "Sub", "Token", ",", " ", "the", " ", "scope", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "store", "d", " ", "in", " ", "the", " ", "Auth", "Sub", "Token", " ", "is", " ", "used", ".", " ", "If", " ", "the", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "a", " ", "string", ",", " ", "the", " ", "scope", "s", " ", "parameter", " ", "is", " ", "used", " ", "to", " ", "dete", "rmin", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "valid", " ", "scope", "s", ".", "\\", "10", ";", " ", "scope", "s", ":", " ", "list", " ", "of", " ", "URL", "s", " ", "for", " ", "whi", "ch", " ", "the", " ", "token", " ", "is", " ", "valid", ".", " ", "Thi", "s", " ", "is", " ", "only", " ", "used", "\\", "10", ";", " ", " ", " ", " ", " ", "if", " ", "the", " ", "token", " ", "parameter", " ", "is", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "token_", ",_", "gdata_", "._", "auth_", "._", "Auth", "Sub", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token", "\\u", "string_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "gdata_", "._", "auth_", "._", "Auth", "Sub", "Token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "._", "set\\u", "token", "\\u", "string_", "(_", "token", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "scope", "s", " ", "wer", "e", " ", "set", " ", "for", " ", "the", " ", "token", ",", " ", "use", " ", "the", " ", "scope", "s", " ", "pass", "ed", " ", "in", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "scope", "s", " ", "based", " ", "on", " ", "the", " ", "current", " ", "service", " ", "name", ".", " ", "If_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "else", " ", "fail", "s", ",", " ", "set", " ", "the", " ", "token", " ", "to", " ", "match", " ", "all", " ", "request", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "token_", "._", "scopes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "scopes_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scopes_", "=_", "look", "up", "\\u", "scopes_", "(_", "self_", "._", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scopes_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scopes_", "=_", "[_", "atom_", "._", "token", "\\u", "store_", "._", "SCOPE", "\\u", "ALL_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "token_", "._", "scopes_", "=_", "scopes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "auto", "\\u", "set\\u", "current", "\\u", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "\\u", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "auto", "\\u", "store", "\\u", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "token", "\\u", "store_", "._", "add", "\\u", "token_", "(_", "token_", ")_", "\\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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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 ]
Unused import
turbulenz/turbulenz_local/turbulenz_local/controllers/apiv1/custommetrics.py
[ { "content": "# Copyright (c) 2012-2013 Turbulenz Limited\n\nfrom simplejson import loads\n\nfrom turbulenz_local.lib.exceptions import ApiException, BadRequest\nfrom turbulenz_local.lib.servicestatus import ServiceStatus\nfrom turbulenz_local.decorators import secure_post\n\nfrom turbulenz_local.controllers import BaseController\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _validate_event(event_key, event_value):\n try:\n event_key = str(event_key)\n except ValueError:\n raise ValueError('Event key should not contain non-ascii characters')\n\n if not event_key:\n raise ValueError('Event key must be a non-empty string')\n\n if isinstance(event_value, (str, unicode)):\n try:\n event_value = loads(event_value)\n except ValueError:\n raise ValueError('Event value must be a number or an array of numbers')\n\n if not isinstance(event_value, list):\n try:\n event_value = float(event_value)\n except (TypeError, ValueError):\n raise ValueError('Event value must be a number or an array of numbers')\n else:\n try:\n for index, value in enumerate(event_value):\n event_value[index] = float(value)\n except (TypeError, ValueError):\n raise ValueError('Event value array elements must be numbers')\n\n return event_key, event_value", "metadata": "root._validate_event", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class CustommetricsController(BaseController):\n\n custommetrics_service = ServiceStatus.check_status_decorator('customMetrics')\n\n\n", "metadata": "root.CustommetricsController", "header": "['module', '___EOS___']", "index": 39 }, { "content": " @classmethod\n @custommetrics_service\n @secure_post\n def add_event(cls, slug, params=None):\n # Only a validation simulation! Custom events are only tracked on the game site.\n try:\n session = cls.game_session_list.get_session(params['gameSessionId'])\n except (KeyError, TypeError):\n raise BadRequest('Invalid game session id')\n\n game = session.game\n if game is None:\n raise ApiException('No game with that slug')\n\n if slug != game.slug:\n raise BadRequest('Slug and game session do not match')\n\n try:\n event_key = params['key']\n except (TypeError, KeyError):\n raise BadRequest('Event key missing')\n\n try:\n event_value = params['value']\n except (TypeError, KeyError):\n raise BadRequest('Event value missing')\n del params['value']\n\n try:\n event_key, event_value = _validate_event(event_key, event_value)\n except ValueError as e:\n raise BadRequest(e.message)\n\n # If reaches this point, assume success\n return {'ok': True, 'data': {'msg': 'Added \"' + str(event_value) + '\" for \"' + event_key + '\" ' \\\n '(Simulation only - Custom events are only tracked on the game site)'}}", "metadata": "root.CustommetricsController.add_event", "header": "['class', 'CustommetricsController', '(', 'BaseController', ')', ':', '___EOS___']", "index": 43 }, { "content": " @classmethod\n @custommetrics_service\n @secure_post\n def add_event_batch(cls, slug, params=None):\n # Only a validation simulation! Custom events are only tracked on the game site.\n try:\n session = cls.game_session_list.get_session(params['gameSessionId'])\n except (KeyError, TypeError):\n raise BadRequest('Invalid game session id')\n\n game = session.game\n if game is None:\n raise ApiException('No game with that slug')\n\n if slug != game.slug:\n raise BadRequest('Slug and game session do not match')\n\n try:\n event_batch = params['batch']\n except (TypeError, KeyError):\n raise BadRequest('Event batch missing')\n del params['batch']\n\n if not isinstance(event_batch, list):\n raise BadRequest('Event batch must be an array of events')\n\n for event in event_batch:\n try:\n event_key = event['key']\n except (TypeError, KeyError):\n raise BadRequest('Event key missing')\n\n try:\n event_value = event['value']\n except (TypeError, KeyError):\n raise BadRequest('Event value missing')\n\n try:\n event_key, event_value = _validate_event(event_key, event_value)\n except ValueError as e:\n raise BadRequest(e.message)\n\n try:\n event_time = float(event['timeOffset'])\n except (TypeError, KeyError):\n raise BadRequest('Event time offset missing')\n except ValueError:\n raise BadRequest('Event time offset should be a float')\n\n if event_time > 0:\n raise BadRequest('Event time offsets should be <= 0 to represent older events')\n\n # If reaches this point, assume success\n return {'ok': True, 'data': {'msg': 'Added %d events ' \\\n '(Simulation only - Custom events are only tracked on the game site)' %\n len(event_batch)}}", "metadata": "root.CustommetricsController.add_event_batch", "header": "['class', 'CustommetricsController', '(', 'BaseController', ')', ':', '___EOS___']", "index": 81 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2013", " ", "Turb", "ulen", "z", " ", "Limit", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "simplejson_", "import_", "loads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "turb", "ulen", "z", "\\u", "local_", "._", "lib_", "._", "exceptions_", "import_", "Ap", "i", "Exception_", ",_", "Ba", "d", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "turb", "ulen", "z", "\\u", "local_", "._", "lib_", "._", "service", "status_", "import_", "Service", "Status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "turb", "ulen", "z", "\\u", "local_", "._", "decorators_", "import_", "secure", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "turb", "ulen", "z", "\\u", "local_", "._", "controllers_", "import_", "Base", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "validat", "e\\u", "event_", "(_", "event", "\\u", "key_", ",_", "event", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "key_", "=_", "str_", "(_", "event", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Event", " ", "key", " ", "shou", "ld", " ", "not", " ", "contain", " ", "non", "-", "ascii", " ", "character", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "event", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Event", " ", "key", " ", "must", " ", "be", " ", "a", " ", "non", "-", "empty", " ", "string", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "event", "\\u", "value_", ",_", "(_", "str_", ",_", "unicode_", ")_", ")_", ":_", "\\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 ", " _", "event", "\\u", "value_", "=_", "loads_", "(_", "event", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Event", " ", "value", " ", "must", " ", "be", " ", "a", " ", "number", " ", "or", " ", "an", " ", "array", " ", "of", " ", "numbers", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "event", "\\u", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "value_", "=_", "float_", "(_", "event", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Event", " ", "value", " ", "must", " ", "be", " ", "a", " ", "number", " ", "or", " ", "an", " ", "array", " ", "of", " ", "numbers", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "index_", ",_", "value_", "in_", "enumerate_", "(_", "event", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "value_", "[_", "index_", "]_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Event", " ", "value", " ", "array", " ", "element", "s", " ", "must", " ", "be", " ", "numbers", "'_", ")_", "\\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_", "event", "\\u", "key_", ",_", "event", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Custom", "metric", "s", "Controller_", "(_", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "custom", "metric", "s", "\\u", "service_", "=_", "Service", "Status_", "._", "check", "\\u", "status", "\\u", "decorator_", "(_", "'", "custom", "Met", "ric", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Custom", "metric", "s", "Controller_", "(_", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "custom", "metric", "s", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "secure", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "event_", "(_", "cls_", ",_", "slug_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "a", " ", "validation", " ", "simulati", "on", "!", " ", "Custom", " ", "events", " ", "are", " ", "only", " ", "tracked", " ", "on", " ", "the", " ", "game", " ", "site", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "cls_", "._", "game", "\\u", "session", "\\u", "list_", "._", "get", "\\u", "session_", "(_", "params_", "[_", "'", "game", "Sess", "ion", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Inva", "lid", " ", "game", " ", "session", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "game_", "=_", "session_", "._", "game_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "game_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ap", "i", "Exception_", "(_", "'", "No", " ", "game", " ", "with", " ", "tha", "t", " ", "slug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slug_", "!=_", "game_", "._", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Sl", "ug", " ", "and", " ", "game", " ", "session", " ", "do", " ", "not", " ", "match", "'_", ")_", "\\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 ", " _", "event", "\\u", "key_", "=_", "params_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "key", " ", "missi", "ng", "'_", ")_", "\\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 ", " _", "event", "\\u", "value_", "=_", "params_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "value", " ", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "params_", "[_", "'", "value", "'_", "]_", "\\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 ", " _", "event", "\\u", "key_", ",_", "event", "\\u", "value_", "=_", "\\u", "validat", "e\\u", "event_", "(_", "event", "\\u", "key_", ",_", "event", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "reache", "s", " ", "this", " ", "point", ",", " ", "assume", " ", "success_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "ok", "'_", ":_", "True_", ",_", "'", "data", "'_", ":_", "{_", "'", "msg", "'_", ":_", "'", "Added", " ", "\"'_", "+_", "str_", "(_", "event", "\\u", "value_", ")_", "+_", "'\"", " ", "for", " ", "\"'_", "+_", "event", "\\u", "key_", "+_", "'\"", " ", "'_", "'(", "Simul", "ation", " ", "only", " ", "-", " ", "Custom", " ", "events", " ", "are", " ", "only", " ", "tracked", " ", "on", " ", "the", " ", "game", " ", "site", ")'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Custom", "metric", "s", "Controller_", "(_", "Base", "Controller_", ")_", ":_", "\\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_", "@_", "custom", "metric", "s", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "secure", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "event", "\\u", "batch_", "(_", "cls_", ",_", "slug_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "a", " ", "validation", " ", "simulati", "on", "!", " ", "Custom", " ", "events", " ", "are", " ", "only", " ", "tracked", " ", "on", " ", "the", " ", "game", " ", "site", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "cls_", "._", "game", "\\u", "session", "\\u", "list_", "._", "get", "\\u", "session_", "(_", "params_", "[_", "'", "game", "Sess", "ion", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Inva", "lid", " ", "game", " ", "session", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "game_", "=_", "session_", "._", "game_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "game_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ap", "i", "Exception_", "(_", "'", "No", " ", "game", " ", "with", " ", "tha", "t", " ", "slug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slug_", "!=_", "game_", "._", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Sl", "ug", " ", "and", " ", "game", " ", "session", " ", "do", " ", "not", " ", "match", "'_", ")_", "\\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 ", " _", "event", "\\u", "batch_", "=_", "params_", "[_", "'", "batch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "batch", " ", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "params_", "[_", "'", "batch", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "event", "\\u", "batch_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "batch", " ", "must", " ", "be", " ", "an", " ", "array", " ", "of", " ", "events", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "event_", "in_", "event", "\\u", "batch_", ":_", "\\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 ", " _", "event", "\\u", "key_", "=_", "event_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "key", " ", "missi", "ng", "'_", ")_", "\\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 ", " _", "event", "\\u", "value_", "=_", "event_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "value", " ", "missi", "ng", "'_", ")_", "\\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 ", " _", "event", "\\u", "key_", ",_", "event", "\\u", "value_", "=_", "\\u", "validat", "e\\u", "event_", "(_", "event", "\\u", "key_", ",_", "event", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "e_", "._", "message_", ")_", "\\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 ", " _", "event", "\\u", "time_", "=_", "float_", "(_", "event_", "[_", "'", "time", "Off", "set", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "time", " ", "offset", " ", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "time", " ", "offset", " ", "shou", "ld", " ", "be", " ", "a", " ", "float", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "\\u", "time_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ba", "d", "Request_", "(_", "'", "Event", " ", "time", " ", "offset", "s", " ", "shou", "ld", " ", "be", " ", "<=", " ", "0", " ", "to", " ", "represent", " ", "older", " ", "events", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "reache", "s", " ", "this", " ", "point", ",", " ", "assume", " ", "success_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "ok", "'_", ":_", "True_", ",_", "'", "data", "'_", ":_", "{_", "'", "msg", "'_", ":_", "'", "Added", " ", "%", "d", " ", "events", " ", "'_", "'(", "Simul", "ation", " ", "only", " ", "-", " ", "Custom", " ", "events", " ", "are", " ", "only", " ", "tracked", " ", "on", " ", "the", " ", "game", " ", "site", ")'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "event", "\\u", "batch_", ")_", "}_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Unused import
disqus/playa/playa/runner.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"\nplaya.runner\n~~~~~~~~~~~~\n\n:copyright: (c) 2011 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nimport eventlet\nimport os\nimport os.path\nimport sys\n\nfrom daemon.daemon import DaemonContext\nfrom daemon.runner import DaemonRunner, make_pidlockfile\nfrom eventlet import wsgi\nfrom optparse import OptionParser\n\nfrom playa import VERSION, app\n\n\n\n\nif __name__ == '__main__':\n main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PlayaServer(DaemonRunner):\n pidfile_timeout = 10\n start_message = u\"started with pid %(pid)d\"\n\n\n", "metadata": "root.PlayaServer", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def __init__(self, host=None, port=None, pidfile=None,\n logfile=None, daemonize=False, debug=False):\n if not logfile:\n logfile = app.config['WEB_LOG_FILE']\n\n logfile = os.path.realpath(logfile)\n pidfile = os.path.realpath(pidfile or app.config['WEB_PID_FILE'])\n \n if daemonize:\n detach_process = True\n else:\n detach_process = False\n\n self.daemon_context = DaemonContext(detach_process=detach_process)\n self.daemon_context.stdout = open(logfile, 'w+')\n self.daemon_context.stderr = open(logfile, 'w+', buffering=0)\n\n self.pidfile = make_pidlockfile(pidfile, self.pidfile_timeout)\n\n self.daemon_context.pidfile = self.pidfile\n\n self.host = host or app.config['WEB_HOST']\n self.port = port or app.config['WEB_PORT']\n\n self.debug = debug\n\n # HACK: set app to self so self.app.run() works\n self.app = self", "metadata": "root.PlayaServer.__init__", "header": "['class', 'PlayaServer', '(', 'DaemonRunner', ')', ':', '___EOS___']", "index": 26 }, { "content": " def execute(self, action):\n self.action = action\n if self.daemon_context.detach_process is False and self.action == 'start':\n # HACK:\n self.run()\n else:\n self.do_action()", "metadata": "root.PlayaServer.execute", "header": "['class', 'PlayaServer', '(', 'DaemonRunner', ')', ':', '___EOS___']", "index": 55 }, { "content": " def run(self):\n upgrade()\n\n if self.debug:\n app.run(host=self.host, port=self.port, debug=self.debug)\n else:\n wsgi.server(eventlet.listen((self.host, self.port)), app)", "metadata": "root.PlayaServer.run", "header": "['class', 'PlayaServer', '(', 'DaemonRunner', ')', ':', '___EOS___']", "index": 63 }, { "content": "def upgrade():\n # create our data path if it doesnt exist\n if not os.path.exists(app.config['DATA_PATH']):\n os.makedirs(app.config['DATA_PATH'])", "metadata": "root.upgrade", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def main():\n command_list = ('start', 'stop', 'restart', 'upgrade')\n args = sys.argv\n if len(args) < 2 or args[1] not in command_list:\n print \"usage: playa [command] [options]\"\n print\n print \"Available subcommands:\"\n for cmd in command_list:\n print \" \", cmd\n sys.exit(1)\n\n parser = OptionParser(version=\"%%prog %s\" % VERSION)\n parser.add_option('--config', metavar='CONFIG')\n if args[1] == 'start':\n parser.add_option('--debug', action='store_true', default=False, dest='debug')\n parser.add_option('--host', metavar='HOSTNAME')\n parser.add_option('--port', type=int, metavar='PORT')\n parser.add_option('--daemon', action='store_true', default=False, dest='daemonize')\n parser.add_option('--no-daemon', action='store_false', default=False, dest='daemonize')\n parser.add_option('--pidfile', dest='pidfile')\n parser.add_option('--logfile', dest='logfile')\n elif args[1] == 'stop':\n parser.add_option('--pidfile', dest='pidfile')\n parser.add_option('--logfile', dest='logfile')\n\n (options, args) = parser.parse_args()\n\n if options.config:\n # assumed to be a file\n app.config.from_pyfile(options.config)\n else:\n config_path = os.path.expanduser(os.path.join('~', '.playa', 'playa.conf.py'))\n if os.path.exists(config_path):\n app.config.from_pyfile(config_path)\n\n if args[0] == 'upgrade':\n upgrade()\n\n elif args[0] == 'start':\n web = PlayaServer(host=options.host, port=options.port,\n pidfile=options.pidfile, logfile=options.logfile,\n daemonize=options.daemonize, debug=options.debug)\n web.execute(args[0])\n\n elif args[0] == 'restart':\n web = PlayaServer()\n web.execute(args[0])\n \n elif args[0] == 'stop':\n web = PlayaServer(pidfile=options.pidfile, logfile=options.logfile)\n web.execute(args[0])\n\n sys.exit(0)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 76 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "play", "a", ".", "runn", "er", "\\", "10", ";", "~~~~~~~~~~~", "~", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2011", " ", "DIS", "QU", "S", ".", "\\", "10", ";", ":", "license", ":", " ", "Ap", "ache", " ", "License", " ", "2.0", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "eventlet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "daemon_", "._", "daemon_", "import_", "Da", "emo", "n", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "daemon_", "._", "runner_", "import_", "Da", "emo", "n", "Runner_", ",_", "make", "\\u", "pid", "lockfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eventlet_", "import_", "wsgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "play", "a_", "import_", "VERSION_", ",_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Play", "a", "Server_", "(_", "Da", "emo", "n", "Runner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid", "file", "\\u", "timeout_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "message_", "=_", "u", "\"", "start", "ed", " ", "with", " ", "pid", " ", "%", "(", "pid", ")", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Play", "a", "Server_", "(_", "Da", "emo", "n", "Runner_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "pidfile_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logfile_", "=_", "None_", ",_", "daemon", "ize_", "=_", "False_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "logfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logfile_", "=_", "app_", "._", "config_", "[_", "'", "WEB", "\\u", "LOG", "\\u", "FILE", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logfile_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "logfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pidfile_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "pidfile_", "or_", "app_", "._", "config_", "[_", "'", "WEB", "\\u", "PID", "\\u", "FILE", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "daemon", "ize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deta", "ch", "\\u", "process_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deta", "ch", "\\u", "process_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "daemon", "\\u", "context_", "=_", "Da", "emo", "n", "Context_", "(_", "deta", "ch", "\\u", "process_", "=_", "deta", "ch", "\\u", "process_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon", "\\u", "context_", "._", "stdout_", "=_", "open_", "(_", "logfile_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon", "\\u", "context_", "._", "stderr_", "=_", "open_", "(_", "logfile_", ",_", "'", "w", "+'_", ",_", "bufferi", "ng_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pidfile_", "=_", "make", "\\u", "pid", "lockfile", "_", "(_", "pidfile_", ",_", "self_", "._", "pid", "file", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "daemon", "\\u", "context_", "._", "pidfile_", "=_", "self_", "._", "pidfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "host_", "=_", "host_", "or_", "app_", "._", "config_", "[_", "'", "WEB", "\\u", "HOST", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "port_", "or_", "app_", "._", "config_", "[_", "'", "WEB", "\\u", "PORT", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "debug_", "=_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HA", "CK", ":", " ", "set", " ", "app", " ", "to", " ", "self", " ", "so", " ", "self", ".", "app", ".", "run", "()", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Play", "a", "Server_", "(_", "Da", "emo", "n", "Runner_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "action_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "daemon", "\\u", "context_", "._", "deta", "ch", "\\u", "process_", "is_", "False_", "and_", "self_", "._", "action_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "HA", "CK", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", ")_", "\\u\\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_", "._", "do", "\\u", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Play", "a", "Server_", "(_", "Da", "emo", "n", "Runner_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upgrade_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "run_", "(_", "host_", "=_", "self_", "._", "host_", ",_", "port_", "=_", "self_", "._", "port_", ",_", "debug_", "=_", "self_", "._", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wsgi_", "._", "server_", "(_", "eventlet_", "._", "listen_", "(_", "(_", "self_", "._", "host_", ",_", "self_", "._", "port_", ")_", ")_", ",_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "upgrade_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "our", " ", "data", " ", "path", " ", "if", " ", "it", " ", "doesnt", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "app_", "._", "config_", "[_", "'", "DATA", "\\u", "PATH", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "app_", "._", "config_", "[_", "'", "DATA", "\\u", "PATH", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command", "\\u", "list_", "=_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "restart", "'_", ",_", "'", "upgrade", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "<_", "2_", "or_", "args_", "[_", "1_", "]_", "not_", "in_", "command", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "usage", ":", " ", "play", "a", " ", "[", "command", "]", " ", "[", "options", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Avail", "able", " ", "subcommands", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cmd_", "in_", "command", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", "\"_", ",_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%%", "prog", " ", "%", "s", "\"_", "%_", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "config", "'_", ",_", "metavar_", "=_", "'", "CONFIG", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "[_", "1_", "]_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "debug", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "dest_", "=_", "'", "debug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "host", "'_", ",_", "metavar_", "=_", "'", "HOSTNAME", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "port", "'_", ",_", "type_", "=_", "int_", ",_", "metavar_", "=_", "'", "PORT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "daemon", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "dest_", "=_", "'", "daemon", "ize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "no", "-", "daemon", "'_", ",_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "default_", "=_", "False_", ",_", "dest_", "=_", "'", "daemon", "ize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "pid", "file", "'_", ",_", "dest_", "=_", "'", "pid", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "logfile", "'_", ",_", "dest_", "=_", "'", "logfile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "[_", "1_", "]_", "==_", "'", "stop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "pid", "file", "'_", ",_", "dest_", "=_", "'", "pid", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "'--", "logfile", "'_", ",_", "dest_", "=_", "'", "logfile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assume", "d", " ", "to", " ", "be", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "config_", "._", "from", "\\u", "pyfi", "le_", "(_", "options_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "path_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "os_", "._", "path_", "._", "join_", "(_", "'~'_", ",_", "'.", "play", "a", "'_", ",_", "'", "play", "a", ".", "conf", ".", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "config", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "config_", "._", "from", "\\u", "pyfi", "le_", "(_", "config", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "[_", "0_", "]_", "==_", "'", "upgrade", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upgrade_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "[_", "0_", "]_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "web_", "=_", "Play", "a", "Server_", "(_", "host_", "=_", "options_", "._", "host_", ",_", "port_", "=_", "options_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pidfile_", "=_", "options_", "._", "pidfile_", ",_", "logfile_", "=_", "options_", "._", "logfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "daemon", "ize_", "=_", "options_", "._", "daemon", "ize_", ",_", "debug_", "=_", "options_", "._", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "._", "execute_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "[_", "0_", "]_", "==_", "'", "restart", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "web_", "=_", "Play", "a", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "._", "execute_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "[_", "0_", "]_", "==_", "'", "stop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "web_", "=_", "Play", "a", "Server_", "(_", "pidfile_", "=_", "options_", "._", "pidfile_", ",_", "logfile_", "=_", "options_", "._", "logfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "._", "execute_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
ContinuumIO/ashiba/enaml/enaml/qt/qt_dock_pane.py
[ { "content": " def _hideTitleBar(self):\n \"\"\" Hides the title bar for the widget.\n\n \"\"\"\n if self.titleBarWidget() is None:\n self.setTitleBarWidget(QWidget())", "metadata": "root.QCustomDockWidget._hideTitleBar", "header": "['class', 'QCustomDockWidget', '(', 'QDockWidget', ')', ':', '___EOS___']", "index": 89 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "QC", "ust", "om", "Dock", "Widget_", "(_", "QD", "ock", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "hide", "Tit", "le", "Bar_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Hi", "des", " ", "the", " ", "title", " ", "bar", " ", "for", " ", "the", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "title", "Bar", "Widget_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Tit", "le", "Bar", "Widget_", "(_", "QW", "idge", "t_", "(_", ")_", ")_", "\\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 ]